summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-05-30 17:27:00 -0400
committerGravatar ameerj2021-07-22 21:51:37 -0400
commit1269a0cf8b3844c1a9bb06c843a7698b0a9643d5 (patch)
treea0716589fa3952bdeb0f1d19b4bb455d9cdd86e5 /src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
parentglsl: Fix ATOM and implement ATOMS (diff)
downloadyuzu-1269a0cf8b3844c1a9bb06c843a7698b0a9643d5.tar.gz
yuzu-1269a0cf8b3844c1a9bb06c843a7698b0a9643d5.tar.xz
yuzu-1269a0cf8b3844c1a9bb06c843a7698b0a9643d5.zip
glsl: Rework variable allocator to allow for variable reuse
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
index 4a3d66c90..1c7413cd4 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
@@ -29,7 +29,7 @@ void SetSignFlag(EmitContext& ctx, IR::Inst& inst, std::string_view result) {
29} 29}
30} // Anonymous namespace 30} // Anonymous namespace
31void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { 31void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
32 const auto result{ctx.reg_alloc.Define(inst, Type::U32)}; 32 const auto result{ctx.var_alloc.Define(inst, GlslVarType::U32)};
33 if (IR::Inst* const carry{inst.GetAssociatedPseudoOperation(IR::Opcode::GetCarryFromOp)}) { 33 if (IR::Inst* const carry{inst.GetAssociatedPseudoOperation(IR::Opcode::GetCarryFromOp)}) {
34 ctx.uses_cc_carry = true; 34 ctx.uses_cc_carry = true;
35 ctx.Add("{}=uaddCarry({},{},carry);", result, a, b); 35 ctx.Add("{}=uaddCarry({},{},carry);", result, a, b);
@@ -130,7 +130,7 @@ void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base,
130 130
131void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, 131void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
132 std::string_view offset, std::string_view count) { 132 std::string_view offset, std::string_view count) {
133 const auto result{ctx.reg_alloc.Define(inst, Type::U32)}; 133 const auto result{ctx.var_alloc.Define(inst, GlslVarType::U32)};
134 ctx.Add("{}=uint(bitfieldExtract(int({}),int({}),int({})));", result, base, offset, count); 134 ctx.Add("{}=uint(bitfieldExtract(int({}),int({}),int({})));", result, base, offset, count);
135 SetZeroFlag(ctx, inst, result); 135 SetZeroFlag(ctx, inst, result);
136 SetSignFlag(ctx, inst, result); 136 SetSignFlag(ctx, inst, result);
@@ -138,7 +138,7 @@ void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view bas
138 138
139void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, 139void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
140 std::string_view offset, std::string_view count) { 140 std::string_view offset, std::string_view count) {
141 const auto result{ctx.reg_alloc.Define(inst, Type::U32)}; 141 const auto result{ctx.var_alloc.Define(inst, GlslVarType::U32)};
142 ctx.Add("{}=uint(bitfieldExtract(uint({}),int({}),int({})));", result, base, offset, count); 142 ctx.Add("{}=uint(bitfieldExtract(uint({}),int({}),int({})));", result, base, offset, count);
143 SetZeroFlag(ctx, inst, result); 143 SetZeroFlag(ctx, inst, result);
144 SetSignFlag(ctx, inst, result); 144 SetSignFlag(ctx, inst, result);
@@ -184,7 +184,7 @@ void EmitUMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::strin
184 184
185void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, 185void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min,
186 std::string_view max) { 186 std::string_view max) {
187 const auto result{ctx.reg_alloc.Define(inst, Type::U32)}; 187 const auto result{ctx.var_alloc.Define(inst, GlslVarType::U32)};
188 ctx.Add("{}=clamp(int({}),int({}),int({}));", result, value, min, max); 188 ctx.Add("{}=clamp(int({}),int({}),int({}));", result, value, min, max);
189 SetZeroFlag(ctx, inst, result); 189 SetZeroFlag(ctx, inst, result);
190 SetSignFlag(ctx, inst, result); 190 SetSignFlag(ctx, inst, result);
@@ -192,7 +192,7 @@ void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std:
192 192
193void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, 193void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min,
194 std::string_view max) { 194 std::string_view max) {
195 const auto result{ctx.reg_alloc.Define(inst, Type::U32)}; 195 const auto result{ctx.var_alloc.Define(inst, GlslVarType::U32)};
196 ctx.Add("{}=clamp(uint({}),uint({}),uint({}));", result, value, min, max); 196 ctx.Add("{}=clamp(uint({}),uint({}),uint({}));", result, value, min, max);
197 SetZeroFlag(ctx, inst, result); 197 SetZeroFlag(ctx, inst, result);
198 SetSignFlag(ctx, inst, result); 198 SetSignFlag(ctx, inst, result);