There is a mismatch in the returned values from vkGetPhysicalDeviceSparseImageFormatProperties2 and vkGetImageSparseMemoryRequirements2. If both functions are called for the same image parameters, there is a mismatch in the VkSparseImageFormatProperties. Specifically, for images of size smaller than the granularity, vkGetImageSparseMemoryRequirements2 will return VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT in formatProperties.flags (and report a full imageMipTailSize and no imageMipTailStride), while vkGetPhysicalDeviceSparseImageFormatProperties2 reports no such flag.
Specific image parameters in VkImageCreateInfo:
flags = VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT
imageType = VK_IMAGE_TYPE_2D
format = VK_FORMAT_BC7_SRGB_BLOCK
extent = { 128, 128, 1 }
mipLevels = 8
arrayLayers = 2
samples = VK_SAMPLE_COUNT_1_BIT
tiling = VK_IMAGE_TILING_OPTIMAL
usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
sharingMode = VK_SHARING_MODE_EXCLUSIVE
initialLayout = VK_IMAGE_LAYOUT_UNDEFINED
Specific image parameters in VkPhysicalDeviceSparseImageFormatInfo2:
format = VK_FORMAT_BC7_SRGB_BLOCK
type = VK_IMAGE_TYPE_2D
samples = VK_SAMPLE_COUNT_1_BIT
usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
tiling = VK_IMAGE_TILING_OPTIMAL
The presence of the flag in formatProperties.flags, as well as the resulting miptail size and stride are clearly a bug in the driver.
I know everything sparse isn’t at the highest priority on the list of bugfixes, so until you fix this, can i just ignore the flag and make a simple educated guess about the miptail size per layer and stride or is there actually some fancy mapping going on underneath?
My system:
Win7 SP1 x64
GTX 970
MSVC 2017 15.8.6 x64
Driver: 411.63
SDK + Validation: 1.1.85
Regards