Hello, in spec manual, it is written
When to create a VkImage,
to determine the set of valid usage bits (VkImageUsageFlags?) for a given format(VkFormat),
call vkGetPhysicalDeviceFormatProperties(device, format, &formatProp);
where VkFormatProperties formatProp;
typedef struct VkFormatProperties {
VkFormatFeatureFlags linearTilingFeatures;
VkFormatFeatureFlags optimalTilingFeatures;
VkFormatFeatureFlags bufferFeatures;
} VkFormatProperties;
However, VkImageUsageFlags is slightly different from VkFormatFeatureFlags
I guess, I can just ignore VkFormatFeatureFlags
What we actually need is VkImageUsageFlags for a given VkFormat
Could you please explain to me about
the relationship between VkFormatFeatureFlags and VkImageUsageFlags?
VkFormatFeatureFlags describe what capabilities a Vulkan implementation offers for an image in a given tiling. Some of those feature flags limit the valid usages (i.e. valid VkImageUsageFlags) of an image using that format and tiling - other feature flags describe different capabilities that have nothing to do with the usage flags.
For the feature flags that do have an effect on allowed usage flags the relationship does not seem too obscure (maybe you could ask instead what is unclear to you?), e.g.
- if you want to use
VK_IMAGE_USAGE_SAMPLED_BIT the format and tiling must support VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT,
- if you want to use
VK_IMAGE_USAGE_STORAGE_BIT the format and tiling must support VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT,
- if you additionally want to use atomic operations on your storage image, the format and tiling must support
VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT
That last one is an example where a feature does not have influence on what usage bits you can use, but it still tells you something about what you are allowed to do with a given image format.
1 Like
Hello, Carsten
Thank you for your advise and kindness
However, I guess this VkFormatFeatureFlags is somewhat ambiguous
VkFormatFeatureFlags and VkImageUsageFlags is not one-to-one
But, I will follow your explanation
Have a great week and see you, Carsten