summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.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/emit_glsl_bitwise_conversion.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 '')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp
index 2b08aa593..9d844b831 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp
@@ -26,7 +26,13 @@ void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) {
}
void EmitConditionRef(EmitContext& ctx, IR::Inst& inst, const IR::Value& value) {
- ctx.AddU1("{}={};", inst, ctx.var_alloc.Consume(value));
+ // Fake one usage to get a real variable out of the condition
+ inst.DestructiveAddUsage(1);
+ const auto ret{ctx.var_alloc.Define(inst, GlslVarType::U1)};
+ const auto input{ctx.var_alloc.Consume(value)};
+ if (ret != input) {
+ ctx.Add("{}={};", ret, input);
+ }
}
void EmitBitCastU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst) {