Mesa (master): zink: fix buffer resource usage flags

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 22 13:53:11 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Sun Feb 21 12:18:09 2021 -0500

zink: fix buffer resource usage flags

* VK_BUFFER_USAGE_STORAGE_BUFFER_BIT should be enabled always because we might need it
* VK_FORMAT_FEATURE* flags need to be used for detection

I hate these enums so much.

Fixes: 2bfa998960d ("zink: add more usage bits for buffer types")

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

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 6ef422d2246..96d219d5429 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -119,7 +119,8 @@ resource_create(struct pipe_screen *pscreen,
       bci.size = templ->width0;
 
       bci.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT |
-                  VK_BUFFER_USAGE_TRANSFER_DST_BIT;
+                  VK_BUFFER_USAGE_TRANSFER_DST_BIT |
+                  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
 
       /* apparently gallium thinks these are the jack-of-all-trades bind types */
       if (templ->bind & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_QUERY_BUFFER)) {
@@ -131,9 +132,7 @@ resource_create(struct pipe_screen *pscreen,
                       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)
+         if (props.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT)
             bci.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
       }
 



More information about the mesa-commit mailing list