zink: flush clears before toggling color write

ensure these sync up onto the expected buffers

Fixes: 3892c13381 ("zink: add an alternate path for EXT_color_write_enable usage")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15568>
This commit is contained in:
Mike Blumenkrantz 2022-03-24 17:31:36 -04:00 committed by Marge Bot
parent 4c6931fca9
commit 6980eb4be2

View file

@ -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 */