1 " ""VK API description"""
3 # Copyright (c) 2015-2016 The Khronos Group Inc.
4 # Copyright (c) 2015-2016 Valve Corporation
5 # Copyright (c) 2015-2016 LunarG, Inc.
6 # Copyright (c) 2015-2016 Google Inc.
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
20 # Author: Chia-I Wu <olv@lunarg.com>
21 # Author: Jon Ashburn <jon@lunarg.com>
22 # Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
23 # Author: Tobin Ehlis <tobin@lunarg.com>
24 # Author: Tony Barbour <tony@LunarG.com>
25 # Author: Gwan-gyeong Mun <kk.moon@samsung.com>
28 """A function parameter."""
30 def __init__(self, ty, name):
35 """Return the parameter in C."""
36 idx = self.ty.find("[")
38 # arrays have a different syntax
40 return "%s %s%s" % (self.ty[:idx], self.name, self.ty[idx:])
42 return "%s %s" % (self.ty, self.name)
44 def indirection_level(self):
45 """Return the level of indirection."""
46 return self.ty.count("*") + self.ty.count("[")
48 def dereferenced_type(self, level=0):
49 """Return the type after dereferencing."""
51 level = self.indirection_level()
53 deref = self.ty if level else ""
55 idx = deref.rfind("[")
57 idx = deref.rfind("*")
67 return "Param(\"%s\", \"%s\")" % (self.ty, self.name)
70 """A function prototype."""
72 def __init__(self, ret, name, params=[]):
73 # the proto has only a param
74 if not isinstance(params, list):
81 def c_params(self, need_type=True, need_name=True):
82 """Return the parameter list in C."""
83 if self.params and (need_type or need_name):
84 if need_type and need_name:
85 return ", ".join([param.c() for param in self.params])
87 return ", ".join([param.ty for param in self.params])
89 return ", ".join([param.name for param in self.params])
91 return "void" if need_type else ""
93 def c_decl(self, name, attr="", typed=False, need_param_names=True):
94 """Return a named declaration in C."""
96 return "%s (%s*%s)(%s)" % (
98 attr + "_PTR " if attr else "",
100 self.c_params(need_name=need_param_names))
102 return "%s%s %s%s(%s)" % (
103 attr + "_ATTR " if attr else "",
105 attr + "_CALL " if attr else "",
107 self.c_params(need_name=need_param_names))
109 def c_pretty_decl(self, name, attr=""):
110 """Return a named declaration in C, with vulkan.h formatting."""
112 for param in self.params:
113 idx = param.ty.find("[")
121 plist.append(" %s%s%s%s" % (param.ty[:idx],
122 " " * pad, param.name, param.ty[idx:]))
124 return "%s%s %s%s(\n%s)" % (
125 attr + "_ATTR " if attr else "",
127 attr + "_CALL " if attr else "",
131 def c_typedef(self, suffix="", attr=""):
132 """Return the typedef for the prototype in C."""
133 return self.c_decl(self.name + suffix, attr=attr, typed=True)
135 def c_func(self, prefix="", attr=""):
136 """Return the prototype in C."""
137 return self.c_decl(prefix + self.name, attr=attr, typed=False)
140 """Return a call to the prototype in C."""
141 return "%s(%s)" % (self.name, self.c_params(need_type=False))
143 def object_in_params(self):
144 """Return the params that are simple VK objects and are inputs."""
145 return [param for param in self.params if param.ty in objects]
147 def object_out_params(self):
148 """Return the params that are simple VK objects and are outputs."""
149 return [param for param in self.params
150 if param.dereferenced_type() in objects]
154 for param in self.params:
155 param_strs.append(str(param))
156 param_str = " [%s]" % (",\n ".join(param_strs))
158 return "Proto(\"%s\", \"%s\",\n%s)" % \
159 (self.ret, self.name, param_str)
161 class Extension(object):
162 def __init__(self, name, headers, objects, protos, ifdef = None):
164 self.headers = headers
165 self.objects = objects
171 lines.append("Extension(")
172 lines.append(" name=\"%s\"," % self.name)
173 lines.append(" headers=[\"%s\"]," %
174 "\", \"".join(self.headers))
176 lines.append(" objects=[")
177 for obj in self.objects:
178 lines.append(" \"%s\"," % obj)
181 lines.append(" protos=[")
182 for proto in self.protos:
183 param_lines = str(proto).splitlines()
184 param_lines[-1] += ",\n" if proto != self.protos[-1] else ","
185 for p in param_lines:
186 lines.append(" " + p)
190 return "\n".join(lines)
195 headers=["vulkan/vulkan.h"],
216 "VkDescriptorSetLayout",
224 Proto("VkResult", "CreateInstance",
225 [Param("const VkInstanceCreateInfo*", "pCreateInfo"),
226 Param("const VkAllocationCallbacks*", "pAllocator"),
227 Param("VkInstance*", "pInstance")]),
229 Proto("void", "DestroyInstance",
230 [Param("VkInstance", "instance"),
231 Param("const VkAllocationCallbacks*", "pAllocator")]),
233 Proto("VkResult", "EnumeratePhysicalDevices",
234 [Param("VkInstance", "instance"),
235 Param("uint32_t*", "pPhysicalDeviceCount"),
236 Param("VkPhysicalDevice*", "pPhysicalDevices")]),
238 Proto("void", "GetPhysicalDeviceFeatures",
239 [Param("VkPhysicalDevice", "physicalDevice"),
240 Param("VkPhysicalDeviceFeatures*", "pFeatures")]),
242 Proto("void", "GetPhysicalDeviceFormatProperties",
243 [Param("VkPhysicalDevice", "physicalDevice"),
244 Param("VkFormat", "format"),
245 Param("VkFormatProperties*", "pFormatProperties")]),
247 Proto("VkResult", "GetPhysicalDeviceImageFormatProperties",
248 [Param("VkPhysicalDevice", "physicalDevice"),
249 Param("VkFormat", "format"),
250 Param("VkImageType", "type"),
251 Param("VkImageTiling", "tiling"),
252 Param("VkImageUsageFlags", "usage"),
253 Param("VkImageCreateFlags", "flags"),
254 Param("VkImageFormatProperties*", "pImageFormatProperties")]),
256 Proto("void", "GetPhysicalDeviceProperties",
257 [Param("VkPhysicalDevice", "physicalDevice"),
258 Param("VkPhysicalDeviceProperties*", "pProperties")]),
260 Proto("void", "GetPhysicalDeviceQueueFamilyProperties",
261 [Param("VkPhysicalDevice", "physicalDevice"),
262 Param("uint32_t*", "pQueueFamilyPropertyCount"),
263 Param("VkQueueFamilyProperties*", "pQueueFamilyProperties")]),
265 Proto("void", "GetPhysicalDeviceMemoryProperties",
266 [Param("VkPhysicalDevice", "physicalDevice"),
267 Param("VkPhysicalDeviceMemoryProperties*", "pMemoryProperties")]),
269 Proto("PFN_vkVoidFunction", "GetInstanceProcAddr",
270 [Param("VkInstance", "instance"),
271 Param("const char*", "pName")]),
273 Proto("PFN_vkVoidFunction", "GetDeviceProcAddr",
274 [Param("VkDevice", "device"),
275 Param("const char*", "pName")]),
277 Proto("VkResult", "CreateDevice",
278 [Param("VkPhysicalDevice", "physicalDevice"),
279 Param("const VkDeviceCreateInfo*", "pCreateInfo"),
280 Param("const VkAllocationCallbacks*", "pAllocator"),
281 Param("VkDevice*", "pDevice")]),
283 Proto("void", "DestroyDevice",
284 [Param("VkDevice", "device"),
285 Param("const VkAllocationCallbacks*", "pAllocator")]),
287 Proto("VkResult", "EnumerateInstanceExtensionProperties",
288 [Param("const char*", "pLayerName"),
289 Param("uint32_t*", "pPropertyCount"),
290 Param("VkExtensionProperties*", "pProperties")]),
292 Proto("VkResult", "EnumerateDeviceExtensionProperties",
293 [Param("VkPhysicalDevice", "physicalDevice"),
294 Param("const char*", "pLayerName"),
295 Param("uint32_t*", "pPropertyCount"),
296 Param("VkExtensionProperties*", "pProperties")]),
298 Proto("VkResult", "EnumerateInstanceLayerProperties",
299 [Param("uint32_t*", "pPropertyCount"),
300 Param("VkLayerProperties*", "pProperties")]),
302 Proto("VkResult", "EnumerateDeviceLayerProperties",
303 [Param("VkPhysicalDevice", "physicalDevice"),
304 Param("uint32_t*", "pPropertyCount"),
305 Param("VkLayerProperties*", "pProperties")]),
307 Proto("void", "GetDeviceQueue",
308 [Param("VkDevice", "device"),
309 Param("uint32_t", "queueFamilyIndex"),
310 Param("uint32_t", "queueIndex"),
311 Param("VkQueue*", "pQueue")]),
313 Proto("VkResult", "QueueSubmit",
314 [Param("VkQueue", "queue"),
315 Param("uint32_t", "submitCount"),
316 Param("const VkSubmitInfo*", "pSubmits"),
317 Param("VkFence", "fence")]),
319 Proto("VkResult", "QueueWaitIdle",
320 [Param("VkQueue", "queue")]),
322 Proto("VkResult", "DeviceWaitIdle",
323 [Param("VkDevice", "device")]),
325 Proto("VkResult", "AllocateMemory",
326 [Param("VkDevice", "device"),
327 Param("const VkMemoryAllocateInfo*", "pAllocateInfo"),
328 Param("const VkAllocationCallbacks*", "pAllocator"),
329 Param("VkDeviceMemory*", "pMemory")]),
331 Proto("void", "FreeMemory",
332 [Param("VkDevice", "device"),
333 Param("VkDeviceMemory", "memory"),
334 Param("const VkAllocationCallbacks*", "pAllocator")]),
336 Proto("VkResult", "MapMemory",
337 [Param("VkDevice", "device"),
338 Param("VkDeviceMemory", "memory"),
339 Param("VkDeviceSize", "offset"),
340 Param("VkDeviceSize", "size"),
341 Param("VkMemoryMapFlags", "flags"),
342 Param("void**", "ppData")]),
344 Proto("void", "UnmapMemory",
345 [Param("VkDevice", "device"),
346 Param("VkDeviceMemory", "memory")]),
348 Proto("VkResult", "FlushMappedMemoryRanges",
349 [Param("VkDevice", "device"),
350 Param("uint32_t", "memoryRangeCount"),
351 Param("const VkMappedMemoryRange*", "pMemoryRanges")]),
353 Proto("VkResult", "InvalidateMappedMemoryRanges",
354 [Param("VkDevice", "device"),
355 Param("uint32_t", "memoryRangeCount"),
356 Param("const VkMappedMemoryRange*", "pMemoryRanges")]),
358 Proto("void", "GetDeviceMemoryCommitment",
359 [Param("VkDevice", "device"),
360 Param("VkDeviceMemory", "memory"),
361 Param("VkDeviceSize*", "pCommittedMemoryInBytes")]),
363 Proto("VkResult", "BindBufferMemory",
364 [Param("VkDevice", "device"),
365 Param("VkBuffer", "buffer"),
366 Param("VkDeviceMemory", "memory"),
367 Param("VkDeviceSize", "memoryOffset")]),
369 Proto("VkResult", "BindImageMemory",
370 [Param("VkDevice", "device"),
371 Param("VkImage", "image"),
372 Param("VkDeviceMemory", "memory"),
373 Param("VkDeviceSize", "memoryOffset")]),
375 Proto("void", "GetBufferMemoryRequirements",
376 [Param("VkDevice", "device"),
377 Param("VkBuffer", "buffer"),
378 Param("VkMemoryRequirements*", "pMemoryRequirements")]),
380 Proto("void", "GetImageMemoryRequirements",
381 [Param("VkDevice", "device"),
382 Param("VkImage", "image"),
383 Param("VkMemoryRequirements*", "pMemoryRequirements")]),
385 Proto("void", "GetImageSparseMemoryRequirements",
386 [Param("VkDevice", "device"),
387 Param("VkImage", "image"),
388 Param("uint32_t*", "pSparseMemoryRequirementCount"),
389 Param("VkSparseImageMemoryRequirements*", "pSparseMemoryRequirements")]),
391 Proto("void", "GetPhysicalDeviceSparseImageFormatProperties",
392 [Param("VkPhysicalDevice", "physicalDevice"),
393 Param("VkFormat", "format"),
394 Param("VkImageType", "type"),
395 Param("VkSampleCountFlagBits", "samples"),
396 Param("VkImageUsageFlags", "usage"),
397 Param("VkImageTiling", "tiling"),
398 Param("uint32_t*", "pPropertyCount"),
399 Param("VkSparseImageFormatProperties*", "pProperties")]),
401 Proto("VkResult", "QueueBindSparse",
402 [Param("VkQueue", "queue"),
403 Param("uint32_t", "bindInfoCount"),
404 Param("const VkBindSparseInfo*", "pBindInfo"),
405 Param("VkFence", "fence")]),
407 Proto("VkResult", "CreateFence",
408 [Param("VkDevice", "device"),
409 Param("const VkFenceCreateInfo*", "pCreateInfo"),
410 Param("const VkAllocationCallbacks*", "pAllocator"),
411 Param("VkFence*", "pFence")]),
413 Proto("void", "DestroyFence",
414 [Param("VkDevice", "device"),
415 Param("VkFence", "fence"),
416 Param("const VkAllocationCallbacks*", "pAllocator")]),
418 Proto("VkResult", "ResetFences",
419 [Param("VkDevice", "device"),
420 Param("uint32_t", "fenceCount"),
421 Param("const VkFence*", "pFences")]),
423 Proto("VkResult", "GetFenceStatus",
424 [Param("VkDevice", "device"),
425 Param("VkFence", "fence")]),
427 Proto("VkResult", "WaitForFences",
428 [Param("VkDevice", "device"),
429 Param("uint32_t", "fenceCount"),
430 Param("const VkFence*", "pFences"),
431 Param("VkBool32", "waitAll"),
432 Param("uint64_t", "timeout")]),
434 Proto("VkResult", "CreateSemaphore",
435 [Param("VkDevice", "device"),
436 Param("const VkSemaphoreCreateInfo*", "pCreateInfo"),
437 Param("const VkAllocationCallbacks*", "pAllocator"),
438 Param("VkSemaphore*", "pSemaphore")]),
440 Proto("void", "DestroySemaphore",
441 [Param("VkDevice", "device"),
442 Param("VkSemaphore", "semaphore"),
443 Param("const VkAllocationCallbacks*", "pAllocator")]),
445 Proto("VkResult", "CreateEvent",
446 [Param("VkDevice", "device"),
447 Param("const VkEventCreateInfo*", "pCreateInfo"),
448 Param("const VkAllocationCallbacks*", "pAllocator"),
449 Param("VkEvent*", "pEvent")]),
451 Proto("void", "DestroyEvent",
452 [Param("VkDevice", "device"),
453 Param("VkEvent", "event"),
454 Param("const VkAllocationCallbacks*", "pAllocator")]),
456 Proto("VkResult", "GetEventStatus",
457 [Param("VkDevice", "device"),
458 Param("VkEvent", "event")]),
460 Proto("VkResult", "SetEvent",
461 [Param("VkDevice", "device"),
462 Param("VkEvent", "event")]),
464 Proto("VkResult", "ResetEvent",
465 [Param("VkDevice", "device"),
466 Param("VkEvent", "event")]),
468 Proto("VkResult", "CreateQueryPool",
469 [Param("VkDevice", "device"),
470 Param("const VkQueryPoolCreateInfo*", "pCreateInfo"),
471 Param("const VkAllocationCallbacks*", "pAllocator"),
472 Param("VkQueryPool*", "pQueryPool")]),
474 Proto("void", "DestroyQueryPool",
475 [Param("VkDevice", "device"),
476 Param("VkQueryPool", "queryPool"),
477 Param("const VkAllocationCallbacks*", "pAllocator")]),
479 Proto("VkResult", "GetQueryPoolResults",
480 [Param("VkDevice", "device"),
481 Param("VkQueryPool", "queryPool"),
482 Param("uint32_t", "firstQuery"),
483 Param("uint32_t", "queryCount"),
484 Param("size_t", "dataSize"),
485 Param("void*", "pData"),
486 Param("VkDeviceSize", "stride"),
487 Param("VkQueryResultFlags", "flags")]),
489 Proto("VkResult", "CreateBuffer",
490 [Param("VkDevice", "device"),
491 Param("const VkBufferCreateInfo*", "pCreateInfo"),
492 Param("const VkAllocationCallbacks*", "pAllocator"),
493 Param("VkBuffer*", "pBuffer")]),
495 Proto("void", "DestroyBuffer",
496 [Param("VkDevice", "device"),
497 Param("VkBuffer", "buffer"),
498 Param("const VkAllocationCallbacks*", "pAllocator")]),
500 Proto("VkResult", "CreateBufferView",
501 [Param("VkDevice", "device"),
502 Param("const VkBufferViewCreateInfo*", "pCreateInfo"),
503 Param("const VkAllocationCallbacks*", "pAllocator"),
504 Param("VkBufferView*", "pView")]),
506 Proto("void", "DestroyBufferView",
507 [Param("VkDevice", "device"),
508 Param("VkBufferView", "bufferView"),
509 Param("const VkAllocationCallbacks*", "pAllocator")]),
511 Proto("VkResult", "CreateImage",
512 [Param("VkDevice", "device"),
513 Param("const VkImageCreateInfo*", "pCreateInfo"),
514 Param("const VkAllocationCallbacks*", "pAllocator"),
515 Param("VkImage*", "pImage")]),
517 Proto("void", "DestroyImage",
518 [Param("VkDevice", "device"),
519 Param("VkImage", "image"),
520 Param("const VkAllocationCallbacks*", "pAllocator")]),
522 Proto("void", "GetImageSubresourceLayout",
523 [Param("VkDevice", "device"),
524 Param("VkImage", "image"),
525 Param("const VkImageSubresource*", "pSubresource"),
526 Param("VkSubresourceLayout*", "pLayout")]),
528 Proto("VkResult", "CreateImageView",
529 [Param("VkDevice", "device"),
530 Param("const VkImageViewCreateInfo*", "pCreateInfo"),
531 Param("const VkAllocationCallbacks*", "pAllocator"),
532 Param("VkImageView*", "pView")]),
534 Proto("void", "DestroyImageView",
535 [Param("VkDevice", "device"),
536 Param("VkImageView", "imageView"),
537 Param("const VkAllocationCallbacks*", "pAllocator")]),
539 Proto("VkResult", "CreateShaderModule",
540 [Param("VkDevice", "device"),
541 Param("const VkShaderModuleCreateInfo*", "pCreateInfo"),
542 Param("const VkAllocationCallbacks*", "pAllocator"),
543 Param("VkShaderModule*", "pShaderModule")]),
545 Proto("void", "DestroyShaderModule",
546 [Param("VkDevice", "device"),
547 Param("VkShaderModule", "shaderModule"),
548 Param("const VkAllocationCallbacks*", "pAllocator")]),
550 Proto("VkResult", "CreatePipelineCache",
551 [Param("VkDevice", "device"),
552 Param("const VkPipelineCacheCreateInfo*", "pCreateInfo"),
553 Param("const VkAllocationCallbacks*", "pAllocator"),
554 Param("VkPipelineCache*", "pPipelineCache")]),
556 Proto("void", "DestroyPipelineCache",
557 [Param("VkDevice", "device"),
558 Param("VkPipelineCache", "pipelineCache"),
559 Param("const VkAllocationCallbacks*", "pAllocator")]),
561 Proto("VkResult", "GetPipelineCacheData",
562 [Param("VkDevice", "device"),
563 Param("VkPipelineCache", "pipelineCache"),
564 Param("size_t*", "pDataSize"),
565 Param("void*", "pData")]),
567 Proto("VkResult", "MergePipelineCaches",
568 [Param("VkDevice", "device"),
569 Param("VkPipelineCache", "dstCache"),
570 Param("uint32_t", "srcCacheCount"),
571 Param("const VkPipelineCache*", "pSrcCaches")]),
573 Proto("VkResult", "CreateGraphicsPipelines",
574 [Param("VkDevice", "device"),
575 Param("VkPipelineCache", "pipelineCache"),
576 Param("uint32_t", "createInfoCount"),
577 Param("const VkGraphicsPipelineCreateInfo*", "pCreateInfos"),
578 Param("const VkAllocationCallbacks*", "pAllocator"),
579 Param("VkPipeline*", "pPipelines")]),
581 Proto("VkResult", "CreateComputePipelines",
582 [Param("VkDevice", "device"),
583 Param("VkPipelineCache", "pipelineCache"),
584 Param("uint32_t", "createInfoCount"),
585 Param("const VkComputePipelineCreateInfo*", "pCreateInfos"),
586 Param("const VkAllocationCallbacks*", "pAllocator"),
587 Param("VkPipeline*", "pPipelines")]),
589 Proto("void", "DestroyPipeline",
590 [Param("VkDevice", "device"),
591 Param("VkPipeline", "pipeline"),
592 Param("const VkAllocationCallbacks*", "pAllocator")]),
594 Proto("VkResult", "CreatePipelineLayout",
595 [Param("VkDevice", "device"),
596 Param("const VkPipelineLayoutCreateInfo*", "pCreateInfo"),
597 Param("const VkAllocationCallbacks*", "pAllocator"),
598 Param("VkPipelineLayout*", "pPipelineLayout")]),
600 Proto("void", "DestroyPipelineLayout",
601 [Param("VkDevice", "device"),
602 Param("VkPipelineLayout", "pipelineLayout"),
603 Param("const VkAllocationCallbacks*", "pAllocator")]),
605 Proto("VkResult", "CreateSampler",
606 [Param("VkDevice", "device"),
607 Param("const VkSamplerCreateInfo*", "pCreateInfo"),
608 Param("const VkAllocationCallbacks*", "pAllocator"),
609 Param("VkSampler*", "pSampler")]),
611 Proto("void", "DestroySampler",
612 [Param("VkDevice", "device"),
613 Param("VkSampler", "sampler"),
614 Param("const VkAllocationCallbacks*", "pAllocator")]),
616 Proto("VkResult", "CreateDescriptorSetLayout",
617 [Param("VkDevice", "device"),
618 Param("const VkDescriptorSetLayoutCreateInfo*", "pCreateInfo"),
619 Param("const VkAllocationCallbacks*", "pAllocator"),
620 Param("VkDescriptorSetLayout*", "pSetLayout")]),
622 Proto("void", "DestroyDescriptorSetLayout",
623 [Param("VkDevice", "device"),
624 Param("VkDescriptorSetLayout", "descriptorSetLayout"),
625 Param("const VkAllocationCallbacks*", "pAllocator")]),
627 Proto("VkResult", "CreateDescriptorPool",
628 [Param("VkDevice", "device"),
629 Param("const VkDescriptorPoolCreateInfo*", "pCreateInfo"),
630 Param("const VkAllocationCallbacks*", "pAllocator"),
631 Param("VkDescriptorPool*", "pDescriptorPool")]),
633 Proto("void", "DestroyDescriptorPool",
634 [Param("VkDevice", "device"),
635 Param("VkDescriptorPool", "descriptorPool"),
636 Param("const VkAllocationCallbacks*", "pAllocator")]),
638 Proto("VkResult", "ResetDescriptorPool",
639 [Param("VkDevice", "device"),
640 Param("VkDescriptorPool", "descriptorPool"),
641 Param("VkDescriptorPoolResetFlags", "flags")]),
643 Proto("VkResult", "AllocateDescriptorSets",
644 [Param("VkDevice", "device"),
645 Param("const VkDescriptorSetAllocateInfo*", "pAllocateInfo"),
646 Param("VkDescriptorSet*", "pDescriptorSets")]),
648 Proto("VkResult", "FreeDescriptorSets",
649 [Param("VkDevice", "device"),
650 Param("VkDescriptorPool", "descriptorPool"),
651 Param("uint32_t", "descriptorSetCount"),
652 Param("const VkDescriptorSet*", "pDescriptorSets")]),
654 Proto("void", "UpdateDescriptorSets",
655 [Param("VkDevice", "device"),
656 Param("uint32_t", "descriptorWriteCount"),
657 Param("const VkWriteDescriptorSet*", "pDescriptorWrites"),
658 Param("uint32_t", "descriptorCopyCount"),
659 Param("const VkCopyDescriptorSet*", "pDescriptorCopies")]),
661 Proto("VkResult", "CreateFramebuffer",
662 [Param("VkDevice", "device"),
663 Param("const VkFramebufferCreateInfo*", "pCreateInfo"),
664 Param("const VkAllocationCallbacks*", "pAllocator"),
665 Param("VkFramebuffer*", "pFramebuffer")]),
667 Proto("void", "DestroyFramebuffer",
668 [Param("VkDevice", "device"),
669 Param("VkFramebuffer", "framebuffer"),
670 Param("const VkAllocationCallbacks*", "pAllocator")]),
672 Proto("VkResult", "CreateRenderPass",
673 [Param("VkDevice", "device"),
674 Param("const VkRenderPassCreateInfo*", "pCreateInfo"),
675 Param("const VkAllocationCallbacks*", "pAllocator"),
676 Param("VkRenderPass*", "pRenderPass")]),
678 Proto("void", "DestroyRenderPass",
679 [Param("VkDevice", "device"),
680 Param("VkRenderPass", "renderPass"),
681 Param("const VkAllocationCallbacks*", "pAllocator")]),
683 Proto("void", "GetRenderAreaGranularity",
684 [Param("VkDevice", "device"),
685 Param("VkRenderPass", "renderPass"),
686 Param("VkExtent2D*", "pGranularity")]),
688 Proto("VkResult", "CreateCommandPool",
689 [Param("VkDevice", "device"),
690 Param("const VkCommandPoolCreateInfo*", "pCreateInfo"),
691 Param("const VkAllocationCallbacks*", "pAllocator"),
692 Param("VkCommandPool*", "pCommandPool")]),
694 Proto("void", "DestroyCommandPool",
695 [Param("VkDevice", "device"),
696 Param("VkCommandPool", "commandPool"),
697 Param("const VkAllocationCallbacks*", "pAllocator")]),
699 Proto("VkResult", "ResetCommandPool",
700 [Param("VkDevice", "device"),
701 Param("VkCommandPool", "commandPool"),
702 Param("VkCommandPoolResetFlags", "flags")]),
704 Proto("VkResult", "AllocateCommandBuffers",
705 [Param("VkDevice", "device"),
706 Param("const VkCommandBufferAllocateInfo*", "pAllocateInfo"),
707 Param("VkCommandBuffer*", "pCommandBuffers")]),
709 Proto("void", "FreeCommandBuffers",
710 [Param("VkDevice", "device"),
711 Param("VkCommandPool", "commandPool"),
712 Param("uint32_t", "commandBufferCount"),
713 Param("const VkCommandBuffer*", "pCommandBuffers")]),
715 Proto("VkResult", "BeginCommandBuffer",
716 [Param("VkCommandBuffer", "commandBuffer"),
717 Param("const VkCommandBufferBeginInfo*", "pBeginInfo")]),
719 Proto("VkResult", "EndCommandBuffer",
720 [Param("VkCommandBuffer", "commandBuffer")]),
722 Proto("VkResult", "ResetCommandBuffer",
723 [Param("VkCommandBuffer", "commandBuffer"),
724 Param("VkCommandBufferResetFlags", "flags")]),
726 Proto("void", "CmdBindPipeline",
727 [Param("VkCommandBuffer", "commandBuffer"),
728 Param("VkPipelineBindPoint", "pipelineBindPoint"),
729 Param("VkPipeline", "pipeline")]),
731 Proto("void", "CmdSetViewport",
732 [Param("VkCommandBuffer", "commandBuffer"),
733 Param("uint32_t", "firstViewport"),
734 Param("uint32_t", "viewportCount"),
735 Param("const VkViewport*", "pViewports")]),
737 Proto("void", "CmdSetScissor",
738 [Param("VkCommandBuffer", "commandBuffer"),
739 Param("uint32_t", "firstScissor"),
740 Param("uint32_t", "scissorCount"),
741 Param("const VkRect2D*", "pScissors")]),
743 Proto("void", "CmdSetLineWidth",
744 [Param("VkCommandBuffer", "commandBuffer"),
745 Param("float", "lineWidth")]),
747 Proto("void", "CmdSetDepthBias",
748 [Param("VkCommandBuffer", "commandBuffer"),
749 Param("float", "depthBiasConstantFactor"),
750 Param("float", "depthBiasClamp"),
751 Param("float", "depthBiasSlopeFactor")]),
753 Proto("void", "CmdSetBlendConstants",
754 [Param("VkCommandBuffer", "commandBuffer"),
755 Param("const float[4]", "blendConstants")]),
757 Proto("void", "CmdSetDepthBounds",
758 [Param("VkCommandBuffer", "commandBuffer"),
759 Param("float", "minDepthBounds"),
760 Param("float", "maxDepthBounds")]),
762 Proto("void", "CmdSetStencilCompareMask",
763 [Param("VkCommandBuffer", "commandBuffer"),
764 Param("VkStencilFaceFlags", "faceMask"),
765 Param("uint32_t", "compareMask")]),
767 Proto("void", "CmdSetStencilWriteMask",
768 [Param("VkCommandBuffer", "commandBuffer"),
769 Param("VkStencilFaceFlags", "faceMask"),
770 Param("uint32_t", "writeMask")]),
772 Proto("void", "CmdSetStencilReference",
773 [Param("VkCommandBuffer", "commandBuffer"),
774 Param("VkStencilFaceFlags", "faceMask"),
775 Param("uint32_t", "reference")]),
777 Proto("void", "CmdBindDescriptorSets",
778 [Param("VkCommandBuffer", "commandBuffer"),
779 Param("VkPipelineBindPoint", "pipelineBindPoint"),
780 Param("VkPipelineLayout", "layout"),
781 Param("uint32_t", "firstSet"),
782 Param("uint32_t", "descriptorSetCount"),
783 Param("const VkDescriptorSet*", "pDescriptorSets"),
784 Param("uint32_t", "dynamicOffsetCount"),
785 Param("const uint32_t*", "pDynamicOffsets")]),
787 Proto("void", "CmdBindIndexBuffer",
788 [Param("VkCommandBuffer", "commandBuffer"),
789 Param("VkBuffer", "buffer"),
790 Param("VkDeviceSize", "offset"),
791 Param("VkIndexType", "indexType")]),
793 Proto("void", "CmdBindVertexBuffers",
794 [Param("VkCommandBuffer", "commandBuffer"),
795 Param("uint32_t", "firstBinding"),
796 Param("uint32_t", "bindingCount"),
797 Param("const VkBuffer*", "pBuffers"),
798 Param("const VkDeviceSize*", "pOffsets")]),
800 Proto("void", "CmdDraw",
801 [Param("VkCommandBuffer", "commandBuffer"),
802 Param("uint32_t", "vertexCount"),
803 Param("uint32_t", "instanceCount"),
804 Param("uint32_t", "firstVertex"),
805 Param("uint32_t", "firstInstance")]),
807 Proto("void", "CmdDrawIndexed",
808 [Param("VkCommandBuffer", "commandBuffer"),
809 Param("uint32_t", "indexCount"),
810 Param("uint32_t", "instanceCount"),
811 Param("uint32_t", "firstIndex"),
812 Param("int32_t", "vertexOffset"),
813 Param("uint32_t", "firstInstance")]),
815 Proto("void", "CmdDrawIndirect",
816 [Param("VkCommandBuffer", "commandBuffer"),
817 Param("VkBuffer", "buffer"),
818 Param("VkDeviceSize", "offset"),
819 Param("uint32_t", "drawCount"),
820 Param("uint32_t", "stride")]),
822 Proto("void", "CmdDrawIndexedIndirect",
823 [Param("VkCommandBuffer", "commandBuffer"),
824 Param("VkBuffer", "buffer"),
825 Param("VkDeviceSize", "offset"),
826 Param("uint32_t", "drawCount"),
827 Param("uint32_t", "stride")]),
829 Proto("void", "CmdDispatch",
830 [Param("VkCommandBuffer", "commandBuffer"),
831 Param("uint32_t", "x"),
832 Param("uint32_t", "y"),
833 Param("uint32_t", "z")]),
835 Proto("void", "CmdDispatchIndirect",
836 [Param("VkCommandBuffer", "commandBuffer"),
837 Param("VkBuffer", "buffer"),
838 Param("VkDeviceSize", "offset")]),
840 Proto("void", "CmdCopyBuffer",
841 [Param("VkCommandBuffer", "commandBuffer"),
842 Param("VkBuffer", "srcBuffer"),
843 Param("VkBuffer", "dstBuffer"),
844 Param("uint32_t", "regionCount"),
845 Param("const VkBufferCopy*", "pRegions")]),
847 Proto("void", "CmdCopyImage",
848 [Param("VkCommandBuffer", "commandBuffer"),
849 Param("VkImage", "srcImage"),
850 Param("VkImageLayout", "srcImageLayout"),
851 Param("VkImage", "dstImage"),
852 Param("VkImageLayout", "dstImageLayout"),
853 Param("uint32_t", "regionCount"),
854 Param("const VkImageCopy*", "pRegions")]),
856 Proto("void", "CmdBlitImage",
857 [Param("VkCommandBuffer", "commandBuffer"),
858 Param("VkImage", "srcImage"),
859 Param("VkImageLayout", "srcImageLayout"),
860 Param("VkImage", "dstImage"),
861 Param("VkImageLayout", "dstImageLayout"),
862 Param("uint32_t", "regionCount"),
863 Param("const VkImageBlit*", "pRegions"),
864 Param("VkFilter", "filter")]),
866 Proto("void", "CmdCopyBufferToImage",
867 [Param("VkCommandBuffer", "commandBuffer"),
868 Param("VkBuffer", "srcBuffer"),
869 Param("VkImage", "dstImage"),
870 Param("VkImageLayout", "dstImageLayout"),
871 Param("uint32_t", "regionCount"),
872 Param("const VkBufferImageCopy*", "pRegions")]),
874 Proto("void", "CmdCopyImageToBuffer",
875 [Param("VkCommandBuffer", "commandBuffer"),
876 Param("VkImage", "srcImage"),
877 Param("VkImageLayout", "srcImageLayout"),
878 Param("VkBuffer", "dstBuffer"),
879 Param("uint32_t", "regionCount"),
880 Param("const VkBufferImageCopy*", "pRegions")]),
882 Proto("void", "CmdUpdateBuffer",
883 [Param("VkCommandBuffer", "commandBuffer"),
884 Param("VkBuffer", "dstBuffer"),
885 Param("VkDeviceSize", "dstOffset"),
886 Param("VkDeviceSize", "dataSize"),
887 Param("const void*", "pData")]),
889 Proto("void", "CmdFillBuffer",
890 [Param("VkCommandBuffer", "commandBuffer"),
891 Param("VkBuffer", "dstBuffer"),
892 Param("VkDeviceSize", "dstOffset"),
893 Param("VkDeviceSize", "size"),
894 Param("uint32_t", "data")]),
896 Proto("void", "CmdClearColorImage",
897 [Param("VkCommandBuffer", "commandBuffer"),
898 Param("VkImage", "image"),
899 Param("VkImageLayout", "imageLayout"),
900 Param("const VkClearColorValue*", "pColor"),
901 Param("uint32_t", "rangeCount"),
902 Param("const VkImageSubresourceRange*", "pRanges")]),
904 Proto("void", "CmdClearDepthStencilImage",
905 [Param("VkCommandBuffer", "commandBuffer"),
906 Param("VkImage", "image"),
907 Param("VkImageLayout", "imageLayout"),
908 Param("const VkClearDepthStencilValue*", "pDepthStencil"),
909 Param("uint32_t", "rangeCount"),
910 Param("const VkImageSubresourceRange*", "pRanges")]),
912 Proto("void", "CmdClearAttachments",
913 [Param("VkCommandBuffer", "commandBuffer"),
914 Param("uint32_t", "attachmentCount"),
915 Param("const VkClearAttachment*", "pAttachments"),
916 Param("uint32_t", "rectCount"),
917 Param("const VkClearRect*", "pRects")]),
919 Proto("void", "CmdResolveImage",
920 [Param("VkCommandBuffer", "commandBuffer"),
921 Param("VkImage", "srcImage"),
922 Param("VkImageLayout", "srcImageLayout"),
923 Param("VkImage", "dstImage"),
924 Param("VkImageLayout", "dstImageLayout"),
925 Param("uint32_t", "regionCount"),
926 Param("const VkImageResolve*", "pRegions")]),
928 Proto("void", "CmdSetEvent",
929 [Param("VkCommandBuffer", "commandBuffer"),
930 Param("VkEvent", "event"),
931 Param("VkPipelineStageFlags", "stageMask")]),
933 Proto("void", "CmdResetEvent",
934 [Param("VkCommandBuffer", "commandBuffer"),
935 Param("VkEvent", "event"),
936 Param("VkPipelineStageFlags", "stageMask")]),
938 Proto("void", "CmdWaitEvents",
939 [Param("VkCommandBuffer", "commandBuffer"),
940 Param("uint32_t", "eventCount"),
941 Param("const VkEvent*", "pEvents"),
942 Param("VkPipelineStageFlags", "srcStageMask"),
943 Param("VkPipelineStageFlags", "dstStageMask"),
944 Param("uint32_t", "memoryBarrierCount"),
945 Param("const VkMemoryBarrier*", "pMemoryBarriers"),
946 Param("uint32_t", "bufferMemoryBarrierCount"),
947 Param("const VkBufferMemoryBarrier*", "pBufferMemoryBarriers"),
948 Param("uint32_t", "imageMemoryBarrierCount"),
949 Param("const VkImageMemoryBarrier*", "pImageMemoryBarriers")]),
951 Proto("void", "CmdPipelineBarrier",
952 [Param("VkCommandBuffer", "commandBuffer"),
953 Param("VkPipelineStageFlags", "srcStageMask"),
954 Param("VkPipelineStageFlags", "dstStageMask"),
955 Param("VkDependencyFlags", "dependencyFlags"),
956 Param("uint32_t", "memoryBarrierCount"),
957 Param("const VkMemoryBarrier*", "pMemoryBarriers"),
958 Param("uint32_t", "bufferMemoryBarrierCount"),
959 Param("const VkBufferMemoryBarrier*", "pBufferMemoryBarriers"),
960 Param("uint32_t", "imageMemoryBarrierCount"),
961 Param("const VkImageMemoryBarrier*", "pImageMemoryBarriers")]),
963 Proto("void", "CmdBeginQuery",
964 [Param("VkCommandBuffer", "commandBuffer"),
965 Param("VkQueryPool", "queryPool"),
966 Param("uint32_t", "query"),
967 Param("VkQueryControlFlags", "flags")]),
969 Proto("void", "CmdEndQuery",
970 [Param("VkCommandBuffer", "commandBuffer"),
971 Param("VkQueryPool", "queryPool"),
972 Param("uint32_t", "query")]),
974 Proto("void", "CmdResetQueryPool",
975 [Param("VkCommandBuffer", "commandBuffer"),
976 Param("VkQueryPool", "queryPool"),
977 Param("uint32_t", "firstQuery"),
978 Param("uint32_t", "queryCount")]),
980 Proto("void", "CmdWriteTimestamp",
981 [Param("VkCommandBuffer", "commandBuffer"),
982 Param("VkPipelineStageFlagBits", "pipelineStage"),
983 Param("VkQueryPool", "queryPool"),
984 Param("uint32_t", "query")]),
986 Proto("void", "CmdCopyQueryPoolResults",
987 [Param("VkCommandBuffer", "commandBuffer"),
988 Param("VkQueryPool", "queryPool"),
989 Param("uint32_t", "firstQuery"),
990 Param("uint32_t", "queryCount"),
991 Param("VkBuffer", "dstBuffer"),
992 Param("VkDeviceSize", "dstOffset"),
993 Param("VkDeviceSize", "stride"),
994 Param("VkQueryResultFlags", "flags")]),
996 Proto("void", "CmdPushConstants",
997 [Param("VkCommandBuffer", "commandBuffer"),
998 Param("VkPipelineLayout", "layout"),
999 Param("VkShaderStageFlags", "stageFlags"),
1000 Param("uint32_t", "offset"),
1001 Param("uint32_t", "size"),
1002 Param("const void*", "pValues")]),
1004 Proto("void", "CmdBeginRenderPass",
1005 [Param("VkCommandBuffer", "commandBuffer"),
1006 Param("const VkRenderPassBeginInfo*", "pRenderPassBegin"),
1007 Param("VkSubpassContents", "contents")]),
1009 Proto("void", "CmdNextSubpass",
1010 [Param("VkCommandBuffer", "commandBuffer"),
1011 Param("VkSubpassContents", "contents")]),
1013 Proto("void", "CmdEndRenderPass",
1014 [Param("VkCommandBuffer", "commandBuffer")]),
1016 Proto("void", "CmdExecuteCommands",
1017 [Param("VkCommandBuffer", "commandBuffer"),
1018 Param("uint32_t", "commandBufferCount"),
1019 Param("const VkCommandBuffer*", "pCommandBuffers")]),
1023 ext_amd_draw_indirect_count = Extension(
1024 name="VK_AMD_draw_indirect_count",
1025 headers=["vulkan/vulkan.h"],
1028 Proto("void", "CmdDrawIndirectCountAMD",
1029 [Param("VkCommandBuffer", "commandBuffer"),
1030 Param("VkBuffer", "buffer"),
1031 Param("VkDeviceSize", "offset"),
1032 Param("VkBuffer", "countBuffer"),
1033 Param("VkDeviceSize", "countBufferOffset"),
1034 Param("uint32_t", "maxDrawCount"),
1035 Param("uint32_t", "stride")]),
1037 Proto("void", "CmdDrawIndexedIndirectCountAMD",
1038 [Param("VkCommandBuffer", "commandBuffer"),
1039 Param("VkBuffer", "buffer"),
1040 Param("VkDeviceSize", "offset"),
1041 Param("VkBuffer", "countBuffer"),
1042 Param("VkDeviceSize", "countBufferOffset"),
1043 Param("uint32_t", "maxDrawCount"),
1044 Param("uint32_t", "stride")]),
1048 ext_nv_external_memory_capabilities = Extension(
1049 name="VK_NV_external_memory_capabilities",
1050 headers=["vulkan/vulkan.h"],
1053 Proto("VkResult", "GetPhysicalDeviceExternalImageFormatPropertiesNV",
1054 [Param("VkPhysicalDevice", "physicalDevice"),
1055 Param("VkFormat", "format"),
1056 Param("VkImageType", "type"),
1057 Param("VkImageTiling", "tiling"),
1058 Param("VkImageUsageFlags", "usage"),
1059 Param("VkImageCreateFlags", "flags"),
1060 Param("VkExternalMemoryHandleTypeFlagsNV", "externalHandleType"),
1061 Param("VkExternalImageFormatPropertiesNV*", "pExternalImageFormatProperties")]),
1065 ext_nv_external_memory_win32 = Extension(
1066 name="VK_NV_external_memory_win32",
1067 headers=["vulkan/vulkan.h"],
1069 ifdef="VK_USE_PLATFORM_WIN32_KHR",
1071 Proto("VkResult", "GetMemoryWin32HandleNV",
1072 [Param("VkDevice", "device"),
1073 Param("VkDeviceMemory", "memory"),
1074 Param("VkExternalMemoryHandleTypeFlagsNV", "handleType"),
1075 Param("HANDLE*", "pHandle")]),
1079 ext_khr_surface = Extension(
1080 name="VK_KHR_surface",
1081 headers=["vulkan/vulkan.h"],
1082 objects=["vkSurfaceKHR"],
1084 Proto("void", "DestroySurfaceKHR",
1085 [Param("VkInstance", "instance"),
1086 Param("VkSurfaceKHR", "surface"),
1087 Param("const VkAllocationCallbacks*", "pAllocator")]),
1089 Proto("VkResult", "GetPhysicalDeviceSurfaceSupportKHR",
1090 [Param("VkPhysicalDevice", "physicalDevice"),
1091 Param("uint32_t", "queueFamilyIndex"),
1092 Param("VkSurfaceKHR", "surface"),
1093 Param("VkBool32*", "pSupported")]),
1095 Proto("VkResult", "GetPhysicalDeviceSurfaceCapabilitiesKHR",
1096 [Param("VkPhysicalDevice", "physicalDevice"),
1097 Param("VkSurfaceKHR", "surface"),
1098 Param("VkSurfaceCapabilitiesKHR*", "pSurfaceCapabilities")]),
1100 Proto("VkResult", "GetPhysicalDeviceSurfaceFormatsKHR",
1101 [Param("VkPhysicalDevice", "physicalDevice"),
1102 Param("VkSurfaceKHR", "surface"),
1103 Param("uint32_t*", "pSurfaceFormatCount"),
1104 Param("VkSurfaceFormatKHR*", "pSurfaceFormats")]),
1106 Proto("VkResult", "GetPhysicalDeviceSurfacePresentModesKHR",
1107 [Param("VkPhysicalDevice", "physicalDevice"),
1108 Param("VkSurfaceKHR", "surface"),
1109 Param("uint32_t*", "pPresentModeCount"),
1110 Param("VkPresentModeKHR*", "pPresentModes")]),
1114 ext_khr_display = Extension(
1115 name="VK_KHR_display",
1116 headers=["vulkan/vulkan.h"],
1117 objects=['VkSurfaceKHR', 'VkDisplayModeKHR'],
1119 Proto("VkResult", "GetPhysicalDeviceDisplayPropertiesKHR",
1120 [Param("VkPhysicalDevice", "physicalDevice"),
1121 Param("uint32_t*", "pPropertyCount"),
1122 Param("VkDisplayPropertiesKHR*", "pProperties")]),
1124 Proto("VkResult", "GetPhysicalDeviceDisplayPlanePropertiesKHR",
1125 [Param("VkPhysicalDevice", "physicalDevice"),
1126 Param("uint32_t*", "pPropertyCount"),
1127 Param("VkDisplayPlanePropertiesKHR*", "pProperties")]),
1129 Proto("VkResult", "GetDisplayPlaneSupportedDisplaysKHR",
1130 [Param("VkPhysicalDevice", "physicalDevice"),
1131 Param("uint32_t", "planeIndex"),
1132 Param("uint32_t*", "pDisplayCount"),
1133 Param("VkDisplayKHR*", "pDisplays")]),
1135 Proto("VkResult", "GetDisplayModePropertiesKHR",
1136 [Param("VkPhysicalDevice", "physicalDevice"),
1137 Param("VkDisplayKHR", "display"),
1138 Param("uint32_t*", "pPropertyCount"),
1139 Param("VkDisplayModePropertiesKHR*", "pProperties")]),
1141 Proto("VkResult", "CreateDisplayModeKHR",
1142 [Param("VkPhysicalDevice", "physicalDevice"),
1143 Param("VkDisplayKHR", "display"),
1144 Param("const VkDisplayModeCreateInfoKHR*", "pCreateInfo"),
1145 Param("const VkAllocationCallbacks*", "pAllocator"),
1146 Param("VkDisplayModeKHR*", "pMode")]),
1148 Proto("VkResult", "GetDisplayPlaneCapabilitiesKHR",
1149 [Param("VkPhysicalDevice", "physicalDevice"),
1150 Param("VkDisplayModeKHR", "mode"),
1151 Param("uint32_t", "planeIndex"),
1152 Param("VkDisplayPlaneCapabilitiesKHR*", "pCapabilities")]),
1154 Proto("VkResult", "CreateDisplayPlaneSurfaceKHR",
1155 [Param("VkInstance", "instance"),
1156 Param("const VkDisplaySurfaceCreateInfoKHR*", "pCreateInfo"),
1157 Param("const VkAllocationCallbacks*", "pAllocator"),
1158 Param("VkSurfaceKHR*", "pSurface")]),
1162 ext_khr_device_swapchain = Extension(
1163 name="VK_KHR_swapchain",
1164 headers=["vulkan/vulkan.h"],
1165 objects=["VkSwapchainKHR"],
1167 Proto("VkResult", "CreateSwapchainKHR",
1168 [Param("VkDevice", "device"),
1169 Param("const VkSwapchainCreateInfoKHR*", "pCreateInfo"),
1170 Param("const VkAllocationCallbacks*", "pAllocator"),
1171 Param("VkSwapchainKHR*", "pSwapchain")]),
1173 Proto("void", "DestroySwapchainKHR",
1174 [Param("VkDevice", "device"),
1175 Param("VkSwapchainKHR", "swapchain"),
1176 Param("const VkAllocationCallbacks*", "pAllocator")]),
1178 Proto("VkResult", "GetSwapchainImagesKHR",
1179 [Param("VkDevice", "device"),
1180 Param("VkSwapchainKHR", "swapchain"),
1181 Param("uint32_t*", "pSwapchainImageCount"),
1182 Param("VkImage*", "pSwapchainImages")]),
1184 Proto("VkResult", "AcquireNextImageKHR",
1185 [Param("VkDevice", "device"),
1186 Param("VkSwapchainKHR", "swapchain"),
1187 Param("uint64_t", "timeout"),
1188 Param("VkSemaphore", "semaphore"),
1189 Param("VkFence", "fence"),
1190 Param("uint32_t*", "pImageIndex")]),
1192 Proto("VkResult", "QueuePresentKHR",
1193 [Param("VkQueue", "queue"),
1194 Param("const VkPresentInfoKHR*", "pPresentInfo")]),
1198 ext_khr_display_swapchain = Extension(
1199 name="VK_KHR_display_swapchain",
1200 headers=["vulkan/vulkan.h"],
1201 objects=["VkDisplayPresentInfoKHR"],
1203 Proto("VkResult", "CreateSharedSwapchainsKHR",
1204 [Param("VkDevice", "device"),
1205 Param("uint32_t", "swapchainCount"),
1206 Param("const VkSwapchainCreateInfoKHR*", "pCreateInfos"),
1207 Param("const VkAllocationCallbacks*", "pAllocator"),
1208 Param("VkSwapchainKHR*", "pSwapchains")]),
1212 ext_khr_xcb_surface = Extension(
1213 name="VK_KHR_xcb_surface",
1214 headers=["vulkan/vulkan.h"],
1217 Proto("VkResult", "CreateXcbSurfaceKHR",
1218 [Param("VkInstance", "instance"),
1219 Param("const VkXcbSurfaceCreateInfoKHR*", "pCreateInfo"),
1220 Param("const VkAllocationCallbacks*", "pAllocator"),
1221 Param("VkSurfaceKHR*", "pSurface")]),
1223 Proto("VkBool32", "GetPhysicalDeviceXcbPresentationSupportKHR",
1224 [Param("VkPhysicalDevice", "physicalDevice"),
1225 Param("uint32_t", "queueFamilyIndex"),
1226 Param("xcb_connection_t*", "connection"),
1227 Param("xcb_visualid_t", "visual_id")]),
1230 ext_khr_xlib_surface = Extension(
1231 name="VK_KHR_xlib_surface",
1232 headers=["vulkan/vulkan.h"],
1234 ifdef="VK_USE_PLATFORM_XLIB_KHR",
1236 Proto("VkResult", "CreateXlibSurfaceKHR",
1237 [Param("VkInstance", "instance"),
1238 Param("const VkXlibSurfaceCreateInfoKHR*", "pCreateInfo"),
1239 Param("const VkAllocationCallbacks*", "pAllocator"),
1240 Param("VkSurfaceKHR*", "pSurface")]),
1242 Proto("VkBool32", "GetPhysicalDeviceXlibPresentationSupportKHR",
1243 [Param("VkPhysicalDevice", "physicalDevice"),
1244 Param("uint32_t", "queueFamilyIndex"),
1245 Param("Display*", "dpy"),
1246 Param("VisualID", "visualID")]),
1249 ext_khr_wayland_surface = Extension(
1250 name="VK_KHR_wayland_surface",
1251 headers=["vulkan/vulkan.h"],
1254 Proto("VkResult", "CreateWaylandSurfaceKHR",
1255 [Param("VkInstance", "instance"),
1256 Param("const VkWaylandSurfaceCreateInfoKHR*", "pCreateInfo"),
1257 Param("const VkAllocationCallbacks*", "pAllocator"),
1258 Param("VkSurfaceKHR*", "pSurface")]),
1260 Proto("VkBool32", "GetPhysicalDeviceWaylandPresentationSupportKHR",
1261 [Param("VkPhysicalDevice", "physicalDevice"),
1262 Param("uint32_t", "queueFamilyIndex"),
1263 Param("struct wl_display*", "display")]),
1266 ext_khr_mir_surface = Extension(
1267 name="VK_KHR_mir_surface",
1268 headers=["vulkan/vulkan.h"],
1271 Proto("VkResult", "CreateMirSurfaceKHR",
1272 [Param("VkInstance", "instance"),
1273 Param("const VkMirSurfaceCreateInfoKHR*", "pCreateInfo"),
1274 Param("const VkAllocationCallbacks*", "pAllocator"),
1275 Param("VkSurfaceKHR*", "pSurface")]),
1277 Proto("VkBool32", "GetPhysicalDeviceMirPresentationSupportKHR",
1278 [Param("VkPhysicalDevice", "physicalDevice"),
1279 Param("uint32_t", "queueFamilyIndex"),
1280 Param("MirConnection*", "connection")]),
1283 ext_khr_android_surface = Extension(
1284 name="VK_KHR_android_surface",
1285 headers=["vulkan/vulkan.h"],
1288 Proto("VkResult", "CreateAndroidSurfaceKHR",
1289 [Param("VkInstance", "instance"),
1290 Param("const VkAndroidSurfaceCreateInfoKHR*", "pCreateInfo"),
1291 Param("const VkAllocationCallbacks*", "pAllocator"),
1292 Param("VkSurfaceKHR*", "pSurface")]),
1295 ext_khr_win32_surface = Extension(
1296 name="VK_KHR_win32_surface",
1297 headers=["vulkan/vulkan.h"],
1300 Proto("VkResult", "CreateWin32SurfaceKHR",
1301 [Param("VkInstance", "instance"),
1302 Param("const VkWin32SurfaceCreateInfoKHR*", "pCreateInfo"),
1303 Param("const VkAllocationCallbacks*", "pAllocator"),
1304 Param("VkSurfaceKHR*", "pSurface")]),
1306 Proto("VkBool32", "GetPhysicalDeviceWin32PresentationSupportKHR",
1307 [Param("VkPhysicalDevice", "physicalDevice"),
1308 Param("uint32_t", "queueFamilyIndex")]),
1311 ext_debug_report = Extension(
1312 name="VK_EXT_debug_report",
1313 headers=["vulkan/vulkan.h"],
1315 "VkDebugReportCallbackEXT",
1318 Proto("VkResult", "CreateDebugReportCallbackEXT",
1319 [Param("VkInstance", "instance"),
1320 Param("const VkDebugReportCallbackCreateInfoEXT*", "pCreateInfo"),
1321 Param("const VkAllocationCallbacks*", "pAllocator"),
1322 Param("VkDebugReportCallbackEXT*", "pCallback")]),
1324 Proto("void", "DestroyDebugReportCallbackEXT",
1325 [Param("VkInstance", "instance"),
1326 Param("VkDebugReportCallbackEXT", "callback"),
1327 Param("const VkAllocationCallbacks*", "pAllocator")]),
1329 Proto("void", "DebugReportMessageEXT",
1330 [Param("VkInstance", "instance"),
1331 Param("VkDebugReportFlagsEXT", "flags"),
1332 Param("VkDebugReportObjectTypeEXT", "objType"),
1333 Param("uint64_t", "object"),
1334 Param("size_t", "location"),
1335 Param("int32_t", "msgCode"),
1336 Param("const char *", "pLayerPrefix"),
1337 Param("const char *", "pMsg")]),
1340 ext_debug_marker = Extension(
1341 name="VK_EXT_debug_marker",
1342 headers=["vulkan/vulkan.h"],
1344 "VkDebugMarkerObjectNameInfoEXT",
1345 "VkDebugMarkerObjectTagInfoEXT",
1346 "VkDebugMarkerMarkerInfoEXT"
1349 Proto("VkResult", "DebugMarkerSetObjectTagEXT",
1350 [Param("VkDevice", "device"),
1351 Param("VkDebugMarkerObjectTagInfoEXT*", "pTagInfo")]),
1353 Proto("VkResult", "DebugMarkerSetObjectNameEXT",
1354 [Param("VkDevice", "device"),
1355 Param("VkDebugMarkerObjectNameInfoEXT*", "pNameInfo")]),
1357 Proto("void", "CmdDebugMarkerBeginEXT",
1358 [Param("VkCommandBuffer", "commandBuffer"),
1359 Param("VkDebugMarkerMarkerInfoEXT*", "pMarkerInfo")]),
1361 Proto("void", "CmdDebugMarkerEndEXT",
1362 [Param("VkCommandBuffer", "commandBuffer")]),
1364 Proto("void", "CmdDebugMarkerInsertEXT",
1365 [Param("VkCommandBuffer", "commandBuffer"),
1366 Param("VkDebugMarkerMarkerInfoEXT*", "pMarkerInfo")]),
1372 if sys.argv[1] == 'AllPlatforms':
1373 extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_xcb_surface,
1374 ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display,
1375 ext_khr_android_surface, ext_khr_display_swapchain]
1376 extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1377 ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1378 ext_khr_display, ext_khr_android_surface, ext_amd_draw_indirect_count,
1379 ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
1380 ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1382 if len(sys.argv) > 3:
1383 if (sys.platform.startswith('win32') or sys.platform.startswith('msys')) and sys.argv[1] != 'Android':
1384 extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1385 ext_khr_display, ext_khr_display_swapchain]
1386 extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1387 ext_khr_display, ext_amd_draw_indirect_count,
1388 ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
1389 ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1390 elif sys.platform.startswith('linux') and sys.argv[1] != 'Android':
1391 extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1392 ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display,
1393 ext_khr_display_swapchain]
1394 extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1395 ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1396 ext_khr_display, ext_amd_draw_indirect_count,
1397 ext_nv_external_memory_capabilities, ext_khr_display_swapchain,
1398 ext_debug_report, ext_debug_marker]
1400 extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1401 ext_khr_display_swapchain]
1402 extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1403 ext_amd_draw_indirect_count, ext_nv_external_memory_capabilities,
1404 ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1406 if sys.argv[1] == 'Win32' or sys.argv[1] == 'msys':
1407 extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1408 ext_khr_display, ext_khr_display_swapchain]
1409 extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1410 ext_khr_display, ext_amd_draw_indirect_count,
1411 ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
1412 ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1413 elif sys.argv[1] == 'Android':
1414 extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1415 ext_khr_display_swapchain]
1416 extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1417 ext_amd_draw_indirect_count, ext_nv_external_memory_capabilities,
1418 ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1419 elif sys.argv[1] == 'Xcb' or sys.argv[1] == 'Xlib' or sys.argv[1] == 'Wayland' or sys.argv[1] == 'Mir' or sys.argv[1] == 'Display':
1420 extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1421 ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1422 ext_khr_display, ext_khr_display_swapchain]
1423 extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1424 ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1425 ext_khr_display, ext_amd_draw_indirect_count,
1426 ext_nv_external_memory_capabilities, ext_khr_display_swapchain,
1427 ext_debug_report, ext_debug_marker]
1429 print('Error: Undefined DisplayServer')
1433 object_dispatch_list = [
1441 object_non_dispatch_list = [
1456 "VkDescriptorSetLayout",
1464 "VkDebugReportCallbackEXT",
1469 object_type_list = object_dispatch_list + object_non_dispatch_list
1474 for ext in extensions:
1475 headers.extend(ext.headers)
1476 objects.extend(ext.objects)
1477 protos.extend(ext.protos)
1479 proto_names = [proto.name for proto in protos]
1484 for ext in extensions_all:
1485 headers_all.extend(ext.headers)
1486 objects_all.extend(ext.objects)
1487 protos_all.extend(ext.protos)
1489 proto_all_names = [proto.name for proto in protos_all]
1491 def parse_vk_h(filename):
1492 # read object and protoype typedefs
1495 with open(filename, "r") as fp:
1498 if line.startswith("VK_DEFINE"):
1499 begin = line.find("(") + 1
1500 end = line.find(",")
1501 # extract the object type
1502 object_lines.append(line[begin:end])
1503 if line.startswith("typedef") and line.endswith(");"):
1504 if "*PFN_vkVoidFunction" in line:
1507 # drop leading "typedef " and trailing ");"
1508 proto_lines.append(line[8:-2])
1510 # parse proto_lines to protos
1512 for line in proto_lines:
1513 first, rest = line.split(" (VKAPI_PTR *PFN_vk")
1514 second, third = rest.split(")(")
1516 # get the return type, no space before "*"
1517 proto_ret = "*".join([t.rstrip() for t in first.split("*")])
1520 proto_name = second.strip()
1522 # get the list of params
1523 param_strs = third.split(", ")
1525 for s in param_strs:
1526 ty, name = s.rsplit(" ", 1)
1528 # no space before "*"
1529 ty = "*".join([t.rstrip() for t in ty.split("*")])
1531 idx = name.rfind("[")
1536 params.append(Param(ty, name))
1538 protos.append(Proto(proto_ret, proto_name, params))
1540 # make them an extension and print
1541 ext = Extension("VK_CORE",
1542 headers=["vulkan/vulkan.h"],
1543 objects=object_lines,
1545 print("core =", str(ext))
1548 print("typedef struct VkLayerDispatchTable_")
1550 for proto in ext.protos:
1551 print(" PFN_vk%s %s;" % (proto.name, proto.name))
1552 print("} VkLayerDispatchTable;")
1554 if __name__ == "__main__":
1555 parse_vk_h("include/vulkan/vulkan.h")