summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-02-24 22:31:32 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:22 +0200
commit7496bbf7584049fb9c99cf705e9cc16aee61a55a (patch)
tree8aeb8a37fa2efda20e05238041c1d54dae073949 /src/shader_recompiler/backend
parentshader: Fix control flow (diff)
downloadyuzu-7496bbf7584049fb9c99cf705e9cc16aee61a55a.tar
yuzu-7496bbf7584049fb9c99cf705e9cc16aee61a55a.tar.gz
yuzu-7496bbf7584049fb9c99cf705e9cc16aee61a55a.tar.bz2
yuzu-7496bbf7584049fb9c99cf705e9cc16aee61a55a.tar.lz
yuzu-7496bbf7584049fb9c99cf705e9cc16aee61a55a.tar.xz
yuzu-7496bbf7584049fb9c99cf705e9cc16aee61a55a.tar.zst
yuzu-7496bbf7584049fb9c99cf705e9cc16aee61a55a.zip
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
index f3aca90d0..bcd6bda28 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
@@ -217,9 +217,16 @@ Id EmitPhi(EmitContext& ctx, IR::Inst* inst) {
IR::Inst* const arg_inst{arg.Inst()};
def = arg_inst->Definition<Id>();
if (!Sirit::ValidId(def)) {
- // If it hasn't been defined, get a forward declaration
- def = ctx.ForwardDeclarationId();
- arg_inst->SetDefinition<Id>(def);
+ if (arg_inst == inst) {
+ // This is a self referencing phi node
+ def = ctx.CurrentId();
+ // Self-referencing definition will be set by the caller
+ } else {
+ // If it hasn't been defined and it's not a self reference,
+ // get a forward declaration
+ def = ctx.ForwardDeclarationId();
+ arg_inst->SetDefinition<Id>(def);
+ }
}
}
IR::Block* const phi_block{inst->PhiBlock(index)};