zink: always set VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT for non-staging resources
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 15 Sep 2020 18:57:45 +0000 (14:57 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 22 Feb 2021 14:32:02 +0000 (14:32 +0000)
this is weird but sometimes gallium makes resources with bind==0, which will
crash later if we don't add this

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9066>

src/gallium/drivers/zink/zink_resource.c

index 96d219d..6d665a6 100644 (file)
@@ -122,6 +122,9 @@ resource_create(struct pipe_screen *pscreen,
                   VK_BUFFER_USAGE_TRANSFER_DST_BIT |
                   VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
 
+      if (templ->usage != PIPE_USAGE_STAGING)
+         bci.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_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)) {
          bci.usage |= VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT |