summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/var_alloc.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-05-31 01:13:22 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commit9f3ffb996b0d02ca64b492d22ff158e8f3659257 (patch)
tree48993eaf320484cf042071a81a1a6b1dcc829eb9 /src/shader_recompiler/backend/glsl/var_alloc.cpp
parentglsl: Rework variable allocator to allow for variable reuse (diff)
downloadyuzu-9f3ffb996b0d02ca64b492d22ff158e8f3659257.tar
yuzu-9f3ffb996b0d02ca64b492d22ff158e8f3659257.tar.gz
yuzu-9f3ffb996b0d02ca64b492d22ff158e8f3659257.tar.bz2
yuzu-9f3ffb996b0d02ca64b492d22ff158e8f3659257.tar.lz
yuzu-9f3ffb996b0d02ca64b492d22ff158e8f3659257.tar.xz
yuzu-9f3ffb996b0d02ca64b492d22ff158e8f3659257.tar.zst
yuzu-9f3ffb996b0d02ca64b492d22ff158e8f3659257.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/var_alloc.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/var_alloc.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glsl/var_alloc.cpp b/src/shader_recompiler/backend/glsl/var_alloc.cpp
index 8c6944f07..896457248 100644
--- a/src/shader_recompiler/backend/glsl/var_alloc.cpp
+++ b/src/shader_recompiler/backend/glsl/var_alloc.cpp
@@ -110,7 +110,6 @@ std::string VarAlloc::Define(IR::Inst& inst, GlslVarType type) {
} else {
Id id{};
id.type.Assign(type);
- // id.is_null.Assign(1);
GetUseTracker(type).uses_temp = true;
inst.SetDefinition<Id>(id);
}
@@ -121,6 +120,20 @@ std::string VarAlloc::Define(IR::Inst& inst, IR::Type type) {
return Define(inst, RegType(type));
}
+std::string VarAlloc::PhiDefine(IR::Inst& inst, IR::Type type) {
+ return AddDefine(inst, RegType(type));
+}
+
+std::string VarAlloc::AddDefine(IR::Inst& inst, GlslVarType type) {
+ if (inst.HasUses()) {
+ inst.SetDefinition<Id>(Alloc(type));
+ return Representation(inst.Definition<Id>());
+ } else {
+ return "";
+ }
+ return Representation(inst.Definition<Id>());
+}
+
std::string VarAlloc::Consume(const IR::Value& value) {
return value.IsImmediate() ? MakeImm(value) : ConsumeInst(*value.InstRecursive());
}
@@ -223,6 +236,8 @@ VarAlloc::UseTracker& VarAlloc::GetUseTracker(GlslVarType type) {
switch (type) {
case GlslVarType::U1:
return var_bool;
+ case GlslVarType::F16x2:
+ return var_f16x2;
case GlslVarType::U32:
return var_u32;
case GlslVarType::S32: