zink: clear the fb clears array instead of freeing it on reset
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 21 Jun 2021 15:25:04 +0000 (11:25 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 22 Jun 2021 12:55:37 +0000 (12:55 +0000)
this cuts cpu usage by ~2% in sourcemark due to not reallocating the array
on every draw

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11499>

src/gallium/drivers/zink/zink_clear.c

index bf38e97..21d5b34 100644 (file)
@@ -578,7 +578,7 @@ fb_clears_apply_internal(struct zink_context *ctx, struct pipe_resource *pres, i
 void
 zink_fb_clear_reset(struct zink_context *ctx, unsigned i)
 {
-   util_dynarray_fini(&ctx->fb_clears[i].clears);
+   util_dynarray_clear(&ctx->fb_clears[i].clears);
    if (i == PIPE_MAX_COLOR_BUFS) {
       ctx->clears_enabled &= ~PIPE_CLEAR_DEPTHSTENCIL;
       ctx->rp_clears_enabled &= ~PIPE_CLEAR_DEPTHSTENCIL;