1 #ifndef VULKAN_METAL_H_
2 #define VULKAN_METAL_H_ 1
3 
4 /*
5 ** Copyright 2015-2023 The Khronos Group Inc.
6 **
7 ** SPDX-License-Identifier: Apache-2.0
8 */
9 
10 /*
11 ** This header is generated from the Khronos Vulkan XML API Registry.
12 **
13 */
14 
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 
21 
22 // VK_EXT_metal_surface is a preprocessor guard. Do not pass it to API calls.
23 #define VK_EXT_metal_surface 1
24 #ifdef __OBJC__
25 @class CAMetalLayer;
26 #else
27 typedef void CAMetalLayer;
28 #endif
29 
30 #define VK_EXT_METAL_SURFACE_SPEC_VERSION 1
31 #define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface"
32 typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
33 typedef struct VkMetalSurfaceCreateInfoEXT {
34     VkStructureType                 sType;
35     const void*                     pNext;
36     VkMetalSurfaceCreateFlagsEXT    flags;
37     const CAMetalLayer*             pLayer;
38 } VkMetalSurfaceCreateInfoEXT;
39 
40 typedef VkResult (VKAPI_PTR *PFN_vkCreateMetalSurfaceEXT)(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
41 
42 #ifndef VK_NO_PROTOTYPES
43 VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(
44     VkInstance                                  instance,
45     const VkMetalSurfaceCreateInfoEXT*          pCreateInfo,
46     const VkAllocationCallbacks*                pAllocator,
47     VkSurfaceKHR*                               pSurface);
48 #endif
49 
50 
51 // VK_EXT_metal_objects is a preprocessor guard. Do not pass it to API calls.
52 #define VK_EXT_metal_objects 1
53 #ifdef __OBJC__
54 @protocol MTLDevice;
55 typedef id<MTLDevice> MTLDevice_id;
56 #else
57 typedef void* MTLDevice_id;
58 #endif
59 
60 #ifdef __OBJC__
61 @protocol MTLCommandQueue;
62 typedef id<MTLCommandQueue> MTLCommandQueue_id;
63 #else
64 typedef void* MTLCommandQueue_id;
65 #endif
66 
67 #ifdef __OBJC__
68 @protocol MTLBuffer;
69 typedef id<MTLBuffer> MTLBuffer_id;
70 #else
71 typedef void* MTLBuffer_id;
72 #endif
73 
74 #ifdef __OBJC__
75 @protocol MTLTexture;
76 typedef id<MTLTexture> MTLTexture_id;
77 #else
78 typedef void* MTLTexture_id;
79 #endif
80 
81 typedef struct __IOSurface* IOSurfaceRef;
82 #ifdef __OBJC__
83 @protocol MTLSharedEvent;
84 typedef id<MTLSharedEvent> MTLSharedEvent_id;
85 #else
86 typedef void* MTLSharedEvent_id;
87 #endif
88 
89 #define VK_EXT_METAL_OBJECTS_SPEC_VERSION 1
90 #define VK_EXT_METAL_OBJECTS_EXTENSION_NAME "VK_EXT_metal_objects"
91 
92 typedef enum VkExportMetalObjectTypeFlagBitsEXT {
93     VK_EXPORT_METAL_OBJECT_TYPE_METAL_DEVICE_BIT_EXT = 0x00000001,
94     VK_EXPORT_METAL_OBJECT_TYPE_METAL_COMMAND_QUEUE_BIT_EXT = 0x00000002,
95     VK_EXPORT_METAL_OBJECT_TYPE_METAL_BUFFER_BIT_EXT = 0x00000004,
96     VK_EXPORT_METAL_OBJECT_TYPE_METAL_TEXTURE_BIT_EXT = 0x00000008,
97     VK_EXPORT_METAL_OBJECT_TYPE_METAL_IOSURFACE_BIT_EXT = 0x00000010,
98     VK_EXPORT_METAL_OBJECT_TYPE_METAL_SHARED_EVENT_BIT_EXT = 0x00000020,
99     VK_EXPORT_METAL_OBJECT_TYPE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
100 } VkExportMetalObjectTypeFlagBitsEXT;
101 typedef VkFlags VkExportMetalObjectTypeFlagsEXT;
102 typedef struct VkExportMetalObjectCreateInfoEXT {
103     VkStructureType                       sType;
104     const void*                           pNext;
105     VkExportMetalObjectTypeFlagBitsEXT    exportObjectType;
106 } VkExportMetalObjectCreateInfoEXT;
107 
108 typedef struct VkExportMetalObjectsInfoEXT {
109     VkStructureType    sType;
110     const void*        pNext;
111 } VkExportMetalObjectsInfoEXT;
112 
113 typedef struct VkExportMetalDeviceInfoEXT {
114     VkStructureType    sType;
115     const void*        pNext;
116     MTLDevice_id       mtlDevice;
117 } VkExportMetalDeviceInfoEXT;
118 
119 typedef struct VkExportMetalCommandQueueInfoEXT {
120     VkStructureType       sType;
121     const void*           pNext;
122     VkQueue               queue;
123     MTLCommandQueue_id    mtlCommandQueue;
124 } VkExportMetalCommandQueueInfoEXT;
125 
126 typedef struct VkExportMetalBufferInfoEXT {
127     VkStructureType    sType;
128     const void*        pNext;
129     VkDeviceMemory     memory;
130     MTLBuffer_id       mtlBuffer;
131 } VkExportMetalBufferInfoEXT;
132 
133 typedef struct VkImportMetalBufferInfoEXT {
134     VkStructureType    sType;
135     const void*        pNext;
136     MTLBuffer_id       mtlBuffer;
137 } VkImportMetalBufferInfoEXT;
138 
139 typedef struct VkExportMetalTextureInfoEXT {
140     VkStructureType          sType;
141     const void*              pNext;
142     VkImage                  image;
143     VkImageView              imageView;
144     VkBufferView             bufferView;
145     VkImageAspectFlagBits    plane;
146     MTLTexture_id            mtlTexture;
147 } VkExportMetalTextureInfoEXT;
148 
149 typedef struct VkImportMetalTextureInfoEXT {
150     VkStructureType          sType;
151     const void*              pNext;
152     VkImageAspectFlagBits    plane;
153     MTLTexture_id            mtlTexture;
154 } VkImportMetalTextureInfoEXT;
155 
156 typedef struct VkExportMetalIOSurfaceInfoEXT {
157     VkStructureType    sType;
158     const void*        pNext;
159     VkImage            image;
160     IOSurfaceRef       ioSurface;
161 } VkExportMetalIOSurfaceInfoEXT;
162 
163 typedef struct VkImportMetalIOSurfaceInfoEXT {
164     VkStructureType    sType;
165     const void*        pNext;
166     IOSurfaceRef       ioSurface;
167 } VkImportMetalIOSurfaceInfoEXT;
168 
169 typedef struct VkExportMetalSharedEventInfoEXT {
170     VkStructureType      sType;
171     const void*          pNext;
172     VkSemaphore          semaphore;
173     VkEvent              event;
174     MTLSharedEvent_id    mtlSharedEvent;
175 } VkExportMetalSharedEventInfoEXT;
176 
177 typedef struct VkImportMetalSharedEventInfoEXT {
178     VkStructureType      sType;
179     const void*          pNext;
180     MTLSharedEvent_id    mtlSharedEvent;
181 } VkImportMetalSharedEventInfoEXT;
182 
183 typedef void (VKAPI_PTR *PFN_vkExportMetalObjectsEXT)(VkDevice device, VkExportMetalObjectsInfoEXT* pMetalObjectsInfo);
184 
185 #ifndef VK_NO_PROTOTYPES
186 VKAPI_ATTR void VKAPI_CALL vkExportMetalObjectsEXT(
187     VkDevice                                    device,
188     VkExportMetalObjectsInfoEXT*                pMetalObjectsInfo);
189 #endif
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif
196