C Specification

To create a VkSurfaceKHR object for a CAMetalLayer, call:

// Provided by VK_EXT_metal_surface
VkResult vkCreateMetalSurfaceEXT(
    VkInstance                                  instance,
    const VkMetalSurfaceCreateInfoEXT*          pCreateInfo,
    const VkAllocationCallbacks*                pAllocator,
    VkSurfaceKHR*                               pSurface);


  • instance is the instance with which to associate the surface.

  • pCreateInfo is a pointer to a VkMetalSurfaceCreateInfoEXT structure specifying parameters affecting the creation of the surface object.

  • pAllocator is the allocator used for host memory allocated for the surface object when there is no more specific allocator available (see Memory Allocation).

  • pSurface is a pointer to a VkSurfaceKHR handle in which the created surface object is returned.


Valid Usage (Implicit)
  • VUID-vkCreateMetalSurfaceEXT-instance-parameter
    instance must be a valid VkInstance handle

  • VUID-vkCreateMetalSurfaceEXT-pCreateInfo-parameter
    pCreateInfo must be a valid pointer to a valid VkMetalSurfaceCreateInfoEXT structure

  • VUID-vkCreateMetalSurfaceEXT-pAllocator-parameter
    If pAllocator is not NULL, pAllocator must be a valid pointer to a valid VkAllocationCallbacks structure

  • VUID-vkCreateMetalSurfaceEXT-pSurface-parameter
    pSurface must be a valid pointer to a VkSurfaceKHR handle

Return Codes
On success, this command returns

On failure, this command returns



See Also

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.

Copyright 2014-2024 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0