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

Author: daoxianggong <daoxiang.g...@imgtec.com>
Date:   Wed Jan  3 13:20:45 2024 +0100

zink - Fix for blend color change without blend state change

Flag blend color change and make sure vkCmdSetBlendConstants is called.

Signed-off-by: daoxianggong <daoxiang.g...@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26799>

---

 src/gallium/drivers/zink/zink_context.c | 2 ++
 src/gallium/drivers/zink/zink_draw.cpp  | 3 ++-
 src/gallium/drivers/zink/zink_types.h   | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index b2e038bfe14..ed6d450f318 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3713,6 +3713,8 @@ zink_set_blend_color(struct pipe_context *pctx,
 {
    struct zink_context *ctx = zink_context(pctx);
    memcpy(ctx->blend_constants, color->color, sizeof(float) * 4);
+
+   ctx->blend_color_changed = true;
    zink_flush_dgc_if_enabled(ctx);
 }
 
diff --git a/src/gallium/drivers/zink/zink_draw.cpp 
b/src/gallium/drivers/zink/zink_draw.cpp
index e8d9280ff54..55af43720fa 100644
--- a/src/gallium/drivers/zink/zink_draw.cpp
+++ b/src/gallium/drivers/zink/zink_draw.cpp
@@ -874,10 +874,11 @@ zink_draw(struct pipe_context *pctx,
       ctx->sample_locations_changed = false;
    }
 
-   if (BATCH_CHANGED || ctx->blend_state_changed) {
+   if (BATCH_CHANGED || ctx->blend_color_changed) {
       VKCTX(CmdSetBlendConstants)(batch->state->cmdbuf, ctx->blend_constants);
    }
    ctx->blend_state_changed = false;
+   ctx->blend_color_changed = false;
 
    if (!DRAW_STATE) {
       if (BATCH_CHANGED || ctx->vertex_buffers_dirty) {
diff --git a/src/gallium/drivers/zink/zink_types.h 
b/src/gallium/drivers/zink/zink_types.h
index d72585437c0..c96f2db6d31 100644
--- a/src/gallium/drivers/zink/zink_types.h
+++ b/src/gallium/drivers/zink/zink_types.h
@@ -2032,6 +2032,7 @@ struct zink_context {
    bool unordered_blitting : 1;
    bool vertex_state_changed : 1;
    bool blend_state_changed : 1;
+   bool blend_color_changed : 1;
    bool sample_mask_changed : 1;
    bool rast_state_changed : 1;
    bool line_width_changed : 1;

Reply via email to