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: 2bfa998960 ("zink: add more usage bits for buffer types")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9175>
This commit is contained in:
Mike Blumenkrantz
2021-02-21 12:18:09 -05:00
committed by Marge Bot
parent 38ce8d4d00
commit 7026ea7171

View File

@@ -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;
}