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 | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp index 40b9ca08e..8e7ad68bd 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | #include "shader_recompiler/profile.h" | 10 | #include "shader_recompiler/profile.h" |
| 11 | 11 | ||
| 12 | namespace Shader::Backend::GLSL { | 12 | namespace Shader::Backend::GLSL { |
| 13 | static constexpr std::string_view SWIZZLE{"xyzw"}; | ||
| 14 | |||
| 13 | void EmitCompositeConstructU32x2(EmitContext& ctx, IR::Inst& inst, std::string_view e1, | 15 | void EmitCompositeConstructU32x2(EmitContext& ctx, IR::Inst& inst, std::string_view e1, |
| 14 | std::string_view e2) { | 16 | std::string_view e2) { |
| 15 | ctx.AddU32x2("{}=uvec2({},{});", inst, e1, e2); | 17 | ctx.AddU32x2("{}=uvec2({},{});", inst, e1, e2); |
| @@ -32,7 +34,7 @@ void EmitCompositeConstructU32x4([[maybe_unused]] EmitContext& ctx, | |||
| 32 | 34 | ||
| 33 | void EmitCompositeExtractU32x2(EmitContext& ctx, IR::Inst& inst, std::string_view composite, | 35 | void EmitCompositeExtractU32x2(EmitContext& ctx, IR::Inst& inst, std::string_view composite, |
| 34 | u32 index) { | 36 | u32 index) { |
| 35 | ctx.AddU32("{}={}[{}];", inst, composite, index); | 37 | ctx.AddU32("{}={}.{};", inst, composite, SWIZZLE[index]); |
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | void EmitCompositeExtractU32x3([[maybe_unused]] EmitContext& ctx, | 40 | void EmitCompositeExtractU32x3([[maybe_unused]] EmitContext& ctx, |
| @@ -130,7 +132,7 @@ void EmitCompositeInsertF16x4([[maybe_unused]] EmitContext& ctx, | |||
| 130 | 132 | ||
| 131 | void EmitCompositeConstructF32x2(EmitContext& ctx, IR::Inst& inst, std::string_view e1, | 133 | void EmitCompositeConstructF32x2(EmitContext& ctx, IR::Inst& inst, std::string_view e1, |
| 132 | std::string_view e2) { | 134 | std::string_view e2) { |
| 133 | ctx.AddF32x2("{}=uvec2({},{});", inst, e1, e2); | 135 | ctx.AddF32x2("{}=vec2({},{});", inst, e1, e2); |
| 134 | } | 136 | } |
| 135 | 137 | ||
| 136 | void EmitCompositeConstructF32x3([[maybe_unused]] EmitContext& ctx, | 138 | void EmitCompositeConstructF32x3([[maybe_unused]] EmitContext& ctx, |
| @@ -150,7 +152,7 @@ void EmitCompositeConstructF32x4([[maybe_unused]] EmitContext& ctx, | |||
| 150 | 152 | ||
| 151 | void EmitCompositeExtractF32x2(EmitContext& ctx, IR::Inst& inst, std::string_view composite, | 153 | void EmitCompositeExtractF32x2(EmitContext& ctx, IR::Inst& inst, std::string_view composite, |
| 152 | u32 index) { | 154 | u32 index) { |
| 153 | ctx.AddF32("{}={}[{}];", inst, composite, index); | 155 | ctx.AddF32("{}={}.{};", inst, composite, SWIZZLE[index]); |
| 154 | } | 156 | } |
| 155 | 157 | ||
| 156 | void EmitCompositeExtractF32x3([[maybe_unused]] EmitContext& ctx, | 158 | void EmitCompositeExtractF32x3([[maybe_unused]] EmitContext& ctx, |