summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar FernandoS272021-04-14 08:00:41 +0200
committerGravatar ameerj2021-07-22 21:51:27 -0400
commitab3831f6cb87d7f0a337cef6ecb4b1f63bfb0bb5 (patch)
tree5c407077d2f0c4fe88985813789ddc3b141a40d8 /src
parentspirv: Fix non-atomic 64-bit store (diff)
downloadyuzu-ab3831f6cb87d7f0a337cef6ecb4b1f63bfb0bb5.tar.gz
yuzu-ab3831f6cb87d7f0a337cef6ecb4b1f63bfb0bb5.tar.xz
yuzu-ab3831f6cb87d7f0a337cef6ecb4b1f63bfb0bb5.zip
spirv: Fix alpha test
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_special.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
index 8bb94f546..ae8b39f41 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
@@ -65,6 +65,10 @@ void AlphaTest(EmitContext& ctx) {
65 if (comparison == CompareFunction::Always) { 65 if (comparison == CompareFunction::Always) {
66 return; 66 return;
67 } 67 }
68 if (!Sirit::ValidId(ctx.frag_color[0])) {
69 return;
70 }
71
68 const Id type{ctx.F32[1]}; 72 const Id type{ctx.F32[1]};
69 const Id rt0_color{ctx.OpLoad(ctx.F32[4], ctx.frag_color[0])}; 73 const Id rt0_color{ctx.OpLoad(ctx.F32[4], ctx.frag_color[0])};
70 const Id alpha{ctx.OpCompositeExtract(type, rt0_color, 3u)}; 74 const Id alpha{ctx.OpCompositeExtract(type, rt0_color, 3u)};
@@ -74,6 +78,7 @@ void AlphaTest(EmitContext& ctx) {
74 const Id alpha_reference{ctx.Constant(ctx.F32[1], ctx.profile.alpha_test_reference)}; 78 const Id alpha_reference{ctx.Constant(ctx.F32[1], ctx.profile.alpha_test_reference)};
75 const Id condition{ComparisonFunction(ctx, comparison, alpha, alpha_reference)}; 79 const Id condition{ComparisonFunction(ctx, comparison, alpha, alpha_reference)};
76 80
81 ctx.OpSelectionMerge(true_label, spv::SelectionControlMask::MaskNone);
77 ctx.OpBranchConditional(condition, true_label, discard_label); 82 ctx.OpBranchConditional(condition, true_label, discard_label);
78 ctx.AddLabel(discard_label); 83 ctx.AddLabel(discard_label);
79 ctx.OpKill(); 84 ctx.OpKill();