anv/sparse: fail the right way in anv_GetDeviceImageSparseMemoryRequirements()
If an application tries to call vkGetDeviceImageSparseMemoryRequirements() for an image that's not supported by Sparse, then anv_image_init_from_create_info() will fail and we will either hit the assertion in case of a debug build or just pretend everything works in case of a release build. Properly return no properties to signal the image is not supported. The spec is not clear in specifying that this is what should be done in this case, but this behavior should match the other query-properties-from-sparse-images-we-didn't-create-yet functions such as vkGetPhysicalDeviceSparseImageFormatProperties(). No known application outside my computer is tripping on this failure. I discovered it when writing my own micro test cases for MSAA sparse. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28792>
This commit is contained in:
@@ -2254,11 +2254,13 @@ void anv_GetDeviceImageSparseMemoryRequirements(
|
||||
* without having to actually create the image, maybe by reworking ISL to
|
||||
* separate creation from parameter computing.
|
||||
*/
|
||||
|
||||
ASSERTED VkResult result =
|
||||
VkResult result =
|
||||
anv_image_init_from_create_info(device, &image, pInfo->pCreateInfo,
|
||||
true /* no_private_binding_alloc */);
|
||||
assert(result == VK_SUCCESS);
|
||||
if (result != VK_SUCCESS) {
|
||||
*pSparseMemoryRequirementCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* The spec says:
|
||||
* "planeAspect is a VkImageAspectFlagBits value specifying the aspect
|
||||
|
||||
Reference in New Issue
Block a user