blob: b3b697539c8586d1f73901222b9e187cce372af6 [file] [log] [blame]
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001"""VK API description"""
Chia-I Wufb2559d2014-08-01 11:19:52 +08002
3# Copyright (C) 2014 LunarG, Inc.
4#
5# Permission is hereby granted, free of charge, to any person obtaining a
6# copy of this software and associated documentation files (the "Software"),
7# to deal in the Software without restriction, including without limitation
8# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9# and/or sell copies of the Software, and to permit persons to whom the
10# Software is furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included
13# in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21# DEALINGS IN THE SOFTWARE.
22
23class Param(object):
24 """A function parameter."""
25
26 def __init__(self, ty, name):
27 self.ty = ty
28 self.name = name
29
30 def c(self):
31 """Return the parameter in C."""
32 idx = self.ty.find("[")
33
34 # arrays have a different syntax
35 if idx >= 0:
36 return "%s %s%s" % (self.ty[:idx], self.name, self.ty[idx:])
37 else:
38 return "%s %s" % (self.ty, self.name)
39
Chia-I Wua5d28fa2015-01-04 15:02:50 +080040 def indirection_level(self):
41 """Return the level of indirection."""
42 return self.ty.count("*") + self.ty.count("[")
43
44 def dereferenced_type(self, level=0):
45 """Return the type after dereferencing."""
46 if not level:
47 level = self.indirection_level()
48
49 deref = self.ty if level else ""
50 while level > 0:
51 idx = deref.rfind("[")
52 if idx < 0:
53 idx = deref.rfind("*")
54 if idx < 0:
55 deref = ""
56 break
57 deref = deref[:idx]
58 level -= 1;
59
60 return deref.rstrip()
61
Chia-I Wu509a4122015-01-04 14:08:46 +080062 def __repr__(self):
63 return "Param(\"%s\", \"%s\")" % (self.ty, self.name)
64
Chia-I Wufb2559d2014-08-01 11:19:52 +080065class Proto(object):
66 """A function prototype."""
67
Chia-I Wue442dc32015-01-01 09:31:15 +080068 def __init__(self, ret, name, params=[]):
Chia-I Wufb2559d2014-08-01 11:19:52 +080069 # the proto has only a param
Chia-I Wue442dc32015-01-01 09:31:15 +080070 if not isinstance(params, list):
71 params = [params]
Chia-I Wufb2559d2014-08-01 11:19:52 +080072
73 self.ret = ret
74 self.name = name
75 self.params = params
76
77 def c_params(self, need_type=True, need_name=True):
78 """Return the parameter list in C."""
79 if self.params and (need_type or need_name):
80 if need_type and need_name:
81 return ", ".join([param.c() for param in self.params])
82 elif need_type:
83 return ", ".join([param.ty for param in self.params])
84 else:
85 return ", ".join([param.name for param in self.params])
86 else:
87 return "void" if need_type else ""
88
89 def c_decl(self, name, attr="", typed=False, need_param_names=True):
90 """Return a named declaration in C."""
91 format_vals = (self.ret,
92 attr + " " if attr else "",
93 name,
94 self.c_params(need_name=need_param_names))
95
96 if typed:
97 return "%s (%s*%s)(%s)" % format_vals
98 else:
99 return "%s %s%s(%s)" % format_vals
100
Chia-I Wuaf3b5552015-01-04 12:00:01 +0800101 def c_pretty_decl(self, name, attr=""):
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600102 """Return a named declaration in C, with vulkan.h formatting."""
Chia-I Wuaf3b5552015-01-04 12:00:01 +0800103 plist = []
104 for param in self.params:
105 idx = param.ty.find("[")
106 if idx < 0:
107 idx = len(param.ty)
108
109 pad = 44 - idx
110 if pad <= 0:
111 pad = 1
112
113 plist.append(" %s%s%s%s" % (param.ty[:idx],
114 " " * pad, param.name, param.ty[idx:]))
115
116 return "%s %s%s(\n%s)" % (self.ret,
117 attr + " " if attr else "",
118 name,
119 ",\n".join(plist))
120
Chia-I Wufb2559d2014-08-01 11:19:52 +0800121 def c_typedef(self, suffix="", attr=""):
122 """Return the typedef for the prototype in C."""
123 return self.c_decl(self.name + suffix, attr=attr, typed=True)
124
125 def c_func(self, prefix="", attr=""):
126 """Return the prototype in C."""
127 return self.c_decl(prefix + self.name, attr=attr, typed=False)
128
129 def c_call(self):
130 """Return a call to the prototype in C."""
131 return "%s(%s)" % (self.name, self.c_params(need_type=False))
132
Chia-I Wua5d28fa2015-01-04 15:02:50 +0800133 def object_in_params(self):
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600134 """Return the params that are simple VK objects and are inputs."""
Chia-I Wua5d28fa2015-01-04 15:02:50 +0800135 return [param for param in self.params if param.ty in objects]
136
137 def object_out_params(self):
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600138 """Return the params that are simple VK objects and are outputs."""
Chia-I Wua5d28fa2015-01-04 15:02:50 +0800139 return [param for param in self.params
140 if param.dereferenced_type() in objects]
141
Chia-I Wu509a4122015-01-04 14:08:46 +0800142 def __repr__(self):
143 param_strs = []
144 for param in self.params:
145 param_strs.append(str(param))
146 param_str = " [%s]" % (",\n ".join(param_strs))
147
148 return "Proto(\"%s\", \"%s\",\n%s)" % \
149 (self.ret, self.name, param_str)
150
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800151class Extension(object):
Chia-I Wue86d8ab2015-01-04 14:46:22 +0800152 def __init__(self, name, headers, objects, protos):
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800153 self.name = name
154 self.headers = headers
Chia-I Wue86d8ab2015-01-04 14:46:22 +0800155 self.objects = objects
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800156 self.protos = protos
157
Chia-I Wu509a4122015-01-04 14:08:46 +0800158 def __repr__(self):
159 lines = []
160 lines.append("Extension(")
161 lines.append(" name=\"%s\"," % self.name)
162 lines.append(" headers=[\"%s\"]," %
163 "\", \"".join(self.headers))
164
165 lines.append(" objects=[")
166 for obj in self.objects:
167 lines.append(" \"%s\"," % obj)
168 lines.append(" ],")
169
170 lines.append(" protos=[")
171 for proto in self.protos:
172 param_lines = str(proto).splitlines()
173 param_lines[-1] += ",\n" if proto != self.protos[-1] else ","
174 for p in param_lines:
175 lines.append(" " + p)
176 lines.append(" ],")
177 lines.append(")")
178
179 return "\n".join(lines)
180
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600181# VK core API
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800182core = Extension(
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600183 name="VK_CORE",
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600184 headers=["vulkan.h", "vk_debug_report_lunarg.h"],
Jon Ashburn9fd4cc42015-04-10 14:33:07 -0600185
Chia-I Wue86d8ab2015-01-04 14:46:22 +0800186 objects=[
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600187 "VkInstance",
Tony Barbourd1c35722015-04-16 15:59:00 -0600188 "VkPhysicalDevice",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600189 "VkDevice",
190 "VkQueue",
Tony Barbourd1c35722015-04-16 15:59:00 -0600191 "VkDeviceMemory",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600192 "VkObject",
193 "VkBuffer",
194 "VkBufferView",
195 "VkImage",
196 "VkImageView",
197 "VkColorAttachmentView",
198 "VkDepthStencilView",
199 "VkShader",
200 "VkPipeline",
201 "VkSampler",
202 "VkDescriptorSet",
203 "VkDescriptorSetLayout",
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -0500204 "VkPipelineLayout",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600205 "VkDescriptorPool",
206 "VkDynamicStateObject",
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -0600207 "VkDynamicVpState",
208 "VkDynamicRsState",
209 "VkDynamicCbState",
210 "VkDynamicDsState",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600211 "VkCmdBuffer",
212 "VkFence",
213 "VkSemaphore",
214 "VkEvent",
215 "VkQueryPool",
216 "VkFramebuffer",
217 "VkRenderPass",
Chia-I Wue86d8ab2015-01-04 14:46:22 +0800218 ],
Chia-I Wue442dc32015-01-01 09:31:15 +0800219 protos=[
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600220 Proto("VkResult", "CreateInstance",
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600221 [Param("const VkInstanceCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600222 Param("VkInstance*", "pInstance")]),
Jon Ashburn1beab2d2015-01-26 14:51:40 -0700223
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600224 Proto("VkResult", "DestroyInstance",
225 [Param("VkInstance", "instance")]),
Jon Ashburn1beab2d2015-01-26 14:51:40 -0700226
Jon Ashburn83a64252015-04-15 11:31:12 -0600227 Proto("VkResult", "EnumeratePhysicalDevices",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600228 [Param("VkInstance", "instance"),
Jon Ashburn83a64252015-04-15 11:31:12 -0600229 Param("uint32_t*", "pPhysicalDeviceCount"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600230 Param("VkPhysicalDevice*", "pPhysicalDevices")]),
Jon Ashburn1beab2d2015-01-26 14:51:40 -0700231
Tony Barbour59a47322015-06-24 16:06:58 -0600232 Proto("VkResult", "GetPhysicalDeviceProperties",
Tony Barbourd1c35722015-04-16 15:59:00 -0600233 [Param("VkPhysicalDevice", "gpu"),
Tony Barbour59a47322015-06-24 16:06:58 -0600234 Param("VkPhysicalDeviceProperties*", "pProperties")]),
235
236 Proto("VkResult", "GetPhysicalDevicePerformance",
237 [Param("VkPhysicalDevice", "gpu"),
238 Param("VkPhysicalDevicePerformance*", "pPerformance")]),
239
240 Proto("VkResult", "GetPhysicalDeviceQueueCount",
241 [Param("VkPhysicalDevice", "gpu"),
242 Param("uint32_t*", "pCount")]),
243
244 Proto("VkResult", "GetPhysicalDeviceQueueProperties",
245 [Param("VkPhysicalDevice", "gpu"),
246 Param("uint32_t", "count"),
247 Param("VkPhysicalDeviceQueueProperties*", "pProperties")]),
248
249 Proto("VkResult", "GetPhysicalDeviceMemoryProperties",
250 [Param("VkPhysicalDevice", "gpu"),
251 Param("VkPhysicalDeviceMemoryProperties*", "pProperties")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800252
Chris Forbesbc0bb772015-06-21 22:55:02 +1200253 Proto("VkResult", "GetPhysicalDeviceFeatures",
254 [Param("VkPhysicalDevice", "physicalDevice"),
255 Param("VkPhysicalDeviceFeatures*", "pFeatures")]),
256
257 Proto("VkResult", "GetPhysicalDeviceFormatInfo",
258 [Param("VkPhysicalDevice", "physicalDevice"),
259 Param("VkFormat", "format"),
260 Param("VkFormatProperties*", "pFormatInfo")]),
261
262 Proto("VkResult", "GetPhysicalDeviceLimits",
263 [Param("VkPhysicalDevice", "physicalDevice"),
264 Param("VkPhysicalDeviceLimits*", "pLimits")]),
265
Jon Ashburnb0fbe912015-05-06 10:15:07 -0600266 Proto("void*", "GetInstanceProcAddr",
267 [Param("VkInstance", "instance"),
268 Param("const char*", "pName")]),
269
Jon Ashburn8d1b0b52015-05-18 13:20:15 -0600270 Proto("void*", "GetDeviceProcAddr",
271 [Param("VkDevice", "device"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600272 Param("const char*", "pName")]),
Chia-I Wuf2ffc522015-01-04 14:51:06 +0800273
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600274 Proto("VkResult", "CreateDevice",
Tony Barbourd1c35722015-04-16 15:59:00 -0600275 [Param("VkPhysicalDevice", "gpu"),
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600276 Param("const VkDeviceCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600277 Param("VkDevice*", "pDevice")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800278
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600279 Proto("VkResult", "DestroyDevice",
280 [Param("VkDevice", "device")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800281
Tony Barbour59a47322015-06-24 16:06:58 -0600282 Proto("VkResult", "GetPhysicalDeviceExtensionProperties",
Tony Barbourd1c35722015-04-16 15:59:00 -0600283 [Param("VkPhysicalDevice", "gpu"),
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600284 Param("const char*", "pLayerName"),
285 Param("uint32_t*", "pCount"),
Tony Barbour59a47322015-06-24 16:06:58 -0600286 Param("VkExtensionProperties*", "pProperties")]),
287
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600288 Proto("VkResult", "GetPhysicalDeviceLayerProperties",
Tony Barbour59a47322015-06-24 16:06:58 -0600289 [Param("VkPhysicalDevice", "gpu"),
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600290 Param("const char*", "pLayerName"),
291 Param("uint32_t*", "pCount"),
292 Param("VkLayerProperties*", "pProperties")]),
Tony Barbour59a47322015-06-24 16:06:58 -0600293
294 Proto("VkResult", "GetGlobalExtensionProperties",
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600295 [Param("const char*", "pLayerName"),
296 Param("uint32_t*", "pCount"),
Tony Barbour59a47322015-06-24 16:06:58 -0600297 Param("VkExtensionProperties*", "pProperties")]),
298
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600299 Proto("VkResult", "GetGlobalLayerProperties",
300 [Param("uint32_t*", "pCount"),
301 Param("VkExtensionProperties*", "pProperties")]),
Tobin Ehlis01939012015-04-16 12:51:37 -0600302
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600303 Proto("VkResult", "GetDeviceQueue",
304 [Param("VkDevice", "device"),
Courtney Goeltzenleuchter18248e62015-03-05 18:09:39 -0700305 Param("uint32_t", "queueNodeIndex"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600306 Param("uint32_t", "queueIndex"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600307 Param("VkQueue*", "pQueue")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800308
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600309 Proto("VkResult", "QueueSubmit",
310 [Param("VkQueue", "queue"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600311 Param("uint32_t", "cmdBufferCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600312 Param("const VkCmdBuffer*", "pCmdBuffers"),
313 Param("VkFence", "fence")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800314
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600315 Proto("VkResult", "QueueWaitIdle",
316 [Param("VkQueue", "queue")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800317
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600318 Proto("VkResult", "DeviceWaitIdle",
319 [Param("VkDevice", "device")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800320
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600321 Proto("VkResult", "AllocMemory",
322 [Param("VkDevice", "device"),
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600323 Param("const VkMemoryAllocInfo*", "pAllocInfo"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600324 Param("VkDeviceMemory*", "pMem")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800325
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600326 Proto("VkResult", "FreeMemory",
Mike Stroyanb050c682015-04-17 12:36:38 -0600327 [Param("VkDevice", "device"),
328 Param("VkDeviceMemory", "mem")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800329
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600330 Proto("VkResult", "MapMemory",
Mike Stroyanb050c682015-04-17 12:36:38 -0600331 [Param("VkDevice", "device"),
332 Param("VkDeviceMemory", "mem"),
Tony Barbour71a85122015-04-16 19:09:28 -0600333 Param("VkDeviceSize", "offset"),
334 Param("VkDeviceSize", "size"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600335 Param("VkFlags", "flags"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600336 Param("void**", "ppData")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800337
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600338 Proto("VkResult", "UnmapMemory",
Mike Stroyanb050c682015-04-17 12:36:38 -0600339 [Param("VkDevice", "device"),
340 Param("VkDeviceMemory", "mem")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800341
Courtney Goeltzenleuchterf69f8a22015-04-29 17:16:21 -0600342 Proto("VkResult", "FlushMappedMemoryRanges",
Mike Stroyanb050c682015-04-17 12:36:38 -0600343 [Param("VkDevice", "device"),
Courtney Goeltzenleuchterf69f8a22015-04-29 17:16:21 -0600344 Param("uint32_t", "memRangeCount"),
345 Param("const VkMappedMemoryRange*", "pMemRanges")]),
346
347 Proto("VkResult", "InvalidateMappedMemoryRanges",
348 [Param("VkDevice", "device"),
349 Param("uint32_t", "memRangeCount"),
350 Param("const VkMappedMemoryRange*", "pMemRanges")]),
Tony Barbourb1250542015-04-16 19:23:13 -0600351
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600352 Proto("VkResult", "DestroyObject",
Mike Stroyanb050c682015-04-17 12:36:38 -0600353 [Param("VkDevice", "device"),
Mark Lobodzinski23065352015-05-29 09:32:35 -0500354 Param("VkObjectType", "objType"),
Mike Stroyanb050c682015-04-17 12:36:38 -0600355 Param("VkObject", "object")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800356
Tony Barbour59a47322015-06-24 16:06:58 -0600357 Proto("VkResult", "GetObjectMemoryRequirements",
Mike Stroyanb050c682015-04-17 12:36:38 -0600358 [Param("VkDevice", "device"),
Mark Lobodzinski23065352015-05-29 09:32:35 -0500359 Param("VkObjectType", "objType"),
Mike Stroyanb050c682015-04-17 12:36:38 -0600360 Param("VkObject", "object"),
Tony Barbour59a47322015-06-24 16:06:58 -0600361 Param("VkMemoryRequirements*", "pMemoryRequirements")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800362
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500363 Proto("VkResult", "BindObjectMemory",
364 [Param("VkDevice", "device"),
Mark Lobodzinski23065352015-05-29 09:32:35 -0500365 Param("VkObjectType", "objType"),
Mark Lobodzinski40f7f402015-04-16 11:44:05 -0500366 Param("VkObject", "object"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600367 Param("VkDeviceMemory", "mem"),
368 Param("VkDeviceSize", "offset")]),
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800369
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500370 Proto("VkResult", "QueueBindSparseBufferMemory",
Mark Lobodzinski40f7f402015-04-16 11:44:05 -0500371 [Param("VkQueue", "queue"),
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500372 Param("VkBuffer", "buffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600373 Param("VkDeviceSize", "rangeOffset"),
374 Param("VkDeviceSize", "rangeSize"),
375 Param("VkDeviceMemory", "mem"),
376 Param("VkDeviceSize", "memOffset")]),
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800377
Mark Lobodzinski942b1722015-05-11 17:21:15 -0500378 Proto("VkResult", "QueueBindSparseImageMemory",
Mark Lobodzinski40f7f402015-04-16 11:44:05 -0500379 [Param("VkQueue", "queue"),
380 Param("VkImage", "image"),
Jeremy Hayesaf0d72c2015-04-15 15:20:03 -0600381 Param("const VkImageMemoryBindInfo*", "pBindInfo"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600382 Param("VkDeviceMemory", "mem"),
383 Param("VkDeviceSize", "memOffset")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800384
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600385 Proto("VkResult", "CreateFence",
386 [Param("VkDevice", "device"),
387 Param("const VkFenceCreateInfo*", "pCreateInfo"),
388 Param("VkFence*", "pFence")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800389
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600390 Proto("VkResult", "ResetFences",
391 [Param("VkDevice", "device"),
Mark Lobodzinski148e1582015-04-07 16:07:57 -0500392 Param("uint32_t", "fenceCount"),
Courtney Goeltzenleuchter2bf8f902015-06-18 17:28:20 -0600393 Param("const VkFence*", "pFences")]),
Mark Lobodzinski148e1582015-04-07 16:07:57 -0500394
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600395 Proto("VkResult", "GetFenceStatus",
Mike Stroyanb050c682015-04-17 12:36:38 -0600396 [Param("VkDevice", "device"),
397 Param("VkFence", "fence")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800398
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600399 Proto("VkResult", "WaitForFences",
400 [Param("VkDevice", "device"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600401 Param("uint32_t", "fenceCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600402 Param("const VkFence*", "pFences"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600403 Param("bool32_t", "waitAll"),
404 Param("uint64_t", "timeout")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800405
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600406 Proto("VkResult", "CreateSemaphore",
407 [Param("VkDevice", "device"),
408 Param("const VkSemaphoreCreateInfo*", "pCreateInfo"),
409 Param("VkSemaphore*", "pSemaphore")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800410
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600411 Proto("VkResult", "QueueSignalSemaphore",
412 [Param("VkQueue", "queue"),
413 Param("VkSemaphore", "semaphore")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800414
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600415 Proto("VkResult", "QueueWaitSemaphore",
416 [Param("VkQueue", "queue"),
417 Param("VkSemaphore", "semaphore")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800418
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600419 Proto("VkResult", "CreateEvent",
420 [Param("VkDevice", "device"),
421 Param("const VkEventCreateInfo*", "pCreateInfo"),
422 Param("VkEvent*", "pEvent")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800423
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600424 Proto("VkResult", "GetEventStatus",
Mike Stroyanb050c682015-04-17 12:36:38 -0600425 [Param("VkDevice", "device"),
426 Param("VkEvent", "event")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800427
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600428 Proto("VkResult", "SetEvent",
Mike Stroyanb050c682015-04-17 12:36:38 -0600429 [Param("VkDevice", "device"),
430 Param("VkEvent", "event")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800431
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600432 Proto("VkResult", "ResetEvent",
Mike Stroyanb050c682015-04-17 12:36:38 -0600433 [Param("VkDevice", "device"),
434 Param("VkEvent", "event")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800435
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600436 Proto("VkResult", "CreateQueryPool",
437 [Param("VkDevice", "device"),
438 Param("const VkQueryPoolCreateInfo*", "pCreateInfo"),
439 Param("VkQueryPool*", "pQueryPool")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800440
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600441 Proto("VkResult", "GetQueryPoolResults",
Mike Stroyanb050c682015-04-17 12:36:38 -0600442 [Param("VkDevice", "device"),
443 Param("VkQueryPool", "queryPool"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600444 Param("uint32_t", "startQuery"),
445 Param("uint32_t", "queryCount"),
446 Param("size_t*", "pDataSize"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600447 Param("void*", "pData"),
448 Param("VkQueryResultFlags", "flags")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800449
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600450 Proto("VkResult", "CreateBuffer",
451 [Param("VkDevice", "device"),
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600452 Param("const VkBufferCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600453 Param("VkBuffer*", "pBuffer")]),
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800454
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600455 Proto("VkResult", "CreateBufferView",
456 [Param("VkDevice", "device"),
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600457 Param("const VkBufferViewCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600458 Param("VkBufferView*", "pView")]),
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800459
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600460 Proto("VkResult", "CreateImage",
461 [Param("VkDevice", "device"),
462 Param("const VkImageCreateInfo*", "pCreateInfo"),
463 Param("VkImage*", "pImage")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800464
Tony Barbour59a47322015-06-24 16:06:58 -0600465 Proto("VkResult", "GetImageSubresourceLayout",
Mike Stroyanb050c682015-04-17 12:36:38 -0600466 [Param("VkDevice", "device"),
467 Param("VkImage", "image"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600468 Param("const VkImageSubresource*", "pSubresource"),
Tony Barbour59a47322015-06-24 16:06:58 -0600469 Param("VkSubresourceLayout*", "pLayout")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800470
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600471 Proto("VkResult", "CreateImageView",
472 [Param("VkDevice", "device"),
473 Param("const VkImageViewCreateInfo*", "pCreateInfo"),
474 Param("VkImageView*", "pView")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800475
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600476 Proto("VkResult", "CreateColorAttachmentView",
477 [Param("VkDevice", "device"),
478 Param("const VkColorAttachmentViewCreateInfo*", "pCreateInfo"),
479 Param("VkColorAttachmentView*", "pView")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800480
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600481 Proto("VkResult", "CreateDepthStencilView",
482 [Param("VkDevice", "device"),
483 Param("const VkDepthStencilViewCreateInfo*", "pCreateInfo"),
484 Param("VkDepthStencilView*", "pView")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800485
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -0600486 Proto("VkResult", "CreateShaderModule",
487 [Param("VkDevice", "device"),
488 Param("const VkShaderModuleCreateInfo*", "pCreateInfo"),
489 Param("VkShaderModule*", "pShaderModule")]),
490
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600491 Proto("VkResult", "CreateShader",
492 [Param("VkDevice", "device"),
493 Param("const VkShaderCreateInfo*", "pCreateInfo"),
494 Param("VkShader*", "pShader")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800495
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600496 Proto("VkResult", "CreateGraphicsPipeline",
497 [Param("VkDevice", "device"),
498 Param("const VkGraphicsPipelineCreateInfo*", "pCreateInfo"),
499 Param("VkPipeline*", "pPipeline")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800500
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600501 Proto("VkResult", "CreateGraphicsPipelineDerivative",
502 [Param("VkDevice", "device"),
503 Param("const VkGraphicsPipelineCreateInfo*", "pCreateInfo"),
504 Param("VkPipeline", "basePipeline"),
505 Param("VkPipeline*", "pPipeline")]),
Courtney Goeltzenleuchter0d40f152015-03-25 15:37:49 -0600506
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600507 Proto("VkResult", "CreateComputePipeline",
508 [Param("VkDevice", "device"),
509 Param("const VkComputePipelineCreateInfo*", "pCreateInfo"),
510 Param("VkPipeline*", "pPipeline")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800511
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600512 Proto("VkResult", "StorePipeline",
Mike Stroyanb050c682015-04-17 12:36:38 -0600513 [Param("VkDevice", "device"),
514 Param("VkPipeline", "pipeline"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600515 Param("size_t*", "pDataSize"),
516 Param("void*", "pData")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800517
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600518 Proto("VkResult", "LoadPipeline",
519 [Param("VkDevice", "device"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600520 Param("size_t", "dataSize"),
521 Param("const void*", "pData"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600522 Param("VkPipeline*", "pPipeline")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800523
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600524 Proto("VkResult", "LoadPipelineDerivative",
525 [Param("VkDevice", "device"),
Courtney Goeltzenleuchter0d40f152015-03-25 15:37:49 -0600526 Param("size_t", "dataSize"),
527 Param("const void*", "pData"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600528 Param("VkPipeline", "basePipeline"),
529 Param("VkPipeline*", "pPipeline")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800530
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -0500531 Proto("VkResult", "CreatePipelineLayout",
532 [Param("VkDevice", "device"),
533 Param("const VkPipelineLayoutCreateInfo*", "pCreateInfo"),
534 Param("VkPipelineLayout*", "pPipelineLayout")]),
535
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600536 Proto("VkResult", "CreateSampler",
537 [Param("VkDevice", "device"),
538 Param("const VkSamplerCreateInfo*", "pCreateInfo"),
539 Param("VkSampler*", "pSampler")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800540
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600541 Proto("VkResult", "CreateDescriptorSetLayout",
542 [Param("VkDevice", "device"),
543 Param("const VkDescriptorSetLayoutCreateInfo*", "pCreateInfo"),
544 Param("VkDescriptorSetLayout*", "pSetLayout")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800545
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600546 Proto("VkResult", "CreateDescriptorPool",
547 [Param("VkDevice", "device"),
548 Param("VkDescriptorPoolUsage", "poolUsage"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600549 Param("uint32_t", "maxSets"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600550 Param("const VkDescriptorPoolCreateInfo*", "pCreateInfo"),
551 Param("VkDescriptorPool*", "pDescriptorPool")]),
Chia-I Wu11078b02015-01-04 16:27:24 +0800552
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600553 Proto("VkResult", "ResetDescriptorPool",
Mike Stroyanb050c682015-04-17 12:36:38 -0600554 [Param("VkDevice", "device"),
555 Param("VkDescriptorPool", "descriptorPool")]),
Chia-I Wu11078b02015-01-04 16:27:24 +0800556
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600557 Proto("VkResult", "AllocDescriptorSets",
Mike Stroyanb050c682015-04-17 12:36:38 -0600558 [Param("VkDevice", "device"),
559 Param("VkDescriptorPool", "descriptorPool"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600560 Param("VkDescriptorSetUsage", "setUsage"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600561 Param("uint32_t", "count"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600562 Param("const VkDescriptorSetLayout*", "pSetLayouts"),
563 Param("VkDescriptorSet*", "pDescriptorSets"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600564 Param("uint32_t*", "pCount")]),
Chia-I Wu11078b02015-01-04 16:27:24 +0800565
Chia-I Wu9d00ed72015-05-25 16:27:55 +0800566 Proto("VkResult", "UpdateDescriptorSets",
Mike Stroyanb050c682015-04-17 12:36:38 -0600567 [Param("VkDevice", "device"),
Chia-I Wu9d00ed72015-05-25 16:27:55 +0800568 Param("uint32_t", "writeCount"),
569 Param("const VkWriteDescriptorSet*", "pDescriptorWrites"),
570 Param("uint32_t", "copyCount"),
571 Param("const VkCopyDescriptorSet*", "pDescriptorCopies")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800572
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600573 Proto("VkResult", "CreateDynamicViewportState",
574 [Param("VkDevice", "device"),
575 Param("const VkDynamicVpStateCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -0600576 Param("VkDynamicVpState*", "pState")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800577
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600578 Proto("VkResult", "CreateDynamicRasterState",
579 [Param("VkDevice", "device"),
580 Param("const VkDynamicRsStateCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -0600581 Param("VkDynamicRsState*", "pState")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800582
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600583 Proto("VkResult", "CreateDynamicColorBlendState",
584 [Param("VkDevice", "device"),
585 Param("const VkDynamicCbStateCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -0600586 Param("VkDynamicCbState*", "pState")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800587
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600588 Proto("VkResult", "CreateDynamicDepthStencilState",
589 [Param("VkDevice", "device"),
590 Param("const VkDynamicDsStateCreateInfo*", "pCreateInfo"),
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -0600591 Param("VkDynamicDsState*", "pState")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800592
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600593 Proto("VkResult", "CreateCommandBuffer",
594 [Param("VkDevice", "device"),
595 Param("const VkCmdBufferCreateInfo*", "pCreateInfo"),
596 Param("VkCmdBuffer*", "pCmdBuffer")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800597
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600598 Proto("VkResult", "BeginCommandBuffer",
599 [Param("VkCmdBuffer", "cmdBuffer"),
600 Param("const VkCmdBufferBeginInfo*", "pBeginInfo")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800601
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600602 Proto("VkResult", "EndCommandBuffer",
603 [Param("VkCmdBuffer", "cmdBuffer")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800604
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600605 Proto("VkResult", "ResetCommandBuffer",
606 [Param("VkCmdBuffer", "cmdBuffer")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800607
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600608 Proto("void", "CmdBindPipeline",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600609 [Param("VkCmdBuffer", "cmdBuffer"),
610 Param("VkPipelineBindPoint", "pipelineBindPoint"),
611 Param("VkPipeline", "pipeline")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800612
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600613 Proto("void", "CmdBindDynamicStateObject",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600614 [Param("VkCmdBuffer", "cmdBuffer"),
615 Param("VkStateBindPoint", "stateBindPoint"),
616 Param("VkDynamicStateObject", "state")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800617
Chia-I Wu53f07d72015-03-28 15:23:55 +0800618 Proto("void", "CmdBindDescriptorSets",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600619 [Param("VkCmdBuffer", "cmdBuffer"),
620 Param("VkPipelineBindPoint", "pipelineBindPoint"),
Mark Lobodzinskif2093b62015-06-15 13:21:21 -0600621 Param("VkPipelineLayout", "layout"),
Cody Northropd4c1a502015-04-16 13:41:56 -0600622 Param("uint32_t", "firstSet"),
623 Param("uint32_t", "setCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600624 Param("const VkDescriptorSet*", "pDescriptorSets"),
Cody Northropd4c1a502015-04-16 13:41:56 -0600625 Param("uint32_t", "dynamicOffsetCount"),
626 Param("const uint32_t*", "pDynamicOffsets")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800627
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600628 Proto("void", "CmdBindVertexBuffers",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600629 [Param("VkCmdBuffer", "cmdBuffer"),
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600630 Param("uint32_t", "startBinding"),
631 Param("uint32_t", "bindingCount"),
632 Param("const VkBuffer*", "pBuffers"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600633 Param("const VkDeviceSize*", "pOffsets")]),
634
Chia-I Wu7a42e122014-11-08 10:48:20 +0800635
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600636 Proto("void", "CmdBindIndexBuffer",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600637 [Param("VkCmdBuffer", "cmdBuffer"),
638 Param("VkBuffer", "buffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600639 Param("VkDeviceSize", "offset"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600640 Param("VkIndexType", "indexType")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800641
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600642 Proto("void", "CmdDraw",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600643 [Param("VkCmdBuffer", "cmdBuffer"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600644 Param("uint32_t", "firstVertex"),
645 Param("uint32_t", "vertexCount"),
646 Param("uint32_t", "firstInstance"),
647 Param("uint32_t", "instanceCount")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800648
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600649 Proto("void", "CmdDrawIndexed",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600650 [Param("VkCmdBuffer", "cmdBuffer"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600651 Param("uint32_t", "firstIndex"),
652 Param("uint32_t", "indexCount"),
653 Param("int32_t", "vertexOffset"),
654 Param("uint32_t", "firstInstance"),
655 Param("uint32_t", "instanceCount")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800656
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600657 Proto("void", "CmdDrawIndirect",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600658 [Param("VkCmdBuffer", "cmdBuffer"),
659 Param("VkBuffer", "buffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600660 Param("VkDeviceSize", "offset"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600661 Param("uint32_t", "count"),
662 Param("uint32_t", "stride")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800663
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600664 Proto("void", "CmdDrawIndexedIndirect",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600665 [Param("VkCmdBuffer", "cmdBuffer"),
666 Param("VkBuffer", "buffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600667 Param("VkDeviceSize", "offset"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600668 Param("uint32_t", "count"),
669 Param("uint32_t", "stride")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800670
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600671 Proto("void", "CmdDispatch",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600672 [Param("VkCmdBuffer", "cmdBuffer"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600673 Param("uint32_t", "x"),
674 Param("uint32_t", "y"),
675 Param("uint32_t", "z")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800676
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600677 Proto("void", "CmdDispatchIndirect",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600678 [Param("VkCmdBuffer", "cmdBuffer"),
679 Param("VkBuffer", "buffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600680 Param("VkDeviceSize", "offset")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800681
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600682 Proto("void", "CmdCopyBuffer",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600683 [Param("VkCmdBuffer", "cmdBuffer"),
684 Param("VkBuffer", "srcBuffer"),
685 Param("VkBuffer", "destBuffer"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600686 Param("uint32_t", "regionCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600687 Param("const VkBufferCopy*", "pRegions")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800688
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600689 Proto("void", "CmdCopyImage",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600690 [Param("VkCmdBuffer", "cmdBuffer"),
691 Param("VkImage", "srcImage"),
692 Param("VkImageLayout", "srcImageLayout"),
693 Param("VkImage", "destImage"),
694 Param("VkImageLayout", "destImageLayout"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600695 Param("uint32_t", "regionCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600696 Param("const VkImageCopy*", "pRegions")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800697
Courtney Goeltzenleuchter89299fa2015-03-08 17:02:18 -0600698 Proto("void", "CmdBlitImage",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600699 [Param("VkCmdBuffer", "cmdBuffer"),
700 Param("VkImage", "srcImage"),
701 Param("VkImageLayout", "srcImageLayout"),
702 Param("VkImage", "destImage"),
703 Param("VkImageLayout", "destImageLayout"),
Courtney Goeltzenleuchter89299fa2015-03-08 17:02:18 -0600704 Param("uint32_t", "regionCount"),
Mark Lobodzinskiee5eef12015-05-22 14:43:25 -0500705 Param("const VkImageBlit*", "pRegions"),
706 Param("VkTexFilter", "filter")]),
Courtney Goeltzenleuchter89299fa2015-03-08 17:02:18 -0600707
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600708 Proto("void", "CmdCopyBufferToImage",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600709 [Param("VkCmdBuffer", "cmdBuffer"),
710 Param("VkBuffer", "srcBuffer"),
711 Param("VkImage", "destImage"),
712 Param("VkImageLayout", "destImageLayout"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600713 Param("uint32_t", "regionCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600714 Param("const VkBufferImageCopy*", "pRegions")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800715
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600716 Proto("void", "CmdCopyImageToBuffer",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600717 [Param("VkCmdBuffer", "cmdBuffer"),
718 Param("VkImage", "srcImage"),
719 Param("VkImageLayout", "srcImageLayout"),
720 Param("VkBuffer", "destBuffer"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600721 Param("uint32_t", "regionCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600722 Param("const VkBufferImageCopy*", "pRegions")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800723
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600724 Proto("void", "CmdUpdateBuffer",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600725 [Param("VkCmdBuffer", "cmdBuffer"),
726 Param("VkBuffer", "destBuffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600727 Param("VkDeviceSize", "destOffset"),
728 Param("VkDeviceSize", "dataSize"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600729 Param("const uint32_t*", "pData")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800730
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600731 Proto("void", "CmdFillBuffer",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600732 [Param("VkCmdBuffer", "cmdBuffer"),
733 Param("VkBuffer", "destBuffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600734 Param("VkDeviceSize", "destOffset"),
735 Param("VkDeviceSize", "fillSize"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600736 Param("uint32_t", "data")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800737
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600738 Proto("void", "CmdClearColorImage",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600739 [Param("VkCmdBuffer", "cmdBuffer"),
740 Param("VkImage", "image"),
741 Param("VkImageLayout", "imageLayout"),
Chris Forbesf0796e12015-06-24 14:34:53 +1200742 Param("const VkClearColorValue*", "pColor"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600743 Param("uint32_t", "rangeCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600744 Param("const VkImageSubresourceRange*", "pRanges")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800745
Chris Forbesd9be82b2015-06-22 17:21:59 +1200746 Proto("void", "CmdClearDepthStencilImage",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600747 [Param("VkCmdBuffer", "cmdBuffer"),
748 Param("VkImage", "image"),
749 Param("VkImageLayout", "imageLayout"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600750 Param("float", "depth"),
751 Param("uint32_t", "stencil"),
752 Param("uint32_t", "rangeCount"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600753 Param("const VkImageSubresourceRange*", "pRanges")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800754
Chris Forbesd9be82b2015-06-22 17:21:59 +1200755 Proto("void", "CmdClearColorAttachment",
756 [Param("VkCmdBuffer", "cmdBuffer"),
757 Param("uint32_t", "colorAttachment"),
758 Param("VkImageLayout", "imageLayout"),
Chris Forbesf0796e12015-06-24 14:34:53 +1200759 Param("const VkClearColorValue*", "pColor"),
Chris Forbesd9be82b2015-06-22 17:21:59 +1200760 Param("uint32_t", "rectCount"),
761 Param("const VkRect3D*", "pRects")]),
762
763 Proto("void", "CmdClearDepthStencilAttachment",
764 [Param("VkCmdBuffer", "cmdBuffer"),
765 Param("VkImageAspectFlags", "imageAspectMask"),
766 Param("VkImageLayout", "imageLayout"),
767 Param("float", "depth"),
768 Param("uint32_t", "stencil"),
769 Param("uint32_t", "rectCount"),
770 Param("const VkRect3D*", "pRects")]),
771
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600772 Proto("void", "CmdResolveImage",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600773 [Param("VkCmdBuffer", "cmdBuffer"),
774 Param("VkImage", "srcImage"),
775 Param("VkImageLayout", "srcImageLayout"),
776 Param("VkImage", "destImage"),
777 Param("VkImageLayout", "destImageLayout"),
Tony Barbour6865d4a2015-04-13 15:02:52 -0600778 Param("uint32_t", "regionCount"),
779 Param("const VkImageResolve*", "pRegions")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800780
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600781 Proto("void", "CmdSetEvent",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600782 [Param("VkCmdBuffer", "cmdBuffer"),
783 Param("VkEvent", "event"),
Tony Barbour0b2cfb22015-06-29 16:20:35 -0600784 Param("VkPipelineStageFlags", "stageMask")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800785
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600786 Proto("void", "CmdResetEvent",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600787 [Param("VkCmdBuffer", "cmdBuffer"),
788 Param("VkEvent", "event"),
Tony Barbour0b2cfb22015-06-29 16:20:35 -0600789 Param("VkPipelineStageFlags", "stageMask")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800790
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600791 Proto("void", "CmdWaitEvents",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600792 [Param("VkCmdBuffer", "cmdBuffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600793 Param("uint32_t", "eventCount"),
794 Param("const VkEvent*", "pEvents"),
Tony Barbour0b2cfb22015-06-29 16:20:35 -0600795 Param("VkPipelineStageFlags", "sourceStageMask"),
796 Param("VkPipelineStageFlags", "destStageMask"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600797 Param("uint32_t", "memBarrierCount"),
798 Param("const void**", "ppMemBarriers")]),
Mike Stroyanfb80d5f2014-12-04 11:08:39 +0000799
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600800 Proto("void", "CmdPipelineBarrier",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600801 [Param("VkCmdBuffer", "cmdBuffer"),
Tony Barbour0b2cfb22015-06-29 16:20:35 -0600802 Param("VkPipelineStageFlags", "sourceStageMask"),
803 Param("VkPipelineStageFlags", "destStageMask"),
804 Param("bool32_t", "byRegion"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600805 Param("uint32_t", "memBarrierCount"),
806 Param("const void**", "ppMemBarriers")]),
Mike Stroyanfb80d5f2014-12-04 11:08:39 +0000807
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600808 Proto("void", "CmdBeginQuery",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600809 [Param("VkCmdBuffer", "cmdBuffer"),
810 Param("VkQueryPool", "queryPool"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600811 Param("uint32_t", "slot"),
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600812 Param("VkFlags", "flags")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800813
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600814 Proto("void", "CmdEndQuery",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600815 [Param("VkCmdBuffer", "cmdBuffer"),
816 Param("VkQueryPool", "queryPool"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600817 Param("uint32_t", "slot")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800818
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600819 Proto("void", "CmdResetQueryPool",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600820 [Param("VkCmdBuffer", "cmdBuffer"),
821 Param("VkQueryPool", "queryPool"),
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600822 Param("uint32_t", "startQuery"),
823 Param("uint32_t", "queryCount")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800824
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600825 Proto("void", "CmdWriteTimestamp",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600826 [Param("VkCmdBuffer", "cmdBuffer"),
827 Param("VkTimestampType", "timestampType"),
828 Param("VkBuffer", "destBuffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600829 Param("VkDeviceSize", "destOffset")]),
Chia-I Wufb2559d2014-08-01 11:19:52 +0800830
Courtney Goeltzenleuchter1dbc8e22015-04-15 18:21:13 -0600831 Proto("void", "CmdCopyQueryPoolResults",
832 [Param("VkCmdBuffer", "cmdBuffer"),
833 Param("VkQueryPool", "queryPool"),
834 Param("uint32_t", "startQuery"),
835 Param("uint32_t", "queryCount"),
836 Param("VkBuffer", "destBuffer"),
Tony Barbourd1c35722015-04-16 15:59:00 -0600837 Param("VkDeviceSize", "destOffset"),
838 Param("VkDeviceSize", "destStride"),
Courtney Goeltzenleuchter1dbc8e22015-04-15 18:21:13 -0600839 Param("VkFlags", "flags")]),
840
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600841 Proto("VkResult", "CreateFramebuffer",
842 [Param("VkDevice", "device"),
843 Param("const VkFramebufferCreateInfo*", "pCreateInfo"),
844 Param("VkFramebuffer*", "pFramebuffer")]),
Jeremy Hayesd65ae082015-01-14 16:17:08 -0700845
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600846 Proto("VkResult", "CreateRenderPass",
847 [Param("VkDevice", "device"),
848 Param("const VkRenderPassCreateInfo*", "pCreateInfo"),
849 Param("VkRenderPass*", "pRenderPass")]),
Jeremy Hayesd65ae082015-01-14 16:17:08 -0700850
Jon Ashburne13f1982015-02-02 09:58:11 -0700851 Proto("void", "CmdBeginRenderPass",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600852 [Param("VkCmdBuffer", "cmdBuffer"),
853 Param("const VkRenderPassBegin*", "pRenderPassBegin")]),
Jon Ashburne13f1982015-02-02 09:58:11 -0700854
855 Proto("void", "CmdEndRenderPass",
Chia-I Wu0b50a1c2015-06-26 15:34:39 +0800856 [Param("VkCmdBuffer", "cmdBuffer")]),
857
858 Proto("void", "CmdExecuteCommands",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600859 [Param("VkCmdBuffer", "cmdBuffer"),
Chia-I Wu0b50a1c2015-06-26 15:34:39 +0800860 Param("uint32_t", "cmdBuffersCount"),
861 Param("const VkCmdBuffer*", "pCmdBuffers")]),
Chia-I Wue442dc32015-01-01 09:31:15 +0800862 ],
Chia-I Wufb2559d2014-08-01 11:19:52 +0800863)
864
Chia-I Wuf8693382015-04-16 22:02:10 +0800865wsi_lunarg = Extension(
866 name="VK_WSI_LunarG",
867 headers=["vk_wsi_lunarg.h"],
868 objects=[
869 "VkDisplayWSI",
870 "VkSwapChainWSI",
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600871 "VkDbgMsgCallback",
Chia-I Wuf8693382015-04-16 22:02:10 +0800872 ],
Chia-I Wue442dc32015-01-01 09:31:15 +0800873 protos=[
Chia-I Wuf8693382015-04-16 22:02:10 +0800874 Proto("VkResult", "CreateSwapChainWSI",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600875 [Param("VkDevice", "device"),
Chia-I Wuf8693382015-04-16 22:02:10 +0800876 Param("const VkSwapChainCreateInfoWSI*", "pCreateInfo"),
877 Param("VkSwapChainWSI*", "pSwapChain")]),
Chia-I Wu6dee8b82014-09-23 10:37:23 +0800878
Chia-I Wuf8693382015-04-16 22:02:10 +0800879 Proto("VkResult", "DestroySwapChainWSI",
880 [Param("VkSwapChainWSI", "swapChain")]),
Chia-I Wu6dee8b82014-09-23 10:37:23 +0800881
Chia-I Wuf8693382015-04-16 22:02:10 +0800882 Proto("VkResult", "GetSwapChainInfoWSI",
883 [Param("VkSwapChainWSI", "swapChain"),
884 Param("VkSwapChainInfoTypeWSI", "infoType"),
885 Param("size_t*", "pDataSize"),
886 Param("void*", "pData")]),
887
888 Proto("VkResult", "QueuePresentWSI",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600889 [Param("VkQueue", "queue"),
Chia-I Wuf8693382015-04-16 22:02:10 +0800890 Param("const VkPresentInfoWSI*", "pPresentInfo")]),
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600891
892# Proto("VkResult", "DbgCreateMsgCallback",
893# [Param("VkInstance", "instance"),
894# Param("VkFlags", "msgFlags"),
895# Param("PFN_vkDbgMsgCallback", "pfnMsgCallback"),
896# Param("void*", "pUserData"),
897# Param("VkDbgMsgCallback*", "pMsgCallback")]),
Chia-I Wue442dc32015-01-01 09:31:15 +0800898 ],
Chia-I Wu6dee8b82014-09-23 10:37:23 +0800899)
900
Chia-I Wuf8693382015-04-16 22:02:10 +0800901extensions = [core, wsi_lunarg]
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800902
Tobin Ehlis7e65d752015-01-15 17:51:52 -0700903object_root_list = [
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600904 "VkInstance",
Tony Barbourd1c35722015-04-16 15:59:00 -0600905 "VkPhysicalDevice",
Chia-I Wuf8693382015-04-16 22:02:10 +0800906 "VkDisplayWSI",
907 "VkSwapChainWSI",
Tobin Ehlis7e65d752015-01-15 17:51:52 -0700908]
909
910object_base_list = [
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600911 "VkDevice",
912 "VkQueue",
Tony Barbourd1c35722015-04-16 15:59:00 -0600913 "VkDeviceMemory",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600914 "VkObject"
Tobin Ehlis7e65d752015-01-15 17:51:52 -0700915]
916
917object_list = [
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600918 "VkBuffer",
919 "VkBufferView",
920 "VkImage",
921 "VkImageView",
922 "VkColorAttachmentView",
923 "VkDepthStencilView",
924 "VkShader",
925 "VkPipeline",
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -0500926 "VkPipelineLayout",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600927 "VkSampler",
928 "VkDescriptorSet",
929 "VkDescriptorSetLayout",
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600930 "VkDescriptorPool",
931 "VkDynamicStateObject",
932 "VkCmdBuffer",
933 "VkFence",
934 "VkSemaphore",
935 "VkEvent",
936 "VkQueryPool",
937 "VkFramebuffer",
938 "VkRenderPass"
Tobin Ehlis7e65d752015-01-15 17:51:52 -0700939]
940
941object_dynamic_state_list = [
Courtney Goeltzenleuchter502744a2015-04-10 16:24:50 -0600942 "VkDynamicVpState",
943 "VkDynamicRsState",
944 "VkDynamicCbState",
945 "VkDynamicDsState"
Tobin Ehlis7e65d752015-01-15 17:51:52 -0700946]
947
948object_type_list = object_root_list + object_base_list + object_list + object_dynamic_state_list
949
Mike Stroyanb050c682015-04-17 12:36:38 -0600950object_parent_list = ["VkObject", "VkDynamicStateObject"]
Tobin Ehlis7e65d752015-01-15 17:51:52 -0700951
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800952headers = []
Chia-I Wue86d8ab2015-01-04 14:46:22 +0800953objects = []
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800954protos = []
955for ext in extensions:
956 headers.extend(ext.headers)
Chia-I Wue86d8ab2015-01-04 14:46:22 +0800957 objects.extend(ext.objects)
Chia-I Wuc4f24e82015-01-01 08:46:31 +0800958 protos.extend(ext.protos)
Chia-I Wu6dee8b82014-09-23 10:37:23 +0800959
Chia-I Wu9a4ceb12015-01-01 14:45:58 +0800960proto_names = [proto.name for proto in protos]
Chia-I Wu900a2572014-08-01 14:44:16 +0800961
Courtney Goeltzenleuchterf53c3cb2015-04-14 14:55:44 -0600962def parse_vk_h(filename):
Chia-I Wu509a4122015-01-04 14:08:46 +0800963 # read object and protoype typedefs
964 object_lines = []
965 proto_lines = []
966 with open(filename, "r") as fp:
967 for line in fp:
968 line = line.strip()
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600969 if line.startswith("VK_DEFINE"):
Chia-I Wu509a4122015-01-04 14:08:46 +0800970 begin = line.find("(") + 1
971 end = line.find(",")
972 # extract the object type
973 object_lines.append(line[begin:end])
974 if line.startswith("typedef") and line.endswith(");"):
975 # drop leading "typedef " and trailing ");"
976 proto_lines.append(line[8:-2])
977
978 # parse proto_lines to protos
979 protos = []
980 for line in proto_lines:
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600981 first, rest = line.split(" (VKAPI *PFN_vk")
982 second, third = rest.split(")(")
Chia-I Wu509a4122015-01-04 14:08:46 +0800983
984 # get the return type, no space before "*"
985 proto_ret = "*".join([t.rstrip() for t in first.split("*")])
986
987 # get the name
988 proto_name = second.strip()
989
990 # get the list of params
991 param_strs = third.split(", ")
992 params = []
993 for s in param_strs:
994 ty, name = s.rsplit(" ", 1)
995
996 # no space before "*"
997 ty = "*".join([t.rstrip() for t in ty.split("*")])
998 # attach [] to ty
999 idx = name.rfind("[")
1000 if idx >= 0:
1001 ty += name[idx:]
1002 name = name[:idx]
1003
1004 params.append(Param(ty, name))
1005
1006 protos.append(Proto(proto_ret, proto_name, params))
1007
1008 # make them an extension and print
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001009 ext = Extension("VK_CORE",
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -06001010 headers=["vulkan.h", "vk_debug_report_lunarg.h"],
Chia-I Wu509a4122015-01-04 14:08:46 +08001011 objects=object_lines,
1012 protos=protos)
1013 print("core =", str(ext))
1014
1015 print("")
Jon Ashburnbacb0f52015-04-06 10:58:22 -06001016 print("typedef struct VkLayerDispatchTable_")
Chia-I Wu509a4122015-01-04 14:08:46 +08001017 print("{")
1018 for proto in ext.protos:
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -06001019 print(" vk%sType %s;" % (proto.name, proto.name))
Jon Ashburnbacb0f52015-04-06 10:58:22 -06001020 print("} VkLayerDispatchTable;")
Chia-I Wu509a4122015-01-04 14:08:46 +08001021
1022if __name__ == "__main__":
Courtney Goeltzenleuchterf53c3cb2015-04-14 14:55:44 -06001023 parse_vk_h("include/vulkan.h")