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 <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10087>
This commit is contained in:
Mike Blumenkrantz
2021-03-09 15:39:50 -05:00
committed by Marge Bot
parent f19946ca6e
commit c7e4f28a16

View File

@@ -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);