diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-04-01 06:07:51 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:25 +0200 |
commit | f1dd743731bd0e7b7f1ef172882971bcd15eb5bc (patch) | |
tree | bd3cf90bce9b0b4ecafb12bd269a250c000336d4 /src/shader_recompiler/backend | |
parent | shader: Fix constant propagation to use reverse post order (diff) | |
download | yuzu-f1dd743731bd0e7b7f1ef172882971bcd15eb5bc.tar yuzu-f1dd743731bd0e7b7f1ef172882971bcd15eb5bc.tar.gz yuzu-f1dd743731bd0e7b7f1ef172882971bcd15eb5bc.tar.bz2 yuzu-f1dd743731bd0e7b7f1ef172882971bcd15eb5bc.tar.lz yuzu-f1dd743731bd0e7b7f1ef172882971bcd15eb5bc.tar.xz yuzu-f1dd743731bd0e7b7f1ef172882971bcd15eb5bc.tar.zst yuzu-f1dd743731bd0e7b7f1ef172882971bcd15eb5bc.zip |
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r-- | src/shader_recompiler/backend/spirv/emit_context.cpp | 2 | ||||
-rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index b0f7e2269..3b3fea50c 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp @@ -114,7 +114,7 @@ EmitContext::~EmitContext() = default; Id EmitContext::Def(const IR::Value& value) { if (!value.IsImmediate()) { - return value.Inst()->Definition<Id>(); + return value.InstRecursive()->Definition<Id>(); } switch (value.Type()) { case IR::Type::Void: diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index 6389d80bf..9dc769307 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp @@ -250,7 +250,7 @@ Id PhiArgDef(EmitContext& ctx, IR::Inst* inst, size_t index) { // Let the context handle immediate definitions, as it already knows how return ctx.Def(arg); } - IR::Inst* const arg_inst{arg.Inst()}; + IR::Inst* const arg_inst{arg.InstRecursive()}; if (const Id def{arg_inst->Definition<Id>()}; Sirit::ValidId(def)) { // Return the current definition if it exists return def; @@ -296,7 +296,12 @@ Id EmitPhi(EmitContext& ctx, IR::Inst* inst) { void EmitVoid(EmitContext&) {} Id EmitIdentity(EmitContext& ctx, const IR::Value& value) { - return ctx.Def(value); + if (const Id id = ctx.Def(value); Sirit::ValidId(id)) { + return id; + } + const Id def{ctx.ForwardDeclarationId()}; + value.InstRecursive()->SetDefinition<Id>(def); + return def; } void EmitGetZeroFromOp(EmitContext&) { |