Mesa (master): zink: add more usage bits for buffer types

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 14 18:35:22 UTC 2021


Module: Mesa
Branch: master
Commit: 2bfa998960d506a60a3c4515a50e19e5ec11e795
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2bfa998960d506a60a3c4515a50e19e5ec11e795

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Nov 17 18:25:41 2020 -0500

zink: add more usage bits for buffer types

these things can be anything they want to be when they grow up

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8330>

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 30a93a0a93d..8ce09755c30 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -120,8 +120,21 @@ resource_create(struct pipe_screen *pscreen,
       bci.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT |
                   VK_BUFFER_USAGE_TRANSFER_DST_BIT;
 
-      if (templ->bind & PIPE_BIND_SAMPLER_VIEW)
-         bci.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
+      /* apparently gallium thinks this is the jack-of-all-trades bind type */
+      if (templ->bind & PIPE_BIND_SAMPLER_VIEW) {
+         bci.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT |
+                      VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT |
+                      VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT |
+                      VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
+                      VK_BUFFER_USAGE_VERTEX_BUFFER_BIT |
+                      VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT;
+         VkFormatProperties props;
+         vkGetPhysicalDeviceFormatProperties(screen->pdev, zink_get_format(screen, templ->format), &props);
+         if (props.bufferFeatures & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)
+            bci.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
+         if (props.bufferFeatures & VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)
+            bci.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
+      }
 
       if (templ->bind & PIPE_BIND_VERTEX_BUFFER)
          bci.usage |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT |



More information about the mesa-commit mailing list