Mesa (main): zink: only reset zink_resource::so_valid on buffer rebind

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 26 15:17:50 UTC 2021


Module: Mesa
Branch: main
Commit: 1a68f2eb8f4818944d656b8d0f9102c576815800
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a68f2eb8f4818944d656b8d0f9102c576815800

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Oct 22 14:32:40 2021 -0400

zink: only reset zink_resource::so_valid on buffer rebind

otherwise this is going to randomly modify some image properties

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13490>

---

 src/gallium/drivers/zink/zink_context.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 0ecfd8540db..b2ecb048f56 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3919,12 +3919,13 @@ rebind_image(struct zink_context *ctx, struct zink_resource *res)
 bool
 zink_resource_rebind(struct zink_context *ctx, struct zink_resource *res)
 {
-   /* force counter buffer reset */
-   res->so_valid = false;
    if (!zink_resource_has_binds(res))
-      return true;
-   if (res->base.b.target == PIPE_BUFFER)
+      return 0;
+   if (res->base.b.target == PIPE_BUFFER) {
+      /* force counter buffer reset */
+      res->so_valid = false;
       return rebind_buffer(ctx, res, 0, 0) == res->bind_count[0] + res->bind_count[1];
+   }
    rebind_image(ctx, res);
    return false;
 }



More information about the mesa-commit mailing list