Vulkan-ValidationLayers
Vulkan-ValidationLayers copied to clipboard
VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 could be more detailed: the sequel
Validation for this has improved since the last ticket I opened, but it's still not at all useful:
VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251(ERROR / SPEC): msgNum: -1094930823 - Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): pCreateInfo The following parameters -
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|VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT)
flags (VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)
drmFormatModifier (144115188085373698) from pDrmFormatModifiers[0]
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling VkGetPhysicalDeviceImageFormatProperties2. 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)
What is the problem here? I have no idea, and none of the provided info is helpful in figuring it out.
We are calling VkGetPhysicalDeviceImageFormatProperties2 for you with the VkImageCreateInfo information, it returned back VK_ERROR_FORMAT_NOT_SUPPORTED... I feel this is an issue with the fact the function has a single error message. The driver doesn't like this combo and not sure how the validation layers could automatically probe it to find when it is happy
To me, this error message having the text The Vulkan spec states: Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts implies that one of these values is undefined, and the undefined nature of the value is what's causing the error.
ok, (deep breath) so this part of the spec is honestly one my least favorite (and I have read most the spec)
lets take imageCreateMaxMipLevels
it is defined as
minimum value of
VkImageFormatProperties::maxMipLevelsinimageCreateImageFormatPropertiesList. The value is undefined ifimageCreateImageFormatPropertiesListis empty.
which points to
imageCreateImageFormatPropertiesListis the list of structures obtained by callingvkGetPhysicalDeviceImageFormatProperties2
and then lastly
If any call to
vkGetPhysicalDeviceImageFormatProperties2returns an error, thenimageCreateImageFormatPropertiesListis defined to be the empty list.
So there is quite not literally anything the app or layer level can detect to know which value is undefined... we just have to query vkGetPhysicalDeviceImageFormatProperties2 for you and make sure it didn't return VK_ERROR_FORMAT_NOT_SUPPORTED
... also we just print out the VU text, which I also think is not helpful at all
created https://gitlab.khronos.org/vulkan/vulkan/-/issues/3825 - I feel the issue is Image Creation Limits is so hard to parse
I'm getting a new validation error message afdter upgrading the SDK from 265 to 275
[14.03.2024 16:40:02:505453][ERROR]: Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): pCreateInfo The following parameters -
format (VK_FORMAT_R8G8B8A8_SRGB)
type (VK_IMAGE_TYPE_2D)
tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)
flags (VkImageCreateFlags(0))
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2. 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://vulkan.lunarg.com/doc/view/1.3.275.0/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)
The thing is I'm creating a pretty vanilla RGBA_SRGB image with only TRANSFER_SRC and COLOR_ATTACHMENT USAGES that kind thats supposed to be supported on every GPU
Seems that the validation of vkCreateImage itself is calling the vkGetPhysicalDeviceImageFormatProperties2 with bad parameters (because I don't call vkGetPhysicalDeviceImageFormatProperties2) and produces validation errors.
@devshgraphicsprogramming yes we currently call vkGetPhysicalDeviceImageFormatProperties2 for you (with all the pNext passed in as well)
that kind thats supposed to be supported on every GPU
I guess the use of VkImageStencilUsageCreateInfo is where this going wrong.. the "can prove this is supported" is call vkGetPhysicalDeviceImageFormatProperties2 with that stencilUsage in it and see if it works... my biggest fear is there is a driver bug that "actually" will make the image but doesn't expose vkGetPhysicalDeviceImageFormatProperties2 correctly when using that pNext
@devshgraphicsprogramming yes we currently call
vkGetPhysicalDeviceImageFormatProperties2for you (with all the pNext passed in as well)that kind thats supposed to be supported on every GPU
I guess the use of
VkImageStencilUsageCreateInfois where this going wrong.. the "can prove this is supported" is callvkGetPhysicalDeviceImageFormatProperties2with thatstencilUsagein it and see if it works... my biggest fear is there is a driver bug that "actually" will make the image but doesn't exposevkGetPhysicalDeviceImageFormatProperties2correctly when using that pNext
I'll try "disconnecting" the stencil usage for non stencil formats.
yep that worked.
Getting similar validation error here. I'm currently following the tutorials on vulkan-tutorial.com and tried creating a image with the nearly the same parameters on the website except using R8G8B8_SRGB, using VMA. Sadly I can't create the image because I run into a validation layer error.
My Wrapper
Result<Image, VkResult> Image::create(
const Vma_allocator& allocator,
VkImageType type,
VkExtent3D extent,
VkFormat format,
VkImageTiling tiling_mode,
VkImageUsageFlags image_usage,
VmaMemoryUsage mem_usage,
VkSharingMode sharing_mode,
VkImageLayout initial_layout,
VkSampleCountFlagBits samples,
uint32_t mipmap_level,
uint32_t array_layers
)
{
VkImageCreateInfo create_info{VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO};
create_info.imageType = type;
create_info.extent = extent;
create_info.format = format;
create_info.tiling = tiling_mode;
create_info.sharingMode = sharing_mode;
create_info.usage = image_usage;
create_info.initialLayout = initial_layout;
create_info.mipLevels = mipmap_level;
create_info.arrayLayers = array_layers;
create_info.samples = samples;
create_info.flags = 0;
VmaAllocationCreateInfo vma_alloc_create_info;
vma_alloc_create_info.priority = 1.0f;
vma_alloc_create_info.usage = mem_usage;
VkImage image_handle;
VmaAllocation vma_allocation;
VmaAllocationInfo vma_alloc_info;
auto result = vmaCreateImage(
*allocator,
&create_info,
&vma_alloc_create_info,
&image_handle,
&vma_allocation,
&vma_alloc_info
);
if (result != VK_SUCCESS)
return result;
else
return Image(
allocator,
{
image_handle,
{*allocator, vma_allocation, vma_alloc_info}
}
);
}
My code
auto image_create_result = Image::create(
allocator,
VK_IMAGE_TYPE_2D,
VkExtent3D(image_x, image_y, 1),
VK_FORMAT_R8G8B8_SRGB,
VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
VMA_MEMORY_USAGE_GPU_ONLY,
VK_SHARING_MODE_EXCLUSIVE
);
Validation Error Output
Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): The following parameters -
format (VK_FORMAT_R8G8B8_SRGB)
type (VK_IMAGE_TYPE_2D)
tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT)
flags (VkImageCreateFlags(0))
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling VkGetPhysicalDeviceImageFormatProperties2. 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://vulkan.lunarg.com/doc/view/1.3.261.1/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)
This is really frustrating for a beginner :-( Anyone has ideas about it? Will it be fine to just disable the validation layer and move on regardless of the potential errors?
Edit
Edit: problem solved. The format is the key to error. Still this validation info should be made better. It's easy to cause confusion especially for beginners