Mesa (main): zink: try for better buffer allocation heaps

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 30 13:23:44 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu May  6 09:53:37 2021 -0400

zink: try for better buffer allocation heaps

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

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 8c4ffe3efa5..28c0ddbfb6a 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -420,10 +420,14 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
       }
 
       vkGetBufferMemoryRequirements(screen->dev, obj->buffer, &reqs);
-      if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
+      if (templ->usage == PIPE_USAGE_STAGING)
+         flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
+      else if (templ->usage == PIPE_USAGE_STREAM)
+         flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
+      else if (templ->usage == PIPE_USAGE_IMMUTABLE)
          flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
       else
-         flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
+         flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
       obj->is_buffer = true;
       obj->transfer_dst = true;
    } else {



More information about the mesa-commit mailing list