Mesa (main): zink: do not check buffer-format for usage-bits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 16 15:55:31 UTC 2021


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Jun 16 02:29:45 2021 -0700

zink: do not check buffer-format for usage-bits

Buffers are created without a format in Vulkan, and we always pass in
R8_UNORM for them in Gallium. It's the view-formats we should have
checked, if anything.

But that's orthogonal to this. We shoudn't keep checking R8_UNORM
capabilities for buffers, all it's going to do is trigger asserts.

Fixes: 00dc0036b ("zink: flatten out buffer creation usage flags codepath")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416>

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 8598aefd150..126455237a3 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -224,21 +224,16 @@ create_bci(struct zink_screen *screen, const struct pipe_resource *templ, unsign
                VK_BUFFER_USAGE_TRANSFER_DST_BIT |
                VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
 
-   VkFormatProperties props = screen->format_props[templ->format];
-
    bci.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT |
                 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT |
+                VK_BUFFER_USAGE_VERTEX_BUFFER_BIT |
                 VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
                 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT |
                 VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT |
                 VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT;
-   if (props.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT)
-      bci.usage |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
 
-   if (bind & PIPE_BIND_SHADER_IMAGE) {
-      assert(props.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT);
+   if (bind & PIPE_BIND_SHADER_IMAGE)
       bci.usage |= VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
-   }
 
    if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
       bci.flags |= VK_BUFFER_CREATE_SPARSE_BINDING_BIT;



More information about the mesa-commit mailing list