blob: 0bbbab06935674351f91d0ee9bd5f45207ad2380 [file] [log] [blame]
Cody Northrop52def6d2018-05-16 13:54:37 -06001#!/usr/bin/env python3
2#
3# Copyright (C) 2018 Google, Inc.
4#
5# Permission is hereby granted, free of charge, to any person obtaining a
6# copy of this software and associated documentation files (the "Software"),
7# to deal in the Software without restriction, including without limitation
8# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9# and/or sell copies of the Software, and to permit persons to whom the
10# Software is furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included
13# in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21# DEALINGS IN THE SOFTWARE.
22
23"""Generate Vulkan wrapper to support Android without libvulkan
24"""
25
26import os
27import sys
28
29class Command(object):
30 PLATFORM = 0
31 LOADER = 1
32 INSTANCE = 2
33 DEVICE = 3
34
35 def __init__(self, name, dispatch):
36 self.name = name
37 self.dispatch = dispatch
38 self.ty = self._get_type()
39
40 @staticmethod
41 def valid_c_typedef(c):
42 return (c.startswith("typedef") and
43 c.endswith(");") and
44 "*PFN_vkVoidFunction" not in c)
45
46 @classmethod
47 def from_c_typedef(cls, c):
48 name_begin = c.find("*PFN_vk") + 5 # instead of 7 to restore vk
49 name_end = c.find(")(", name_begin)
50 name = c[name_begin:name_end]
51
52 dispatch_begin = name_end + 2
53 dispatch_end = c.find(" ", dispatch_begin)
54 dispatch = c[dispatch_begin:dispatch_end]
55 if not dispatch.startswith("Vk"):
56 dispatch = None
57
58 return cls(name, dispatch)
59
60 def _get_type(self):
61 if self.dispatch:
62 if self.dispatch in ["VkDevice", "VkQueue", "VkCommandBuffer"]:
63 return self.DEVICE
64 else:
65 return self.INSTANCE
66 else:
67 if self.name in ["GetInstanceProcAddr"]:
68 return self.PLATFORM
69 else:
70 return self.LOADER
71
72 def __repr__(self):
73 return "Command(name=%s, dispatch=%s)" % \
74 (repr(self.name), repr(self.dispatch))
75
76class Extension(object):
77 def __init__(self, name, version, guard=None, commands=[]):
78 self.name = name
79 self.version = version
80 self.guard = guard
81 self.commands = commands[:]
82
83 def add_command(self, cmd):
84 self.commands.append(cmd)
85
86 def __repr__(self):
87 lines = []
88 lines.append("Extension(name=%s, version=%s, guard=%s, commands=[" %
89 (repr(self.name), repr(self.version), repr(self.guard)))
90
91 for cmd in self.commands:
92 lines.append(" %s," % repr(cmd))
93
94 lines.append("])")
95
96 return "\n".join(lines)
97
98# generated by "generate_vulkan_wrapper.py parse vulkan.h"
99VK_core_0 = Extension(name='VK_core_0', version=0, guard=None, commands=[
100 Command(name='vkCreateInstance', dispatch=None),
101 Command(name='vkDestroyInstance', dispatch='VkInstance'),
102 Command(name='vkEnumeratePhysicalDevices', dispatch='VkInstance'),
103 Command(name='vkGetPhysicalDeviceFeatures', dispatch='VkPhysicalDevice'),
104 Command(name='vkGetPhysicalDeviceFormatProperties', dispatch='VkPhysicalDevice'),
105 Command(name='vkGetPhysicalDeviceImageFormatProperties', dispatch='VkPhysicalDevice'),
106 Command(name='vkGetPhysicalDeviceProperties', dispatch='VkPhysicalDevice'),
107 Command(name='vkGetPhysicalDeviceQueueFamilyProperties', dispatch='VkPhysicalDevice'),
108 Command(name='vkGetPhysicalDeviceMemoryProperties', dispatch='VkPhysicalDevice'),
109 Command(name='vkGetInstanceProcAddr', dispatch='VkInstance'),
110 Command(name='vkGetDeviceProcAddr', dispatch='VkDevice'),
111 Command(name='vkCreateDevice', dispatch='VkPhysicalDevice'),
112 Command(name='vkDestroyDevice', dispatch='VkDevice'),
113 Command(name='vkEnumerateInstanceExtensionProperties', dispatch=None),
114 Command(name='vkEnumerateDeviceExtensionProperties', dispatch='VkPhysicalDevice'),
115 Command(name='vkEnumerateInstanceLayerProperties', dispatch=None),
116 Command(name='vkEnumerateDeviceLayerProperties', dispatch='VkPhysicalDevice'),
117 Command(name='vkGetDeviceQueue', dispatch='VkDevice'),
118 Command(name='vkQueueSubmit', dispatch='VkQueue'),
119 Command(name='vkQueueWaitIdle', dispatch='VkQueue'),
120 Command(name='vkDeviceWaitIdle', dispatch='VkDevice'),
121 Command(name='vkAllocateMemory', dispatch='VkDevice'),
122 Command(name='vkFreeMemory', dispatch='VkDevice'),
123 Command(name='vkMapMemory', dispatch='VkDevice'),
124 Command(name='vkUnmapMemory', dispatch='VkDevice'),
125 Command(name='vkFlushMappedMemoryRanges', dispatch='VkDevice'),
126 Command(name='vkInvalidateMappedMemoryRanges', dispatch='VkDevice'),
127 Command(name='vkGetDeviceMemoryCommitment', dispatch='VkDevice'),
128 Command(name='vkBindBufferMemory', dispatch='VkDevice'),
129 Command(name='vkBindImageMemory', dispatch='VkDevice'),
130 Command(name='vkGetBufferMemoryRequirements', dispatch='VkDevice'),
131 Command(name='vkGetImageMemoryRequirements', dispatch='VkDevice'),
132 Command(name='vkGetImageSparseMemoryRequirements', dispatch='VkDevice'),
133 Command(name='vkGetPhysicalDeviceSparseImageFormatProperties', dispatch='VkPhysicalDevice'),
134 Command(name='vkQueueBindSparse', dispatch='VkQueue'),
135 Command(name='vkCreateFence', dispatch='VkDevice'),
136 Command(name='vkDestroyFence', dispatch='VkDevice'),
137 Command(name='vkResetFences', dispatch='VkDevice'),
138 Command(name='vkGetFenceStatus', dispatch='VkDevice'),
139 Command(name='vkWaitForFences', dispatch='VkDevice'),
140 Command(name='vkCreateSemaphore', dispatch='VkDevice'),
141 Command(name='vkDestroySemaphore', dispatch='VkDevice'),
142 Command(name='vkCreateEvent', dispatch='VkDevice'),
143 Command(name='vkDestroyEvent', dispatch='VkDevice'),
144 Command(name='vkGetEventStatus', dispatch='VkDevice'),
145 Command(name='vkSetEvent', dispatch='VkDevice'),
146 Command(name='vkResetEvent', dispatch='VkDevice'),
147 Command(name='vkCreateQueryPool', dispatch='VkDevice'),
148 Command(name='vkDestroyQueryPool', dispatch='VkDevice'),
149 Command(name='vkGetQueryPoolResults', dispatch='VkDevice'),
150 Command(name='vkCreateBuffer', dispatch='VkDevice'),
151 Command(name='vkDestroyBuffer', dispatch='VkDevice'),
152 Command(name='vkCreateBufferView', dispatch='VkDevice'),
153 Command(name='vkDestroyBufferView', dispatch='VkDevice'),
154 Command(name='vkCreateImage', dispatch='VkDevice'),
155 Command(name='vkDestroyImage', dispatch='VkDevice'),
156 Command(name='vkGetImageSubresourceLayout', dispatch='VkDevice'),
157 Command(name='vkCreateImageView', dispatch='VkDevice'),
158 Command(name='vkDestroyImageView', dispatch='VkDevice'),
159 Command(name='vkCreateShaderModule', dispatch='VkDevice'),
160 Command(name='vkDestroyShaderModule', dispatch='VkDevice'),
161 Command(name='vkCreatePipelineCache', dispatch='VkDevice'),
162 Command(name='vkDestroyPipelineCache', dispatch='VkDevice'),
163 Command(name='vkGetPipelineCacheData', dispatch='VkDevice'),
164 Command(name='vkMergePipelineCaches', dispatch='VkDevice'),
165 Command(name='vkCreateGraphicsPipelines', dispatch='VkDevice'),
166 Command(name='vkCreateComputePipelines', dispatch='VkDevice'),
167 Command(name='vkDestroyPipeline', dispatch='VkDevice'),
168 Command(name='vkCreatePipelineLayout', dispatch='VkDevice'),
169 Command(name='vkDestroyPipelineLayout', dispatch='VkDevice'),
170 Command(name='vkCreateSampler', dispatch='VkDevice'),
171 Command(name='vkDestroySampler', dispatch='VkDevice'),
172 Command(name='vkCreateDescriptorSetLayout', dispatch='VkDevice'),
173 Command(name='vkDestroyDescriptorSetLayout', dispatch='VkDevice'),
174 Command(name='vkCreateDescriptorPool', dispatch='VkDevice'),
175 Command(name='vkDestroyDescriptorPool', dispatch='VkDevice'),
176 Command(name='vkResetDescriptorPool', dispatch='VkDevice'),
177 Command(name='vkAllocateDescriptorSets', dispatch='VkDevice'),
178 Command(name='vkFreeDescriptorSets', dispatch='VkDevice'),
179 Command(name='vkUpdateDescriptorSets', dispatch='VkDevice'),
180 Command(name='vkCreateFramebuffer', dispatch='VkDevice'),
181 Command(name='vkDestroyFramebuffer', dispatch='VkDevice'),
182 Command(name='vkCreateRenderPass', dispatch='VkDevice'),
183 Command(name='vkDestroyRenderPass', dispatch='VkDevice'),
184 Command(name='vkGetRenderAreaGranularity', dispatch='VkDevice'),
185 Command(name='vkCreateCommandPool', dispatch='VkDevice'),
186 Command(name='vkDestroyCommandPool', dispatch='VkDevice'),
187 Command(name='vkResetCommandPool', dispatch='VkDevice'),
188 Command(name='vkAllocateCommandBuffers', dispatch='VkDevice'),
189 Command(name='vkFreeCommandBuffers', dispatch='VkDevice'),
190 Command(name='vkBeginCommandBuffer', dispatch='VkCommandBuffer'),
191 Command(name='vkEndCommandBuffer', dispatch='VkCommandBuffer'),
192 Command(name='vkResetCommandBuffer', dispatch='VkCommandBuffer'),
193 Command(name='vkCmdBindPipeline', dispatch='VkCommandBuffer'),
194 Command(name='vkCmdSetViewport', dispatch='VkCommandBuffer'),
195 Command(name='vkCmdSetScissor', dispatch='VkCommandBuffer'),
196 Command(name='vkCmdSetLineWidth', dispatch='VkCommandBuffer'),
197 Command(name='vkCmdSetDepthBias', dispatch='VkCommandBuffer'),
198 Command(name='vkCmdSetBlendConstants', dispatch='VkCommandBuffer'),
199 Command(name='vkCmdSetDepthBounds', dispatch='VkCommandBuffer'),
200 Command(name='vkCmdSetStencilCompareMask', dispatch='VkCommandBuffer'),
201 Command(name='vkCmdSetStencilWriteMask', dispatch='VkCommandBuffer'),
202 Command(name='vkCmdSetStencilReference', dispatch='VkCommandBuffer'),
203 Command(name='vkCmdBindDescriptorSets', dispatch='VkCommandBuffer'),
204 Command(name='vkCmdBindIndexBuffer', dispatch='VkCommandBuffer'),
205 Command(name='vkCmdBindVertexBuffers', dispatch='VkCommandBuffer'),
206 Command(name='vkCmdDraw', dispatch='VkCommandBuffer'),
207 Command(name='vkCmdDrawIndexed', dispatch='VkCommandBuffer'),
208 Command(name='vkCmdDrawIndirect', dispatch='VkCommandBuffer'),
209 Command(name='vkCmdDrawIndexedIndirect', dispatch='VkCommandBuffer'),
210 Command(name='vkCmdDispatch', dispatch='VkCommandBuffer'),
211 Command(name='vkCmdDispatchIndirect', dispatch='VkCommandBuffer'),
212 Command(name='vkCmdCopyBuffer', dispatch='VkCommandBuffer'),
213 Command(name='vkCmdCopyImage', dispatch='VkCommandBuffer'),
214 Command(name='vkCmdBlitImage', dispatch='VkCommandBuffer'),
215 Command(name='vkCmdCopyBufferToImage', dispatch='VkCommandBuffer'),
216 Command(name='vkCmdCopyImageToBuffer', dispatch='VkCommandBuffer'),
217 Command(name='vkCmdUpdateBuffer', dispatch='VkCommandBuffer'),
218 Command(name='vkCmdFillBuffer', dispatch='VkCommandBuffer'),
219 Command(name='vkCmdClearColorImage', dispatch='VkCommandBuffer'),
220 Command(name='vkCmdClearDepthStencilImage', dispatch='VkCommandBuffer'),
221 Command(name='vkCmdClearAttachments', dispatch='VkCommandBuffer'),
222 Command(name='vkCmdResolveImage', dispatch='VkCommandBuffer'),
223 Command(name='vkCmdSetEvent', dispatch='VkCommandBuffer'),
224 Command(name='vkCmdResetEvent', dispatch='VkCommandBuffer'),
225 Command(name='vkCmdWaitEvents', dispatch='VkCommandBuffer'),
226 Command(name='vkCmdPipelineBarrier', dispatch='VkCommandBuffer'),
227 Command(name='vkCmdBeginQuery', dispatch='VkCommandBuffer'),
228 Command(name='vkCmdEndQuery', dispatch='VkCommandBuffer'),
229 Command(name='vkCmdResetQueryPool', dispatch='VkCommandBuffer'),
230 Command(name='vkCmdWriteTimestamp', dispatch='VkCommandBuffer'),
231 Command(name='vkCmdCopyQueryPoolResults', dispatch='VkCommandBuffer'),
232 Command(name='vkCmdPushConstants', dispatch='VkCommandBuffer'),
233 Command(name='vkCmdBeginRenderPass', dispatch='VkCommandBuffer'),
234 Command(name='vkCmdNextSubpass', dispatch='VkCommandBuffer'),
235 Command(name='vkCmdEndRenderPass', dispatch='VkCommandBuffer'),
236 Command(name='vkCmdExecuteCommands', dispatch='VkCommandBuffer'),
237])
238
239VK_core_1 = Extension(name='VK_core_1', version=1, guard=None, commands=[
240 Command(name='vkEnumerateInstanceVersion', dispatch=None),
241 Command(name='vkBindBufferMemory2', dispatch='VkDevice'),
242 Command(name='vkBindImageMemory2', dispatch='VkDevice'),
243 Command(name='vkGetDeviceGroupPeerMemoryFeatures', dispatch='VkDevice'),
244 Command(name='vkCmdSetDeviceMask', dispatch='VkCommandBuffer'),
245 Command(name='vkCmdDispatchBase', dispatch='VkCommandBuffer'),
246 Command(name='vkEnumeratePhysicalDeviceGroups', dispatch='VkInstance'),
247 Command(name='vkGetImageMemoryRequirements2', dispatch='VkDevice'),
248 Command(name='vkGetBufferMemoryRequirements2', dispatch='VkDevice'),
249 Command(name='vkGetImageSparseMemoryRequirements2', dispatch='VkDevice'),
250 Command(name='vkGetPhysicalDeviceFeatures2', dispatch='VkPhysicalDevice'),
251 Command(name='vkGetPhysicalDeviceProperties2', dispatch='VkPhysicalDevice'),
252 Command(name='vkGetPhysicalDeviceFormatProperties2', dispatch='VkPhysicalDevice'),
253 Command(name='vkGetPhysicalDeviceImageFormatProperties2', dispatch='VkPhysicalDevice'),
254 Command(name='vkGetPhysicalDeviceQueueFamilyProperties2', dispatch='VkPhysicalDevice'),
255 Command(name='vkGetPhysicalDeviceMemoryProperties2', dispatch='VkPhysicalDevice'),
256 Command(name='vkGetPhysicalDeviceSparseImageFormatProperties2', dispatch='VkPhysicalDevice'),
257 Command(name='vkTrimCommandPool', dispatch='VkDevice'),
258 Command(name='vkGetDeviceQueue2', dispatch='VkDevice'),
259 Command(name='vkCreateSamplerYcbcrConversion', dispatch='VkDevice'),
260 Command(name='vkDestroySamplerYcbcrConversion', dispatch='VkDevice'),
261 Command(name='vkCreateDescriptorUpdateTemplate', dispatch='VkDevice'),
262 Command(name='vkDestroyDescriptorUpdateTemplate', dispatch='VkDevice'),
263 Command(name='vkUpdateDescriptorSetWithTemplate', dispatch='VkDevice'),
264 Command(name='vkGetPhysicalDeviceExternalBufferProperties', dispatch='VkPhysicalDevice'),
265 Command(name='vkGetPhysicalDeviceExternalFenceProperties', dispatch='VkPhysicalDevice'),
266 Command(name='vkGetPhysicalDeviceExternalSemaphoreProperties', dispatch='VkPhysicalDevice'),
267 Command(name='vkGetDescriptorSetLayoutSupport', dispatch='VkDevice'),
268])
269
270VK_KHR_surface = Extension(name='VK_KHR_surface', version=25, guard=None, commands=[
271 Command(name='vkDestroySurfaceKHR', dispatch='VkInstance'),
272 Command(name='vkGetPhysicalDeviceSurfaceSupportKHR', dispatch='VkPhysicalDevice'),
273 Command(name='vkGetPhysicalDeviceSurfaceCapabilitiesKHR', dispatch='VkPhysicalDevice'),
274 Command(name='vkGetPhysicalDeviceSurfaceFormatsKHR', dispatch='VkPhysicalDevice'),
275 Command(name='vkGetPhysicalDeviceSurfacePresentModesKHR', dispatch='VkPhysicalDevice'),
276])
277
278VK_KHR_swapchain = Extension(name='VK_KHR_swapchain', version=70, guard=None, commands=[
279 Command(name='vkCreateSwapchainKHR', dispatch='VkDevice'),
280 Command(name='vkDestroySwapchainKHR', dispatch='VkDevice'),
281 Command(name='vkGetSwapchainImagesKHR', dispatch='VkDevice'),
282 Command(name='vkAcquireNextImageKHR', dispatch='VkDevice'),
283 Command(name='vkQueuePresentKHR', dispatch='VkQueue'),
284 Command(name='vkGetDeviceGroupPresentCapabilitiesKHR', dispatch='VkDevice'),
285 Command(name='vkGetDeviceGroupSurfacePresentModesKHR', dispatch='VkDevice'),
286 Command(name='vkGetPhysicalDevicePresentRectanglesKHR', dispatch='VkPhysicalDevice'),
287 Command(name='vkAcquireNextImage2KHR', dispatch='VkDevice'),
288])
289
290VK_KHR_display = Extension(name='VK_KHR_display', version=21, guard=None, commands=[
291 Command(name='vkGetPhysicalDeviceDisplayPropertiesKHR', dispatch='VkPhysicalDevice'),
292 Command(name='vkGetPhysicalDeviceDisplayPlanePropertiesKHR', dispatch='VkPhysicalDevice'),
293 Command(name='vkGetDisplayPlaneSupportedDisplaysKHR', dispatch='VkPhysicalDevice'),
294 Command(name='vkGetDisplayModePropertiesKHR', dispatch='VkPhysicalDevice'),
295 Command(name='vkCreateDisplayModeKHR', dispatch='VkPhysicalDevice'),
296 Command(name='vkGetDisplayPlaneCapabilitiesKHR', dispatch='VkPhysicalDevice'),
297 Command(name='vkCreateDisplayPlaneSurfaceKHR', dispatch='VkInstance'),
298])
299
300VK_KHR_display_swapchain = Extension(name='VK_KHR_display_swapchain', version=9, guard=None, commands=[
301 Command(name='vkCreateSharedSwapchainsKHR', dispatch='VkDevice'),
302])
303
304VK_KHR_sampler_mirror_clamp_to_edge = Extension(name='VK_KHR_sampler_mirror_clamp_to_edge', version=1, guard=None, commands=[
305])
306
307VK_KHR_multiview = Extension(name='VK_KHR_multiview', version=1, guard=None, commands=[
308])
309
310VK_KHR_get_physical_device_properties2 = Extension(name='VK_KHR_get_physical_device_properties2', version=1, guard=None, commands=[
311 Command(name='vkGetPhysicalDeviceFeatures2KHR', dispatch='VkPhysicalDevice'),
312 Command(name='vkGetPhysicalDeviceProperties2KHR', dispatch='VkPhysicalDevice'),
313 Command(name='vkGetPhysicalDeviceFormatProperties2KHR', dispatch='VkPhysicalDevice'),
314 Command(name='vkGetPhysicalDeviceImageFormatProperties2KHR', dispatch='VkPhysicalDevice'),
315 Command(name='vkGetPhysicalDeviceQueueFamilyProperties2KHR', dispatch='VkPhysicalDevice'),
316 Command(name='vkGetPhysicalDeviceMemoryProperties2KHR', dispatch='VkPhysicalDevice'),
317 Command(name='vkGetPhysicalDeviceSparseImageFormatProperties2KHR', dispatch='VkPhysicalDevice'),
318])
319
320VK_KHR_device_group = Extension(name='VK_KHR_device_group', version=3, guard=None, commands=[
321 Command(name='vkGetDeviceGroupPeerMemoryFeaturesKHR', dispatch='VkDevice'),
322 Command(name='vkCmdSetDeviceMaskKHR', dispatch='VkCommandBuffer'),
323 Command(name='vkCmdDispatchBaseKHR', dispatch='VkCommandBuffer'),
324])
325
326VK_KHR_shader_draw_parameters = Extension(name='VK_KHR_shader_draw_parameters', version=1, guard=None, commands=[
327])
328
329VK_KHR_maintenance1 = Extension(name='VK_KHR_maintenance1', version=2, guard=None, commands=[
330 Command(name='vkTrimCommandPoolKHR', dispatch='VkDevice'),
331])
332
333VK_KHR_device_group_creation = Extension(name='VK_KHR_device_group_creation', version=1, guard=None, commands=[
334 Command(name='vkEnumeratePhysicalDeviceGroupsKHR', dispatch='VkInstance'),
335])
336
337VK_KHR_external_memory_capabilities = Extension(name='VK_KHR_external_memory_capabilities', version=1, guard=None, commands=[
338 Command(name='vkGetPhysicalDeviceExternalBufferPropertiesKHR', dispatch='VkPhysicalDevice'),
339])
340
341VK_KHR_external_memory = Extension(name='VK_KHR_external_memory', version=1, guard=None, commands=[
342])
343
344VK_KHR_external_memory_fd = Extension(name='VK_KHR_external_memory_fd', version=1, guard=None, commands=[
345 Command(name='vkGetMemoryFdKHR', dispatch='VkDevice'),
346 Command(name='vkGetMemoryFdPropertiesKHR', dispatch='VkDevice'),
347])
348
349VK_KHR_external_semaphore_capabilities = Extension(name='VK_KHR_external_semaphore_capabilities', version=1, guard=None, commands=[
350 Command(name='vkGetPhysicalDeviceExternalSemaphorePropertiesKHR', dispatch='VkPhysicalDevice'),
351])
352
353VK_KHR_external_semaphore = Extension(name='VK_KHR_external_semaphore', version=1, guard=None, commands=[
354])
355
356VK_KHR_external_semaphore_fd = Extension(name='VK_KHR_external_semaphore_fd', version=1, guard=None, commands=[
357 Command(name='vkImportSemaphoreFdKHR', dispatch='VkDevice'),
358 Command(name='vkGetSemaphoreFdKHR', dispatch='VkDevice'),
359])
360
361VK_KHR_push_descriptor = Extension(name='VK_KHR_push_descriptor', version=2, guard=None, commands=[
362 Command(name='vkCmdPushDescriptorSetKHR', dispatch='VkCommandBuffer'),
363 Command(name='vkCmdPushDescriptorSetWithTemplateKHR', dispatch='VkCommandBuffer'),
364])
365
366VK_KHR_16bit_storage = Extension(name='VK_KHR_16bit_storage', version=1, guard=None, commands=[
367])
368
369VK_KHR_incremental_present = Extension(name='VK_KHR_incremental_present', version=1, guard=None, commands=[
370])
371
372VK_KHR_descriptor_update_template = Extension(name='VK_KHR_descriptor_update_template', version=1, guard=None, commands=[
373 Command(name='vkCreateDescriptorUpdateTemplateKHR', dispatch='VkDevice'),
374 Command(name='vkDestroyDescriptorUpdateTemplateKHR', dispatch='VkDevice'),
375 Command(name='vkUpdateDescriptorSetWithTemplateKHR', dispatch='VkDevice'),
376])
377
378VK_KHR_shared_presentable_image = Extension(name='VK_KHR_shared_presentable_image', version=1, guard=None, commands=[
379 Command(name='vkGetSwapchainStatusKHR', dispatch='VkDevice'),
380])
381
382VK_KHR_external_fence_capabilities = Extension(name='VK_KHR_external_fence_capabilities', version=1, guard=None, commands=[
383 Command(name='vkGetPhysicalDeviceExternalFencePropertiesKHR', dispatch='VkPhysicalDevice'),
384])
385
386VK_KHR_external_fence = Extension(name='VK_KHR_external_fence', version=1, guard=None, commands=[
387])
388
389VK_KHR_external_fence_fd = Extension(name='VK_KHR_external_fence_fd', version=1, guard=None, commands=[
390 Command(name='vkImportFenceFdKHR', dispatch='VkDevice'),
391 Command(name='vkGetFenceFdKHR', dispatch='VkDevice'),
392])
393
394VK_KHR_maintenance2 = Extension(name='VK_KHR_maintenance2', version=1, guard=None, commands=[
395])
396
397VK_KHR_get_surface_capabilities2 = Extension(name='VK_KHR_get_surface_capabilities2', version=1, guard=None, commands=[
398 Command(name='vkGetPhysicalDeviceSurfaceCapabilities2KHR', dispatch='VkPhysicalDevice'),
399 Command(name='vkGetPhysicalDeviceSurfaceFormats2KHR', dispatch='VkPhysicalDevice'),
400])
401
402VK_KHR_variable_pointers = Extension(name='VK_KHR_variable_pointers', version=1, guard=None, commands=[
403])
404
405VK_KHR_dedicated_allocation = Extension(name='VK_KHR_dedicated_allocation', version=3, guard=None, commands=[
406])
407
408VK_KHR_storage_buffer_storage_class = Extension(name='VK_KHR_storage_buffer_storage_class', version=1, guard=None, commands=[
409])
410
411VK_KHR_relaxed_block_layout = Extension(name='VK_KHR_relaxed_block_layout', version=1, guard=None, commands=[
412])
413
414VK_KHR_get_memory_requirements2 = Extension(name='VK_KHR_get_memory_requirements2', version=1, guard=None, commands=[
415 Command(name='vkGetImageMemoryRequirements2KHR', dispatch='VkDevice'),
416 Command(name='vkGetBufferMemoryRequirements2KHR', dispatch='VkDevice'),
417 Command(name='vkGetImageSparseMemoryRequirements2KHR', dispatch='VkDevice'),
418])
419
420VK_KHR_image_format_list = Extension(name='VK_KHR_image_format_list', version=1, guard=None, commands=[
421])
422
423VK_KHR_sampler_ycbcr_conversion = Extension(name='VK_KHR_sampler_ycbcr_conversion', version=1, guard=None, commands=[
424 Command(name='vkCreateSamplerYcbcrConversionKHR', dispatch='VkDevice'),
425 Command(name='vkDestroySamplerYcbcrConversionKHR', dispatch='VkDevice'),
426])
427
428VK_KHR_bind_memory2 = Extension(name='VK_KHR_bind_memory2', version=1, guard=None, commands=[
429 Command(name='vkBindBufferMemory2KHR', dispatch='VkDevice'),
430 Command(name='vkBindImageMemory2KHR', dispatch='VkDevice'),
431])
432
433VK_KHR_maintenance3 = Extension(name='VK_KHR_maintenance3', version=1, guard=None, commands=[
434 Command(name='vkGetDescriptorSetLayoutSupportKHR', dispatch='VkDevice'),
435])
436
437VK_EXT_debug_report = Extension(name='VK_EXT_debug_report', version=9, guard=None, commands=[
438 Command(name='vkCreateDebugReportCallbackEXT', dispatch='VkInstance'),
439 Command(name='vkDestroyDebugReportCallbackEXT', dispatch='VkInstance'),
440 Command(name='vkDebugReportMessageEXT', dispatch='VkInstance'),
441])
442
443VK_NV_glsl_shader = Extension(name='VK_NV_glsl_shader', version=1, guard=None, commands=[
444])
445
446VK_EXT_depth_range_unrestricted = Extension(name='VK_EXT_depth_range_unrestricted', version=1, guard=None, commands=[
447])
448
449VK_IMG_filter_cubic = Extension(name='VK_IMG_filter_cubic', version=1, guard=None, commands=[
450])
451
452VK_AMD_rasterization_order = Extension(name='VK_AMD_rasterization_order', version=1, guard=None, commands=[
453])
454
455VK_AMD_shader_trinary_minmax = Extension(name='VK_AMD_shader_trinary_minmax', version=1, guard=None, commands=[
456])
457
458VK_AMD_shader_explicit_vertex_parameter = Extension(name='VK_AMD_shader_explicit_vertex_parameter', version=1, guard=None, commands=[
459])
460
461VK_EXT_debug_marker = Extension(name='VK_EXT_debug_marker', version=4, guard=None, commands=[
462 Command(name='vkDebugMarkerSetObjectTagEXT', dispatch='VkDevice'),
463 Command(name='vkDebugMarkerSetObjectNameEXT', dispatch='VkDevice'),
464 Command(name='vkCmdDebugMarkerBeginEXT', dispatch='VkCommandBuffer'),
465 Command(name='vkCmdDebugMarkerEndEXT', dispatch='VkCommandBuffer'),
466 Command(name='vkCmdDebugMarkerInsertEXT', dispatch='VkCommandBuffer'),
467])
468
469VK_AMD_gcn_shader = Extension(name='VK_AMD_gcn_shader', version=1, guard=None, commands=[
470])
471
472VK_NV_dedicated_allocation = Extension(name='VK_NV_dedicated_allocation', version=1, guard=None, commands=[
473])
474
475VK_AMD_draw_indirect_count = Extension(name='VK_AMD_draw_indirect_count', version=1, guard=None, commands=[
476 Command(name='vkCmdDrawIndirectCountAMD', dispatch='VkCommandBuffer'),
477 Command(name='vkCmdDrawIndexedIndirectCountAMD', dispatch='VkCommandBuffer'),
478])
479
480VK_AMD_negative_viewport_height = Extension(name='VK_AMD_negative_viewport_height', version=1, guard=None, commands=[
481])
482
483VK_AMD_gpu_shader_half_float = Extension(name='VK_AMD_gpu_shader_half_float', version=1, guard=None, commands=[
484])
485
486VK_AMD_shader_ballot = Extension(name='VK_AMD_shader_ballot', version=1, guard=None, commands=[
487])
488
489VK_AMD_texture_gather_bias_lod = Extension(name='VK_AMD_texture_gather_bias_lod', version=1, guard=None, commands=[
490])
491
492VK_AMD_shader_info = Extension(name='VK_AMD_shader_info', version=1, guard=None, commands=[
493 Command(name='vkGetShaderInfoAMD', dispatch='VkDevice'),
494])
495
496VK_AMD_shader_image_load_store_lod = Extension(name='VK_AMD_shader_image_load_store_lod', version=1, guard=None, commands=[
497])
498
499VK_IMG_format_pvrtc = Extension(name='VK_IMG_format_pvrtc', version=1, guard=None, commands=[
500])
501
502VK_NV_external_memory_capabilities = Extension(name='VK_NV_external_memory_capabilities', version=1, guard=None, commands=[
503 Command(name='vkGetPhysicalDeviceExternalImageFormatPropertiesNV', dispatch='VkPhysicalDevice'),
504])
505
506VK_NV_external_memory = Extension(name='VK_NV_external_memory', version=1, guard=None, commands=[
507])
508
509VK_EXT_validation_flags = Extension(name='VK_EXT_validation_flags', version=1, guard=None, commands=[
510])
511
512VK_EXT_shader_subgroup_ballot = Extension(name='VK_EXT_shader_subgroup_ballot', version=1, guard=None, commands=[
513])
514
515VK_EXT_shader_subgroup_vote = Extension(name='VK_EXT_shader_subgroup_vote', version=1, guard=None, commands=[
516])
517
518VK_NVX_device_generated_commands = Extension(name='VK_NVX_device_generated_commands', version=3, guard=None, commands=[
519 Command(name='vkCmdProcessCommandsNVX', dispatch='VkCommandBuffer'),
520 Command(name='vkCmdReserveSpaceForCommandsNVX', dispatch='VkCommandBuffer'),
521 Command(name='vkCreateIndirectCommandsLayoutNVX', dispatch='VkDevice'),
522 Command(name='vkDestroyIndirectCommandsLayoutNVX', dispatch='VkDevice'),
523 Command(name='vkCreateObjectTableNVX', dispatch='VkDevice'),
524 Command(name='vkDestroyObjectTableNVX', dispatch='VkDevice'),
525 Command(name='vkRegisterObjectsNVX', dispatch='VkDevice'),
526 Command(name='vkUnregisterObjectsNVX', dispatch='VkDevice'),
527 Command(name='vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX', dispatch='VkPhysicalDevice'),
528])
529
530VK_NV_clip_space_w_scaling = Extension(name='VK_NV_clip_space_w_scaling', version=1, guard=None, commands=[
531 Command(name='vkCmdSetViewportWScalingNV', dispatch='VkCommandBuffer'),
532])
533
534VK_EXT_direct_mode_display = Extension(name='VK_EXT_direct_mode_display', version=1, guard=None, commands=[
535 Command(name='vkReleaseDisplayEXT', dispatch='VkPhysicalDevice'),
536])
537
538VK_EXT_display_surface_counter = Extension(name='VK_EXT_display_surface_counter', version=1, guard=None, commands=[
539 Command(name='vkGetPhysicalDeviceSurfaceCapabilities2EXT', dispatch='VkPhysicalDevice'),
540])
541
542VK_EXT_display_control = Extension(name='VK_EXT_display_control', version=1, guard=None, commands=[
543 Command(name='vkDisplayPowerControlEXT', dispatch='VkDevice'),
544 Command(name='vkRegisterDeviceEventEXT', dispatch='VkDevice'),
545 Command(name='vkRegisterDisplayEventEXT', dispatch='VkDevice'),
546 Command(name='vkGetSwapchainCounterEXT', dispatch='VkDevice'),
547])
548
549VK_GOOGLE_display_timing = Extension(name='VK_GOOGLE_display_timing', version=1, guard=None, commands=[
550 Command(name='vkGetRefreshCycleDurationGOOGLE', dispatch='VkDevice'),
551 Command(name='vkGetPastPresentationTimingGOOGLE', dispatch='VkDevice'),
552])
553
554VK_NV_sample_mask_override_coverage = Extension(name='VK_NV_sample_mask_override_coverage', version=1, guard=None, commands=[
555])
556
557VK_NV_geometry_shader_passthrough = Extension(name='VK_NV_geometry_shader_passthrough', version=1, guard=None, commands=[
558])
559
560VK_NV_viewport_array2 = Extension(name='VK_NV_viewport_array2', version=1, guard=None, commands=[
561])
562
563VK_NVX_multiview_per_view_attributes = Extension(name='VK_NVX_multiview_per_view_attributes', version=1, guard=None, commands=[
564])
565
566VK_NV_viewport_swizzle = Extension(name='VK_NV_viewport_swizzle', version=1, guard=None, commands=[
567])
568
569VK_EXT_discard_rectangles = Extension(name='VK_EXT_discard_rectangles', version=1, guard=None, commands=[
570 Command(name='vkCmdSetDiscardRectangleEXT', dispatch='VkCommandBuffer'),
571])
572
573VK_EXT_conservative_rasterization = Extension(name='VK_EXT_conservative_rasterization', version=1, guard=None, commands=[
574])
575
576VK_EXT_swapchain_colorspace = Extension(name='VK_EXT_swapchain_colorspace', version=3, guard=None, commands=[
577])
578
579VK_EXT_hdr_metadata = Extension(name='VK_EXT_hdr_metadata', version=1, guard=None, commands=[
580 Command(name='vkSetHdrMetadataEXT', dispatch='VkDevice'),
581])
582
583VK_EXT_external_memory_dma_buf = Extension(name='VK_EXT_external_memory_dma_buf', version=1, guard=None, commands=[
584])
585
586VK_EXT_queue_family_foreign = Extension(name='VK_EXT_queue_family_foreign', version=1, guard=None, commands=[
587])
588
589VK_EXT_debug_utils = Extension(name='VK_EXT_debug_utils', version=1, guard=None, commands=[
590 Command(name='vkSetDebugUtilsObjectNameEXT', dispatch='VkDevice'),
591 Command(name='vkSetDebugUtilsObjectTagEXT', dispatch='VkDevice'),
592 Command(name='vkQueueBeginDebugUtilsLabelEXT', dispatch='VkQueue'),
593 Command(name='vkQueueEndDebugUtilsLabelEXT', dispatch='VkQueue'),
594 Command(name='vkQueueInsertDebugUtilsLabelEXT', dispatch='VkQueue'),
595 Command(name='vkCmdBeginDebugUtilsLabelEXT', dispatch='VkCommandBuffer'),
596 Command(name='vkCmdEndDebugUtilsLabelEXT', dispatch='VkCommandBuffer'),
597 Command(name='vkCmdInsertDebugUtilsLabelEXT', dispatch='VkCommandBuffer'),
598 Command(name='vkCreateDebugUtilsMessengerEXT', dispatch='VkInstance'),
599 Command(name='vkDestroyDebugUtilsMessengerEXT', dispatch='VkInstance'),
600 Command(name='vkSubmitDebugUtilsMessageEXT', dispatch='VkInstance'),
601])
602
603VK_EXT_sampler_filter_minmax = Extension(name='VK_EXT_sampler_filter_minmax', version=1, guard=None, commands=[
604])
605
606VK_AMD_gpu_shader_int16 = Extension(name='VK_AMD_gpu_shader_int16', version=1, guard=None, commands=[
607])
608
609VK_AMD_mixed_attachment_samples = Extension(name='VK_AMD_mixed_attachment_samples', version=1, guard=None, commands=[
610])
611
612VK_AMD_shader_fragment_mask = Extension(name='VK_AMD_shader_fragment_mask', version=1, guard=None, commands=[
613])
614
615VK_EXT_shader_stencil_export = Extension(name='VK_EXT_shader_stencil_export', version=1, guard=None, commands=[
616])
617
618VK_EXT_sample_locations = Extension(name='VK_EXT_sample_locations', version=1, guard=None, commands=[
619 Command(name='vkCmdSetSampleLocationsEXT', dispatch='VkCommandBuffer'),
620 Command(name='vkGetPhysicalDeviceMultisamplePropertiesEXT', dispatch='VkPhysicalDevice'),
621])
622
623VK_EXT_blend_operation_advanced = Extension(name='VK_EXT_blend_operation_advanced', version=2, guard=None, commands=[
624])
625
626VK_NV_fragment_coverage_to_color = Extension(name='VK_NV_fragment_coverage_to_color', version=1, guard=None, commands=[
627])
628
629VK_NV_framebuffer_mixed_samples = Extension(name='VK_NV_framebuffer_mixed_samples', version=1, guard=None, commands=[
630])
631
632VK_NV_fill_rectangle = Extension(name='VK_NV_fill_rectangle', version=1, guard=None, commands=[
633])
634
635VK_EXT_post_depth_coverage = Extension(name='VK_EXT_post_depth_coverage', version=1, guard=None, commands=[
636])
637
638VK_EXT_validation_cache = Extension(name='VK_EXT_validation_cache', version=1, guard=None, commands=[
639 Command(name='vkCreateValidationCacheEXT', dispatch='VkDevice'),
640 Command(name='vkDestroyValidationCacheEXT', dispatch='VkDevice'),
641 Command(name='vkMergeValidationCachesEXT', dispatch='VkDevice'),
642 Command(name='vkGetValidationCacheDataEXT', dispatch='VkDevice'),
643])
644
645VK_EXT_descriptor_indexing = Extension(name='VK_EXT_descriptor_indexing', version=2, guard=None, commands=[
646])
647
648VK_EXT_shader_viewport_index_layer = Extension(name='VK_EXT_shader_viewport_index_layer', version=1, guard=None, commands=[
649])
650
651VK_EXT_global_priority = Extension(name='VK_EXT_global_priority', version=2, guard=None, commands=[
652])
653
654VK_EXT_external_memory_host = Extension(name='VK_EXT_external_memory_host', version=1, guard=None, commands=[
655 Command(name='vkGetMemoryHostPointerPropertiesEXT', dispatch='VkDevice'),
656])
657
658VK_AMD_buffer_marker = Extension(name='VK_AMD_buffer_marker', version=1, guard=None, commands=[
659 Command(name='vkCmdWriteBufferMarkerAMD', dispatch='VkCommandBuffer'),
660])
661
662VK_AMD_shader_core_properties = Extension(name='VK_AMD_shader_core_properties', version=1, guard=None, commands=[
663])
664
665VK_EXT_vertex_attribute_divisor = Extension(name='VK_EXT_vertex_attribute_divisor', version=1, guard=None, commands=[
666])
667
668VK_NV_shader_subgroup_partitioned = Extension(name='VK_NV_shader_subgroup_partitioned', version=1, guard=None, commands=[
669])
670
671VK_KHR_android_surface = Extension(name='VK_KHR_android_surface', version=6, guard='VK_USE_PLATFORM_ANDROID_KHR', commands=[
672 Command(name='vkCreateAndroidSurfaceKHR', dispatch='VkInstance'),
673])
674
675VK_ANDROID_external_memory_android_hardware_buffer = Extension(name='VK_ANDROID_external_memory_android_hardware_buffer', version=3, guard='VK_USE_PLATFORM_ANDROID_KHR', commands=[
676 Command(name='vkGetAndroidHardwareBufferPropertiesANDROID', dispatch='VkDevice'),
677 Command(name='vkGetMemoryAndroidHardwareBufferANDROID', dispatch='VkDevice'),
678])
679
680VK_MVK_ios_surface = Extension(name='VK_MVK_ios_surface', version=2, guard='VK_USE_PLATFORM_IOS_MVK', commands=[
681 Command(name='vkCreateIOSSurfaceMVK', dispatch='VkInstance'),
682])
683
684VK_MVK_macos_surface = Extension(name='VK_MVK_macos_surface', version=2, guard='VK_USE_PLATFORM_MACOS_MVK', commands=[
685 Command(name='vkCreateMacOSSurfaceMVK', dispatch='VkInstance'),
686])
687
688VK_KHR_mir_surface = Extension(name='VK_KHR_mir_surface', version=4, guard='VK_USE_PLATFORM_MIR_KHR', commands=[
689 Command(name='vkCreateMirSurfaceKHR', dispatch='VkInstance'),
690 Command(name='vkGetPhysicalDeviceMirPresentationSupportKHR', dispatch='VkPhysicalDevice'),
691])
692
693VK_NN_vi_surface = Extension(name='VK_NN_vi_surface', version=1, guard='VK_USE_PLATFORM_VI_NN', commands=[
694 Command(name='vkCreateViSurfaceNN', dispatch='VkInstance'),
695])
696
697VK_KHR_wayland_surface = Extension(name='VK_KHR_wayland_surface', version=6, guard='VK_USE_PLATFORM_WAYLAND_KHR', commands=[
698 Command(name='vkCreateWaylandSurfaceKHR', dispatch='VkInstance'),
699 Command(name='vkGetPhysicalDeviceWaylandPresentationSupportKHR', dispatch='VkPhysicalDevice'),
700])
701
702VK_KHR_win32_surface = Extension(name='VK_KHR_win32_surface', version=6, guard='VK_USE_PLATFORM_WIN32_KHR', commands=[
703 Command(name='vkCreateWin32SurfaceKHR', dispatch='VkInstance'),
704 Command(name='vkGetPhysicalDeviceWin32PresentationSupportKHR', dispatch='VkPhysicalDevice'),
705])
706
707VK_KHR_external_memory_win32 = Extension(name='VK_KHR_external_memory_win32', version=1, guard='VK_USE_PLATFORM_WIN32_KHR', commands=[
708 Command(name='vkGetMemoryWin32HandleKHR', dispatch='VkDevice'),
709 Command(name='vkGetMemoryWin32HandlePropertiesKHR', dispatch='VkDevice'),
710])
711
712VK_KHR_win32_keyed_mutex = Extension(name='VK_KHR_win32_keyed_mutex', version=1, guard='VK_USE_PLATFORM_WIN32_KHR', commands=[
713])
714
715VK_KHR_external_semaphore_win32 = Extension(name='VK_KHR_external_semaphore_win32', version=1, guard='VK_USE_PLATFORM_WIN32_KHR', commands=[
716 Command(name='vkImportSemaphoreWin32HandleKHR', dispatch='VkDevice'),
717 Command(name='vkGetSemaphoreWin32HandleKHR', dispatch='VkDevice'),
718])
719
720VK_KHR_external_fence_win32 = Extension(name='VK_KHR_external_fence_win32', version=1, guard='VK_USE_PLATFORM_WIN32_KHR', commands=[
721 Command(name='vkImportFenceWin32HandleKHR', dispatch='VkDevice'),
722 Command(name='vkGetFenceWin32HandleKHR', dispatch='VkDevice'),
723])
724
725VK_NV_external_memory_win32 = Extension(name='VK_NV_external_memory_win32', version=1, guard='VK_USE_PLATFORM_WIN32_KHR', commands=[
726 Command(name='vkGetMemoryWin32HandleNV', dispatch='VkDevice'),
727])
728
729VK_NV_win32_keyed_mutex = Extension(name='VK_NV_win32_keyed_mutex', version=1, guard='VK_USE_PLATFORM_WIN32_KHR', commands=[
730])
731
732VK_KHR_xcb_surface = Extension(name='VK_KHR_xcb_surface', version=6, guard='VK_USE_PLATFORM_XCB_KHR', commands=[
733 Command(name='vkCreateXcbSurfaceKHR', dispatch='VkInstance'),
734 Command(name='vkGetPhysicalDeviceXcbPresentationSupportKHR', dispatch='VkPhysicalDevice'),
735])
736
737VK_KHR_xlib_surface = Extension(name='VK_KHR_xlib_surface', version=6, guard='VK_USE_PLATFORM_XLIB_KHR', commands=[
738 Command(name='vkCreateXlibSurfaceKHR', dispatch='VkInstance'),
739 Command(name='vkGetPhysicalDeviceXlibPresentationSupportKHR', dispatch='VkPhysicalDevice'),
740])
741
742VK_EXT_acquire_xlib_display = Extension(name='VK_EXT_acquire_xlib_display', version=1, guard='VK_USE_PLATFORM_XLIB_XRANDR_EXT', commands=[
743 Command(name='vkAcquireXlibDisplayEXT', dispatch='VkPhysicalDevice'),
744 Command(name='vkGetRandROutputDisplayEXT', dispatch='VkPhysicalDevice'),
745])
746
747extensions = [
748 VK_core_0,
749 VK_core_1,
750 VK_KHR_surface,
751 VK_KHR_swapchain,
752 VK_KHR_display,
753 VK_KHR_display_swapchain,
754 VK_KHR_sampler_mirror_clamp_to_edge,
755 VK_KHR_multiview,
756 VK_KHR_get_physical_device_properties2,
757 VK_KHR_device_group,
758 VK_KHR_shader_draw_parameters,
759 VK_KHR_maintenance1,
760 VK_KHR_device_group_creation,
761 VK_KHR_external_memory_capabilities,
762 VK_KHR_external_memory,
763 VK_KHR_external_memory_fd,
764 VK_KHR_external_semaphore_capabilities,
765 VK_KHR_external_semaphore,
766 VK_KHR_external_semaphore_fd,
767 VK_KHR_push_descriptor,
768 VK_KHR_16bit_storage,
769 VK_KHR_incremental_present,
770 VK_KHR_descriptor_update_template,
771 VK_KHR_shared_presentable_image,
772 VK_KHR_external_fence_capabilities,
773 VK_KHR_external_fence,
774 VK_KHR_external_fence_fd,
775 VK_KHR_maintenance2,
776 VK_KHR_get_surface_capabilities2,
777 VK_KHR_variable_pointers,
778 VK_KHR_dedicated_allocation,
779 VK_KHR_storage_buffer_storage_class,
780 VK_KHR_relaxed_block_layout,
781 VK_KHR_get_memory_requirements2,
782 VK_KHR_image_format_list,
783 VK_KHR_sampler_ycbcr_conversion,
784 VK_KHR_bind_memory2,
785 VK_KHR_maintenance3,
786 VK_EXT_debug_report,
787 VK_NV_glsl_shader,
788 VK_EXT_depth_range_unrestricted,
789 VK_IMG_filter_cubic,
790 VK_AMD_rasterization_order,
791 VK_AMD_shader_trinary_minmax,
792 VK_AMD_shader_explicit_vertex_parameter,
793 VK_EXT_debug_marker,
794 VK_AMD_gcn_shader,
795 VK_NV_dedicated_allocation,
796 VK_AMD_draw_indirect_count,
797 VK_AMD_negative_viewport_height,
798 VK_AMD_gpu_shader_half_float,
799 VK_AMD_shader_ballot,
800 VK_AMD_texture_gather_bias_lod,
801 VK_AMD_shader_info,
802 VK_AMD_shader_image_load_store_lod,
803 VK_IMG_format_pvrtc,
804 VK_NV_external_memory_capabilities,
805 VK_NV_external_memory,
806 VK_EXT_validation_flags,
807 VK_EXT_shader_subgroup_ballot,
808 VK_EXT_shader_subgroup_vote,
809 VK_NVX_device_generated_commands,
810 VK_NV_clip_space_w_scaling,
811 VK_EXT_direct_mode_display,
812 VK_EXT_display_surface_counter,
813 VK_EXT_display_control,
814 VK_GOOGLE_display_timing,
815 VK_NV_sample_mask_override_coverage,
816 VK_NV_geometry_shader_passthrough,
817 VK_NV_viewport_array2,
818 VK_NVX_multiview_per_view_attributes,
819 VK_NV_viewport_swizzle,
820 VK_EXT_discard_rectangles,
821 VK_EXT_conservative_rasterization,
822 VK_EXT_swapchain_colorspace,
823 VK_EXT_hdr_metadata,
824 VK_EXT_external_memory_dma_buf,
825 VK_EXT_queue_family_foreign,
826 VK_EXT_debug_utils,
827 VK_EXT_sampler_filter_minmax,
828 VK_AMD_gpu_shader_int16,
829 VK_AMD_mixed_attachment_samples,
830 VK_AMD_shader_fragment_mask,
831 VK_EXT_shader_stencil_export,
832 VK_EXT_sample_locations,
833 VK_EXT_blend_operation_advanced,
834 VK_NV_fragment_coverage_to_color,
835 VK_NV_framebuffer_mixed_samples,
836 VK_NV_fill_rectangle,
837 VK_EXT_post_depth_coverage,
838 VK_EXT_validation_cache,
839 VK_EXT_descriptor_indexing,
840 VK_EXT_shader_viewport_index_layer,
841 VK_EXT_global_priority,
842 VK_EXT_external_memory_host,
843 VK_AMD_buffer_marker,
844 VK_AMD_shader_core_properties,
845 VK_EXT_vertex_attribute_divisor,
846 VK_NV_shader_subgroup_partitioned,
847 VK_KHR_android_surface,
848 VK_ANDROID_external_memory_android_hardware_buffer,
849 VK_MVK_ios_surface,
850 VK_MVK_macos_surface,
851 VK_KHR_mir_surface,
852 VK_NN_vi_surface,
853 VK_KHR_wayland_surface,
854 VK_KHR_win32_surface,
855 VK_KHR_external_memory_win32,
856 VK_KHR_win32_keyed_mutex,
857 VK_KHR_external_semaphore_win32,
858 VK_KHR_external_fence_win32,
859 VK_NV_external_memory_win32,
860 VK_NV_win32_keyed_mutex,
861 VK_KHR_xcb_surface,
862 VK_KHR_xlib_surface,
863 VK_EXT_acquire_xlib_display,
864]
865# end of generated code
866
867def generate_wrapper_header(guard):
868 copyright = []
869 copyright.append("/* ")
870 copyright.append(" * Copyright 2018 The Android Open Source Project ")
871 copyright.append(" * ")
872 copyright.append(" * Licensed under the Apache License, Version 2.0 (the \"License\"); ")
873 copyright.append(" * you may not use this file except in compliance with the License. ")
874 copyright.append(" * You may obtain a copy of the License at ")
875 copyright.append(" * ")
876 copyright.append(" * http://www.apache.org/licenses/LICENSE-2.0 ")
877 copyright.append(" * ")
878 copyright.append(" * Unless required by applicable law or agreed to in writing, software ")
879 copyright.append(" * distributed under the License is distributed on an \"AS IS\" BASIS, ")
880 copyright.append(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.")
881 copyright.append(" * See the License for the specific language governing permissions and ")
882 copyright.append(" * limitations under the License. ")
883 copyright.append(" */ ")
884 lines = [line.rstrip() for line in copyright]
885
886 lines.append("// This file is generated.")
887 lines.append("#ifndef %s" % guard)
888 lines.append("#define %s" % guard)
889 lines.append("")
890 lines.append("#ifdef __cplusplus")
891 lines.append("extern \"C\" {")
892 lines.append("#endif")
893 lines.append("")
894 lines.append("#define VK_NO_PROTOTYPES 1")
895 lines.append("#include <vulkan/vulkan.h>")
896 lines.append("")
897 lines.append("/* Initialize the Vulkan function pointer variables declared in this header.")
898 lines.append(" * Returns 0 if vulkan is not available, non-zero if it is available.")
899 lines.append(" */")
900 lines.append("int InitVulkan(void);")
901 lines.append("")
902
903 for ext in extensions:
904 # Only wrap core and WSI functions
905 wrapped_exts = {'VK_core', 'VK_KHR'}
906 if not any(ext.name.startswith(s) for s in wrapped_exts):
907 continue
908
909 if ext.guard:
910 lines.append("#ifdef %s" % ext.guard)
911
912 lines.append("// %s" % ext.name)
913 for cmd in ext.commands:
914 lines.append("extern PFN_%s %s;" % (cmd.name, cmd.name))
915
916 if ext.guard:
917 lines.append("#endif")
918 lines.append("")
919
920 lines.append("")
921 lines.append("")
922 lines.append("#ifdef __cplusplus")
923 lines.append("}")
924 lines.append("#endif")
925 lines.append("")
926 lines.append("#endif // %s" % guard)
927
928 return "\n".join(lines)
929
930def generate_wrapper_source(header):
931 copyright = []
932 copyright.append("/* ")
933 copyright.append(" * Copyright 2018 The Android Open Source Project ")
934 copyright.append(" * ")
935 copyright.append(" * Licensed under the Apache License, Version 2.0 (the \"License\"); ")
936 copyright.append(" * you may not use this file except in compliance with the License. ")
937 copyright.append(" * You may obtain a copy of the License at ")
938 copyright.append(" * ")
939 copyright.append(" * http://www.apache.org/licenses/LICENSE-2.0 ")
940 copyright.append(" * ")
941 copyright.append(" * Unless required by applicable law or agreed to in writing, software ")
942 copyright.append(" * distributed under the License is distributed on an \"AS IS\" BASIS, ")
943 copyright.append(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.")
944 copyright.append(" * See the License for the specific language governing permissions and ")
945 copyright.append(" * limitations under the License. ")
946 copyright.append(" */ ")
947 lines = [line.rstrip() for line in copyright]
948
949 lines.append("// This file is generated.")
950 lines.append("#ifdef __cplusplus")
951 lines.append("extern \"C\" {")
952 lines.append("#endif")
953 lines.append("")
954 lines.append("#include \"%s\"" % header)
955 lines.append("#include <dlfcn.h>")
956 lines.append("")
957
958 lines.append("int InitVulkan(void) {")
959 lines.append(" void* libvulkan = dlopen(\"libvulkan.so\", RTLD_NOW | RTLD_LOCAL);")
960 lines.append(" if (!libvulkan)")
961 lines.append(" return 0;")
962 lines.append("")
963 lines.append(" // Vulkan supported, set function addresses")
964 for ext in extensions:
965 # Only wrap core and WSI functions
966 wrapped_exts = {'VK_core', 'VK_KHR'}
967 if not any(ext.name.startswith(s) for s in wrapped_exts):
968 continue
969
970 if ext.guard:
971 lines.append("")
972 lines.append("#ifdef %s" % ext.guard)
973
974 for cmd in ext.commands:
975 lines.append(" %s = reinterpret_cast<PFN_%s>(dlsym(libvulkan, \"%s\"));" % (cmd.name, cmd.name, cmd.name))
976
977 if ext.guard:
978 lines.append("#endif")
979
980 lines.append(" return 1;")
981 lines.append("}")
982 lines.append("")
983
984 lines.append("// No Vulkan support, do not set function addresses")
985 for ext in extensions:
986 if ext.guard:
987 lines.append("")
988 lines.append("#ifdef %s" % ext.guard)
989
990 for cmd in ext.commands:
991 lines.append("PFN_%s %s;" % (cmd.name, cmd.name))
992
993 if ext.guard:
994 lines.append("#endif")
995
996 lines.append("")
997 lines.append("#ifdef __cplusplus")
998 lines.append("}")
999 lines.append("#endif")
1000
1001 return "\n".join(lines)
1002
1003def parse_subheader(filename, ext_guard):
1004 sub_extensions = []
1005
1006 with open(filename, "r") as f:
1007 current_ext = None
1008 spec_version = None
1009
1010 for line in f:
1011 line = line.strip();
1012
1013 if line.startswith("#define VK_API_VERSION"):
1014 minor_end = line.rfind(",")
1015 minor_begin = line.rfind(",", 0, minor_end) + 1
1016 spec_version = int(line[minor_begin:minor_end])
1017 # add core
1018 current_ext = Extension("VK_core_%s" % spec_version, spec_version)
1019 sub_extensions.append(current_ext)
1020 elif Command.valid_c_typedef(line):
1021 current_ext.add_command(Command.from_c_typedef(line))
1022 elif line.startswith("#define") and "SPEC_VERSION " in line:
1023 version_begin = line.rfind(" ") + 1
1024 spec_version = int(line[version_begin:])
1025 elif line.startswith("#define") and "EXTENSION_NAME " in line:
1026 name_end = line.rfind("\"")
1027 name_begin = line.rfind("\"", 0, name_end) + 1
1028 name = line[name_begin:name_end]
1029 # add extension
1030 current_ext = Extension(name, spec_version, ext_guard)
1031 sub_extensions.append(current_ext)
1032
1033 return sub_extensions;
1034
1035def parse_vulkan_h(filename):
1036 extensions = []
1037
1038 with open(filename, "r") as f:
1039 ext_guard = None
1040
1041 for line in f:
1042 line = line.strip();
1043
1044 if line.startswith("#include \"vulkan_"):
1045 # Extract the filename and parse it. Must be local to script file (no path).
1046 extensions.extend(parse_subheader(line[10:].replace('"', ''), ext_guard))
1047 elif line.startswith("#ifdef VK_USE_PLATFORM"):
1048 guard_begin = line.find(" ") + 1
1049 ext_guard = line[guard_begin:]
1050 elif ext_guard and line.startswith("#endif") and ext_guard in line:
1051 ext_guard = None
1052
1053 for ext in extensions:
1054 print("%s = %s" % (ext.name, repr(ext)))
1055 print("")
1056
1057 print("extensions = [")
1058 for ext in extensions:
1059 print(" %s," % ext.name)
1060 print("]")
1061
1062if __name__ == "__main__":
1063 if sys.argv[1] == "parse":
1064 parse_vulkan_h(sys.argv[2])
1065 else:
1066 filename = sys.argv[1]
1067 base = os.path.basename(filename)
1068 contents = []
1069
1070 if base.endswith(".h"):
1071 contents = generate_wrapper_header(base.replace(".", "_").upper())
1072 elif base.endswith(".cpp"):
1073 contents = generate_wrapper_source(base.replace(".cpp", ".h"))
1074
1075 with open(filename, "w") as f:
1076 print(contents, file=f)