To query the supported swapchain format-color space pairs for a surface, call:
// Provided by VK_KHR_surface VkResult vkGetPhysicalDeviceSurfaceFormatsKHR( VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats);
physicalDeviceis the physical device that will be associated with the swapchain to be created, as described for vkCreateSwapchainKHR.
surfaceis the surface that will be associated with the swapchain.
pSurfaceFormatCountis a pointer to an integer related to the number of format pairs available or queried, as described below.
NULLor a pointer to an array of
NULL, then the number of format pairs
supported for the given
surface is returned in
pSurfaceFormatCount must point to a variable set by the
user to the number of elements in the
pSurfaceFormats array, and on
return the variable is overwritten with the number of structures actually
If the value of
pSurfaceFormatCount is less than the number of format
pairs supported, at most
pSurfaceFormatCount structures will be
VK_INCOMPLETE will be returned instead of
VK_SUCCESS, to indicate that not all the available format pairs were
The number of format pairs supported must be greater than or equal to 1.
pSurfaceFormats must not contain an entry whose value for
pSurfaceFormats includes an entry whose value for
VK_COLOR_SPACE_SRGB_NONLINEAR_KHR and whose value for
is a UNORM (or SRGB) format and the corresponding SRGB (or UNORM) format is
a color renderable format for
pSurfaceFormats must also contain an entry with the same value for
format equal to the corresponding SRGB (or UNORM)
VK_GOOGLE_surfaceless_query extension is enabled, the values
pSurfaceFormats will be identical for every valid surface
created on this physical device, and so
surface can be
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.