From 38fe070d78324afd735709a70fc52b97f84bca1e Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 12 Mar 2020 17:43:03 -0300 Subject: [PATCH] gl_shader_decompiler: Add layer component to texelFetch TexelFetch was not emitting the array component generating invalid GLSL. --- .../renderer_opengl/gl_shader_decompiler.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 3a41ed30cb..b148aa057f 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1822,16 +1822,19 @@ private: expr += GetSampler(meta->sampler); expr += ", "; - expr += constructors.at(operation.GetOperandsCount() - 1); + expr += constructors.at(operation.GetOperandsCount() + (meta->array ? 1 : 0) - 1); expr += '('; for (std::size_t i = 0; i < count; ++i) { - expr += VisitOperand(operation, i).AsInt(); - const std::size_t next = i + 1; - if (next == count) - expr += ')'; - else if (next < count) + if (i > 0) { expr += ", "; + } + expr += VisitOperand(operation, i).AsInt(); } + if (meta->array) { + expr += ", "; + expr += Visit(meta->array).AsInt(); + } + expr += ')'; if (meta->lod && !meta->sampler.IsBuffer()) { expr += ", ";