summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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) {
217 IR::Inst* const arg_inst{arg.Inst()}; 217 IR::Inst* const arg_inst{arg.Inst()};
218 def = arg_inst->Definition<Id>(); 218 def = arg_inst->Definition<Id>();
219 if (!Sirit::ValidId(def)) { 219 if (!Sirit::ValidId(def)) {
220 // If it hasn't been defined, get a forward declaration 220 if (arg_inst == inst) {
221 def = ctx.ForwardDeclarationId(); 221 // This is a self referencing phi node
222 arg_inst->SetDefinition<Id>(def); 222 def = ctx.CurrentId();
223 // Self-referencing definition will be set by the caller
224 } else {
225 // If it hasn't been defined and it's not a self reference,
226 // get a forward declaration
227 def = ctx.ForwardDeclarationId();
228 arg_inst->SetDefinition<Id>(def);
229 }
223 } 230 }
224 } 231 }
225 IR::Block* const phi_block{inst->PhiBlock(index)}; 232 IR::Block* const phi_block{inst->PhiBlock(index)};