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@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416>
(cherry picked from commit a8fc38b276)
This commit is contained in:
Erik Faye-Lund 2021-06-16 02:29:45 -07:00 committed by Eric Engestrom
parent 1151f52ccf
commit c4e33a4ed7
2 changed files with 3 additions and 8 deletions

View file

@ -1012,7 +1012,7 @@
"description": "zink: do not check buffer-format for usage-bits",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "00dc0036bb6d0c6de1ec3dc395e1d9e63d05ed83"
},

View file

@ -226,21 +226,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;
}
return bci;
}