C Specification
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);
Parameters
-
instanceis the instance to associate the surface with. -
pCreateInfois a pointer to aVkAndroidSurfaceCreateInfoKHRstructure 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.
Description
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.
|
Note
In particular, only one |
If successful, vkCreateAndroidSurfaceKHR increments the
ANativeWindow’s reference count, and vkDestroySurfaceKHR will
decrement it.
On Android, when a swapchain’s imageExtent does not match the
surface’s 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).
Document Notes
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.