diff options
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 52 |
2 files changed, 49 insertions, 14 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 12229cf4c..3c5e9ea96 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -581,6 +581,15 @@ union Instruction { | |||
| 581 | } pset; | 581 | } pset; |
| 582 | 582 | ||
| 583 | union { | 583 | union { |
| 584 | BitField<0, 3, u64> pred0; | ||
| 585 | BitField<3, 3, u64> pred3; | ||
| 586 | BitField<8, 5, ControlCode> cc; // flag in cc | ||
| 587 | BitField<39, 3, u64> pred39; | ||
| 588 | BitField<42, 1, u64> neg_pred39; | ||
| 589 | BitField<45, 4, PredOperation> op; // op with pred39 | ||
| 590 | } csetp; | ||
| 591 | |||
| 592 | union { | ||
| 584 | BitField<39, 3, u64> pred39; | 593 | BitField<39, 3, u64> pred39; |
| 585 | BitField<42, 1, u64> neg_pred; | 594 | BitField<42, 1, u64> neg_pred; |
| 586 | BitField<43, 1, u64> neg_a; | 595 | BitField<43, 1, u64> neg_a; |
| @@ -895,6 +904,7 @@ public: | |||
| 895 | ISET_IMM, | 904 | ISET_IMM, |
| 896 | PSETP, | 905 | PSETP, |
| 897 | PSET, | 906 | PSET, |
| 907 | CSETP, | ||
| 898 | XMAD_IMM, | 908 | XMAD_IMM, |
| 899 | XMAD_CR, | 909 | XMAD_CR, |
| 900 | XMAD_RC, | 910 | XMAD_RC, |
| @@ -1131,6 +1141,7 @@ private: | |||
| 1131 | INST("0011011-0101----", Id::ISET_IMM, Type::IntegerSet, "ISET_IMM"), | 1141 | INST("0011011-0101----", Id::ISET_IMM, Type::IntegerSet, "ISET_IMM"), |
| 1132 | INST("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"), | 1142 | INST("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"), |
| 1133 | INST("0101000010010---", Id::PSETP, Type::PredicateSetPredicate, "PSETP"), | 1143 | INST("0101000010010---", Id::PSETP, Type::PredicateSetPredicate, "PSETP"), |
| 1144 | INST("010100001010----", Id::PSETP, Type::PredicateSetPredicate, "CSETP"), | ||
| 1134 | INST("0011011-00------", Id::XMAD_IMM, Type::Xmad, "XMAD_IMM"), | 1145 | INST("0011011-00------", Id::XMAD_IMM, Type::Xmad, "XMAD_IMM"), |
| 1135 | INST("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"), | 1146 | INST("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"), |
| 1136 | 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 34f9e57d4..158eb2190 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -2267,13 +2267,15 @@ private: | |||
| 2267 | break; | 2267 | break; |
| 2268 | } | 2268 | } |
| 2269 | case OpCode::Type::PredicateSetPredicate: { | 2269 | case OpCode::Type::PredicateSetPredicate: { |
| 2270 | const std::string op_a = | 2270 | switch (opcode->GetId()) { |
| 2271 | GetPredicateCondition(instr.psetp.pred12, instr.psetp.neg_pred12 != 0); | 2271 | case OpCode::Id::PSETP: { |
| 2272 | const std::string op_b = | 2272 | const std::string op_a = |
| 2273 | GetPredicateCondition(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); | 2273 | GetPredicateCondition(instr.psetp.pred12, instr.psetp.neg_pred12 != 0); |
| 2274 | const std::string op_b = | ||
| 2275 | GetPredicateCondition(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); | ||
| 2274 | 2276 | ||
| 2275 | // We can't use the constant predicate as destination. | 2277 | // We can't use the constant predicate as destination. |
| 2276 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); | 2278 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); |
| 2277 | 2279 | ||
| 2278 | const std::string second_pred = | 2280 | const std::string second_pred = |
| 2279 | GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0); | 2281 | GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0); |
| @@ -2283,15 +2285,37 @@ private: | |||
| 2283 | const std::string predicate = | 2285 | const std::string predicate = |
| 2284 | '(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')'; | 2286 | '(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')'; |
| 2285 | 2287 | ||
| 2286 | // Set the primary predicate to the result of Predicate OP SecondPredicate | 2288 | // Set the primary predicate to the result of Predicate OP SecondPredicate |
| 2287 | SetPredicate(instr.psetp.pred3, | 2289 | SetPredicate(instr.psetp.pred3, |
| 2288 | '(' + predicate + ") " + combiner + " (" + second_pred + ')'); | 2290 | '(' + predicate + ") " + combiner + " (" + second_pred + ')'); |
| 2289 | 2291 | ||
| 2290 | if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { | 2292 | if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { |
| 2291 | // Set the secondary predicate to the result of !Predicate OP SecondPredicate, | 2293 | // Set the secondary predicate to the result of !Predicate OP SecondPredicate, |
| 2292 | // if enabled | 2294 | // if enabled |
| 2293 | SetPredicate(instr.psetp.pred0, | 2295 | SetPredicate(instr.psetp.pred0, |
| 2294 | "!(" + predicate + ") " + combiner + " (" + second_pred + ')'); | 2296 | "!(" + predicate + ") " + combiner + " (" + second_pred + ')'); |
| 2297 | } | ||
| 2298 | break; | ||
| 2299 | } | ||
| 2300 | case OpCode::Id::CSETP: { | ||
| 2301 | std::string pred = | ||
| 2302 | GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0); | ||
| 2303 | std::string combiner = GetPredicateCombiner(instr.csetp.op); | ||
| 2304 | std::string controlCode = regs.GetControlCode(instr.csetp.cc); | ||
| 2305 | if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) { | ||
| 2306 | SetPredicate(instr.csetp.pred3, | ||
| 2307 | '(' + controlCode + ") " + combiner + " (" + pred + ')'); | ||
| 2308 | } | ||
| 2309 | if (instr.csetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { | ||
| 2310 | SetPredicate(instr.csetp.pred0, | ||
| 2311 | "!(" + controlCode + ") " + combiner + " (" + pred + ')'); | ||
| 2312 | } | ||
| 2313 | break; | ||
| 2314 | } | ||
| 2315 | default: { | ||
| 2316 | LOG_CRITICAL(HW_GPU, "Unhandled predicate instruction: {}", opcode->GetName()); | ||
| 2317 | UNREACHABLE(); | ||
| 2318 | } | ||
| 2295 | } | 2319 | } |
| 2296 | break; | 2320 | break; |
| 2297 | } | 2321 | } |