summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-08-11 16:00:14 -0500
committerGravatar Subv2018-08-11 16:00:14 -0500
commitc1ad9738810d312ec38beccd709ce0853641a94a (patch)
tree999f11d3e815983d173e7db2d408f03762f39f51 /src
parentGPU/Shaders: Implemented SSY and SYNC as a way to modify control flow during ... (diff)
downloadyuzu-c1ad9738810d312ec38beccd709ce0853641a94a.tar.gz
yuzu-c1ad9738810d312ec38beccd709ce0853641a94a.tar.xz
yuzu-c1ad9738810d312ec38beccd709ce0853641a94a.zip
GPU/Shader: Don't predicate instructions that don't have a predicate field (SSY).
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/shader_bytecode.h7
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp8
2 files changed, 13 insertions, 2 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 3d4557b7e..42c6ea5fd 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -598,6 +598,13 @@ public:
598 Unknown, 598 Unknown,
599 }; 599 };
600 600
601 /// Returns whether an opcode has an execution predicate field or not (ie, whether it can be
602 /// conditionally executed).
603 static bool IsPredicatedInstruction(Id opcode) {
604 // TODO(Subv): Add the rest of unpredicated instructions.
605 return opcode != Id::SSY;
606 }
607
601 class Matcher { 608 class Matcher {
602 public: 609 public:
603 Matcher(const char* const name, u16 mask, u16 expected, OpCode::Id id, OpCode::Type type) 610 Matcher(const char* const name, u16 mask, u16 expected, OpCode::Id id, OpCode::Type type)
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 532a47037..8954deb81 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -837,7 +837,11 @@ private:
837 ASSERT_MSG(instr.pred.full_pred != Pred::NeverExecute, 837 ASSERT_MSG(instr.pred.full_pred != Pred::NeverExecute,
838 "NeverExecute predicate not implemented"); 838 "NeverExecute predicate not implemented");
839 839
840 if (instr.pred.pred_index != static_cast<u64>(Pred::UnusedIndex)) { 840 // Some instructions (like SSY) don't have a predicate field, they are always
841 // unconditionally executed.
842 bool can_be_predicated = OpCode::IsPredicatedInstruction(opcode->GetId());
843
844 if (can_be_predicated && instr.pred.pred_index != static_cast<u64>(Pred::UnusedIndex)) {
841 shader.AddLine("if (" + 845 shader.AddLine("if (" +
842 GetPredicateCondition(instr.pred.pred_index, instr.negate_pred != 0) + 846 GetPredicateCondition(instr.pred.pred_index, instr.negate_pred != 0) +
843 ')'); 847 ')');
@@ -1709,7 +1713,7 @@ private:
1709 } 1713 }
1710 1714
1711 // Close the predicate condition scope. 1715 // Close the predicate condition scope.
1712 if (instr.pred.pred_index != static_cast<u64>(Pred::UnusedIndex)) { 1716 if (can_be_predicated && instr.pred.pred_index != static_cast<u64>(Pred::UnusedIndex)) {
1713 --shader.scope; 1717 --shader.scope;
1714 shader.AddLine('}'); 1718 shader.AddLine('}');
1715 } 1719 }