summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-04 02:57:52 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commit34fdb6471d6050b438fd53a0406aedbf6b690600 (patch)
tree0f483ab7f1e38bff1b03db30b9a000730df95913 /src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp
parentglsl: Refactor Global memory functions (diff)
downloadyuzu-34fdb6471d6050b438fd53a0406aedbf6b690600.tar
yuzu-34fdb6471d6050b438fd53a0406aedbf6b690600.tar.gz
yuzu-34fdb6471d6050b438fd53a0406aedbf6b690600.tar.bz2
yuzu-34fdb6471d6050b438fd53a0406aedbf6b690600.tar.lz
yuzu-34fdb6471d6050b438fd53a0406aedbf6b690600.tar.xz
yuzu-34fdb6471d6050b438fd53a0406aedbf6b690600.tar.zst
yuzu-34fdb6471d6050b438fd53a0406aedbf6b690600.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp10
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 @@
namespace Shader::Backend::GLSL {
namespace {
-static constexpr std::string_view cas_loop{R"(for (;;){{
+constexpr const char cas_loop[]{R"(for (;;){{
uint old_value={};
{}=atomicCompSwap({},old_value,{}({},{}));
if ({}==old_value){{break;}}
@@ -21,7 +21,7 @@ void SharedCasFunction(EmitContext& ctx, IR::Inst& inst, std::string_view offset
std::string_view value, std::string_view function) {
const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)};
const std::string smem{fmt::format("smem[{}>>2]", offset)};
- ctx.Add(cas_loop.data(), smem, ret, smem, function, smem, value, ret);
+ ctx.Add(cas_loop, smem, ret, smem, function, smem, value, ret);
}
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,
const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)};
const std::string ssbo{fmt::format("{}_ssbo{}[{}>>2]", ctx.stage_name, binding.U32(),
ctx.var_alloc.Consume(offset))};
- ctx.Add(cas_loop.data(), ssbo, ret, ssbo, function, ssbo, value, ret);
+ ctx.Add(cas_loop, ssbo, ret, ssbo, function, ssbo, value, ret);
}
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
const std::string ssbo{fmt::format("{}_ssbo{}[{}>>2]", ctx.stage_name, binding.U32(),
ctx.var_alloc.Consume(offset))};
const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U32)};
- ctx.Add(cas_loop.data(), ssbo, ret, ssbo, function, ssbo, value, ret);
+ ctx.Add(cas_loop, ssbo, ret, ssbo, function, ssbo, value, ret);
ctx.AddF32("{}=utof({});", inst, ret);
}
-} // namespace
+} // Anonymous namespace
void EmitSharedAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset,
std::string_view value) {