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 | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp index d3301054c..9714ffe33 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_atomic.cpp | |||
| @@ -20,7 +20,7 @@ static constexpr std::string_view cas_loop{R"(for (;;){{ | |||
| 20 | void SharedCasFunction(EmitContext& ctx, IR::Inst& inst, std::string_view offset, | 20 | 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[{}/4]", 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.data(), smem, ret, smem, function, smem, value, ret); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| @@ -45,7 +45,7 @@ void SsboCasFunctionF32(EmitContext& ctx, IR::Inst& inst, const IR::Value& bindi | |||
| 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) { |
| 48 | ctx.AddU32("{}=atomicAdd(smem[{}/4],{});", inst, pointer_offset, value); | 48 | ctx.AddU32("{}=atomicAdd(smem[{}>>2],{});", inst, pointer_offset, value); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | void EmitSharedAtomicSMin32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 51 | void EmitSharedAtomicSMin32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| @@ -56,7 +56,7 @@ void EmitSharedAtomicSMin32(EmitContext& ctx, IR::Inst& inst, std::string_view p | |||
| 56 | 56 | ||
| 57 | void EmitSharedAtomicUMin32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 57 | void EmitSharedAtomicUMin32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 58 | std::string_view value) { | 58 | std::string_view value) { |
| 59 | ctx.AddU32("{}=atomicMin(smem[{}/4],{});", inst, pointer_offset, value); | 59 | ctx.AddU32("{}=atomicMin(smem[{}>>2],{});", inst, pointer_offset, value); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | void EmitSharedAtomicSMax32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 62 | void EmitSharedAtomicSMax32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| @@ -67,7 +67,7 @@ void EmitSharedAtomicSMax32(EmitContext& ctx, IR::Inst& inst, std::string_view p | |||
| 67 | 67 | ||
| 68 | void EmitSharedAtomicUMax32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 68 | void EmitSharedAtomicUMax32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 69 | std::string_view value) { | 69 | std::string_view value) { |
| 70 | ctx.AddU32("{}=atomicMax(smem[{}/4],{});", inst, pointer_offset, value); | 70 | ctx.AddU32("{}=atomicMax(smem[{}>>2],{});", inst, pointer_offset, value); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | void EmitSharedAtomicInc32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 73 | void EmitSharedAtomicInc32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| @@ -82,31 +82,31 @@ void EmitSharedAtomicDec32(EmitContext& ctx, IR::Inst& inst, std::string_view po | |||
| 82 | 82 | ||
| 83 | void EmitSharedAtomicAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 83 | void EmitSharedAtomicAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 84 | std::string_view value) { | 84 | std::string_view value) { |
| 85 | ctx.AddU32("{}=atomicAnd(smem[{}/4],{});", inst, pointer_offset, value); | 85 | ctx.AddU32("{}=atomicAnd(smem[{}>>2],{});", inst, pointer_offset, value); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | void EmitSharedAtomicOr32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 88 | void EmitSharedAtomicOr32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 89 | std::string_view value) { | 89 | std::string_view value) { |
| 90 | ctx.AddU32("{}=atomicOr(smem[{}/4],{});", inst, pointer_offset, value); | 90 | ctx.AddU32("{}=atomicOr(smem[{}>>2],{});", inst, pointer_offset, value); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | void EmitSharedAtomicXor32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 93 | void EmitSharedAtomicXor32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 94 | std::string_view value) { | 94 | std::string_view value) { |
| 95 | ctx.AddU32("{}=atomicXor(smem[{}/4],{});", inst, pointer_offset, value); | 95 | ctx.AddU32("{}=atomicXor(smem[{}>>2],{});", inst, pointer_offset, value); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | void EmitSharedAtomicExchange32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 98 | void EmitSharedAtomicExchange32(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 99 | std::string_view value) { | 99 | std::string_view value) { |
| 100 | ctx.AddU32("{}=atomicExchange(smem[{}/4],{});", inst, pointer_offset, value); | 100 | ctx.AddU32("{}=atomicExchange(smem[{}>>2],{});", inst, pointer_offset, value); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void EmitSharedAtomicExchange64(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, | 103 | void EmitSharedAtomicExchange64(EmitContext& ctx, IR::Inst& inst, std::string_view pointer_offset, |
| 104 | std::string_view value) { | 104 | std::string_view value) { |
| 105 | // LOG_WARNING("Int64 Atomics not supported, fallback to non-atomic"); | 105 | // LOG_WARNING("Int64 Atomics not supported, fallback to non-atomic"); |
| 106 | ctx.AddU64("{}=packUint2x32(uvec2(smem[{}/4],smem[({}+4)/4]));", inst, pointer_offset, | 106 | ctx.AddU64("{}=packUint2x32(uvec2(smem[{}>>2],smem[({}+4)>>2]));", inst, pointer_offset, |
| 107 | pointer_offset); | 107 | pointer_offset); |
| 108 | ctx.Add("smem[{}/4]=unpackUint2x32({}).x;smem[({}+4)/4]=unpackUint2x32({}).y;", pointer_offset, | 108 | ctx.Add("smem[{}>>2]=unpackUint2x32({}).x;smem[({}+4)>>2]=unpackUint2x32({}).y;", |
| 109 | value, pointer_offset, value); | 109 | pointer_offset, value, pointer_offset, value); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | void EmitStorageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, | 112 | void EmitStorageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, |