// Copyright 2018-2021 The Khronos Group, Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

[[platformCreateSurface_metal,platformCreateSurface_metal]]

=== Metal Platform

[open,refpage='vkCreateMetalSurfaceEXT',desc='Create a VkSurfaceKHR object for CAMetalLayer',type='protos']
--
To create a sname:VkSurfaceKHR object for a basetype:CAMetalLayer, call:

include::{generated}/api/protos/vkCreateMetalSurfaceEXT.txt[]

  * pname:instance is the instance with which to associate the surface.
  * pname:pCreateInfo is a pointer to a slink:VkMetalSurfaceCreateInfoEXT
    structure specifying parameters affecting the creation of the surface
    object.
  * pname:pAllocator is the allocator used for host memory allocated for the
    surface object when there is no more specific allocator available (see
    <<memory-allocation,Memory Allocation>>).
  * pname:pSurface is a pointer to a sname:VkSurfaceKHR handle in which the
    created surface object is returned.

include::{generated}/validity/protos/vkCreateMetalSurfaceEXT.txt[]
--

[open,refpage='VkMetalSurfaceCreateInfoEXT',desc='Structure specifying parameters of a newly created Metal surface object',type='structs']
--
The slink:VkMetalSurfaceCreateInfoEXT structure is defined as:

include::{generated}/api/structs/VkMetalSurfaceCreateInfoEXT.txt[]

  * pname:sType is the type of this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:flags is reserved for future use.
  * pname:pLayer is a reference to a basetype:CAMetalLayer object
    representing a renderable surface.

include::{generated}/validity/structs/VkMetalSurfaceCreateInfoEXT.txt[]
--

[open,refpage='CAMetalLayer',desc='CoreAnimation native layer type for Metal',type='basetypes']
--
To remove an unnecessary compile-time dependency, an incomplete type
definition of basetype:CAMetalLayer is provided in the Vulkan headers:

include::{generated}/api/basetypes/CAMetalLayer.txt[]

The actual basetype:CAMetalLayer type is defined in the QuartzCore
framework.
--

[open,refpage='VkMetalSurfaceCreateFlagsEXT',desc='Reserved for future use',type='flags']
--
include::{generated}/api/flags/VkMetalSurfaceCreateFlagsEXT.txt[]

tname:VkMetalSurfaceCreateFlagsEXT is a bitmask type for setting a mask, but
is currently reserved for future use.
--
