diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 6233ee358..b18f25026 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -399,11 +399,18 @@ private: | |||
| 399 | const std::string op_a = GetRegister(instr.gpr8); | 399 | const std::string op_a = GetRegister(instr.gpr8); |
| 400 | const std::string op_b = GetRegister(instr.gpr20); | 400 | const std::string op_b = GetRegister(instr.gpr20); |
| 401 | const std::string sampler = GetSampler(instr.sampler); | 401 | const std::string sampler = GetSampler(instr.sampler); |
| 402 | const std::string coord = "vec2(" + op_a + ", " + op_b + ")"; | 402 | const std::string coord = "vec2 coords = vec2(" + op_a + ", " + op_b + ");"; |
| 403 | const std::string texture = "texture(" + sampler + ", " + coord + ")"; | 403 | // Add an extra scope and declare the texture coords inside to prevent overwriting |
| 404 | // them in case they are used as outputs of the texs instruction. | ||
| 405 | shader.AddLine("{"); | ||
| 406 | ++shader.scope; | ||
| 407 | shader.AddLine(coord); | ||
| 408 | const std::string texture = "texture(" + sampler + ", coords)"; | ||
| 404 | for (unsigned elem = 0; elem < instr.attribute.fmt20.size; ++elem) { | 409 | for (unsigned elem = 0; elem < instr.attribute.fmt20.size; ++elem) { |
| 405 | SetDest(elem, GetRegister(instr.gpr0, elem), texture, 1, 4); | 410 | SetDest(elem, GetRegister(instr.gpr0, elem), texture, 1, 4); |
| 406 | } | 411 | } |
| 412 | --shader.scope; | ||
| 413 | shader.AddLine("}"); | ||
| 407 | break; | 414 | break; |
| 408 | } | 415 | } |
| 409 | default: { | 416 | default: { |