mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-13 11:27:56 -05:00
glsl: Cleanup and address feedback
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user