From 6980eb4be2eeff5545f453e18a32239168cdc5f1 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 24 Mar 2022 17:31:36 -0400 Subject: [PATCH] zink: flush clears before toggling color write ensure these sync up onto the expected buffers Fixes: 3892c133811 ("zink: add an alternate path for EXT_color_write_enable usage") Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index b183a86f981..bc9c0c35dfd 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2577,6 +2577,9 @@ zink_set_color_write_enables(struct zink_context *ctx) bool disable_color_writes = ctx->rast_state && ctx->rast_state->base.rasterizer_discard && ctx->primitives_generated_active; if (ctx->disable_color_writes == disable_color_writes) return; + /* flush all pending clears: these have already occurred */ + if (disable_color_writes && ctx->clears_enabled) + zink_batch_rp(ctx); ctx->disable_color_writes = disable_color_writes; if (zink_screen(ctx->base.screen)->driver_workarounds.color_write_missing) { /* use dummy color buffers instead of the more sane option */