diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c index bdcc193d7b9..5ae59cd2dfa 100644 --- a/src/gallium/drivers/zink/zink_clear.c +++ b/src/gallium/drivers/zink/zink_clear.c @@ -247,7 +247,30 @@ zink_clear(struct pipe_context *pctx, union pipe_color_union color; color.f[0] = color.f[1] = color.f[2] = 0; color.f[3] = 1.0; - pctx->clear(pctx, void_clears, NULL, &color, 0, 0); + for (unsigned i = 0; i < fb->nr_cbufs; i++) { + if ((void_clears & (PIPE_CLEAR_COLOR0 << i)) && fb->cbufs[i]) { + struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[i]; + unsigned num_clears = zink_fb_clear_count(fb_clear); + if (num_clears) { + if (zink_fb_clear_first_needs_explicit(fb_clear)) { + /* a scissored clear exists: + * - extend the clear array + * - shift existing clears back by one position + * - inject void clear base of array + */ + add_new_clear(fb_clear); + struct zink_framebuffer_clear_data *clear = fb_clear->clears.data; + memcpy(clear + 1, clear, num_clears); + memcpy(&clear->color, &color, sizeof(color)); + } else { + /* no void clear needed */ + } + void_clears &= ~(PIPE_CLEAR_COLOR0 << i); + } + } + } + if (void_clears) + pctx->clear(pctx, void_clears, NULL, &color, 0, 0); } if (buffers & PIPE_CLEAR_COLOR) {