In addition to the minimum capabilities described in the previous sections (Limits and Formats), implementations may support additional capabilities for certain types of images. For example, larger dimensions or additional sample counts for certain image types, or additional capabilities for linear tiling format images.
To query additional capabilities specific to image types, call:
VkResult vkGetPhysicalDeviceImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageFormatProperties* pImageFormatProperties);
physicalDevice is the physical device from which to query the
image capabilities.
format is the image format, corresponding to
VkImageCreateInfo::format.
type is the image type, corresponding to
VkImageCreateInfo::imageType.
tiling is the image tiling, corresponding to
VkImageCreateInfo::tiling.
usage is the intended usage of the image, corresponding to
VkImageCreateInfo::usage.
flags is a bitmask describing additional parameters of the image,
corresponding to VkImageCreateInfo::flags.
pImageFormatProperties points to an instance of the
VkImageFormatProperties structure in which capabilities are
returned.
The format, type, tiling, usage, and flags
parameters correspond to parameters that would be consumed by
vkCreateImage (as members of VkImageCreateInfo).
If format is not a supported image format, or if the combination of
format, type, tiling, usage, and flags is not
supported for images, then vkGetPhysicalDeviceImageFormatProperties
returns VK_ERROR_FORMAT_NOT_SUPPORTED.
The limitations on an image format that are reported by
vkGetPhysicalDeviceImageFormatProperties have the following property:
if usage1 and usage2 of type VkImageUsageFlags are such that
the bits set in usage1 are a subset of the bits set in usage2, and
flags1 and flags2 of type VkImageCreateFlags are such that
the bits set in flags1 are a subset of the bits set in flags2,
then the limitations for usage1 and flags1 must be no more strict
than the limitations for usage2 and flags2, for all values of
format, type, and tiling.
The VkImageFormatProperties structure is defined as:
typedef struct VkImageFormatProperties {
VkExtent3D maxExtent;
uint32_t maxMipLevels;
uint32_t maxArrayLayers;
VkSampleCountFlags sampleCounts;
VkDeviceSize maxResourceSize;
} VkImageFormatProperties;
maxExtent are the maximum image dimensions.
See the Allowed Extent Values section
below for how these values are constrained by type.
maxMipLevels is the maximum number of mipmap levels.
maxMipLevels must either be equal to 1 (valid only if
tiling is VK_IMAGE_TILING_LINEAR) or be equal to
⌈log2(max(width, height, depth))⌉
+ 1.
width, height, and depth are taken
from the corresponding members of maxExtent.
maxArrayLayers is the maximum number of array layers.
maxArrayLayers must either be equal to 1 or be greater than or
equal to the maxImageArrayLayers member of
VkPhysicalDeviceLimits.
A value of 1 is valid only if tiling is
VK_IMAGE_TILING_LINEAR or if type is VK_IMAGE_TYPE_3D.
sampleCounts is a bitmask of VkSampleCountFlagBits
specifying all the supported sample counts for this image as described
below.
maxResourceSize is an upper bound on the total image size in
bytes, inclusive of all image subresources.
Implementations may have an address space limit on total size of a
resource, which is advertised by this property.
maxResourceSize must be at least 231.
| Note | |
|---|---|
There is no mechanism to query the size of an image before creating it, to
compare that size against |
If the combination of parameters to
vkGetPhysicalDeviceImageFormatProperties is not supported by the
implementation for use in vkCreateImage, then all members of
VkImageFormatProperties will be filled with zero.
vkGetPhysicalDeviceImageFormatProperties returns a bitmask of
VkSampleCountFlagBits in sampleCounts specifying the supported
sample counts for the image parameters.
sampleCounts will be set to VK_SAMPLE_COUNT_1_BIT if at least
one of the following conditions is true:
tiling is VK_IMAGE_TILING_LINEAR
type is not VK_IMAGE_TYPE_2D
flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT flag nor the
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT flag in
VkFormatProperties::optimalTilingFeatures returned by
vkGetPhysicalDeviceFormatProperties is set
Otherwise, the bits set in sampleCounts will be the sample counts
supported for the specified values of usage and format.
For each bit set in usage, the supported sample counts relate to the
limits in VkPhysicalDeviceLimits as follows:
usage includes VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, a
superset of
VkPhysicalDeviceLimits::framebufferColorSampleCounts
usage includes
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, and format
includes a depth aspect, a superset of
VkPhysicalDeviceLimits::framebufferDepthSampleCounts
usage includes
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, and format
includes a stencil aspect, a superset of
VkPhysicalDeviceLimits::framebufferStencilSampleCounts
usage includes VK_IMAGE_USAGE_SAMPLED_BIT, and
format includes a color aspect, a superset of
VkPhysicalDeviceLimits::sampledImageColorSampleCounts
usage includes VK_IMAGE_USAGE_SAMPLED_BIT, and
format includes a depth aspect, a superset of
VkPhysicalDeviceLimits::sampledImageDepthSampleCounts
usage includes VK_IMAGE_USAGE_SAMPLED_BIT, and
format is an integer format, a superset of
VkPhysicalDeviceLimits::sampledImageIntegerSampleCounts
usage includes VK_IMAGE_USAGE_STORAGE_BIT, a superset of
VkPhysicalDeviceLimits::storageImageSampleCounts
If multiple bits are set in usage, sampleCounts will be the
intersection of the per-usage values described above.
If none of the bits described above are set in usage, then there is no
corresponding limit in VkPhysicalDeviceLimits.
In this case, sampleCounts must include at least
VK_SAMPLE_COUNT_1_BIT.
For VK_IMAGE_TYPE_1D:
maxExtent.width ≤
VkPhysicalDeviceLimits.maxImageDimension1D
maxExtent.height = 1
maxExtent.depth = 1
For VK_IMAGE_TYPE_2D:
maxExtent.width ≤
VkPhysicalDeviceLimits.maxImageDimension2D
maxExtent.height ≤
VkPhysicalDeviceLimits.maxImageDimension2D
maxExtent.depth = 1
For VK_IMAGE_TYPE_3D:
maxExtent.width ≤
VkPhysicalDeviceLimits.maxImageDimension3D
maxExtent.height ≤
VkPhysicalDeviceLimits.maxImageDimension3D
maxExtent.depth ≤
VkPhysicalDeviceLimits.maxImageDimension3D