Mesa (main): zink: also nope out of any dst alpha blends for rgbx formats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 16 19:55:00 UTC 2021


Module: Mesa
Branch: main
Commit: 1e86cdd8b7b9b817735e453dacd116473a829e00
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e86cdd8b7b9b817735e453dacd116473a829e00

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Apr 13 14:56:08 2021 -0400

zink: also nope out of any dst alpha blends for rgbx formats

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11391>

---

 src/gallium/drivers/zink/zink_pipeline.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c
index fede591433a..1ea1413e738 100644
--- a/src/gallium/drivers/zink/zink_pipeline.c
+++ b/src/gallium/drivers/zink/zink_pipeline.c
@@ -35,6 +35,16 @@
 #include "util/u_debug.h"
 #include "util/u_prim.h"
 
+static VkBlendFactor
+clamp_void_blend_factor(VkBlendFactor f)
+{
+   if (f == VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA)
+      return VK_BLEND_FACTOR_ZERO;
+   if (f == VK_BLEND_FACTOR_DST_ALPHA)
+      return VK_BLEND_FACTOR_ONE;
+   return f;
+}
+
 VkPipeline
 zink_create_gfx_pipeline(struct zink_screen *screen,
                          struct zink_gfx_program *prog,
@@ -80,8 +90,11 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
    if (state->void_alpha_attachments) {
       for (unsigned i = 0; i < state->num_attachments; i++) {
          blend_att[i] = state->blend_state->attachments[i];
-         if (state->void_alpha_attachments & BITFIELD_BIT(i))
+         if (state->void_alpha_attachments & BITFIELD_BIT(i)) {
             blend_att[i].dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
+            blend_att[i].srcColorBlendFactor = clamp_void_blend_factor(blend_att[i].srcColorBlendFactor);
+            blend_att[i].dstColorBlendFactor = clamp_void_blend_factor(blend_att[i].dstColorBlendFactor);
+         }
       }
       blend_state.pAttachments = blend_att;
    } else



More information about the mesa-commit mailing list