To create a
VkSurfaceKHR object for an Android native window, call:
// Provided by VK_KHR_android_surface VkResult vkCreateAndroidSurfaceKHR( VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
instanceis the instance to associate the surface with.
pCreateInfois a pointer to a
VkAndroidSurfaceCreateInfoKHRstructure containing parameters affecting the creation of the surface object.
pAllocatoris the allocator used for host memory allocated for the surface object when there is no more specific allocator available (see Memory Allocation).
pSurfaceis a pointer to a VkSurfaceKHR handle in which the created surface object is returned.
During the lifetime of a surface created using a particular ANativeWindow handle any attempts to create another surface for the same ANativeWindow and any attempts to connect to the same ANativeWindow through other platform mechanisms will fail.
In particular, only one
vkCreateAndroidSurfaceKHR increments the
ANativeWindow’s reference count, and
On Android, when a swapchain’s
imageExtent does not match the
currentExtent, the presentable images will be scaled to the
surface’s dimensions during presentation.
minImageExtent is (1,1), and
maxImageExtent is the maximum
image size supported by the consumer.
For the system compositor,
currentExtent is the window size (i.e. the
consumer’s preferred size).
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.