diff options
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 30 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 3c5e9ea96..b25168600 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -1141,7 +1141,7 @@ private: | |||
| 1141 | INST("0011011-0101----", Id::ISET_IMM, Type::IntegerSet, "ISET_IMM"), | 1141 | INST("0011011-0101----", Id::ISET_IMM, Type::IntegerSet, "ISET_IMM"), |
| 1142 | INST("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"), | 1142 | INST("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"), |
| 1143 | INST("0101000010010---", Id::PSETP, Type::PredicateSetPredicate, "PSETP"), | 1143 | INST("0101000010010---", Id::PSETP, Type::PredicateSetPredicate, "PSETP"), |
| 1144 | INST("010100001010----", Id::PSETP, Type::PredicateSetPredicate, "CSETP"), | 1144 | INST("010100001010----", Id::CSETP, Type::PredicateSetPredicate, "CSETP"), |
| 1145 | INST("0011011-00------", Id::XMAD_IMM, Type::Xmad, "XMAD_IMM"), | 1145 | INST("0011011-00------", Id::XMAD_IMM, Type::Xmad, "XMAD_IMM"), |
| 1146 | INST("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"), | 1146 | INST("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"), |
| 1147 | INST("010100010-------", Id::XMAD_RC, Type::Xmad, "XMAD_RC"), | 1147 | INST("010100010-------", Id::XMAD_RC, Type::Xmad, "XMAD_RC"), |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 158eb2190..2f1d6de3c 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -351,12 +351,12 @@ public: | |||
| 351 | shader.AddLine(dest + " = " + src + ';'); | 351 | shader.AddLine(dest + " = " + src + ';'); |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | std::string GetControlCode(const Tegra::Shader::ControlCode cc) { | 354 | std::string GetControlCode(const Tegra::Shader::ControlCode cc) const { |
| 355 | u32 code = static_cast<u32>(cc); | 355 | const u32 code = static_cast<u32>(cc); |
| 356 | return "controlCode_" + std::to_string(code); | 356 | return "controlCode_" + std::to_string(code) + suffix; |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | void SetControlCode(const Tegra::Shader::ControlCode cc, const std::string& value) { | 359 | void SetControlCode(const Tegra::Shader::ControlCode cc, const std::string& value) const { |
| 360 | shader.AddLine(GetControlCode(cc) + " = " + value + ';'); | 360 | shader.AddLine(GetControlCode(cc) + " = " + value + ';'); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| @@ -424,7 +424,7 @@ public: | |||
| 424 | declarations.AddNewLine(); | 424 | declarations.AddNewLine(); |
| 425 | 425 | ||
| 426 | for (u32 cc = 0; cc < 32; cc++) { | 426 | for (u32 cc = 0; cc < 32; cc++) { |
| 427 | Tegra::Shader::ControlCode code = static_cast<Tegra::Shader::ControlCode>(cc); | 427 | const Tegra::Shader::ControlCode code = static_cast<Tegra::Shader::ControlCode>(cc); |
| 428 | declarations.AddLine("bool " + GetControlCode(code) + " = false;"); | 428 | declarations.AddLine("bool " + GetControlCode(code) + " = false;"); |
| 429 | } | 429 | } |
| 430 | declarations.AddNewLine(); | 430 | declarations.AddNewLine(); |
| @@ -1656,6 +1656,10 @@ private: | |||
| 1656 | 1656 | ||
| 1657 | regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_output_signed, 0, op_a, 1, | 1657 | regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_output_signed, 0, op_a, 1, |
| 1658 | 1, instr.alu.saturate_d, 0, instr.conversion.dest_size); | 1658 | 1, instr.alu.saturate_d, 0, instr.conversion.dest_size); |
| 1659 | if (instr.generates_cc.Value() != 0) { | ||
| 1660 | const std::string neucondition = "( " + op_a + " != 0 )"; | ||
| 1661 | regs.SetControlCode(Tegra::Shader::ControlCode::NEU, neucondition); | ||
| 1662 | } | ||
| 1659 | break; | 1663 | break; |
| 1660 | } | 1664 | } |
| 1661 | case OpCode::Id::I2F_R: | 1665 | case OpCode::Id::I2F_R: |
| @@ -2277,13 +2281,13 @@ private: | |||
| 2277 | // We can't use the constant predicate as destination. | 2281 | // We can't use the constant predicate as destination. |
| 2278 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); | 2282 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); |
| 2279 | 2283 | ||
| 2280 | const std::string second_pred = | 2284 | const std::string second_pred = |
| 2281 | GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0); | 2285 | GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0); |
| 2282 | 2286 | ||
| 2283 | const std::string combiner = GetPredicateCombiner(instr.psetp.op); | 2287 | const std::string combiner = GetPredicateCombiner(instr.psetp.op); |
| 2284 | 2288 | ||
| 2285 | const std::string predicate = | 2289 | const std::string predicate = |
| 2286 | '(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')'; | 2290 | '(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')'; |
| 2287 | 2291 | ||
| 2288 | // Set the primary predicate to the result of Predicate OP SecondPredicate | 2292 | // Set the primary predicate to the result of Predicate OP SecondPredicate |
| 2289 | SetPredicate(instr.psetp.pred3, | 2293 | SetPredicate(instr.psetp.pred3, |
| @@ -2298,10 +2302,10 @@ private: | |||
| 2298 | break; | 2302 | break; |
| 2299 | } | 2303 | } |
| 2300 | case OpCode::Id::CSETP: { | 2304 | case OpCode::Id::CSETP: { |
| 2301 | std::string pred = | 2305 | const std::string pred = |
| 2302 | GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0); | 2306 | GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0); |
| 2303 | std::string combiner = GetPredicateCombiner(instr.csetp.op); | 2307 | const std::string combiner = GetPredicateCombiner(instr.csetp.op); |
| 2304 | std::string controlCode = regs.GetControlCode(instr.csetp.cc); | 2308 | const std::string controlCode = regs.GetControlCode(instr.csetp.cc); |
| 2305 | if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) { | 2309 | if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) { |
| 2306 | SetPredicate(instr.csetp.pred3, | 2310 | SetPredicate(instr.csetp.pred3, |
| 2307 | '(' + controlCode + ") " + combiner + " (" + pred + ')'); | 2311 | '(' + controlCode + ") " + combiner + " (" + pred + ')'); |