Mesa (main): zink: collapse host_visible and non-coherent alignment alloc cases

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 17 01:17:17 UTC 2021


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

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

zink: collapse host_visible and non-coherent alignment alloc cases

* buffers can use normal mem prop checking to determine host_visible setting
* sparse buffers are never coherent, so this case can be dropped from the conditional

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397>

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 126455237a3..9dbc7c49754 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -496,15 +496,10 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
 
    obj->coherent = flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
 
-   if (templ->target != PIPE_BUFFER) {
-      VkMemoryType mem_type =
-         screen->info.mem_props.memoryTypes[mai.memoryTypeIndex];
-      obj->host_visible = mem_type.propertyFlags &
-                          VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
-   } else if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE)) {
-      obj->host_visible = true;
-      if (!obj->coherent)
-         mai.allocationSize = reqs.size = align(reqs.size, screen->info.props.limits.nonCoherentAtomSize);
+   VkMemoryType mem_type = screen->info.mem_props.memoryTypes[mai.memoryTypeIndex];
+   obj->host_visible = mem_type.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
+   if (templ->target == PIPE_BUFFER && !obj->coherent) {
+      mai.allocationSize = reqs.size = align(reqs.size, screen->info.props.limits.nonCoherentAtomSize);
    }
 
    VkExportMemoryAllocateInfo emai = {0};



More information about the mesa-commit mailing list