diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp')
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp index 954fc67b1..7421ce97d 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp @@ -13,8 +13,13 @@ namespace { constexpr std::string_view SWIZZLE{"xyzw"}; void CompositeInsert(EmitContext& ctx, std::string_view result, std::string_view composite, std::string_view object, u32 index) { - ctx.Add("{}={};", result, composite); - ctx.Add("{}.{}={};", result, SWIZZLE[index], object); + if (result == composite) { + // The result is aliased with the composite + ctx.Add("{}.{}={};", composite, SWIZZLE[index], object); + } else { + ctx.Add("{}={};", result, composite); + ctx.Add("{}.{}={};", result, SWIZZLE[index], object); + } } } // Anonymous namespace |