Mesa (main): zink: flag all buffer resources with PIPE_BIND_SHADER_IMAGE

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 28 14:56:54 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jan 21 10:25:33 2022 -0500

zink: flag all buffer resources with PIPE_BIND_SHADER_IMAGE

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

---

 src/gallium/drivers/zink/zink_resource.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 0c5a075ab95..c77198050ec 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -927,10 +927,9 @@ resource_create(struct pipe_screen *pscreen,
    }
 
    res->internal_format = templ->format;
-   if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
-      res->base.b.bind |= PIPE_BIND_SHADER_IMAGE;
    if (templ->target == PIPE_BUFFER) {
       util_range_init(&res->valid_buffer_range);
+      res->base.b.bind |= PIPE_BIND_SHADER_IMAGE;
       if (!screen->resizable_bar && templ->width0 >= 8196) {
          /* We don't want to evict buffers from VRAM by mapping them for CPU access,
           * because they might never be moved back again. If a buffer is large enough,
@@ -942,6 +941,8 @@ resource_create(struct pipe_screen *pscreen,
          res->base.b.flags |= PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY;
       }
    } else {
+      if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
+         res->base.b.bind |= PIPE_BIND_SHADER_IMAGE;
       if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE) {
          uint32_t count = 1;
          VKSCR(GetImageSparseMemoryRequirements)(screen->dev, res->obj->image, &count, &res->sparse);



More information about the mesa-commit mailing list