summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-05 11:28:50 -0400
committerGravatar GitHub2018-07-05 11:28:50 -0400
commit1b0a74e23f8eb716e5561d07f4c15d62d6162491 (patch)
tree1e3fa8f0ce4d7f156ce363bd7b2e59d9b84fd502 /src
parentMerge pull request #620 from Subv/depth_z32f (diff)
parentGPU: Implemented the PSETP shader instruction. (diff)
downloadyuzu-1b0a74e23f8eb716e5561d07f4c15d62d6162491.tar.gz
yuzu-1b0a74e23f8eb716e5561d07f4c15d62d6162491.tar.xz
yuzu-1b0a74e23f8eb716e5561d07f4c15d62d6162491.zip
Merge pull request #621 from Subv/psetp_
GPU: Implemented the PSETP shader instruction.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/shader_bytecode.h13
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp30
2 files changed, 43 insertions, 0 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index c1226a649..95b7d46ec 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -329,6 +329,19 @@ union Instruction {
329 } isetp; 329 } isetp;
330 330
331 union { 331 union {
332 BitField<0, 3, u64> pred0;
333 BitField<3, 3, u64> pred3;
334 BitField<12, 3, u64> pred12;
335 BitField<15, 1, u64> neg_pred12;
336 BitField<24, 2, PredOperation> cond;
337 BitField<29, 3, u64> pred29;
338 BitField<32, 1, u64> neg_pred29;
339 BitField<39, 3, u64> pred39;
340 BitField<42, 1, u64> neg_pred39;
341 BitField<45, 2, PredOperation> op;
342 } psetp;
343
344 union {
332 BitField<39, 3, u64> pred39; 345 BitField<39, 3, u64> pred39;
333 BitField<42, 1, u64> neg_pred; 346 BitField<42, 1, u64> neg_pred;
334 BitField<43, 1, u64> neg_a; 347 BitField<43, 1, u64> neg_a;
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index ec9956edb..a4b730e1c 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1477,6 +1477,36 @@ private:
1477 } 1477 }
1478 break; 1478 break;
1479 } 1479 }
1480 case OpCode::Type::PredicateSetPredicate: {
1481 std::string op_a =
1482 GetPredicateCondition(instr.psetp.pred12, instr.psetp.neg_pred12 != 0);
1483 std::string op_b =
1484 GetPredicateCondition(instr.psetp.pred29, instr.psetp.neg_pred29 != 0);
1485
1486 using Tegra::Shader::Pred;
1487 // We can't use the constant predicate as destination.
1488 ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex));
1489
1490 std::string second_pred =
1491 GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0);
1492
1493 std::string combiner = GetPredicateCombiner(instr.psetp.op);
1494
1495 std::string predicate =
1496 '(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')';
1497
1498 // Set the primary predicate to the result of Predicate OP SecondPredicate
1499 SetPredicate(instr.psetp.pred3,
1500 '(' + predicate + ") " + combiner + " (" + second_pred + ')');
1501
1502 if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
1503 // Set the secondary predicate to the result of !Predicate OP SecondPredicate,
1504 // if enabled
1505 SetPredicate(instr.psetp.pred0,
1506 "!(" + predicate + ") " + combiner + " (" + second_pred + ')');
1507 }
1508 break;
1509 }
1480 case OpCode::Type::FloatSet: { 1510 case OpCode::Type::FloatSet: {
1481 std::string op_a = instr.fset.neg_a ? "-" : ""; 1511 std::string op_a = instr.fset.neg_a ? "-" : "";
1482 op_a += regs.GetRegisterAsFloat(instr.gpr8); 1512 op_a += regs.GetRegisterAsFloat(instr.gpr8);