diff options
| author | 2018-11-21 22:06:01 -0300 | |
|---|---|---|
| committer | 2018-11-21 22:31:16 -0300 | |
| commit | 8a5e6fce072227edcf1c8af19c3749d695f483ac (patch) | |
| tree | 945d868936da09d49ba0fb0ba3e7dba2f2e1717c /src | |
| parent | Merge pull request #1753 from FernandoS27/ufbtype (diff) | |
| download | yuzu-8a5e6fce072227edcf1c8af19c3749d695f483ac.tar.gz yuzu-8a5e6fce072227edcf1c8af19c3749d695f483ac.tar.xz yuzu-8a5e6fce072227edcf1c8af19c3749d695f483ac.zip | |
gl_shader_decompiler: Rename control codes to condition codes
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 110 |
2 files changed, 50 insertions, 67 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 83a6fd875..ee1710e8a 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -261,7 +261,7 @@ enum class FlowCondition : u64 { | |||
| 261 | Fcsm_Tr = 0x1C, // TODO(bunnei): What is this used for? | 261 | Fcsm_Tr = 0x1C, // TODO(bunnei): What is this used for? |
| 262 | }; | 262 | }; |
| 263 | 263 | ||
| 264 | enum class ControlCode : u64 { | 264 | enum class ConditionCode : u64 { |
| 265 | F = 0, | 265 | F = 0, |
| 266 | LT = 1, | 266 | LT = 1, |
| 267 | EQ = 2, | 267 | EQ = 2, |
| @@ -569,7 +569,6 @@ union Instruction { | |||
| 569 | BitField<39, 2, u64> tab5cb8_2; | 569 | BitField<39, 2, u64> tab5cb8_2; |
| 570 | BitField<41, 3, u64> tab5c68_1; | 570 | BitField<41, 3, u64> tab5c68_1; |
| 571 | BitField<44, 2, u64> tab5c68_0; | 571 | BitField<44, 2, u64> tab5c68_0; |
| 572 | BitField<47, 1, u64> cc; | ||
| 573 | BitField<48, 1, u64> negate_b; | 572 | BitField<48, 1, u64> negate_b; |
| 574 | } fmul; | 573 | } fmul; |
| 575 | 574 | ||
| @@ -831,7 +830,7 @@ union Instruction { | |||
| 831 | union { | 830 | union { |
| 832 | BitField<0, 3, u64> pred0; | 831 | BitField<0, 3, u64> pred0; |
| 833 | BitField<3, 3, u64> pred3; | 832 | BitField<3, 3, u64> pred3; |
| 834 | BitField<8, 5, ControlCode> cc; // flag in cc | 833 | BitField<8, 5, ConditionCode> cc; // flag in cc |
| 835 | BitField<39, 3, u64> pred39; | 834 | BitField<39, 3, u64> pred39; |
| 836 | BitField<42, 1, u64> neg_pred39; | 835 | BitField<42, 1, u64> neg_pred39; |
| 837 | BitField<45, 4, PredOperation> op; // op with pred39 | 836 | BitField<45, 4, PredOperation> op; // op with pred39 |
| @@ -1235,7 +1234,7 @@ union Instruction { | |||
| 1235 | BitField<60, 1, u64> is_b_gpr; | 1234 | BitField<60, 1, u64> is_b_gpr; |
| 1236 | BitField<59, 1, u64> is_c_gpr; | 1235 | BitField<59, 1, u64> is_c_gpr; |
| 1237 | BitField<20, 24, s64> smem_imm; | 1236 | BitField<20, 24, s64> smem_imm; |
| 1238 | BitField<0, 5, ControlCode> flow_control_code; | 1237 | BitField<0, 5, ConditionCode> flow_condition_code; |
| 1239 | 1238 | ||
| 1240 | Attribute attribute; | 1239 | Attribute attribute; |
| 1241 | Sampler sampler; | 1240 | Sampler sampler; |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 90a88b91a..91e844960 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -371,7 +371,7 @@ public: | |||
| 371 | if (sets_cc) { | 371 | if (sets_cc) { |
| 372 | const std::string zero_condition = "( " + ConvertIntegerSize(value, size) + " == 0 )"; | 372 | const std::string zero_condition = "( " + ConvertIntegerSize(value, size) + " == 0 )"; |
| 373 | SetInternalFlag(InternalFlag::ZeroFlag, zero_condition); | 373 | SetInternalFlag(InternalFlag::ZeroFlag, zero_condition); |
| 374 | LOG_WARNING(HW_GPU, "Control Codes Imcomplete."); | 374 | LOG_WARNING(HW_GPU, "Condition codes implementation is incomplete."); |
| 375 | } | 375 | } |
| 376 | } | 376 | } |
| 377 | 377 | ||
| @@ -454,12 +454,12 @@ public: | |||
| 454 | shader.AddLine("lmem[" + index + "] = " + func + '(' + value + ");"); | 454 | shader.AddLine("lmem[" + index + "] = " + func + '(' + value + ");"); |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | std::string GetControlCode(const Tegra::Shader::ControlCode cc) const { | 457 | std::string GetConditionCode(const Tegra::Shader::ConditionCode cc) const { |
| 458 | switch (cc) { | 458 | switch (cc) { |
| 459 | case Tegra::Shader::ControlCode::NEU: | 459 | case Tegra::Shader::ConditionCode::NEU: |
| 460 | return "!(" + GetInternalFlag(InternalFlag::ZeroFlag) + ')'; | 460 | return "!(" + GetInternalFlag(InternalFlag::ZeroFlag) + ')'; |
| 461 | default: | 461 | default: |
| 462 | UNIMPLEMENTED_MSG("Unimplemented Control Code: {}", static_cast<u32>(cc)); | 462 | UNIMPLEMENTED_MSG("Unimplemented condition code: {}", static_cast<u32>(cc)); |
| 463 | return "false"; | 463 | return "false"; |
| 464 | } | 464 | } |
| 465 | } | 465 | } |
| @@ -1508,9 +1508,7 @@ private: | |||
| 1508 | instr.fmul.tab5c68_0 != 1, "FMUL tab5cb8_0({}) is not implemented", | 1508 | instr.fmul.tab5c68_0 != 1, "FMUL tab5cb8_0({}) is not implemented", |
| 1509 | instr.fmul.tab5c68_0 | 1509 | instr.fmul.tab5c68_0 |
| 1510 | .Value()); // SMO typical sends 1 here which seems to be the default | 1510 | .Value()); // SMO typical sends 1 here which seems to be the default |
| 1511 | UNIMPLEMENTED_IF_MSG(instr.fmul.cc != 0, "FMUL cc is not implemented"); | 1511 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1512 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | ||
| 1513 | "FMUL Generates an unhandled Control Code"); | ||
| 1514 | 1512 | ||
| 1515 | op_b = GetOperandAbsNeg(op_b, false, instr.fmul.negate_b); | 1513 | op_b = GetOperandAbsNeg(op_b, false, instr.fmul.negate_b); |
| 1516 | 1514 | ||
| @@ -1521,8 +1519,7 @@ private: | |||
| 1521 | case OpCode::Id::FADD_C: | 1519 | case OpCode::Id::FADD_C: |
| 1522 | case OpCode::Id::FADD_R: | 1520 | case OpCode::Id::FADD_R: |
| 1523 | case OpCode::Id::FADD_IMM: { | 1521 | case OpCode::Id::FADD_IMM: { |
| 1524 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | 1522 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1525 | "FADD Generates an unhandled Control Code"); | ||
| 1526 | 1523 | ||
| 1527 | op_a = GetOperandAbsNeg(op_a, instr.alu.abs_a, instr.alu.negate_a); | 1524 | op_a = GetOperandAbsNeg(op_a, instr.alu.abs_a, instr.alu.negate_a); |
| 1528 | op_b = GetOperandAbsNeg(op_b, instr.alu.abs_b, instr.alu.negate_b); | 1525 | op_b = GetOperandAbsNeg(op_b, instr.alu.abs_b, instr.alu.negate_b); |
| @@ -1571,8 +1568,7 @@ private: | |||
| 1571 | case OpCode::Id::FMNMX_C: | 1568 | case OpCode::Id::FMNMX_C: |
| 1572 | case OpCode::Id::FMNMX_R: | 1569 | case OpCode::Id::FMNMX_R: |
| 1573 | case OpCode::Id::FMNMX_IMM: { | 1570 | case OpCode::Id::FMNMX_IMM: { |
| 1574 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | 1571 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1575 | "FMNMX Generates an unhandled Control Code"); | ||
| 1576 | 1572 | ||
| 1577 | op_a = GetOperandAbsNeg(op_a, instr.alu.abs_a, instr.alu.negate_a); | 1573 | op_a = GetOperandAbsNeg(op_a, instr.alu.abs_a, instr.alu.negate_a); |
| 1578 | op_b = GetOperandAbsNeg(op_b, instr.alu.abs_b, instr.alu.negate_b); | 1574 | op_b = GetOperandAbsNeg(op_b, instr.alu.abs_b, instr.alu.negate_b); |
| @@ -1608,8 +1604,7 @@ private: | |||
| 1608 | break; | 1604 | break; |
| 1609 | } | 1605 | } |
| 1610 | case OpCode::Id::FMUL32_IMM: { | 1606 | case OpCode::Id::FMUL32_IMM: { |
| 1611 | UNIMPLEMENTED_IF_MSG(instr.op_32.generates_cc, | 1607 | UNIMPLEMENTED_IF(instr.op_32.generates_cc); |
| 1612 | "FMUL32 Generates an unhandled Control Code"); | ||
| 1613 | 1608 | ||
| 1614 | regs.SetRegisterToFloat(instr.gpr0, 0, | 1609 | regs.SetRegisterToFloat(instr.gpr0, 0, |
| 1615 | regs.GetRegisterAsFloat(instr.gpr8) + " * " + | 1610 | regs.GetRegisterAsFloat(instr.gpr8) + " * " + |
| @@ -1618,8 +1613,7 @@ private: | |||
| 1618 | break; | 1613 | break; |
| 1619 | } | 1614 | } |
| 1620 | case OpCode::Id::FADD32I: { | 1615 | case OpCode::Id::FADD32I: { |
| 1621 | UNIMPLEMENTED_IF_MSG(instr.op_32.generates_cc, | 1616 | UNIMPLEMENTED_IF(instr.op_32.generates_cc); |
| 1622 | "FADD32 Generates an unhandled Control Code"); | ||
| 1623 | 1617 | ||
| 1624 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr8); | 1618 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr8); |
| 1625 | std::string op_b = GetImmediate32(instr); | 1619 | std::string op_b = GetImmediate32(instr); |
| @@ -1654,7 +1648,7 @@ private: | |||
| 1654 | 1648 | ||
| 1655 | switch (opcode->get().GetId()) { | 1649 | switch (opcode->get().GetId()) { |
| 1656 | case OpCode::Id::BFE_IMM: { | 1650 | case OpCode::Id::BFE_IMM: { |
| 1657 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "BFE Generates an unhandled Control Code"); | 1651 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1658 | 1652 | ||
| 1659 | std::string inner_shift = | 1653 | std::string inner_shift = |
| 1660 | '(' + op_a + " << " + std::to_string(instr.bfe.GetLeftShiftValue()) + ')'; | 1654 | '(' + op_a + " << " + std::to_string(instr.bfe.GetLeftShiftValue()) + ')'; |
| @@ -1691,7 +1685,7 @@ private: | |||
| 1691 | case OpCode::Id::SHR_C: | 1685 | case OpCode::Id::SHR_C: |
| 1692 | case OpCode::Id::SHR_R: | 1686 | case OpCode::Id::SHR_R: |
| 1693 | case OpCode::Id::SHR_IMM: { | 1687 | case OpCode::Id::SHR_IMM: { |
| 1694 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "SHR Generates an unhandled Control Code"); | 1688 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1695 | 1689 | ||
| 1696 | if (!instr.shift.is_signed) { | 1690 | if (!instr.shift.is_signed) { |
| 1697 | // Logical shift right | 1691 | // Logical shift right |
| @@ -1706,8 +1700,7 @@ private: | |||
| 1706 | case OpCode::Id::SHL_C: | 1700 | case OpCode::Id::SHL_C: |
| 1707 | case OpCode::Id::SHL_R: | 1701 | case OpCode::Id::SHL_R: |
| 1708 | case OpCode::Id::SHL_IMM: | 1702 | case OpCode::Id::SHL_IMM: |
| 1709 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "SHL Generates an unhandled Control Code"); | 1703 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1710 | |||
| 1711 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " << " + op_b, 1, 1); | 1704 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " << " + op_b, 1, 1); |
| 1712 | break; | 1705 | break; |
| 1713 | default: { | 1706 | default: { |
| @@ -1722,8 +1715,7 @@ private: | |||
| 1722 | 1715 | ||
| 1723 | switch (opcode->get().GetId()) { | 1716 | switch (opcode->get().GetId()) { |
| 1724 | case OpCode::Id::IADD32I: | 1717 | case OpCode::Id::IADD32I: |
| 1725 | UNIMPLEMENTED_IF_MSG(instr.op_32.generates_cc, | 1718 | UNIMPLEMENTED_IF_MSG(instr.op_32.generates_cc); |
| 1726 | "IADD32 Generates an unhandled Control Code"); | ||
| 1727 | 1719 | ||
| 1728 | if (instr.iadd32i.negate_a) | 1720 | if (instr.iadd32i.negate_a) |
| 1729 | op_a = "-(" + op_a + ')'; | 1721 | op_a = "-(" + op_a + ')'; |
| @@ -1732,8 +1724,7 @@ private: | |||
| 1732 | instr.iadd32i.saturate != 0); | 1724 | instr.iadd32i.saturate != 0); |
| 1733 | break; | 1725 | break; |
| 1734 | case OpCode::Id::LOP32I: { | 1726 | case OpCode::Id::LOP32I: { |
| 1735 | UNIMPLEMENTED_IF_MSG(instr.op_32.generates_cc, | 1727 | UNIMPLEMENTED_IF(instr.op_32.generates_cc); |
| 1736 | "LOP32I Generates an unhandled Control Code"); | ||
| 1737 | 1728 | ||
| 1738 | if (instr.alu.lop32i.invert_a) | 1729 | if (instr.alu.lop32i.invert_a) |
| 1739 | op_a = "~(" + op_a + ')'; | 1730 | op_a = "~(" + op_a + ')'; |
| @@ -1771,8 +1762,7 @@ private: | |||
| 1771 | case OpCode::Id::IADD_C: | 1762 | case OpCode::Id::IADD_C: |
| 1772 | case OpCode::Id::IADD_R: | 1763 | case OpCode::Id::IADD_R: |
| 1773 | case OpCode::Id::IADD_IMM: { | 1764 | case OpCode::Id::IADD_IMM: { |
| 1774 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | 1765 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1775 | "IADD Generates an unhandled Control Code"); | ||
| 1776 | 1766 | ||
| 1777 | if (instr.alu_integer.negate_a) | 1767 | if (instr.alu_integer.negate_a) |
| 1778 | op_a = "-(" + op_a + ')'; | 1768 | op_a = "-(" + op_a + ')'; |
| @@ -1787,8 +1777,7 @@ private: | |||
| 1787 | case OpCode::Id::IADD3_C: | 1777 | case OpCode::Id::IADD3_C: |
| 1788 | case OpCode::Id::IADD3_R: | 1778 | case OpCode::Id::IADD3_R: |
| 1789 | case OpCode::Id::IADD3_IMM: { | 1779 | case OpCode::Id::IADD3_IMM: { |
| 1790 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | 1780 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1791 | "IADD3 Generates an unhandled Control Code"); | ||
| 1792 | 1781 | ||
| 1793 | std::string op_c = regs.GetRegisterAsInteger(instr.gpr39); | 1782 | std::string op_c = regs.GetRegisterAsInteger(instr.gpr39); |
| 1794 | 1783 | ||
| @@ -1850,8 +1839,7 @@ private: | |||
| 1850 | case OpCode::Id::ISCADD_C: | 1839 | case OpCode::Id::ISCADD_C: |
| 1851 | case OpCode::Id::ISCADD_R: | 1840 | case OpCode::Id::ISCADD_R: |
| 1852 | case OpCode::Id::ISCADD_IMM: { | 1841 | case OpCode::Id::ISCADD_IMM: { |
| 1853 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | 1842 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1854 | "ISCADD Generates an unhandled Control Code"); | ||
| 1855 | 1843 | ||
| 1856 | if (instr.alu_integer.negate_a) | 1844 | if (instr.alu_integer.negate_a) |
| 1857 | op_a = "-(" + op_a + ')'; | 1845 | op_a = "-(" + op_a + ')'; |
| @@ -1886,7 +1874,7 @@ private: | |||
| 1886 | case OpCode::Id::LOP_C: | 1874 | case OpCode::Id::LOP_C: |
| 1887 | case OpCode::Id::LOP_R: | 1875 | case OpCode::Id::LOP_R: |
| 1888 | case OpCode::Id::LOP_IMM: { | 1876 | case OpCode::Id::LOP_IMM: { |
| 1889 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "LOP Generates an unhandled Control Code"); | 1877 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1890 | 1878 | ||
| 1891 | if (instr.alu.lop.invert_a) | 1879 | if (instr.alu.lop.invert_a) |
| 1892 | op_a = "~(" + op_a + ')'; | 1880 | op_a = "~(" + op_a + ')'; |
| @@ -1901,8 +1889,7 @@ private: | |||
| 1901 | case OpCode::Id::LOP3_C: | 1889 | case OpCode::Id::LOP3_C: |
| 1902 | case OpCode::Id::LOP3_R: | 1890 | case OpCode::Id::LOP3_R: |
| 1903 | case OpCode::Id::LOP3_IMM: { | 1891 | case OpCode::Id::LOP3_IMM: { |
| 1904 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | 1892 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1905 | "LOP3 Generates an unhandled Control Code"); | ||
| 1906 | 1893 | ||
| 1907 | const std::string op_c = regs.GetRegisterAsInteger(instr.gpr39); | 1894 | const std::string op_c = regs.GetRegisterAsInteger(instr.gpr39); |
| 1908 | std::string lut; | 1895 | std::string lut; |
| @@ -1920,8 +1907,7 @@ private: | |||
| 1920 | case OpCode::Id::IMNMX_R: | 1907 | case OpCode::Id::IMNMX_R: |
| 1921 | case OpCode::Id::IMNMX_IMM: { | 1908 | case OpCode::Id::IMNMX_IMM: { |
| 1922 | UNIMPLEMENTED_IF(instr.imnmx.exchange != Tegra::Shader::IMinMaxExchange::None); | 1909 | UNIMPLEMENTED_IF(instr.imnmx.exchange != Tegra::Shader::IMinMaxExchange::None); |
| 1923 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, | 1910 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 1924 | "IMNMX Generates an unhandled Control Code"); | ||
| 1925 | 1911 | ||
| 1926 | const std::string condition = | 1912 | const std::string condition = |
| 1927 | GetPredicateCondition(instr.imnmx.pred, instr.imnmx.negate_pred != 0); | 1913 | GetPredicateCondition(instr.imnmx.pred, instr.imnmx.negate_pred != 0); |
| @@ -2094,7 +2080,7 @@ private: | |||
| 2094 | instr.ffma.tab5980_0.Value()); // Seems to be 1 by default based on SMO | 2080 | instr.ffma.tab5980_0.Value()); // Seems to be 1 by default based on SMO |
| 2095 | UNIMPLEMENTED_IF_MSG(instr.ffma.tab5980_1 != 0, "FFMA tab5980_1({}) not implemented", | 2081 | UNIMPLEMENTED_IF_MSG(instr.ffma.tab5980_1 != 0, "FFMA tab5980_1({}) not implemented", |
| 2096 | instr.ffma.tab5980_1.Value()); | 2082 | instr.ffma.tab5980_1.Value()); |
| 2097 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "FFMA Generates an unhandled Control Code"); | 2083 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 2098 | 2084 | ||
| 2099 | switch (opcode->get().GetId()) { | 2085 | switch (opcode->get().GetId()) { |
| 2100 | case OpCode::Id::FFMA_CR: { | 2086 | case OpCode::Id::FFMA_CR: { |
| @@ -2204,7 +2190,7 @@ private: | |||
| 2204 | case OpCode::Id::I2F_C: { | 2190 | case OpCode::Id::I2F_C: { |
| 2205 | UNIMPLEMENTED_IF(instr.conversion.dest_size != Register::Size::Word); | 2191 | UNIMPLEMENTED_IF(instr.conversion.dest_size != Register::Size::Word); |
| 2206 | UNIMPLEMENTED_IF(instr.conversion.selector); | 2192 | UNIMPLEMENTED_IF(instr.conversion.selector); |
| 2207 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "I2F Generates an unhandled Control Code"); | 2193 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 2208 | 2194 | ||
| 2209 | std::string op_a{}; | 2195 | std::string op_a{}; |
| 2210 | 2196 | ||
| @@ -2234,7 +2220,7 @@ private: | |||
| 2234 | case OpCode::Id::F2F_R: { | 2220 | case OpCode::Id::F2F_R: { |
| 2235 | UNIMPLEMENTED_IF(instr.conversion.dest_size != Register::Size::Word); | 2221 | UNIMPLEMENTED_IF(instr.conversion.dest_size != Register::Size::Word); |
| 2236 | UNIMPLEMENTED_IF(instr.conversion.src_size != Register::Size::Word); | 2222 | UNIMPLEMENTED_IF(instr.conversion.src_size != Register::Size::Word); |
| 2237 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "F2F Generates an unhandled Control Code"); | 2223 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 2238 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr20); | 2224 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr20); |
| 2239 | 2225 | ||
| 2240 | if (instr.conversion.abs_a) { | 2226 | if (instr.conversion.abs_a) { |
| @@ -2272,7 +2258,7 @@ private: | |||
| 2272 | case OpCode::Id::F2I_R: | 2258 | case OpCode::Id::F2I_R: |
| 2273 | case OpCode::Id::F2I_C: { | 2259 | case OpCode::Id::F2I_C: { |
| 2274 | UNIMPLEMENTED_IF(instr.conversion.src_size != Register::Size::Word); | 2260 | UNIMPLEMENTED_IF(instr.conversion.src_size != Register::Size::Word); |
| 2275 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "F2I Generates an unhandled Control Code"); | 2261 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 2276 | std::string op_a{}; | 2262 | std::string op_a{}; |
| 2277 | 2263 | ||
| 2278 | if (instr.is_b_gpr) { | 2264 | if (instr.is_b_gpr) { |
| @@ -3083,7 +3069,7 @@ private: | |||
| 3083 | break; | 3069 | break; |
| 3084 | } | 3070 | } |
| 3085 | case OpCode::Type::PredicateSetRegister: { | 3071 | case OpCode::Type::PredicateSetRegister: { |
| 3086 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "PSET Generates an unhandled Control Code"); | 3072 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 3087 | 3073 | ||
| 3088 | const std::string op_a = | 3074 | const std::string op_a = |
| 3089 | GetPredicateCondition(instr.pset.pred12, instr.pset.neg_pred12 != 0); | 3075 | GetPredicateCondition(instr.pset.pred12, instr.pset.neg_pred12 != 0); |
| @@ -3142,14 +3128,14 @@ private: | |||
| 3142 | const std::string pred = | 3128 | const std::string pred = |
| 3143 | GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0); | 3129 | GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0); |
| 3144 | const std::string combiner = GetPredicateCombiner(instr.csetp.op); | 3130 | const std::string combiner = GetPredicateCombiner(instr.csetp.op); |
| 3145 | const std::string control_code = regs.GetControlCode(instr.csetp.cc); | 3131 | const std::string condition_code = regs.GetConditionCode(instr.csetp.cc); |
| 3146 | if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) { | 3132 | if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) { |
| 3147 | SetPredicate(instr.csetp.pred3, | 3133 | SetPredicate(instr.csetp.pred3, |
| 3148 | '(' + control_code + ") " + combiner + " (" + pred + ')'); | 3134 | '(' + condition_code + ") " + combiner + " (" + pred + ')'); |
| 3149 | } | 3135 | } |
| 3150 | if (instr.csetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { | 3136 | if (instr.csetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { |
| 3151 | SetPredicate(instr.csetp.pred0, | 3137 | SetPredicate(instr.csetp.pred0, |
| 3152 | "!(" + control_code + ") " + combiner + " (" + pred + ')'); | 3138 | "!(" + condition_code + ") " + combiner + " (" + pred + ')'); |
| 3153 | } | 3139 | } |
| 3154 | break; | 3140 | break; |
| 3155 | } | 3141 | } |
| @@ -3280,7 +3266,7 @@ private: | |||
| 3280 | case OpCode::Type::Xmad: { | 3266 | case OpCode::Type::Xmad: { |
| 3281 | UNIMPLEMENTED_IF(instr.xmad.sign_a); | 3267 | UNIMPLEMENTED_IF(instr.xmad.sign_a); |
| 3282 | UNIMPLEMENTED_IF(instr.xmad.sign_b); | 3268 | UNIMPLEMENTED_IF(instr.xmad.sign_b); |
| 3283 | UNIMPLEMENTED_IF_MSG(instr.generates_cc, "XMAD Generates an unhandled Control Code"); | 3269 | UNIMPLEMENTED_IF(instr.generates_cc); |
| 3284 | 3270 | ||
| 3285 | std::string op_a{regs.GetRegisterAsInteger(instr.gpr8, 0, instr.xmad.sign_a)}; | 3271 | std::string op_a{regs.GetRegisterAsInteger(instr.gpr8, 0, instr.xmad.sign_a)}; |
| 3286 | std::string op_b; | 3272 | std::string op_b; |
| @@ -3372,9 +3358,9 @@ private: | |||
| 3372 | default: { | 3358 | default: { |
| 3373 | switch (opcode->get().GetId()) { | 3359 | switch (opcode->get().GetId()) { |
| 3374 | case OpCode::Id::EXIT: { | 3360 | case OpCode::Id::EXIT: { |
| 3375 | const Tegra::Shader::ControlCode cc = instr.flow_control_code; | 3361 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; |
| 3376 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ControlCode::T, | 3362 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, |
| 3377 | "EXIT Control Code used: {}", static_cast<u32>(cc)); | 3363 | "EXIT condition code used: {}", static_cast<u32>(cc)); |
| 3378 | 3364 | ||
| 3379 | if (stage == Maxwell3D::Regs::ShaderStage::Fragment) { | 3365 | if (stage == Maxwell3D::Regs::ShaderStage::Fragment) { |
| 3380 | EmitFragmentOutputsWrite(); | 3366 | EmitFragmentOutputsWrite(); |
| @@ -3406,9 +3392,9 @@ private: | |||
| 3406 | case OpCode::Id::KIL: { | 3392 | case OpCode::Id::KIL: { |
| 3407 | UNIMPLEMENTED_IF(instr.flow.cond != Tegra::Shader::FlowCondition::Always); | 3393 | UNIMPLEMENTED_IF(instr.flow.cond != Tegra::Shader::FlowCondition::Always); |
| 3408 | 3394 | ||
| 3409 | const Tegra::Shader::ControlCode cc = instr.flow_control_code; | 3395 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; |
| 3410 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ControlCode::T, | 3396 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, |
| 3411 | "KIL Control Code used: {}", static_cast<u32>(cc)); | 3397 | "KIL condition code used: {}", static_cast<u32>(cc)); |
| 3412 | 3398 | ||
| 3413 | // Enclose "discard" in a conditional, so that GLSL compilation does not complain | 3399 | // Enclose "discard" in a conditional, so that GLSL compilation does not complain |
| 3414 | // about unexecuted instructions that may follow this. | 3400 | // about unexecuted instructions that may follow this. |
| @@ -3470,9 +3456,9 @@ private: | |||
| 3470 | UNIMPLEMENTED_IF_MSG(instr.bra.constant_buffer != 0, | 3456 | UNIMPLEMENTED_IF_MSG(instr.bra.constant_buffer != 0, |
| 3471 | "BRA with constant buffers are not implemented"); | 3457 | "BRA with constant buffers are not implemented"); |
| 3472 | 3458 | ||
| 3473 | const Tegra::Shader::ControlCode cc = instr.flow_control_code; | 3459 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; |
| 3474 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ControlCode::T, | 3460 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, |
| 3475 | "BRA Control Code used: {}", static_cast<u32>(cc)); | 3461 | "BRA condition code used: {}", static_cast<u32>(cc)); |
| 3476 | 3462 | ||
| 3477 | const u32 target = offset + instr.bra.GetBranchTarget(); | 3463 | const u32 target = offset + instr.bra.GetBranchTarget(); |
| 3478 | shader.AddLine("{ jmp_to = " + std::to_string(target) + "u; break; }"); | 3464 | shader.AddLine("{ jmp_to = " + std::to_string(target) + "u; break; }"); |
| @@ -3515,9 +3501,9 @@ private: | |||
| 3515 | break; | 3501 | break; |
| 3516 | } | 3502 | } |
| 3517 | case OpCode::Id::SYNC: { | 3503 | case OpCode::Id::SYNC: { |
| 3518 | const Tegra::Shader::ControlCode cc = instr.flow_control_code; | 3504 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; |
| 3519 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ControlCode::T, | 3505 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, |
| 3520 | "SYNC Control Code used: {}", static_cast<u32>(cc)); | 3506 | "SYNC condition code used: {}", static_cast<u32>(cc)); |
| 3521 | 3507 | ||
| 3522 | // The SYNC opcode jumps to the address previously set by the SSY opcode | 3508 | // The SYNC opcode jumps to the address previously set by the SSY opcode |
| 3523 | EmitPopFromFlowStack(); | 3509 | EmitPopFromFlowStack(); |
| @@ -3525,10 +3511,10 @@ private: | |||
| 3525 | } | 3511 | } |
| 3526 | case OpCode::Id::BRK: { | 3512 | case OpCode::Id::BRK: { |
| 3527 | // The BRK opcode jumps to the address previously set by the PBK opcode | 3513 | // The BRK opcode jumps to the address previously set by the PBK opcode |
| 3528 | const Tegra::Shader::ControlCode cc = instr.flow_control_code; | 3514 | const Tegra::Shader::ConditionCode cc = instr.flow_condition_code; |
| 3529 | if (cc != Tegra::Shader::ControlCode::T) { | 3515 | UNIMPLEMENTED_IF_MSG(cc != Tegra::Shader::ConditionCode::T, |
| 3530 | UNIMPLEMENTED_MSG("BRK Control Code used: {}", static_cast<u32>(cc)); | 3516 | "BRK condition code used: {}", static_cast<u32>(cc)); |
| 3531 | } | 3517 | |
| 3532 | EmitPopFromFlowStack(); | 3518 | EmitPopFromFlowStack(); |
| 3533 | break; | 3519 | break; |
| 3534 | } | 3520 | } |
| @@ -3539,6 +3525,8 @@ private: | |||
| 3539 | break; | 3525 | break; |
| 3540 | } | 3526 | } |
| 3541 | case OpCode::Id::VMAD: { | 3527 | case OpCode::Id::VMAD: { |
| 3528 | UNIMPLEMENTED_IF(instr.generates_cc); | ||
| 3529 | |||
| 3542 | const bool result_signed = instr.video.signed_a == 1 || instr.video.signed_b == 1; | 3530 | const bool result_signed = instr.video.signed_a == 1 || instr.video.signed_b == 1; |
| 3543 | const std::string op_a = GetVideoOperandA(instr); | 3531 | const std::string op_a = GetVideoOperandA(instr); |
| 3544 | const std::string op_b = GetVideoOperandB(instr); | 3532 | const std::string op_b = GetVideoOperandB(instr); |
| @@ -3558,10 +3546,6 @@ private: | |||
| 3558 | regs.SetRegisterToInteger(instr.gpr0, result_signed, 1, result, 1, 1, | 3546 | regs.SetRegisterToInteger(instr.gpr0, result_signed, 1, result, 1, 1, |
| 3559 | instr.vmad.saturate == 1, 0, Register::Size::Word, | 3547 | instr.vmad.saturate == 1, 0, Register::Size::Word, |
| 3560 | instr.vmad.cc); | 3548 | instr.vmad.cc); |
| 3561 | if (instr.generates_cc) { | ||
| 3562 | UNIMPLEMENTED_MSG("VMAD Generates an unhandled Control Code"); | ||
| 3563 | } | ||
| 3564 | |||
| 3565 | break; | 3549 | break; |
| 3566 | } | 3550 | } |
| 3567 | case OpCode::Id::VSETP: { | 3551 | case OpCode::Id::VSETP: { |