Mesa (master): zink: simplify clear-apply on fb state change

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 8 03:50:47 UTC 2021


Module: Mesa
Branch: master
Commit: c7e4f28a162c48f656e6dd5eab543b4e1edb2405
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7e4f28a162c48f656e6dd5eab543b4e1edb2405

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Mar  9 15:39:50 2021 -0500

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 at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10087>

---

 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 e1ff9f15bf8..8f27200076c 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);



More information about the mesa-commit mailing list