zink: VkImageCreate validation errors
Running zink with validation layer enable it caught these errors:
Mips level issue
VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251(ERROR / SPEC): msgNum: -1094930823 - Validation
Error: \[ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 \] Object 0: handle = 0x55ca92b8ac40,
type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xbebcae79 | vkCreateImage(): Format VK_FORMAT_B8G8R8A8_UNORM
is not supported for this combination of parameters and VkGetPhysicalDeviceImageFormatProperties
returned back VK_ERROR_FORMAT_NOT_SUPPORTED. The Vulkan spec states: Each of the following values (as
described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels,
imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts (https://www.khronos.org
/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-
02251)
VkExternalMemoryImageCreateInfo.handleType
VkExternalMemoryImageCreateInfo.handleType
VUID-VkImageCreateInfo-pNext-00990(ERROR / SPEC): msgNum: 1181525669 - Validation Error: [ VUID-
VkImageCreateInfo-pNext-00990 ] Object 0: handle = 0x55ca92b8ac40, type = VK_OBJECT_TYPE_DEVICE; |
MessageID = 0x466ca6a5 | vkCreateImage(): The handle type
(VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT), format (VK_FORMAT_B8G8R8A8_UNORM), type
(VK_IMAGE_TYPE_2D), tiling (VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT), usage
(VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT),
flags (VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) is not supported combination of parameters and
vkGetPhysicalDeviceImageFormatProperties2 returned back VK_ERROR_FORMAT_NOT_SUPPORTED. The Vulkan spec
states: If the pNext chain includes a VkExternalMemoryImageCreateInfo structure, its handleTypes member
must only contain bits that are also in
VkExternalImageFormatProperties::externalMemoryProperties.compatibleHandleTypes, as returned by
vkGetPhysicalDeviceImageFormatProperties2 with format, imageType, tiling, usage, and flags equal to those
in this structure, and with a VkPhysicalDeviceExternalImageFormatInfo structure included in the pNext
chain, with a handleType equal to any one of the handle types specified in
VkExternalMemoryImageCreateInfo::handleTypes (https://www.khronos.org/registry/vulkan/specs/1.3-
extensions/html/vkspec.html#VUID-VkImageCreateInfo-pNext-00990)
For the handle type, zink is not checking the handletypes
available when it have an external/shared image. And at least for ANV on an integrated Graphics it doesn't support VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT/VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT
with the current image configuration.
But it leaves a question, what zink should do when the underling driver doesn't support these handletypes?
Edited by Igor Torrente