zink: set the sparse format usage flags directly based on queried props

this should yield more consistent results and avoid weird cases where
various formats are queried for things they don't support and won't use

Fixes: 9a412c10b7 ("zink: set all usage flags when querying sparse features")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28115>
(cherry picked from commit 8fa413fef0)
This commit is contained in:
Mike Blumenkrantz 2024-03-11 14:45:34 -04:00 committed by Eric Engestrom
parent 47bbdbec9b
commit 63218f4161
2 changed files with 6 additions and 4 deletions

View file

@ -744,7 +744,7 @@
"description": "zink: set the sparse format usage flags directly based on queried props",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "9a412c10b7a96adf71c9a2ca44a0abca75de1c49",
"notes": null

View file

@ -2552,9 +2552,11 @@ zink_get_sparse_texture_virtual_page_size(struct pipe_screen *pscreen,
default:
return 0;
}
VkImageUsageFlags flags = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
flags |= is_zs ? VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT : VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
VkImageUsageFlags use_flags = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_STORAGE_BIT;
use_flags |= is_zs ? VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT : VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
VkImageUsageFlags flags = screen->format_props[pformat].optimalTilingFeatures & use_flags;
VkSparseImageFormatProperties props[4]; //planar?
unsigned prop_count = ARRAY_SIZE(props);
VKSCR(GetPhysicalDeviceSparseImageFormatProperties)(screen->pdev, format, type,