diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-05-26 02:55:06 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:36 +0200 |
commit | b95716e5431e7ddb05239c31080c01aab24a13ac (patch) | |
tree | 0de79d8166ee7ebbdb10bcc3a830bf0580d0de3d /src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp | |
parent | glsl: Fix floating point compare ops (diff) | |
download | yuzu-b95716e5431e7ddb05239c31080c01aab24a13ac.tar yuzu-b95716e5431e7ddb05239c31080c01aab24a13ac.tar.gz yuzu-b95716e5431e7ddb05239c31080c01aab24a13ac.tar.bz2 yuzu-b95716e5431e7ddb05239c31080c01aab24a13ac.tar.lz yuzu-b95716e5431e7ddb05239c31080c01aab24a13ac.tar.xz yuzu-b95716e5431e7ddb05239c31080c01aab24a13ac.tar.zst yuzu-b95716e5431e7ddb05239c31080c01aab24a13ac.zip |
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp')
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp index d67a1d81f..b37b3c76d 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp @@ -19,8 +19,15 @@ static void NotImplemented() { throw NotImplementedException("GLSL instruction"); } -void EmitPhi(EmitContext& ctx, IR::Inst& inst) { - // NotImplemented(); +void EmitPhi(EmitContext& ctx, IR::Inst& phi) { + const size_t num_args{phi.NumArgs()}; + for (size_t i = 0; i < num_args; ++i) { + ctx.reg_alloc.Consume(phi.Arg(i)); + } + if (!phi.Definition<Id>().is_valid) { + // The phi node wasn't forward defined + ctx.Add("{};", ctx.reg_alloc.Define(phi, phi.Arg(0).Type())); + } } void EmitVoid(EmitContext& ctx) { @@ -31,11 +38,18 @@ void EmitReference(EmitContext&) { // NotImplemented(); } -void EmitPhiMove(EmitContext& ctx, const IR::Value& phi, const IR::Value& value) { - if (phi == value) { +void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value& value) { + IR::Inst& phi{RegAlloc::AliasInst(*phi_value.Inst())}; + if (!phi.Definition<Id>().is_valid) { + // The phi node wasn't forward defined + ctx.Add("{};", ctx.reg_alloc.Define(phi, phi.Arg(0).Type())); + } + const auto phi_reg{ctx.reg_alloc.Consume(IR::Value{&phi})}; + const auto val_reg{ctx.reg_alloc.Consume(value)}; + if (phi_reg == val_reg) { return; } - ctx.Add("{}={};", ctx.reg_alloc.Consume(phi), ctx.reg_alloc.Consume(value)); + ctx.Add("{}={};", phi_reg, val_reg); } void EmitBranch(EmitContext& ctx, std::string_view label) { |