Explorar o código

gl_shader_decompiler: Fix GLSL compiler error with KIL instruction.

bunnei %!s(int64=8) %!d(string=hai) anos
pai
achega
c68aa65226
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      src/video_core/renderer_opengl/gl_shader_decompiler.cpp

+ 8 - 0
src/video_core/renderer_opengl/gl_shader_decompiler.cpp

@@ -1667,7 +1667,15 @@ private:
             }
             case OpCode::Id::KIL: {
                 ASSERT(instr.flow.cond == Tegra::Shader::FlowCondition::Always);
+
+                // Enclose "discard" in a conditional, so that GLSL compilation does not complain
+                // about unexecuted instructions that may follow this.
+                shader.AddLine("if (true) {");
+                ++shader.scope;
                 shader.AddLine("discard;");
+                --shader.scope;
+                shader.AddLine("}");
+
                 break;
             }
             case OpCode::Id::BRA: {