From c7e4f28a162c48f656e6dd5eab543b4e1edb2405 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 9 Mar 2021 15:39:50 -0500 Subject: [PATCH] zink: simplify clear-apply on fb state change since surfaces are cached and deduplicated, we no longer have to do deep comparisons to determine whether two surfaces are equal and can just compare the pointers Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index e1ff9f1..8f27200 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1501,18 +1501,13 @@ zink_set_framebuffer_state(struct pipe_context *pctx, for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) { struct pipe_surface *surf = ctx->fb_state.cbufs[i]; - if (surf && - (!state->cbufs[i] || i >= state->nr_cbufs || - surf->texture != state->cbufs[i]->texture || - surf->format != state->cbufs[i]->format || - memcmp(&surf->u, &state->cbufs[i]->u, sizeof(union pipe_surface_desc)))) + if (surf && (i >= state->nr_cbufs || surf != state->cbufs[i])) zink_fb_clears_apply(ctx, surf->texture); } if (ctx->fb_state.zsbuf) { struct pipe_surface *surf = ctx->fb_state.zsbuf; - if (!state->zsbuf || surf->texture != state->zsbuf->texture || - memcmp(&surf->u, &state->zsbuf->u, sizeof(union pipe_surface_desc))) - zink_fb_clears_apply(ctx, ctx->fb_state.zsbuf->texture); + if (surf != state->zsbuf) + zink_fb_clears_apply(ctx, ctx->fb_state.zsbuf->texture); } util_copy_framebuffer_state(&ctx->fb_state, state); -- 2.7.4