• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1" ""VK API description"""
2
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.
7#
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
11#
12#     http://www.apache.org/licenses/LICENSE-2.0
13#
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.
19#
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>
26
27class Param(object):
28    """A function parameter."""
29
30    def __init__(self, ty, name):
31        self.ty = ty
32        self.name = name
33
34    def c(self):
35        """Return the parameter in C."""
36        idx = self.ty.find("[")
37
38        # arrays have a different syntax
39        if idx >= 0:
40            return "%s %s%s" % (self.ty[:idx], self.name, self.ty[idx:])
41        else:
42            return "%s %s" % (self.ty, self.name)
43
44    def indirection_level(self):
45        """Return the level of indirection."""
46        return self.ty.count("*") + self.ty.count("[")
47
48    def dereferenced_type(self, level=0):
49        """Return the type after dereferencing."""
50        if not level:
51            level = self.indirection_level()
52
53        deref = self.ty if level else ""
54        while level > 0:
55            idx = deref.rfind("[")
56            if idx < 0:
57                idx = deref.rfind("*")
58            if idx < 0:
59                deref = ""
60                break
61            deref = deref[:idx]
62            level -= 1;
63
64        return deref.rstrip()
65
66class Proto(object):
67    """A function prototype."""
68
69    def __init__(self, ret, name, params=[]):
70        # the proto has only a param
71        if not isinstance(params, list):
72            params = [params]
73
74        self.ret = ret
75        self.name = name
76        self.params = params
77
78    def c_params(self, need_type=True, need_name=True):
79        """Return the parameter list in C."""
80        if self.params and (need_type or need_name):
81            if need_type and need_name:
82                return ", ".join([param.c() for param in self.params])
83            elif need_type:
84                return ", ".join([param.ty for param in self.params])
85            else:
86                return ", ".join([param.name for param in self.params])
87        else:
88            return "void" if need_type else ""
89
90    def c_decl(self, name, attr="", typed=False, need_param_names=True):
91        """Return a named declaration in C."""
92        if typed:
93            return "%s (%s*%s)(%s)" % (
94                self.ret,
95                attr + "_PTR " if attr else "",
96                name,
97                self.c_params(need_name=need_param_names))
98        else:
99            return "%s%s %s%s(%s)" % (
100                attr + "_ATTR " if attr else "",
101                self.ret,
102                attr + "_CALL " if attr else "",
103                name,
104                self.c_params(need_name=need_param_names))
105
106    def c_pretty_decl(self, name, attr=""):
107        """Return a named declaration in C, with vulkan.h formatting."""
108        plist = []
109        for param in self.params:
110            idx = param.ty.find("[")
111            if idx < 0:
112                idx = len(param.ty)
113
114            pad = 44 - idx
115            if pad <= 0:
116                pad = 1
117
118            plist.append("    %s%s%s%s" % (param.ty[:idx],
119                " " * pad, param.name, param.ty[idx:]))
120
121        return "%s%s %s%s(\n%s)" % (
122                attr + "_ATTR " if attr else "",
123                self.ret,
124                attr + "_CALL " if attr else "",
125                name,
126                ",\n".join(plist))
127
128    def c_func(self, prefix="", attr=""):
129        """Return the prototype in C."""
130        return self.c_decl(prefix + self.name, attr=attr, typed=False)
131
132    def c_call(self):
133        """Return a call to the prototype in C."""
134        return "%s(%s)" % (self.name, self.c_params(need_type=False))
135
136    def object_in_params(self):
137        """Return the params that are simple VK objects and are inputs."""
138        return [param for param in self.params if param.ty in objects]
139
140    def object_out_params(self):
141        """Return the params that are simple VK objects and are outputs."""
142        return [param for param in self.params
143                if param.dereferenced_type() in objects]
144
145    def __repr__(self):
146        param_strs = []
147        for param in self.params:
148            param_strs.append(str(param))
149        param_str = "    [%s]" % (",\n     ".join(param_strs))
150
151        return "Proto(\"%s\", \"%s\",\n%s)" % \
152                (self.ret, self.name, param_str)
153
154class Extension(object):
155    def __init__(self, name, headers, objects, protos, ifdef = None):
156        self.name = name
157        self.headers = headers
158        self.objects = objects
159        self.protos = protos
160        self.ifdef = ifdef
161
162# VK core API
163core = Extension(
164    name="VK_CORE",
165    headers=["vulkan/vulkan.h"],
166    objects=[
167        "VkInstance",
168        "VkPhysicalDevice",
169        "VkDevice",
170        "VkQueue",
171        "VkSemaphore",
172        "VkCommandBuffer",
173        "VkFence",
174        "VkDeviceMemory",
175        "VkBuffer",
176        "VkImage",
177        "VkEvent",
178        "VkQueryPool",
179        "VkBufferView",
180        "VkImageView",
181        "VkShaderModule",
182        "VkPipelineCache",
183        "VkPipelineLayout",
184        "VkRenderPass",
185        "VkPipeline",
186        "VkDescriptorSetLayout",
187        "VkSampler",
188        "VkDescriptorPool",
189        "VkDescriptorSet",
190        "VkFramebuffer",
191        "VkCommandPool",
192    ],
193    protos=[
194        Proto("VkResult", "CreateInstance",
195            [Param("const VkInstanceCreateInfo*", "pCreateInfo"),
196             Param("const VkAllocationCallbacks*", "pAllocator"),
197             Param("VkInstance*", "pInstance")]),
198
199        Proto("void", "DestroyInstance",
200            [Param("VkInstance", "instance"),
201             Param("const VkAllocationCallbacks*", "pAllocator")]),
202
203        Proto("VkResult", "EnumeratePhysicalDevices",
204            [Param("VkInstance", "instance"),
205             Param("uint32_t*", "pPhysicalDeviceCount"),
206             Param("VkPhysicalDevice*", "pPhysicalDevices")]),
207
208        Proto("void", "GetPhysicalDeviceFeatures",
209            [Param("VkPhysicalDevice", "physicalDevice"),
210             Param("VkPhysicalDeviceFeatures*", "pFeatures")]),
211
212        Proto("void", "GetPhysicalDeviceFormatProperties",
213            [Param("VkPhysicalDevice", "physicalDevice"),
214             Param("VkFormat", "format"),
215             Param("VkFormatProperties*", "pFormatProperties")]),
216
217        Proto("VkResult", "GetPhysicalDeviceImageFormatProperties",
218            [Param("VkPhysicalDevice", "physicalDevice"),
219             Param("VkFormat", "format"),
220             Param("VkImageType", "type"),
221             Param("VkImageTiling", "tiling"),
222             Param("VkImageUsageFlags", "usage"),
223             Param("VkImageCreateFlags", "flags"),
224             Param("VkImageFormatProperties*", "pImageFormatProperties")]),
225
226        Proto("void", "GetPhysicalDeviceProperties",
227            [Param("VkPhysicalDevice", "physicalDevice"),
228             Param("VkPhysicalDeviceProperties*", "pProperties")]),
229
230        Proto("void", "GetPhysicalDeviceQueueFamilyProperties",
231            [Param("VkPhysicalDevice", "physicalDevice"),
232             Param("uint32_t*", "pQueueFamilyPropertyCount"),
233             Param("VkQueueFamilyProperties*", "pQueueFamilyProperties")]),
234
235        Proto("void", "GetPhysicalDeviceMemoryProperties",
236            [Param("VkPhysicalDevice", "physicalDevice"),
237             Param("VkPhysicalDeviceMemoryProperties*", "pMemoryProperties")]),
238
239        Proto("PFN_vkVoidFunction", "GetInstanceProcAddr",
240            [Param("VkInstance", "instance"),
241             Param("const char*", "pName")]),
242
243        Proto("PFN_vkVoidFunction", "GetDeviceProcAddr",
244            [Param("VkDevice", "device"),
245             Param("const char*", "pName")]),
246
247        Proto("VkResult", "CreateDevice",
248            [Param("VkPhysicalDevice", "physicalDevice"),
249             Param("const VkDeviceCreateInfo*", "pCreateInfo"),
250             Param("const VkAllocationCallbacks*", "pAllocator"),
251             Param("VkDevice*", "pDevice")]),
252
253        Proto("void", "DestroyDevice",
254            [Param("VkDevice", "device"),
255             Param("const VkAllocationCallbacks*", "pAllocator")]),
256
257        Proto("VkResult", "EnumerateInstanceExtensionProperties",
258            [Param("const char*", "pLayerName"),
259             Param("uint32_t*", "pPropertyCount"),
260             Param("VkExtensionProperties*", "pProperties")]),
261
262        Proto("VkResult", "EnumerateDeviceExtensionProperties",
263            [Param("VkPhysicalDevice", "physicalDevice"),
264             Param("const char*", "pLayerName"),
265             Param("uint32_t*", "pPropertyCount"),
266             Param("VkExtensionProperties*", "pProperties")]),
267
268        Proto("VkResult", "EnumerateInstanceLayerProperties",
269            [Param("uint32_t*", "pPropertyCount"),
270             Param("VkLayerProperties*", "pProperties")]),
271
272        Proto("VkResult", "EnumerateDeviceLayerProperties",
273            [Param("VkPhysicalDevice", "physicalDevice"),
274             Param("uint32_t*", "pPropertyCount"),
275             Param("VkLayerProperties*", "pProperties")]),
276
277        Proto("void", "GetDeviceQueue",
278            [Param("VkDevice", "device"),
279             Param("uint32_t", "queueFamilyIndex"),
280             Param("uint32_t", "queueIndex"),
281             Param("VkQueue*", "pQueue")]),
282
283        Proto("VkResult", "QueueSubmit",
284            [Param("VkQueue", "queue"),
285             Param("uint32_t", "submitCount"),
286             Param("const VkSubmitInfo*", "pSubmits"),
287             Param("VkFence", "fence")]),
288
289        Proto("VkResult", "QueueWaitIdle",
290            [Param("VkQueue", "queue")]),
291
292        Proto("VkResult", "DeviceWaitIdle",
293            [Param("VkDevice", "device")]),
294
295        Proto("VkResult", "AllocateMemory",
296            [Param("VkDevice", "device"),
297             Param("const VkMemoryAllocateInfo*", "pAllocateInfo"),
298             Param("const VkAllocationCallbacks*", "pAllocator"),
299             Param("VkDeviceMemory*", "pMemory")]),
300
301        Proto("void", "FreeMemory",
302            [Param("VkDevice", "device"),
303             Param("VkDeviceMemory", "memory"),
304             Param("const VkAllocationCallbacks*", "pAllocator")]),
305
306        Proto("VkResult", "MapMemory",
307            [Param("VkDevice", "device"),
308             Param("VkDeviceMemory", "memory"),
309             Param("VkDeviceSize", "offset"),
310             Param("VkDeviceSize", "size"),
311             Param("VkMemoryMapFlags", "flags"),
312             Param("void**", "ppData")]),
313
314        Proto("void", "UnmapMemory",
315            [Param("VkDevice", "device"),
316             Param("VkDeviceMemory", "memory")]),
317
318        Proto("VkResult", "FlushMappedMemoryRanges",
319            [Param("VkDevice", "device"),
320             Param("uint32_t", "memoryRangeCount"),
321             Param("const VkMappedMemoryRange*", "pMemoryRanges")]),
322
323        Proto("VkResult", "InvalidateMappedMemoryRanges",
324            [Param("VkDevice", "device"),
325             Param("uint32_t", "memoryRangeCount"),
326             Param("const VkMappedMemoryRange*", "pMemoryRanges")]),
327
328        Proto("void", "GetDeviceMemoryCommitment",
329            [Param("VkDevice", "device"),
330             Param("VkDeviceMemory", "memory"),
331             Param("VkDeviceSize*", "pCommittedMemoryInBytes")]),
332
333        Proto("VkResult", "BindBufferMemory",
334            [Param("VkDevice", "device"),
335             Param("VkBuffer", "buffer"),
336             Param("VkDeviceMemory", "memory"),
337             Param("VkDeviceSize", "memoryOffset")]),
338
339        Proto("VkResult", "BindImageMemory",
340            [Param("VkDevice", "device"),
341             Param("VkImage", "image"),
342             Param("VkDeviceMemory", "memory"),
343             Param("VkDeviceSize", "memoryOffset")]),
344
345        Proto("void", "GetBufferMemoryRequirements",
346            [Param("VkDevice", "device"),
347             Param("VkBuffer", "buffer"),
348             Param("VkMemoryRequirements*", "pMemoryRequirements")]),
349
350        Proto("void", "GetImageMemoryRequirements",
351            [Param("VkDevice", "device"),
352             Param("VkImage", "image"),
353             Param("VkMemoryRequirements*", "pMemoryRequirements")]),
354
355        Proto("void", "GetImageSparseMemoryRequirements",
356            [Param("VkDevice", "device"),
357             Param("VkImage", "image"),
358             Param("uint32_t*", "pSparseMemoryRequirementCount"),
359             Param("VkSparseImageMemoryRequirements*", "pSparseMemoryRequirements")]),
360
361        Proto("void", "GetPhysicalDeviceSparseImageFormatProperties",
362            [Param("VkPhysicalDevice", "physicalDevice"),
363             Param("VkFormat", "format"),
364             Param("VkImageType", "type"),
365             Param("VkSampleCountFlagBits", "samples"),
366             Param("VkImageUsageFlags", "usage"),
367             Param("VkImageTiling", "tiling"),
368             Param("uint32_t*", "pPropertyCount"),
369             Param("VkSparseImageFormatProperties*", "pProperties")]),
370
371        Proto("VkResult", "QueueBindSparse",
372            [Param("VkQueue", "queue"),
373             Param("uint32_t", "bindInfoCount"),
374             Param("const VkBindSparseInfo*", "pBindInfo"),
375             Param("VkFence", "fence")]),
376
377        Proto("VkResult", "CreateFence",
378            [Param("VkDevice", "device"),
379             Param("const VkFenceCreateInfo*", "pCreateInfo"),
380             Param("const VkAllocationCallbacks*", "pAllocator"),
381             Param("VkFence*", "pFence")]),
382
383        Proto("void", "DestroyFence",
384            [Param("VkDevice", "device"),
385             Param("VkFence", "fence"),
386             Param("const VkAllocationCallbacks*", "pAllocator")]),
387
388        Proto("VkResult", "ResetFences",
389            [Param("VkDevice", "device"),
390             Param("uint32_t", "fenceCount"),
391             Param("const VkFence*", "pFences")]),
392
393        Proto("VkResult", "GetFenceStatus",
394            [Param("VkDevice", "device"),
395             Param("VkFence", "fence")]),
396
397        Proto("VkResult", "WaitForFences",
398            [Param("VkDevice", "device"),
399             Param("uint32_t", "fenceCount"),
400             Param("const VkFence*", "pFences"),
401             Param("VkBool32", "waitAll"),
402             Param("uint64_t", "timeout")]),
403
404        Proto("VkResult", "CreateSemaphore",
405            [Param("VkDevice", "device"),
406             Param("const VkSemaphoreCreateInfo*", "pCreateInfo"),
407             Param("const VkAllocationCallbacks*", "pAllocator"),
408             Param("VkSemaphore*", "pSemaphore")]),
409
410        Proto("void", "DestroySemaphore",
411            [Param("VkDevice", "device"),
412             Param("VkSemaphore", "semaphore"),
413             Param("const VkAllocationCallbacks*", "pAllocator")]),
414
415        Proto("VkResult", "CreateEvent",
416            [Param("VkDevice", "device"),
417             Param("const VkEventCreateInfo*", "pCreateInfo"),
418             Param("const VkAllocationCallbacks*", "pAllocator"),
419             Param("VkEvent*", "pEvent")]),
420
421        Proto("void", "DestroyEvent",
422            [Param("VkDevice", "device"),
423             Param("VkEvent", "event"),
424             Param("const VkAllocationCallbacks*", "pAllocator")]),
425
426        Proto("VkResult", "GetEventStatus",
427            [Param("VkDevice", "device"),
428             Param("VkEvent", "event")]),
429
430        Proto("VkResult", "SetEvent",
431            [Param("VkDevice", "device"),
432             Param("VkEvent", "event")]),
433
434        Proto("VkResult", "ResetEvent",
435            [Param("VkDevice", "device"),
436             Param("VkEvent", "event")]),
437
438        Proto("VkResult", "CreateQueryPool",
439            [Param("VkDevice", "device"),
440             Param("const VkQueryPoolCreateInfo*", "pCreateInfo"),
441             Param("const VkAllocationCallbacks*", "pAllocator"),
442             Param("VkQueryPool*", "pQueryPool")]),
443
444        Proto("void", "DestroyQueryPool",
445            [Param("VkDevice", "device"),
446             Param("VkQueryPool", "queryPool"),
447             Param("const VkAllocationCallbacks*", "pAllocator")]),
448
449        Proto("VkResult", "GetQueryPoolResults",
450            [Param("VkDevice", "device"),
451             Param("VkQueryPool", "queryPool"),
452             Param("uint32_t", "firstQuery"),
453             Param("uint32_t", "queryCount"),
454             Param("size_t", "dataSize"),
455             Param("void*", "pData"),
456             Param("VkDeviceSize", "stride"),
457             Param("VkQueryResultFlags", "flags")]),
458
459        Proto("VkResult", "CreateBuffer",
460            [Param("VkDevice", "device"),
461             Param("const VkBufferCreateInfo*", "pCreateInfo"),
462             Param("const VkAllocationCallbacks*", "pAllocator"),
463             Param("VkBuffer*", "pBuffer")]),
464
465        Proto("void", "DestroyBuffer",
466            [Param("VkDevice", "device"),
467             Param("VkBuffer", "buffer"),
468             Param("const VkAllocationCallbacks*", "pAllocator")]),
469
470        Proto("VkResult", "CreateBufferView",
471            [Param("VkDevice", "device"),
472             Param("const VkBufferViewCreateInfo*", "pCreateInfo"),
473             Param("const VkAllocationCallbacks*", "pAllocator"),
474             Param("VkBufferView*", "pView")]),
475
476        Proto("void", "DestroyBufferView",
477            [Param("VkDevice", "device"),
478             Param("VkBufferView", "bufferView"),
479             Param("const VkAllocationCallbacks*", "pAllocator")]),
480
481        Proto("VkResult", "CreateImage",
482            [Param("VkDevice", "device"),
483             Param("const VkImageCreateInfo*", "pCreateInfo"),
484             Param("const VkAllocationCallbacks*", "pAllocator"),
485             Param("VkImage*", "pImage")]),
486
487        Proto("void", "DestroyImage",
488            [Param("VkDevice", "device"),
489             Param("VkImage", "image"),
490             Param("const VkAllocationCallbacks*", "pAllocator")]),
491
492        Proto("void", "GetImageSubresourceLayout",
493            [Param("VkDevice", "device"),
494             Param("VkImage", "image"),
495             Param("const VkImageSubresource*", "pSubresource"),
496             Param("VkSubresourceLayout*", "pLayout")]),
497
498        Proto("VkResult", "CreateImageView",
499            [Param("VkDevice", "device"),
500             Param("const VkImageViewCreateInfo*", "pCreateInfo"),
501             Param("const VkAllocationCallbacks*", "pAllocator"),
502             Param("VkImageView*", "pView")]),
503
504        Proto("void", "DestroyImageView",
505            [Param("VkDevice", "device"),
506             Param("VkImageView", "imageView"),
507             Param("const VkAllocationCallbacks*", "pAllocator")]),
508
509        Proto("VkResult", "CreateShaderModule",
510            [Param("VkDevice", "device"),
511             Param("const VkShaderModuleCreateInfo*", "pCreateInfo"),
512             Param("const VkAllocationCallbacks*", "pAllocator"),
513             Param("VkShaderModule*", "pShaderModule")]),
514
515        Proto("void", "DestroyShaderModule",
516            [Param("VkDevice", "device"),
517             Param("VkShaderModule", "shaderModule"),
518             Param("const VkAllocationCallbacks*", "pAllocator")]),
519
520        Proto("VkResult", "CreatePipelineCache",
521            [Param("VkDevice", "device"),
522             Param("const VkPipelineCacheCreateInfo*", "pCreateInfo"),
523             Param("const VkAllocationCallbacks*", "pAllocator"),
524             Param("VkPipelineCache*", "pPipelineCache")]),
525
526        Proto("void", "DestroyPipelineCache",
527            [Param("VkDevice", "device"),
528             Param("VkPipelineCache", "pipelineCache"),
529             Param("const VkAllocationCallbacks*", "pAllocator")]),
530
531        Proto("VkResult", "GetPipelineCacheData",
532            [Param("VkDevice", "device"),
533             Param("VkPipelineCache", "pipelineCache"),
534             Param("size_t*", "pDataSize"),
535             Param("void*", "pData")]),
536
537        Proto("VkResult", "MergePipelineCaches",
538            [Param("VkDevice", "device"),
539             Param("VkPipelineCache", "dstCache"),
540             Param("uint32_t", "srcCacheCount"),
541             Param("const VkPipelineCache*", "pSrcCaches")]),
542
543        Proto("VkResult", "CreateGraphicsPipelines",
544            [Param("VkDevice", "device"),
545             Param("VkPipelineCache", "pipelineCache"),
546             Param("uint32_t", "createInfoCount"),
547             Param("const VkGraphicsPipelineCreateInfo*", "pCreateInfos"),
548             Param("const VkAllocationCallbacks*", "pAllocator"),
549             Param("VkPipeline*", "pPipelines")]),
550
551        Proto("VkResult", "CreateComputePipelines",
552            [Param("VkDevice", "device"),
553             Param("VkPipelineCache", "pipelineCache"),
554             Param("uint32_t", "createInfoCount"),
555             Param("const VkComputePipelineCreateInfo*", "pCreateInfos"),
556             Param("const VkAllocationCallbacks*", "pAllocator"),
557             Param("VkPipeline*", "pPipelines")]),
558
559        Proto("void", "DestroyPipeline",
560            [Param("VkDevice", "device"),
561             Param("VkPipeline", "pipeline"),
562             Param("const VkAllocationCallbacks*", "pAllocator")]),
563
564        Proto("VkResult", "CreatePipelineLayout",
565            [Param("VkDevice", "device"),
566             Param("const VkPipelineLayoutCreateInfo*", "pCreateInfo"),
567             Param("const VkAllocationCallbacks*", "pAllocator"),
568             Param("VkPipelineLayout*", "pPipelineLayout")]),
569
570        Proto("void", "DestroyPipelineLayout",
571            [Param("VkDevice", "device"),
572             Param("VkPipelineLayout", "pipelineLayout"),
573             Param("const VkAllocationCallbacks*", "pAllocator")]),
574
575        Proto("VkResult", "CreateSampler",
576            [Param("VkDevice", "device"),
577             Param("const VkSamplerCreateInfo*", "pCreateInfo"),
578             Param("const VkAllocationCallbacks*", "pAllocator"),
579             Param("VkSampler*", "pSampler")]),
580
581        Proto("void", "DestroySampler",
582            [Param("VkDevice", "device"),
583             Param("VkSampler", "sampler"),
584             Param("const VkAllocationCallbacks*", "pAllocator")]),
585
586        Proto("VkResult", "CreateDescriptorSetLayout",
587            [Param("VkDevice", "device"),
588             Param("const VkDescriptorSetLayoutCreateInfo*", "pCreateInfo"),
589             Param("const VkAllocationCallbacks*", "pAllocator"),
590             Param("VkDescriptorSetLayout*", "pSetLayout")]),
591
592        Proto("void", "DestroyDescriptorSetLayout",
593            [Param("VkDevice", "device"),
594             Param("VkDescriptorSetLayout", "descriptorSetLayout"),
595             Param("const VkAllocationCallbacks*", "pAllocator")]),
596
597        Proto("VkResult", "CreateDescriptorPool",
598            [Param("VkDevice", "device"),
599             Param("const VkDescriptorPoolCreateInfo*", "pCreateInfo"),
600             Param("const VkAllocationCallbacks*", "pAllocator"),
601             Param("VkDescriptorPool*", "pDescriptorPool")]),
602
603        Proto("void", "DestroyDescriptorPool",
604            [Param("VkDevice", "device"),
605             Param("VkDescriptorPool", "descriptorPool"),
606             Param("const VkAllocationCallbacks*", "pAllocator")]),
607
608        Proto("VkResult", "ResetDescriptorPool",
609            [Param("VkDevice", "device"),
610             Param("VkDescriptorPool", "descriptorPool"),
611             Param("VkDescriptorPoolResetFlags", "flags")]),
612
613        Proto("VkResult", "AllocateDescriptorSets",
614            [Param("VkDevice", "device"),
615             Param("const VkDescriptorSetAllocateInfo*", "pAllocateInfo"),
616             Param("VkDescriptorSet*", "pDescriptorSets")]),
617
618        Proto("VkResult", "FreeDescriptorSets",
619            [Param("VkDevice", "device"),
620             Param("VkDescriptorPool", "descriptorPool"),
621             Param("uint32_t", "descriptorSetCount"),
622             Param("const VkDescriptorSet*", "pDescriptorSets")]),
623
624        Proto("void", "UpdateDescriptorSets",
625            [Param("VkDevice", "device"),
626             Param("uint32_t", "descriptorWriteCount"),
627             Param("const VkWriteDescriptorSet*", "pDescriptorWrites"),
628             Param("uint32_t", "descriptorCopyCount"),
629             Param("const VkCopyDescriptorSet*", "pDescriptorCopies")]),
630
631        Proto("VkResult", "CreateFramebuffer",
632            [Param("VkDevice", "device"),
633             Param("const VkFramebufferCreateInfo*", "pCreateInfo"),
634             Param("const VkAllocationCallbacks*", "pAllocator"),
635             Param("VkFramebuffer*", "pFramebuffer")]),
636
637        Proto("void", "DestroyFramebuffer",
638            [Param("VkDevice", "device"),
639             Param("VkFramebuffer", "framebuffer"),
640             Param("const VkAllocationCallbacks*", "pAllocator")]),
641
642        Proto("VkResult", "CreateRenderPass",
643            [Param("VkDevice", "device"),
644             Param("const VkRenderPassCreateInfo*", "pCreateInfo"),
645             Param("const VkAllocationCallbacks*", "pAllocator"),
646             Param("VkRenderPass*", "pRenderPass")]),
647
648        Proto("void", "DestroyRenderPass",
649            [Param("VkDevice", "device"),
650             Param("VkRenderPass", "renderPass"),
651             Param("const VkAllocationCallbacks*", "pAllocator")]),
652
653        Proto("void", "GetRenderAreaGranularity",
654            [Param("VkDevice", "device"),
655             Param("VkRenderPass", "renderPass"),
656             Param("VkExtent2D*", "pGranularity")]),
657
658        Proto("VkResult", "CreateCommandPool",
659            [Param("VkDevice", "device"),
660             Param("const VkCommandPoolCreateInfo*", "pCreateInfo"),
661             Param("const VkAllocationCallbacks*", "pAllocator"),
662             Param("VkCommandPool*", "pCommandPool")]),
663
664        Proto("void", "DestroyCommandPool",
665            [Param("VkDevice", "device"),
666             Param("VkCommandPool", "commandPool"),
667             Param("const VkAllocationCallbacks*", "pAllocator")]),
668
669        Proto("VkResult", "ResetCommandPool",
670            [Param("VkDevice", "device"),
671             Param("VkCommandPool", "commandPool"),
672             Param("VkCommandPoolResetFlags", "flags")]),
673
674        Proto("VkResult", "AllocateCommandBuffers",
675            [Param("VkDevice", "device"),
676             Param("const VkCommandBufferAllocateInfo*", "pAllocateInfo"),
677             Param("VkCommandBuffer*", "pCommandBuffers")]),
678
679        Proto("void", "FreeCommandBuffers",
680            [Param("VkDevice", "device"),
681             Param("VkCommandPool", "commandPool"),
682             Param("uint32_t", "commandBufferCount"),
683             Param("const VkCommandBuffer*", "pCommandBuffers")]),
684
685        Proto("VkResult", "BeginCommandBuffer",
686            [Param("VkCommandBuffer", "commandBuffer"),
687             Param("const VkCommandBufferBeginInfo*", "pBeginInfo")]),
688
689        Proto("VkResult", "EndCommandBuffer",
690            [Param("VkCommandBuffer", "commandBuffer")]),
691
692        Proto("VkResult", "ResetCommandBuffer",
693            [Param("VkCommandBuffer", "commandBuffer"),
694             Param("VkCommandBufferResetFlags", "flags")]),
695
696        Proto("void", "CmdBindPipeline",
697            [Param("VkCommandBuffer", "commandBuffer"),
698             Param("VkPipelineBindPoint", "pipelineBindPoint"),
699             Param("VkPipeline", "pipeline")]),
700
701        Proto("void", "CmdSetViewport",
702            [Param("VkCommandBuffer", "commandBuffer"),
703             Param("uint32_t", "firstViewport"),
704             Param("uint32_t", "viewportCount"),
705             Param("const VkViewport*", "pViewports")]),
706
707        Proto("void", "CmdSetScissor",
708            [Param("VkCommandBuffer", "commandBuffer"),
709             Param("uint32_t", "firstScissor"),
710             Param("uint32_t", "scissorCount"),
711             Param("const VkRect2D*", "pScissors")]),
712
713        Proto("void", "CmdSetLineWidth",
714            [Param("VkCommandBuffer", "commandBuffer"),
715             Param("float", "lineWidth")]),
716
717        Proto("void", "CmdSetDepthBias",
718            [Param("VkCommandBuffer", "commandBuffer"),
719             Param("float", "depthBiasConstantFactor"),
720             Param("float", "depthBiasClamp"),
721             Param("float", "depthBiasSlopeFactor")]),
722
723        Proto("void", "CmdSetBlendConstants",
724            [Param("VkCommandBuffer", "commandBuffer"),
725             Param("const float[4]", "blendConstants")]),
726
727        Proto("void", "CmdSetDepthBounds",
728            [Param("VkCommandBuffer", "commandBuffer"),
729             Param("float", "minDepthBounds"),
730             Param("float", "maxDepthBounds")]),
731
732        Proto("void", "CmdSetStencilCompareMask",
733            [Param("VkCommandBuffer", "commandBuffer"),
734             Param("VkStencilFaceFlags", "faceMask"),
735             Param("uint32_t", "compareMask")]),
736
737        Proto("void", "CmdSetStencilWriteMask",
738            [Param("VkCommandBuffer", "commandBuffer"),
739             Param("VkStencilFaceFlags", "faceMask"),
740             Param("uint32_t", "writeMask")]),
741
742        Proto("void", "CmdSetStencilReference",
743            [Param("VkCommandBuffer", "commandBuffer"),
744             Param("VkStencilFaceFlags", "faceMask"),
745             Param("uint32_t", "reference")]),
746
747        Proto("void", "CmdBindDescriptorSets",
748            [Param("VkCommandBuffer", "commandBuffer"),
749             Param("VkPipelineBindPoint", "pipelineBindPoint"),
750             Param("VkPipelineLayout", "layout"),
751             Param("uint32_t", "firstSet"),
752             Param("uint32_t", "descriptorSetCount"),
753             Param("const VkDescriptorSet*", "pDescriptorSets"),
754             Param("uint32_t", "dynamicOffsetCount"),
755             Param("const uint32_t*", "pDynamicOffsets")]),
756
757        Proto("void", "CmdBindIndexBuffer",
758            [Param("VkCommandBuffer", "commandBuffer"),
759             Param("VkBuffer", "buffer"),
760             Param("VkDeviceSize", "offset"),
761             Param("VkIndexType", "indexType")]),
762
763        Proto("void", "CmdBindVertexBuffers",
764            [Param("VkCommandBuffer", "commandBuffer"),
765             Param("uint32_t", "firstBinding"),
766             Param("uint32_t", "bindingCount"),
767             Param("const VkBuffer*", "pBuffers"),
768             Param("const VkDeviceSize*", "pOffsets")]),
769
770        Proto("void", "CmdDraw",
771            [Param("VkCommandBuffer", "commandBuffer"),
772             Param("uint32_t", "vertexCount"),
773             Param("uint32_t", "instanceCount"),
774             Param("uint32_t", "firstVertex"),
775             Param("uint32_t", "firstInstance")]),
776
777        Proto("void", "CmdDrawIndexed",
778            [Param("VkCommandBuffer", "commandBuffer"),
779             Param("uint32_t", "indexCount"),
780             Param("uint32_t", "instanceCount"),
781             Param("uint32_t", "firstIndex"),
782             Param("int32_t", "vertexOffset"),
783             Param("uint32_t", "firstInstance")]),
784
785        Proto("void", "CmdDrawIndirect",
786            [Param("VkCommandBuffer", "commandBuffer"),
787             Param("VkBuffer", "buffer"),
788             Param("VkDeviceSize", "offset"),
789             Param("uint32_t", "drawCount"),
790             Param("uint32_t", "stride")]),
791
792        Proto("void", "CmdDrawIndexedIndirect",
793            [Param("VkCommandBuffer", "commandBuffer"),
794             Param("VkBuffer", "buffer"),
795             Param("VkDeviceSize", "offset"),
796             Param("uint32_t", "drawCount"),
797             Param("uint32_t", "stride")]),
798
799        Proto("void", "CmdDispatch",
800            [Param("VkCommandBuffer", "commandBuffer"),
801             Param("uint32_t", "x"),
802             Param("uint32_t", "y"),
803             Param("uint32_t", "z")]),
804
805        Proto("void", "CmdDispatchIndirect",
806            [Param("VkCommandBuffer", "commandBuffer"),
807             Param("VkBuffer", "buffer"),
808             Param("VkDeviceSize", "offset")]),
809
810        Proto("void", "CmdCopyBuffer",
811            [Param("VkCommandBuffer", "commandBuffer"),
812             Param("VkBuffer", "srcBuffer"),
813             Param("VkBuffer", "dstBuffer"),
814             Param("uint32_t", "regionCount"),
815             Param("const VkBufferCopy*", "pRegions")]),
816
817        Proto("void", "CmdCopyImage",
818            [Param("VkCommandBuffer", "commandBuffer"),
819             Param("VkImage", "srcImage"),
820             Param("VkImageLayout", "srcImageLayout"),
821             Param("VkImage", "dstImage"),
822             Param("VkImageLayout", "dstImageLayout"),
823             Param("uint32_t", "regionCount"),
824             Param("const VkImageCopy*", "pRegions")]),
825
826        Proto("void", "CmdBlitImage",
827            [Param("VkCommandBuffer", "commandBuffer"),
828             Param("VkImage", "srcImage"),
829             Param("VkImageLayout", "srcImageLayout"),
830             Param("VkImage", "dstImage"),
831             Param("VkImageLayout", "dstImageLayout"),
832             Param("uint32_t", "regionCount"),
833             Param("const VkImageBlit*", "pRegions"),
834             Param("VkFilter", "filter")]),
835
836        Proto("void", "CmdCopyBufferToImage",
837            [Param("VkCommandBuffer", "commandBuffer"),
838             Param("VkBuffer", "srcBuffer"),
839             Param("VkImage", "dstImage"),
840             Param("VkImageLayout", "dstImageLayout"),
841             Param("uint32_t", "regionCount"),
842             Param("const VkBufferImageCopy*", "pRegions")]),
843
844        Proto("void", "CmdCopyImageToBuffer",
845            [Param("VkCommandBuffer", "commandBuffer"),
846             Param("VkImage", "srcImage"),
847             Param("VkImageLayout", "srcImageLayout"),
848             Param("VkBuffer", "dstBuffer"),
849             Param("uint32_t", "regionCount"),
850             Param("const VkBufferImageCopy*", "pRegions")]),
851
852        Proto("void", "CmdUpdateBuffer",
853            [Param("VkCommandBuffer", "commandBuffer"),
854             Param("VkBuffer", "dstBuffer"),
855             Param("VkDeviceSize", "dstOffset"),
856             Param("VkDeviceSize", "dataSize"),
857             Param("const void*", "pData")]),
858
859        Proto("void", "CmdFillBuffer",
860            [Param("VkCommandBuffer", "commandBuffer"),
861             Param("VkBuffer", "dstBuffer"),
862             Param("VkDeviceSize", "dstOffset"),
863             Param("VkDeviceSize", "size"),
864             Param("uint32_t", "data")]),
865
866        Proto("void", "CmdClearColorImage",
867            [Param("VkCommandBuffer", "commandBuffer"),
868             Param("VkImage", "image"),
869             Param("VkImageLayout", "imageLayout"),
870             Param("const VkClearColorValue*", "pColor"),
871             Param("uint32_t", "rangeCount"),
872             Param("const VkImageSubresourceRange*", "pRanges")]),
873
874        Proto("void", "CmdClearDepthStencilImage",
875            [Param("VkCommandBuffer", "commandBuffer"),
876             Param("VkImage", "image"),
877             Param("VkImageLayout", "imageLayout"),
878             Param("const VkClearDepthStencilValue*", "pDepthStencil"),
879             Param("uint32_t", "rangeCount"),
880             Param("const VkImageSubresourceRange*", "pRanges")]),
881
882        Proto("void", "CmdClearAttachments",
883            [Param("VkCommandBuffer", "commandBuffer"),
884             Param("uint32_t", "attachmentCount"),
885             Param("const VkClearAttachment*", "pAttachments"),
886             Param("uint32_t", "rectCount"),
887             Param("const VkClearRect*", "pRects")]),
888
889        Proto("void", "CmdResolveImage",
890            [Param("VkCommandBuffer", "commandBuffer"),
891             Param("VkImage", "srcImage"),
892             Param("VkImageLayout", "srcImageLayout"),
893             Param("VkImage", "dstImage"),
894             Param("VkImageLayout", "dstImageLayout"),
895             Param("uint32_t", "regionCount"),
896             Param("const VkImageResolve*", "pRegions")]),
897
898        Proto("void", "CmdSetEvent",
899            [Param("VkCommandBuffer", "commandBuffer"),
900             Param("VkEvent", "event"),
901             Param("VkPipelineStageFlags", "stageMask")]),
902
903        Proto("void", "CmdResetEvent",
904            [Param("VkCommandBuffer", "commandBuffer"),
905             Param("VkEvent", "event"),
906             Param("VkPipelineStageFlags", "stageMask")]),
907
908        Proto("void", "CmdWaitEvents",
909            [Param("VkCommandBuffer", "commandBuffer"),
910             Param("uint32_t", "eventCount"),
911             Param("const VkEvent*", "pEvents"),
912             Param("VkPipelineStageFlags", "srcStageMask"),
913             Param("VkPipelineStageFlags", "dstStageMask"),
914             Param("uint32_t", "memoryBarrierCount"),
915             Param("const VkMemoryBarrier*", "pMemoryBarriers"),
916             Param("uint32_t", "bufferMemoryBarrierCount"),
917             Param("const VkBufferMemoryBarrier*", "pBufferMemoryBarriers"),
918             Param("uint32_t", "imageMemoryBarrierCount"),
919             Param("const VkImageMemoryBarrier*", "pImageMemoryBarriers")]),
920
921        Proto("void", "CmdPipelineBarrier",
922            [Param("VkCommandBuffer", "commandBuffer"),
923             Param("VkPipelineStageFlags", "srcStageMask"),
924             Param("VkPipelineStageFlags", "dstStageMask"),
925             Param("VkDependencyFlags", "dependencyFlags"),
926             Param("uint32_t", "memoryBarrierCount"),
927             Param("const VkMemoryBarrier*", "pMemoryBarriers"),
928             Param("uint32_t", "bufferMemoryBarrierCount"),
929             Param("const VkBufferMemoryBarrier*", "pBufferMemoryBarriers"),
930             Param("uint32_t", "imageMemoryBarrierCount"),
931             Param("const VkImageMemoryBarrier*", "pImageMemoryBarriers")]),
932
933        Proto("void", "CmdBeginQuery",
934            [Param("VkCommandBuffer", "commandBuffer"),
935             Param("VkQueryPool", "queryPool"),
936             Param("uint32_t", "query"),
937             Param("VkQueryControlFlags", "flags")]),
938
939        Proto("void", "CmdEndQuery",
940            [Param("VkCommandBuffer", "commandBuffer"),
941             Param("VkQueryPool", "queryPool"),
942             Param("uint32_t", "query")]),
943
944        Proto("void", "CmdResetQueryPool",
945            [Param("VkCommandBuffer", "commandBuffer"),
946             Param("VkQueryPool", "queryPool"),
947             Param("uint32_t", "firstQuery"),
948             Param("uint32_t", "queryCount")]),
949
950        Proto("void", "CmdWriteTimestamp",
951            [Param("VkCommandBuffer", "commandBuffer"),
952             Param("VkPipelineStageFlagBits", "pipelineStage"),
953             Param("VkQueryPool", "queryPool"),
954             Param("uint32_t", "query")]),
955
956        Proto("void", "CmdCopyQueryPoolResults",
957            [Param("VkCommandBuffer", "commandBuffer"),
958             Param("VkQueryPool", "queryPool"),
959             Param("uint32_t", "firstQuery"),
960             Param("uint32_t", "queryCount"),
961             Param("VkBuffer", "dstBuffer"),
962             Param("VkDeviceSize", "dstOffset"),
963             Param("VkDeviceSize", "stride"),
964             Param("VkQueryResultFlags", "flags")]),
965
966        Proto("void", "CmdPushConstants",
967            [Param("VkCommandBuffer", "commandBuffer"),
968             Param("VkPipelineLayout", "layout"),
969             Param("VkShaderStageFlags", "stageFlags"),
970             Param("uint32_t", "offset"),
971             Param("uint32_t", "size"),
972             Param("const void*", "pValues")]),
973
974        Proto("void", "CmdBeginRenderPass",
975            [Param("VkCommandBuffer", "commandBuffer"),
976             Param("const VkRenderPassBeginInfo*", "pRenderPassBegin"),
977             Param("VkSubpassContents", "contents")]),
978
979        Proto("void", "CmdNextSubpass",
980            [Param("VkCommandBuffer", "commandBuffer"),
981             Param("VkSubpassContents", "contents")]),
982
983        Proto("void", "CmdEndRenderPass",
984            [Param("VkCommandBuffer", "commandBuffer")]),
985
986        Proto("void", "CmdExecuteCommands",
987            [Param("VkCommandBuffer", "commandBuffer"),
988             Param("uint32_t", "commandBufferCount"),
989             Param("const VkCommandBuffer*", "pCommandBuffers")]),
990    ],
991)
992
993ext_amd_draw_indirect_count = Extension(
994    name="VK_AMD_draw_indirect_count",
995    headers=["vulkan/vulkan.h"],
996    objects=[],
997    protos=[
998        Proto("void", "CmdDrawIndirectCountAMD",
999            [Param("VkCommandBuffer", "commandBuffer"),
1000             Param("VkBuffer", "buffer"),
1001             Param("VkDeviceSize", "offset"),
1002             Param("VkBuffer", "countBuffer"),
1003             Param("VkDeviceSize", "countBufferOffset"),
1004             Param("uint32_t", "maxDrawCount"),
1005             Param("uint32_t", "stride")]),
1006
1007        Proto("void", "CmdDrawIndexedIndirectCountAMD",
1008            [Param("VkCommandBuffer", "commandBuffer"),
1009             Param("VkBuffer", "buffer"),
1010             Param("VkDeviceSize", "offset"),
1011             Param("VkBuffer", "countBuffer"),
1012             Param("VkDeviceSize", "countBufferOffset"),
1013             Param("uint32_t", "maxDrawCount"),
1014             Param("uint32_t", "stride")]),
1015    ],
1016)
1017
1018ext_nv_external_memory_capabilities = Extension(
1019    name="VK_NV_external_memory_capabilities",
1020    headers=["vulkan/vulkan.h"],
1021    objects=[],
1022    protos=[
1023        Proto("VkResult", "GetPhysicalDeviceExternalImageFormatPropertiesNV",
1024            [Param("VkPhysicalDevice", "physicalDevice"),
1025             Param("VkFormat", "format"),
1026             Param("VkImageType", "type"),
1027             Param("VkImageTiling", "tiling"),
1028             Param("VkImageUsageFlags", "usage"),
1029             Param("VkImageCreateFlags", "flags"),
1030             Param("VkExternalMemoryHandleTypeFlagsNV", "externalHandleType"),
1031             Param("VkExternalImageFormatPropertiesNV*", "pExternalImageFormatProperties")]),
1032    ],
1033)
1034
1035ext_nv_external_memory_win32 = Extension(
1036    name="VK_NV_external_memory_win32",
1037    headers=["vulkan/vulkan.h"],
1038    objects=[],
1039    ifdef="VK_USE_PLATFORM_WIN32_KHR",
1040    protos=[
1041        Proto("VkResult", "GetMemoryWin32HandleNV",
1042            [Param("VkDevice", "device"),
1043             Param("VkDeviceMemory", "memory"),
1044             Param("VkExternalMemoryHandleTypeFlagsNV", "handleType"),
1045             Param("HANDLE*", "pHandle")]),
1046    ],
1047)
1048
1049ext_khr_surface = Extension(
1050    name="VK_KHR_surface",
1051    headers=["vulkan/vulkan.h"],
1052    objects=["vkSurfaceKHR"],
1053    protos=[
1054        Proto("void", "DestroySurfaceKHR",
1055            [Param("VkInstance", "instance"),
1056             Param("VkSurfaceKHR", "surface"),
1057             Param("const VkAllocationCallbacks*", "pAllocator")]),
1058
1059        Proto("VkResult", "GetPhysicalDeviceSurfaceSupportKHR",
1060            [Param("VkPhysicalDevice", "physicalDevice"),
1061             Param("uint32_t", "queueFamilyIndex"),
1062             Param("VkSurfaceKHR", "surface"),
1063             Param("VkBool32*", "pSupported")]),
1064
1065        Proto("VkResult", "GetPhysicalDeviceSurfaceCapabilitiesKHR",
1066            [Param("VkPhysicalDevice", "physicalDevice"),
1067             Param("VkSurfaceKHR", "surface"),
1068             Param("VkSurfaceCapabilitiesKHR*", "pSurfaceCapabilities")]),
1069
1070        Proto("VkResult", "GetPhysicalDeviceSurfaceFormatsKHR",
1071            [Param("VkPhysicalDevice", "physicalDevice"),
1072             Param("VkSurfaceKHR", "surface"),
1073             Param("uint32_t*", "pSurfaceFormatCount"),
1074             Param("VkSurfaceFormatKHR*", "pSurfaceFormats")]),
1075
1076        Proto("VkResult", "GetPhysicalDeviceSurfacePresentModesKHR",
1077            [Param("VkPhysicalDevice", "physicalDevice"),
1078             Param("VkSurfaceKHR", "surface"),
1079             Param("uint32_t*", "pPresentModeCount"),
1080             Param("VkPresentModeKHR*", "pPresentModes")]),
1081    ],
1082)
1083
1084ext_khr_display = Extension(
1085    name="VK_KHR_display",
1086    headers=["vulkan/vulkan.h"],
1087    objects=['VkSurfaceKHR', 'VkDisplayModeKHR'],
1088    protos=[
1089        Proto("VkResult", "GetPhysicalDeviceDisplayPropertiesKHR",
1090            [Param("VkPhysicalDevice", "physicalDevice"),
1091             Param("uint32_t*", "pPropertyCount"),
1092             Param("VkDisplayPropertiesKHR*", "pProperties")]),
1093
1094        Proto("VkResult", "GetPhysicalDeviceDisplayPlanePropertiesKHR",
1095            [Param("VkPhysicalDevice", "physicalDevice"),
1096             Param("uint32_t*", "pPropertyCount"),
1097             Param("VkDisplayPlanePropertiesKHR*", "pProperties")]),
1098
1099        Proto("VkResult", "GetDisplayPlaneSupportedDisplaysKHR",
1100            [Param("VkPhysicalDevice", "physicalDevice"),
1101             Param("uint32_t", "planeIndex"),
1102             Param("uint32_t*", "pDisplayCount"),
1103             Param("VkDisplayKHR*", "pDisplays")]),
1104
1105        Proto("VkResult", "GetDisplayModePropertiesKHR",
1106            [Param("VkPhysicalDevice", "physicalDevice"),
1107             Param("VkDisplayKHR", "display"),
1108             Param("uint32_t*", "pPropertyCount"),
1109             Param("VkDisplayModePropertiesKHR*", "pProperties")]),
1110
1111        Proto("VkResult", "CreateDisplayModeKHR",
1112            [Param("VkPhysicalDevice", "physicalDevice"),
1113             Param("VkDisplayKHR", "display"),
1114             Param("const VkDisplayModeCreateInfoKHR*", "pCreateInfo"),
1115             Param("const VkAllocationCallbacks*", "pAllocator"),
1116             Param("VkDisplayModeKHR*", "pMode")]),
1117
1118        Proto("VkResult", "GetDisplayPlaneCapabilitiesKHR",
1119            [Param("VkPhysicalDevice", "physicalDevice"),
1120             Param("VkDisplayModeKHR", "mode"),
1121             Param("uint32_t", "planeIndex"),
1122             Param("VkDisplayPlaneCapabilitiesKHR*", "pCapabilities")]),
1123
1124        Proto("VkResult", "CreateDisplayPlaneSurfaceKHR",
1125            [Param("VkInstance", "instance"),
1126             Param("const VkDisplaySurfaceCreateInfoKHR*", "pCreateInfo"),
1127             Param("const VkAllocationCallbacks*", "pAllocator"),
1128             Param("VkSurfaceKHR*", "pSurface")]),
1129    ],
1130)
1131
1132ext_khr_device_swapchain = Extension(
1133    name="VK_KHR_swapchain",
1134    headers=["vulkan/vulkan.h"],
1135    objects=["VkSwapchainKHR"],
1136    protos=[
1137        Proto("VkResult", "CreateSwapchainKHR",
1138            [Param("VkDevice", "device"),
1139             Param("const VkSwapchainCreateInfoKHR*", "pCreateInfo"),
1140             Param("const VkAllocationCallbacks*", "pAllocator"),
1141             Param("VkSwapchainKHR*", "pSwapchain")]),
1142
1143        Proto("void", "DestroySwapchainKHR",
1144            [Param("VkDevice", "device"),
1145             Param("VkSwapchainKHR", "swapchain"),
1146             Param("const VkAllocationCallbacks*", "pAllocator")]),
1147
1148        Proto("VkResult", "GetSwapchainImagesKHR",
1149            [Param("VkDevice", "device"),
1150         Param("VkSwapchainKHR", "swapchain"),
1151         Param("uint32_t*", "pSwapchainImageCount"),
1152             Param("VkImage*", "pSwapchainImages")]),
1153
1154        Proto("VkResult", "AcquireNextImageKHR",
1155            [Param("VkDevice", "device"),
1156             Param("VkSwapchainKHR", "swapchain"),
1157             Param("uint64_t", "timeout"),
1158             Param("VkSemaphore", "semaphore"),
1159             Param("VkFence", "fence"),
1160             Param("uint32_t*", "pImageIndex")]),
1161
1162        Proto("VkResult", "QueuePresentKHR",
1163            [Param("VkQueue", "queue"),
1164             Param("const VkPresentInfoKHR*", "pPresentInfo")]),
1165    ],
1166)
1167
1168ext_khr_display_swapchain = Extension(
1169    name="VK_KHR_display_swapchain",
1170    headers=["vulkan/vulkan.h"],
1171    objects=["VkDisplayPresentInfoKHR"],
1172    protos=[
1173        Proto("VkResult", "CreateSharedSwapchainsKHR",
1174            [Param("VkDevice", "device"),
1175             Param("uint32_t", "swapchainCount"),
1176             Param("const VkSwapchainCreateInfoKHR*", "pCreateInfos"),
1177             Param("const VkAllocationCallbacks*", "pAllocator"),
1178             Param("VkSwapchainKHR*", "pSwapchains")]),
1179    ],
1180)
1181
1182ext_khr_xcb_surface = Extension(
1183    name="VK_KHR_xcb_surface",
1184    headers=["vulkan/vulkan.h"],
1185    objects=[],
1186    protos=[
1187        Proto("VkResult", "CreateXcbSurfaceKHR",
1188            [Param("VkInstance", "instance"),
1189             Param("const VkXcbSurfaceCreateInfoKHR*", "pCreateInfo"),
1190             Param("const VkAllocationCallbacks*", "pAllocator"),
1191             Param("VkSurfaceKHR*", "pSurface")]),
1192
1193        Proto("VkBool32", "GetPhysicalDeviceXcbPresentationSupportKHR",
1194            [Param("VkPhysicalDevice", "physicalDevice"),
1195             Param("uint32_t", "queueFamilyIndex"),
1196             Param("xcb_connection_t*", "connection"),
1197             Param("xcb_visualid_t", "visual_id")]),
1198    ],
1199)
1200ext_khr_xlib_surface = Extension(
1201    name="VK_KHR_xlib_surface",
1202    headers=["vulkan/vulkan.h"],
1203    objects=[],
1204    ifdef="VK_USE_PLATFORM_XLIB_KHR",
1205    protos=[
1206        Proto("VkResult", "CreateXlibSurfaceKHR",
1207            [Param("VkInstance", "instance"),
1208             Param("const VkXlibSurfaceCreateInfoKHR*", "pCreateInfo"),
1209             Param("const VkAllocationCallbacks*", "pAllocator"),
1210             Param("VkSurfaceKHR*", "pSurface")]),
1211
1212        Proto("VkBool32", "GetPhysicalDeviceXlibPresentationSupportKHR",
1213            [Param("VkPhysicalDevice", "physicalDevice"),
1214             Param("uint32_t", "queueFamilyIndex"),
1215             Param("Display*", "dpy"),
1216             Param("VisualID", "visualID")]),
1217    ],
1218)
1219ext_khr_wayland_surface = Extension(
1220    name="VK_KHR_wayland_surface",
1221    headers=["vulkan/vulkan.h"],
1222    objects=[],
1223    protos=[
1224        Proto("VkResult", "CreateWaylandSurfaceKHR",
1225            [Param("VkInstance", "instance"),
1226             Param("const VkWaylandSurfaceCreateInfoKHR*", "pCreateInfo"),
1227             Param("const VkAllocationCallbacks*", "pAllocator"),
1228             Param("VkSurfaceKHR*", "pSurface")]),
1229
1230        Proto("VkBool32", "GetPhysicalDeviceWaylandPresentationSupportKHR",
1231            [Param("VkPhysicalDevice", "physicalDevice"),
1232             Param("uint32_t", "queueFamilyIndex"),
1233             Param("struct wl_display*", "display")]),
1234    ],
1235)
1236ext_khr_mir_surface = Extension(
1237    name="VK_KHR_mir_surface",
1238    headers=["vulkan/vulkan.h"],
1239    objects=[],
1240    protos=[
1241        Proto("VkResult", "CreateMirSurfaceKHR",
1242            [Param("VkInstance", "instance"),
1243             Param("const VkMirSurfaceCreateInfoKHR*", "pCreateInfo"),
1244             Param("const VkAllocationCallbacks*", "pAllocator"),
1245             Param("VkSurfaceKHR*", "pSurface")]),
1246
1247        Proto("VkBool32", "GetPhysicalDeviceMirPresentationSupportKHR",
1248            [Param("VkPhysicalDevice", "physicalDevice"),
1249             Param("uint32_t", "queueFamilyIndex"),
1250             Param("MirConnection*", "connection")]),
1251    ],
1252)
1253ext_khr_android_surface = Extension(
1254    name="VK_KHR_android_surface",
1255    headers=["vulkan/vulkan.h"],
1256    objects=[],
1257    protos=[
1258        Proto("VkResult", "CreateAndroidSurfaceKHR",
1259            [Param("VkInstance", "instance"),
1260             Param("const VkAndroidSurfaceCreateInfoKHR*", "pCreateInfo"),
1261             Param("const VkAllocationCallbacks*", "pAllocator"),
1262             Param("VkSurfaceKHR*", "pSurface")]),
1263    ],
1264)
1265ext_khr_win32_surface = Extension(
1266    name="VK_KHR_win32_surface",
1267    headers=["vulkan/vulkan.h"],
1268    objects=[],
1269    protos=[
1270        Proto("VkResult", "CreateWin32SurfaceKHR",
1271            [Param("VkInstance", "instance"),
1272             Param("const VkWin32SurfaceCreateInfoKHR*", "pCreateInfo"),
1273             Param("const VkAllocationCallbacks*", "pAllocator"),
1274             Param("VkSurfaceKHR*", "pSurface")]),
1275
1276        Proto("VkBool32", "GetPhysicalDeviceWin32PresentationSupportKHR",
1277            [Param("VkPhysicalDevice", "physicalDevice"),
1278             Param("uint32_t", "queueFamilyIndex")]),
1279    ],
1280)
1281ext_debug_report = Extension(
1282    name="VK_EXT_debug_report",
1283    headers=["vulkan/vulkan.h"],
1284    objects=[
1285        "VkDebugReportCallbackEXT",
1286    ],
1287    protos=[
1288        Proto("VkResult", "CreateDebugReportCallbackEXT",
1289            [Param("VkInstance", "instance"),
1290             Param("const VkDebugReportCallbackCreateInfoEXT*", "pCreateInfo"),
1291             Param("const VkAllocationCallbacks*", "pAllocator"),
1292             Param("VkDebugReportCallbackEXT*", "pCallback")]),
1293
1294        Proto("void", "DestroyDebugReportCallbackEXT",
1295            [Param("VkInstance", "instance"),
1296             Param("VkDebugReportCallbackEXT", "callback"),
1297             Param("const VkAllocationCallbacks*", "pAllocator")]),
1298
1299        Proto("void", "DebugReportMessageEXT",
1300            [Param("VkInstance", "instance"),
1301             Param("VkDebugReportFlagsEXT", "flags"),
1302             Param("VkDebugReportObjectTypeEXT", "objType"),
1303             Param("uint64_t", "object"),
1304             Param("size_t", "location"),
1305             Param("int32_t", "msgCode"),
1306             Param("const char *", "pLayerPrefix"),
1307             Param("const char *", "pMsg")]),
1308    ],
1309)
1310ext_debug_marker = Extension(
1311    name="VK_EXT_debug_marker",
1312    headers=["vulkan/vulkan.h"],
1313    objects=[
1314        "VkDebugMarkerObjectNameInfoEXT",
1315        "VkDebugMarkerObjectTagInfoEXT",
1316        "VkDebugMarkerMarkerInfoEXT"
1317    ],
1318    protos=[
1319        Proto("VkResult", "DebugMarkerSetObjectTagEXT",
1320            [Param("VkDevice", "device"),
1321             Param("VkDebugMarkerObjectTagInfoEXT*", "pTagInfo")]),
1322
1323        Proto("VkResult", "DebugMarkerSetObjectNameEXT",
1324            [Param("VkDevice", "device"),
1325             Param("VkDebugMarkerObjectNameInfoEXT*", "pNameInfo")]),
1326
1327        Proto("void", "CmdDebugMarkerBeginEXT",
1328            [Param("VkCommandBuffer", "commandBuffer"),
1329             Param("VkDebugMarkerMarkerInfoEXT*", "pMarkerInfo")]),
1330
1331        Proto("void", "CmdDebugMarkerEndEXT",
1332            [Param("VkCommandBuffer", "commandBuffer")]),
1333
1334        Proto("void", "CmdDebugMarkerInsertEXT",
1335            [Param("VkCommandBuffer", "commandBuffer"),
1336             Param("VkDebugMarkerMarkerInfoEXT*", "pMarkerInfo")]),
1337    ],
1338)
1339
1340import sys
1341
1342if sys.argv[1] == 'AllPlatforms':
1343    extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface, ext_khr_xcb_surface,
1344                         ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display,
1345                         ext_khr_android_surface, ext_khr_display_swapchain]
1346    extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1347                             ext_khr_xcb_surface, ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1348                             ext_khr_display, ext_khr_android_surface, ext_amd_draw_indirect_count,
1349                             ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
1350                             ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1351else :
1352    if len(sys.argv) > 3:
1353        if (sys.platform.startswith('win32') or sys.platform.startswith('msys')) and sys.argv[1] != 'Android':
1354            extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1355                                 ext_khr_display, ext_khr_display_swapchain]
1356            extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1357                                      ext_khr_display, ext_amd_draw_indirect_count,
1358                                      ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
1359                                      ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1360        elif sys.platform.startswith('linux') and sys.argv[1] != 'Android':
1361            extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1362                                 ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface, ext_khr_display,
1363                                 ext_khr_display_swapchain]
1364            extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1365                                      ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1366                                      ext_khr_display, ext_amd_draw_indirect_count,
1367                                      ext_nv_external_memory_capabilities, ext_khr_display_swapchain,
1368                                      ext_debug_report, ext_debug_marker]
1369        else: # android
1370            extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1371                                 ext_khr_display_swapchain]
1372            extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1373                                      ext_amd_draw_indirect_count, ext_nv_external_memory_capabilities,
1374                                      ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1375    else :
1376        if sys.argv[1] == 'Win32' or sys.argv[1] == 'msys':
1377            extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1378                                 ext_khr_display, ext_khr_display_swapchain]
1379            extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_win32_surface,
1380                                      ext_khr_display, ext_amd_draw_indirect_count,
1381                                      ext_nv_external_memory_capabilities, ext_nv_external_memory_win32,
1382                                      ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1383        elif sys.argv[1] == 'Android':
1384            extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1385                                 ext_khr_display_swapchain]
1386            extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_android_surface,
1387                                      ext_amd_draw_indirect_count, ext_nv_external_memory_capabilities,
1388                                      ext_khr_display_swapchain, ext_debug_report, ext_debug_marker]
1389        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':
1390            extensions = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1391                                 ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1392                                 ext_khr_display, ext_khr_display_swapchain]
1393            extensions_all = [core, ext_khr_surface, ext_khr_device_swapchain, ext_khr_xcb_surface,
1394                                      ext_khr_xlib_surface, ext_khr_wayland_surface, ext_khr_mir_surface,
1395                                      ext_khr_display, ext_amd_draw_indirect_count,
1396                                      ext_nv_external_memory_capabilities, ext_khr_display_swapchain,
1397                                      ext_debug_report, ext_debug_marker]
1398        else:
1399            print('Error: Undefined DisplayServer')
1400            extensions = []
1401            extensions_all = []
1402
1403object_dispatch_list = [
1404    "VkInstance",
1405    "VkPhysicalDevice",
1406    "VkDevice",
1407    "VkQueue",
1408    "VkCommandBuffer",
1409]
1410
1411object_non_dispatch_list = [
1412    "VkCommandPool",
1413    "VkFence",
1414    "VkDeviceMemory",
1415    "VkBuffer",
1416    "VkImage",
1417    "VkSemaphore",
1418    "VkEvent",
1419    "VkQueryPool",
1420    "VkBufferView",
1421    "VkImageView",
1422    "VkShaderModule",
1423    "VkPipelineCache",
1424    "VkPipelineLayout",
1425    "VkPipeline",
1426    "VkDescriptorSetLayout",
1427    "VkSampler",
1428    "VkDescriptorPool",
1429    "VkDescriptorSet",
1430    "VkRenderPass",
1431    "VkFramebuffer",
1432    "VkSwapchainKHR",
1433    "VkSurfaceKHR",
1434    "VkDebugReportCallbackEXT",
1435    "VkDisplayKHR",
1436    "VkDisplayModeKHR",
1437]
1438
1439object_type_list = object_dispatch_list + object_non_dispatch_list
1440
1441headers = []
1442objects = []
1443protos = []
1444for ext in extensions:
1445    headers.extend(ext.headers)
1446    objects.extend(ext.objects)
1447    protos.extend(ext.protos)
1448
1449proto_names = [proto.name for proto in protos]
1450
1451headers_all = []
1452objects_all = []
1453protos_all = []
1454for ext in extensions_all:
1455    headers_all.extend(ext.headers)
1456    objects_all.extend(ext.objects)
1457    protos_all.extend(ext.protos)
1458
1459proto_all_names = [proto.name for proto in protos_all]
1460