Mesa (main): zink: set dedicated allocation when needed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 19 23:53:39 UTC 2021


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

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Wed Jan 27 12:06:21 2021 -0500

zink: set dedicated allocation when needed

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>

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

---

 src/gallium/drivers/zink/zink_resource.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index ee19ae5da04..1ea943e3c47 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -658,6 +658,18 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
       mai.allocationSize = reqs.size = align(reqs.size, screen->info.props.limits.nonCoherentAtomSize);
    }
 
+   VkMemoryDedicatedAllocateInfo ded_alloc_info = {
+      .sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
+      .pNext = mai.pNext,
+      .image = obj->image,
+      .buffer = VK_NULL_HANDLE,
+   };
+
+   if (screen->info.have_KHR_dedicated_allocation && need_dedicated) {
+      ded_alloc_info.pNext = mai.pNext;
+      mai.pNext = &ded_alloc_info;
+   }
+
    VkExportMemoryAllocateInfo emai = {0};
    if (templ->bind & PIPE_BIND_SHARED && shared) {
       emai.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO;



More information about the mesa-commit mailing list