summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-04-19 20:33:17 +0200
committerSubv <subv2112@gmail.com>2018-04-19 20:33:17 +0200
commit5367935d359361c3c361c48fa02860a83ea5490f (patch)
tree6039f431d3a4d015302bbd23bb5a7c0ed88f8790
parentMerge pull request #353 from Subv/compressed_formats (diff)
downloadyuzu-5367935d359361c3c361c48fa02860a83ea5490f.tar
yuzu-5367935d359361c3c361c48fa02860a83ea5490f.tar.gz
yuzu-5367935d359361c3c361c48fa02860a83ea5490f.tar.bz2
yuzu-5367935d359361c3c361c48fa02860a83ea5490f.tar.lz
yuzu-5367935d359361c3c361c48fa02860a83ea5490f.tar.xz
yuzu-5367935d359361c3c361c48fa02860a83ea5490f.tar.zst
yuzu-5367935d359361c3c361c48fa02860a83ea5490f.zip
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp11
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:
const std::string op_a = GetRegister(instr.gpr8);
const std::string op_b = GetRegister(instr.gpr20);
const std::string sampler = GetSampler(instr.sampler);
- const std::string coord = "vec2(" + op_a + ", " + op_b + ")";
- const std::string texture = "texture(" + sampler + ", " + coord + ")";
+ const std::string coord = "vec2 coords = vec2(" + op_a + ", " + op_b + ");";
+ // Add an extra scope and declare the texture coords inside to prevent overwriting
+ // them in case they are used as outputs of the texs instruction.
+ shader.AddLine("{");
+ ++shader.scope;
+ shader.AddLine(coord);
+ const std::string texture = "texture(" + sampler + ", coords)";
for (unsigned elem = 0; elem < instr.attribute.fmt20.size; ++elem) {
SetDest(elem, GetRegister(instr.gpr0, elem), texture, 1, 4);
}
+ --shader.scope;
+ shader.AddLine("}");
break;
}
default: {