From c68aa65226f49d29da1fa6eb9880c51165a240e2 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 12 Aug 2018 00:06:48 -0400 Subject: gl_shader_decompiler: Fix GLSL compiler error with KIL instruction. --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 85297bd00..d21daf28a 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/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: { -- cgit v1.2.3