diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp index f8d2c12db..5ba39261b 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace Shader::Backend::GLSL { | 12 | namespace Shader::Backend::GLSL { |
| 13 | namespace { | 13 | namespace { |
| 14 | static constexpr std::string_view cas_loop{R"(for (;;){{ | 14 | constexpr const char cas_loop[]{R"(for (;;){{ |
| 15 | uint old_value={}; | 15 | uint old_value={}; |
| 16 | {}=atomicCompSwap({},old_value,{}({},{})); | 16 | {}=atomicCompSwap({},old_value,{}({},{})); |
| 17 | if ({}==old_value){{break;}} | 17 | if ({}==old_value){{break;}} |
| @@ -21,7 +21,7 @@ void SharedCasFunction(EmitContext& ctx, IR::Inst& inst, std::string_view offset | |||
| 21 | std::string_view value, std::string_view function) { | 21 | std::string_view value, std::string_view function) { |
| 22 | const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; | 22 | const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; |
| 23 | const std::string smem{fmt::format("smem[{}>>2]", offset)}; | 23 | const std::string smem{fmt::format("smem[{}>>2]", offset)}; |
| 24 | ctx.Add(cas_loop.data(), smem, ret, smem, function, smem, value, ret); | 24 | ctx.Add(cas_loop, smem, ret, smem, function, smem, value, ret); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | void SsboCasFunction(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 27 | void SsboCasFunction(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| @@ -29,7 +29,7 @@ void SsboCasFunction(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | |||
| 29 | const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; | 29 | const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; |
| 30 | const std::string ssbo{fmt::format("{}_ssbo{}[{}>>2]", ctx.stage_name, binding.U32(), | 30 | const std::string ssbo{fmt::format("{}_ssbo{}[{}>>2]", ctx.stage_name, binding.U32(), |
| 31 | ctx.var_alloc.Consume(offset))}; | 31 | ctx.var_alloc.Consume(offset))}; |
| 32 | ctx.Add(cas_loop.data(), ssbo, ret, ssbo, function, ssbo, value, ret); | 32 | ctx.Add(cas_loop, ssbo, ret, ssbo, function, ssbo, value, ret); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | void SsboCasFunctionF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 35 | void SsboCasFunctionF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |
| @@ -38,10 +38,10 @@ void SsboCasFunctionF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& bindi | |||
| 38 | const std::string ssbo{fmt::format("{}_ssbo{}[{}>>2]", ctx.stage_name, binding.U32(), | 38 | const std::string ssbo{fmt::format("{}_ssbo{}[{}>>2]", ctx.stage_name, binding.U32(), |
| 39 | ctx.var_alloc.Consume(offset))}; | 39 | ctx.var_alloc.Consume(offset))}; |
| 40 | const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; | 40 | const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)}; |
| 41 | ctx.Add(cas_loop.data(), ssbo, ret, ssbo, function, ssbo, value, ret); | 41 | ctx.Add(cas_loop, ssbo, ret, ssbo, function, ssbo, value, ret); |
| 42 | ctx.AddF32("{}=utof({});", inst, ret); | 42 | ctx.AddF32("{}=utof({});", inst, ret); |
| 43 | } | 43 | } |
| 44 | } // namespace | 44 | } // Anonymous namespace |
| 45 | 45 | ||
| 46 | void EmitSharedAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 46 | void EmitSharedAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 47 | std::string_view value) { | 47 | std::string_view value) { |