diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 98 |
2 files changed, 103 insertions, 1 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 141b9159b..b09ea3318 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -579,6 +579,10 @@ union Instruction { | |||
| 579 | } fmul32; | 579 | } fmul32; |
| 580 | 580 | ||
| 581 | union { | 581 | union { |
| 582 | BitField<52, 1, u64> generates_cc; | ||
| 583 | } op_32; | ||
| 584 | |||
| 585 | union { | ||
| 582 | BitField<48, 1, u64> is_signed; | 586 | BitField<48, 1, u64> is_signed; |
| 583 | } shift; | 587 | } shift; |
| 584 | 588 | ||
| @@ -1658,4 +1662,4 @@ private: | |||
| 1658 | } | 1662 | } |
| 1659 | }; | 1663 | }; |
| 1660 | 1664 | ||
| 1661 | } // namespace Tegra::Shader \ No newline at end of file | 1665 | } // namespace Tegra::Shader |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index dcf6941b0..d656e5d1c 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -373,6 +373,7 @@ public: | |||
| 373 | if (sets_cc) { | 373 | if (sets_cc) { |
| 374 | const std::string zero_condition = "( " + ConvertIntegerSize(value, size) + " == 0 )"; | 374 | const std::string zero_condition = "( " + ConvertIntegerSize(value, size) + " == 0 )"; |
| 375 | SetInternalFlag(InternalFlag::ZeroFlag, zero_condition); | 375 | SetInternalFlag(InternalFlag::ZeroFlag, zero_condition); |
| 376 | LOG_WARNING(HW_GPU, "Control Codes Imcomplete."); | ||
| 376 | } | 377 | } |
| 377 | } | 378 | } |
| 378 | 379 | ||
| @@ -1525,6 +1526,10 @@ private: | |||
| 1525 | 1526 | ||
| 1526 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b, 1, 1, | 1527 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b, 1, 1, |
| 1527 | instr.alu.saturate_d, 0, true); | 1528 | instr.alu.saturate_d, 0, true); |
| 1529 | if (instr.generates_cc) { | ||
| 1530 | LOG_CRITICAL(HW_GPU, "FMUL Generates an unhandled Control Code"); | ||
| 1531 | UNREACHABLE(); | ||
| 1532 | } | ||
| 1528 | break; | 1533 | break; |
| 1529 | } | 1534 | } |
| 1530 | case OpCode::Id::FADD_C: | 1535 | case OpCode::Id::FADD_C: |
| @@ -1535,6 +1540,10 @@ private: | |||
| 1535 | 1540 | ||
| 1536 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " + " + op_b, 1, 1, | 1541 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " + " + op_b, 1, 1, |
| 1537 | instr.alu.saturate_d, 0, true); | 1542 | instr.alu.saturate_d, 0, true); |
| 1543 | if (instr.generates_cc) { | ||
| 1544 | LOG_CRITICAL(HW_GPU, "FADD Generates an unhandled Control Code"); | ||
| 1545 | UNREACHABLE(); | ||
| 1546 | } | ||
| 1538 | break; | 1547 | break; |
| 1539 | } | 1548 | } |
| 1540 | case OpCode::Id::MUFU: { | 1549 | case OpCode::Id::MUFU: { |
| @@ -1588,6 +1597,10 @@ private: | |||
| 1588 | '(' + condition + ") ? min(" + parameters + ") : max(" + | 1597 | '(' + condition + ") ? min(" + parameters + ") : max(" + |
| 1589 | parameters + ')', | 1598 | parameters + ')', |
| 1590 | 1, 1, false, 0, true); | 1599 | 1, 1, false, 0, true); |
| 1600 | if (instr.generates_cc) { | ||
| 1601 | LOG_CRITICAL(HW_GPU, "FMNMX Generates an unhandled Control Code"); | ||
| 1602 | UNREACHABLE(); | ||
| 1603 | } | ||
| 1591 | break; | 1604 | break; |
| 1592 | } | 1605 | } |
| 1593 | case OpCode::Id::RRO_C: | 1606 | case OpCode::Id::RRO_C: |
| @@ -1617,6 +1630,10 @@ private: | |||
| 1617 | regs.GetRegisterAsFloat(instr.gpr8) + " * " + | 1630 | regs.GetRegisterAsFloat(instr.gpr8) + " * " + |
| 1618 | GetImmediate32(instr), | 1631 | GetImmediate32(instr), |
| 1619 | 1, 1, instr.fmul32.saturate, 0, true); | 1632 | 1, 1, instr.fmul32.saturate, 0, true); |
| 1633 | if (instr.op_32.generates_cc) { | ||
| 1634 | LOG_CRITICAL(HW_GPU, "FMUL32 Generates an unhandled Control Code"); | ||
| 1635 | UNREACHABLE(); | ||
| 1636 | } | ||
| 1620 | break; | 1637 | break; |
| 1621 | } | 1638 | } |
| 1622 | case OpCode::Id::FADD32I: { | 1639 | case OpCode::Id::FADD32I: { |
| @@ -1640,6 +1657,10 @@ private: | |||
| 1640 | } | 1657 | } |
| 1641 | 1658 | ||
| 1642 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " + " + op_b, 1, 1, false, 0, true); | 1659 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " + " + op_b, 1, 1, false, 0, true); |
| 1660 | if (instr.op_32.generates_cc) { | ||
| 1661 | LOG_CRITICAL(HW_GPU, "FADD32 Generates an unhandled Control Code"); | ||
| 1662 | UNREACHABLE(); | ||
| 1663 | } | ||
| 1643 | break; | 1664 | break; |
| 1644 | } | 1665 | } |
| 1645 | } | 1666 | } |
| @@ -1660,6 +1681,10 @@ private: | |||
| 1660 | std::to_string(instr.bfe.GetLeftShiftValue() + instr.bfe.shift_position) + ')'; | 1681 | std::to_string(instr.bfe.GetLeftShiftValue() + instr.bfe.shift_position) + ')'; |
| 1661 | 1682 | ||
| 1662 | regs.SetRegisterToInteger(instr.gpr0, true, 0, outer_shift, 1, 1); | 1683 | regs.SetRegisterToInteger(instr.gpr0, true, 0, outer_shift, 1, 1); |
| 1684 | if (instr.generates_cc) { | ||
| 1685 | LOG_CRITICAL(HW_GPU, "BFE Generates an unhandled Control Code"); | ||
| 1686 | UNREACHABLE(); | ||
| 1687 | } | ||
| 1663 | break; | 1688 | break; |
| 1664 | } | 1689 | } |
| 1665 | default: { | 1690 | default: { |
| @@ -1697,12 +1722,20 @@ private: | |||
| 1697 | // Cast to int is superfluous for arithmetic shift, it's only for a logical shift | 1722 | // Cast to int is superfluous for arithmetic shift, it's only for a logical shift |
| 1698 | regs.SetRegisterToInteger(instr.gpr0, true, 0, "int(" + op_a + " >> " + op_b + ')', | 1723 | regs.SetRegisterToInteger(instr.gpr0, true, 0, "int(" + op_a + " >> " + op_b + ')', |
| 1699 | 1, 1); | 1724 | 1, 1); |
| 1725 | if (instr.generates_cc) { | ||
| 1726 | LOG_CRITICAL(HW_GPU, "SHR Generates an unhandled Control Code"); | ||
| 1727 | UNREACHABLE(); | ||
| 1728 | } | ||
| 1700 | break; | 1729 | break; |
| 1701 | } | 1730 | } |
| 1702 | case OpCode::Id::SHL_C: | 1731 | case OpCode::Id::SHL_C: |
| 1703 | case OpCode::Id::SHL_R: | 1732 | case OpCode::Id::SHL_R: |
| 1704 | case OpCode::Id::SHL_IMM: | 1733 | case OpCode::Id::SHL_IMM: |
| 1705 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " << " + op_b, 1, 1); | 1734 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " << " + op_b, 1, 1); |
| 1735 | if (instr.generates_cc) { | ||
| 1736 | LOG_CRITICAL(HW_GPU, "SHL Generates an unhandled Control Code"); | ||
| 1737 | UNREACHABLE(); | ||
| 1738 | } | ||
| 1706 | break; | 1739 | break; |
| 1707 | default: { | 1740 | default: { |
| 1708 | LOG_CRITICAL(HW_GPU, "Unhandled shift instruction: {}", opcode->GetName()); | 1741 | LOG_CRITICAL(HW_GPU, "Unhandled shift instruction: {}", opcode->GetName()); |
| @@ -1722,6 +1755,10 @@ private: | |||
| 1722 | 1755 | ||
| 1723 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " + " + op_b, 1, 1, | 1756 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " + " + op_b, 1, 1, |
| 1724 | instr.iadd32i.saturate != 0); | 1757 | instr.iadd32i.saturate != 0); |
| 1758 | if (instr.op_32.generates_cc) { | ||
| 1759 | LOG_CRITICAL(HW_GPU, "IADD32 Generates an unhandled Control Code"); | ||
| 1760 | UNREACHABLE(); | ||
| 1761 | } | ||
| 1725 | break; | 1762 | break; |
| 1726 | case OpCode::Id::LOP32I: { | 1763 | case OpCode::Id::LOP32I: { |
| 1727 | if (instr.alu.lop32i.invert_a) | 1764 | if (instr.alu.lop32i.invert_a) |
| @@ -1733,6 +1770,10 @@ private: | |||
| 1733 | WriteLogicOperation(instr.gpr0, instr.alu.lop32i.operation, op_a, op_b, | 1770 | WriteLogicOperation(instr.gpr0, instr.alu.lop32i.operation, op_a, op_b, |
| 1734 | Tegra::Shader::PredicateResultMode::None, | 1771 | Tegra::Shader::PredicateResultMode::None, |
| 1735 | Tegra::Shader::Pred::UnusedIndex); | 1772 | Tegra::Shader::Pred::UnusedIndex); |
| 1773 | if (instr.op_32.generates_cc) { | ||
| 1774 | LOG_CRITICAL(HW_GPU, "LOP32I Generates an unhandled Control Code"); | ||
| 1775 | UNREACHABLE(); | ||
| 1776 | } | ||
| 1736 | break; | 1777 | break; |
| 1737 | } | 1778 | } |
| 1738 | default: { | 1779 | default: { |
| @@ -1769,6 +1810,10 @@ private: | |||
| 1769 | 1810 | ||
| 1770 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " + " + op_b, 1, 1, | 1811 | regs.SetRegisterToInteger(instr.gpr0, true, 0, op_a + " + " + op_b, 1, 1, |
| 1771 | instr.alu.saturate_d); | 1812 | instr.alu.saturate_d); |
| 1813 | if (instr.generates_cc) { | ||
| 1814 | LOG_CRITICAL(HW_GPU, "IADD Generates an unhandled Control Code"); | ||
| 1815 | UNREACHABLE(); | ||
| 1816 | } | ||
| 1772 | break; | 1817 | break; |
| 1773 | } | 1818 | } |
| 1774 | case OpCode::Id::IADD3_C: | 1819 | case OpCode::Id::IADD3_C: |
| @@ -1830,6 +1875,11 @@ private: | |||
| 1830 | } | 1875 | } |
| 1831 | 1876 | ||
| 1832 | regs.SetRegisterToInteger(instr.gpr0, true, 0, result, 1, 1); | 1877 | regs.SetRegisterToInteger(instr.gpr0, true, 0, result, 1, 1); |
| 1878 | |||
| 1879 | if (instr.generates_cc) { | ||
| 1880 | LOG_CRITICAL(HW_GPU, "IADD3 Generates an unhandled Control Code"); | ||
| 1881 | UNREACHABLE(); | ||
| 1882 | } | ||
| 1833 | break; | 1883 | break; |
| 1834 | } | 1884 | } |
| 1835 | case OpCode::Id::ISCADD_C: | 1885 | case OpCode::Id::ISCADD_C: |
| @@ -1845,6 +1895,10 @@ private: | |||
| 1845 | 1895 | ||
| 1846 | regs.SetRegisterToInteger(instr.gpr0, true, 0, | 1896 | regs.SetRegisterToInteger(instr.gpr0, true, 0, |
| 1847 | "((" + op_a + " << " + shift + ") + " + op_b + ')', 1, 1); | 1897 | "((" + op_a + " << " + shift + ") + " + op_b + ')', 1, 1); |
| 1898 | if (instr.generates_cc) { | ||
| 1899 | LOG_CRITICAL(HW_GPU, "ISCADD Generates an unhandled Control Code"); | ||
| 1900 | UNREACHABLE(); | ||
| 1901 | } | ||
| 1848 | break; | 1902 | break; |
| 1849 | } | 1903 | } |
| 1850 | case OpCode::Id::POPC_C: | 1904 | case OpCode::Id::POPC_C: |
| @@ -1876,6 +1930,10 @@ private: | |||
| 1876 | 1930 | ||
| 1877 | WriteLogicOperation(instr.gpr0, instr.alu.lop.operation, op_a, op_b, | 1931 | WriteLogicOperation(instr.gpr0, instr.alu.lop.operation, op_a, op_b, |
| 1878 | instr.alu.lop.pred_result_mode, instr.alu.lop.pred48); | 1932 | instr.alu.lop.pred_result_mode, instr.alu.lop.pred48); |
| 1933 | if (instr.generates_cc) { | ||
| 1934 | LOG_CRITICAL(HW_GPU, "LOP Generates an unhandled Control Code"); | ||
| 1935 | UNREACHABLE(); | ||
| 1936 | } | ||
| 1879 | break; | 1937 | break; |
| 1880 | } | 1938 | } |
| 1881 | case OpCode::Id::LOP3_C: | 1939 | case OpCode::Id::LOP3_C: |
| @@ -1891,6 +1949,10 @@ private: | |||
| 1891 | } | 1949 | } |
| 1892 | 1950 | ||
| 1893 | WriteLop3Instruction(instr.gpr0, op_a, op_b, op_c, lut); | 1951 | WriteLop3Instruction(instr.gpr0, op_a, op_b, op_c, lut); |
| 1952 | if (instr.generates_cc) { | ||
| 1953 | LOG_CRITICAL(HW_GPU, "LOP3 Generates an unhandled Control Code"); | ||
| 1954 | UNREACHABLE(); | ||
| 1955 | } | ||
| 1894 | break; | 1956 | break; |
| 1895 | } | 1957 | } |
| 1896 | case OpCode::Id::IMNMX_C: | 1958 | case OpCode::Id::IMNMX_C: |
| @@ -1905,6 +1967,10 @@ private: | |||
| 1905 | '(' + condition + ") ? min(" + parameters + ") : max(" + | 1967 | '(' + condition + ") ? min(" + parameters + ") : max(" + |
| 1906 | parameters + ')', | 1968 | parameters + ')', |
| 1907 | 1, 1); | 1969 | 1, 1); |
| 1970 | if (instr.generates_cc) { | ||
| 1971 | LOG_CRITICAL(HW_GPU, "IMNMX Generates an unhandled Control Code"); | ||
| 1972 | UNREACHABLE(); | ||
| 1973 | } | ||
| 1908 | break; | 1974 | break; |
| 1909 | } | 1975 | } |
| 1910 | case OpCode::Id::LEA_R2: | 1976 | case OpCode::Id::LEA_R2: |
| @@ -2103,6 +2169,10 @@ private: | |||
| 2103 | 2169 | ||
| 2104 | regs.SetRegisterToFloat(instr.gpr0, 0, "fma(" + op_a + ", " + op_b + ", " + op_c + ')', | 2170 | regs.SetRegisterToFloat(instr.gpr0, 0, "fma(" + op_a + ", " + op_b + ", " + op_c + ')', |
| 2105 | 1, 1, instr.alu.saturate_d, 0, true); | 2171 | 1, 1, instr.alu.saturate_d, 0, true); |
| 2172 | if (instr.generates_cc) { | ||
| 2173 | LOG_CRITICAL(HW_GPU, "FFMA Generates an unhandled Control Code"); | ||
| 2174 | UNREACHABLE(); | ||
| 2175 | } | ||
| 2106 | 2176 | ||
| 2107 | break; | 2177 | break; |
| 2108 | } | 2178 | } |
| @@ -2208,6 +2278,11 @@ private: | |||
| 2208 | } | 2278 | } |
| 2209 | 2279 | ||
| 2210 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a, 1, 1); | 2280 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a, 1, 1); |
| 2281 | |||
| 2282 | if (instr.generates_cc) { | ||
| 2283 | LOG_CRITICAL(HW_GPU, "I2F Generates an unhandled Control Code"); | ||
| 2284 | UNREACHABLE(); | ||
| 2285 | } | ||
| 2211 | break; | 2286 | break; |
| 2212 | } | 2287 | } |
| 2213 | case OpCode::Id::F2F_R: { | 2288 | case OpCode::Id::F2F_R: { |
| @@ -2246,6 +2321,11 @@ private: | |||
| 2246 | } | 2321 | } |
| 2247 | 2322 | ||
| 2248 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a, 1, 1, instr.alu.saturate_d); | 2323 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a, 1, 1, instr.alu.saturate_d); |
| 2324 | |||
| 2325 | if (instr.generates_cc) { | ||
| 2326 | LOG_CRITICAL(HW_GPU, "F2F Generates an unhandled Control Code"); | ||
| 2327 | UNREACHABLE(); | ||
| 2328 | } | ||
| 2249 | break; | 2329 | break; |
| 2250 | } | 2330 | } |
| 2251 | case OpCode::Id::F2I_R: | 2331 | case OpCode::Id::F2I_R: |
| @@ -2295,6 +2375,10 @@ private: | |||
| 2295 | 2375 | ||
| 2296 | regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_output_signed, 0, op_a, 1, | 2376 | regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_output_signed, 0, op_a, 1, |
| 2297 | 1, false, 0, instr.conversion.dest_size); | 2377 | 1, false, 0, instr.conversion.dest_size); |
| 2378 | if (instr.generates_cc) { | ||
| 2379 | LOG_CRITICAL(HW_GPU, "F2I Generates an unhandled Control Code"); | ||
| 2380 | UNREACHABLE(); | ||
| 2381 | } | ||
| 2298 | break; | 2382 | break; |
| 2299 | } | 2383 | } |
| 2300 | default: { | 2384 | default: { |
| @@ -3102,6 +3186,11 @@ private: | |||
| 3102 | regs.SetRegisterToFloat(instr.gpr0, 0, value, 1, 1); | 3186 | regs.SetRegisterToFloat(instr.gpr0, 0, value, 1, 1); |
| 3103 | } | 3187 | } |
| 3104 | 3188 | ||
| 3189 | if (instr.generates_cc) { | ||
| 3190 | LOG_CRITICAL(HW_GPU, "PSET Generates an unhandled Control Code"); | ||
| 3191 | UNREACHABLE(); | ||
| 3192 | } | ||
| 3193 | |||
| 3105 | break; | 3194 | break; |
| 3106 | } | 3195 | } |
| 3107 | case OpCode::Type::PredicateSetPredicate: { | 3196 | case OpCode::Type::PredicateSetPredicate: { |
| @@ -3366,6 +3455,10 @@ private: | |||
| 3366 | } | 3455 | } |
| 3367 | 3456 | ||
| 3368 | regs.SetRegisterToInteger(instr.gpr0, is_signed, 0, sum, 1, 1); | 3457 | regs.SetRegisterToInteger(instr.gpr0, is_signed, 0, sum, 1, 1); |
| 3458 | if (instr.generates_cc) { | ||
| 3459 | LOG_CRITICAL(HW_GPU, "XMAD Generates an unhandled Control Code"); | ||
| 3460 | UNREACHABLE(); | ||
| 3461 | } | ||
| 3369 | break; | 3462 | break; |
| 3370 | } | 3463 | } |
| 3371 | default: { | 3464 | default: { |
| @@ -3537,6 +3630,11 @@ private: | |||
| 3537 | regs.SetRegisterToInteger(instr.gpr0, result_signed, 1, result, 1, 1, | 3630 | regs.SetRegisterToInteger(instr.gpr0, result_signed, 1, result, 1, 1, |
| 3538 | instr.vmad.saturate == 1, 0, Register::Size::Word, | 3631 | instr.vmad.saturate == 1, 0, Register::Size::Word, |
| 3539 | instr.vmad.cc); | 3632 | instr.vmad.cc); |
| 3633 | if (instr.generates_cc) { | ||
| 3634 | LOG_CRITICAL(HW_GPU, "VMAD Generates an unhandled Control Code"); | ||
| 3635 | UNREACHABLE(); | ||
| 3636 | } | ||
| 3637 | |||
| 3540 | break; | 3638 | break; |
| 3541 | } | 3639 | } |
| 3542 | case OpCode::Id::VSETP: { | 3640 | case OpCode::Id::VSETP: { |