blob: 033d85f72917989710508069e3b7f7da3d897397 [file] [log] [blame]
Chia-I Wufb2559d2014-08-01 11:19:52 +08001"""XGL API description"""
2
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
40class Proto(object):
41 """A function prototype."""
42
43 def __init__(self, ret, name, params=()):
44 # the proto has only a param
45 if not isinstance(params, (list, tuple)):
46 params = (params,)
47
48 self.ret = ret
49 self.name = name
50 self.params = params
51
52 def c_params(self, need_type=True, need_name=True):
53 """Return the parameter list in C."""
54 if self.params and (need_type or need_name):
55 if need_type and need_name:
56 return ", ".join([param.c() for param in self.params])
57 elif need_type:
58 return ", ".join([param.ty for param in self.params])
59 else:
60 return ", ".join([param.name for param in self.params])
61 else:
62 return "void" if need_type else ""
63
64 def c_decl(self, name, attr="", typed=False, need_param_names=True):
65 """Return a named declaration in C."""
66 format_vals = (self.ret,
67 attr + " " if attr else "",
68 name,
69 self.c_params(need_name=need_param_names))
70
71 if typed:
72 return "%s (%s*%s)(%s)" % format_vals
73 else:
74 return "%s %s%s(%s)" % format_vals
75
76 def c_typedef(self, suffix="", attr=""):
77 """Return the typedef for the prototype in C."""
78 return self.c_decl(self.name + suffix, attr=attr, typed=True)
79
80 def c_func(self, prefix="", attr=""):
81 """Return the prototype in C."""
82 return self.c_decl(prefix + self.name, attr=attr, typed=False)
83
84 def c_call(self):
85 """Return a call to the prototype in C."""
86 return "%s(%s)" % (self.name, self.c_params(need_type=False))
87
88# XGL core API
89core = (
Jon Ashburn21734942014-10-17 15:31:22 -060090 Proto("XGL_VOID *", "GetProcAddr",
Jon Ashburnd43f9b62014-10-14 19:15:22 -060091 (Param("XGL_PHYSICAL_GPU", "gpu"),
92 Param("const XGL_CHAR*", "pName"))),
93
Chia-I Wufb2559d2014-08-01 11:19:52 +080094 Proto("XGL_RESULT", "InitAndEnumerateGpus",
95 (Param("const XGL_APPLICATION_INFO*", "pAppInfo"),
96 Param("const XGL_ALLOC_CALLBACKS*", "pAllocCb"),
97 Param("XGL_UINT", "maxGpus"),
98 Param("XGL_UINT*", "pGpuCount"),
99 Param("XGL_PHYSICAL_GPU*", "pGpus"))),
100
101 Proto("XGL_RESULT", "GetGpuInfo",
102 (Param("XGL_PHYSICAL_GPU", "gpu"),
103 Param("XGL_PHYSICAL_GPU_INFO_TYPE", "infoType"),
104 Param("XGL_SIZE*", "pDataSize"),
105 Param("XGL_VOID*", "pData"))),
106
107 Proto("XGL_RESULT", "CreateDevice",
108 (Param("XGL_PHYSICAL_GPU", "gpu"),
109 Param("const XGL_DEVICE_CREATE_INFO*", "pCreateInfo"),
110 Param("XGL_DEVICE*", "pDevice"))),
111
112 Proto("XGL_RESULT", "DestroyDevice",
113 (Param("XGL_DEVICE", "device"))),
114
115 Proto("XGL_RESULT", "GetExtensionSupport",
116 (Param("XGL_PHYSICAL_GPU", "gpu"),
117 Param("const XGL_CHAR*", "pExtName"))),
118
Jon Ashburn96f28fc2014-10-15 15:30:23 -0600119 Proto("XGL_RESULT", "EnumerateLayers",
120 (Param("XGL_PHYSICAL_GPU", "gpu"),
121 Param("XGL_SIZE", "maxLayerCount"),
122 Param("XGL_SIZE", "maxStringSize"),
123 Param("XGL_CHAR* const*", "pOutLayers"),
124 Param("XGL_SIZE *", "pOutLayerCount"))),
125
Chia-I Wufb2559d2014-08-01 11:19:52 +0800126 Proto("XGL_RESULT", "GetDeviceQueue",
127 (Param("XGL_DEVICE", "device"),
128 Param("XGL_QUEUE_TYPE", "queueType"),
129 Param("XGL_UINT", "queueIndex"),
130 Param("XGL_QUEUE*", "pQueue"))),
131
132 Proto("XGL_RESULT", "QueueSubmit",
133 (Param("XGL_QUEUE", "queue"),
134 Param("XGL_UINT", "cmdBufferCount"),
135 Param("const XGL_CMD_BUFFER*", "pCmdBuffers"),
136 Param("XGL_UINT", "memRefCount"),
137 Param("const XGL_MEMORY_REF*", "pMemRefs"),
138 Param("XGL_FENCE", "fence"))),
139
140 Proto("XGL_RESULT", "QueueSetGlobalMemReferences",
141 (Param("XGL_QUEUE", "queue"),
142 Param("XGL_UINT", "memRefCount"),
143 Param("const XGL_MEMORY_REF*", "pMemRefs"))),
144
145 Proto("XGL_RESULT", "QueueWaitIdle",
146 (Param("XGL_QUEUE", "queue"))),
147
148 Proto("XGL_RESULT", "DeviceWaitIdle",
149 (Param("XGL_DEVICE", "device"))),
150
151 Proto("XGL_RESULT", "GetMemoryHeapCount",
152 (Param("XGL_DEVICE", "device"),
153 Param("XGL_UINT*", "pCount"))),
154
155 Proto("XGL_RESULT", "GetMemoryHeapInfo",
156 (Param("XGL_DEVICE", "device"),
157 Param("XGL_UINT", "heapId"),
158 Param("XGL_MEMORY_HEAP_INFO_TYPE", "infoType"),
159 Param("XGL_SIZE*", "pDataSize"),
160 Param("XGL_VOID*", "pData"))),
161
162 Proto("XGL_RESULT", "AllocMemory",
163 (Param("XGL_DEVICE", "device"),
164 Param("const XGL_MEMORY_ALLOC_INFO*", "pAllocInfo"),
165 Param("XGL_GPU_MEMORY*", "pMem"))),
166
167 Proto("XGL_RESULT", "FreeMemory",
168 (Param("XGL_GPU_MEMORY", "mem"))),
169
170 Proto("XGL_RESULT", "SetMemoryPriority",
171 (Param("XGL_GPU_MEMORY", "mem"),
172 Param("XGL_MEMORY_PRIORITY", "priority"))),
173
174 Proto("XGL_RESULT", "MapMemory",
175 (Param("XGL_GPU_MEMORY", "mem"),
176 Param("XGL_FLAGS", "flags"),
177 Param("XGL_VOID**", "ppData"))),
178
179 Proto("XGL_RESULT", "UnmapMemory",
180 (Param("XGL_GPU_MEMORY", "mem"))),
181
182 Proto("XGL_RESULT", "PinSystemMemory",
183 (Param("XGL_DEVICE", "device"),
184 Param("const XGL_VOID*", "pSysMem"),
185 Param("XGL_SIZE", "memSize"),
186 Param("XGL_GPU_MEMORY*", "pMem"))),
187
188 Proto("XGL_RESULT", "RemapVirtualMemoryPages",
189 (Param("XGL_DEVICE", "device"),
190 Param("XGL_UINT", "rangeCount"),
191 Param("const XGL_VIRTUAL_MEMORY_REMAP_RANGE*", "pRanges"),
192 Param("XGL_UINT", "preWaitSemaphoreCount"),
193 Param("const XGL_QUEUE_SEMAPHORE*", "pPreWaitSemaphores"),
194 Param("XGL_UINT", "postSignalSemaphoreCount"),
195 Param("const XGL_QUEUE_SEMAPHORE*", "pPostSignalSemaphores"))),
196
197 Proto("XGL_RESULT", "GetMultiGpuCompatibility",
198 (Param("XGL_PHYSICAL_GPU", "gpu0"),
199 Param("XGL_PHYSICAL_GPU", "gpu1"),
200 Param("XGL_GPU_COMPATIBILITY_INFO*", "pInfo"))),
201
202 Proto("XGL_RESULT", "OpenSharedMemory",
203 (Param("XGL_DEVICE", "device"),
204 Param("const XGL_MEMORY_OPEN_INFO*", "pOpenInfo"),
205 Param("XGL_GPU_MEMORY*", "pMem"))),
206
207 Proto("XGL_RESULT", "OpenSharedQueueSemaphore",
208 (Param("XGL_DEVICE", "device"),
209 Param("const XGL_QUEUE_SEMAPHORE_OPEN_INFO*", "pOpenInfo"),
210 Param("XGL_QUEUE_SEMAPHORE*", "pSemaphore"))),
211
212 Proto("XGL_RESULT", "OpenPeerMemory",
213 (Param("XGL_DEVICE", "device"),
214 Param("const XGL_PEER_MEMORY_OPEN_INFO*", "pOpenInfo"),
215 Param("XGL_GPU_MEMORY*", "pMem"))),
216
217 Proto("XGL_RESULT", "OpenPeerImage",
218 (Param("XGL_DEVICE", "device"),
219 Param("const XGL_PEER_IMAGE_OPEN_INFO*", "pOpenInfo"),
220 Param("XGL_IMAGE*", "pImage"),
221 Param("XGL_GPU_MEMORY*", "pMem"))),
222
223 Proto("XGL_RESULT", "DestroyObject",
224 (Param("XGL_OBJECT", "object"))),
225
226 Proto("XGL_RESULT", "GetObjectInfo",
227 (Param("XGL_BASE_OBJECT", "object"),
228 Param("XGL_OBJECT_INFO_TYPE", "infoType"),
229 Param("XGL_SIZE*", "pDataSize"),
230 Param("XGL_VOID*", "pData"))),
231
232 Proto("XGL_RESULT", "BindObjectMemory",
233 (Param("XGL_OBJECT", "object"),
234 Param("XGL_GPU_MEMORY", "mem"),
235 Param("XGL_GPU_SIZE", "offset"))),
236
237 Proto("XGL_RESULT", "CreateFence",
238 (Param("XGL_DEVICE", "device"),
239 Param("const XGL_FENCE_CREATE_INFO*", "pCreateInfo"),
240 Param("XGL_FENCE*", "pFence"))),
241
242 Proto("XGL_RESULT", "GetFenceStatus",
243 (Param("XGL_FENCE", "fence"))),
244
245 Proto("XGL_RESULT", "WaitForFences",
246 (Param("XGL_DEVICE", "device"),
247 Param("XGL_UINT", "fenceCount"),
248 Param("const XGL_FENCE*", "pFences"),
249 Param("XGL_BOOL", "waitAll"),
250 Param("XGL_UINT64", "timeout"))),
251
252 Proto("XGL_RESULT", "CreateQueueSemaphore",
253 (Param("XGL_DEVICE", "device"),
254 Param("const XGL_QUEUE_SEMAPHORE_CREATE_INFO*", "pCreateInfo"),
255 Param("XGL_QUEUE_SEMAPHORE*", "pSemaphore"))),
256
257 Proto("XGL_RESULT", "SignalQueueSemaphore",
258 (Param("XGL_QUEUE", "queue"),
259 Param("XGL_QUEUE_SEMAPHORE", "semaphore"))),
260
261 Proto("XGL_RESULT", "WaitQueueSemaphore",
262 (Param("XGL_QUEUE", "queue"),
263 Param("XGL_QUEUE_SEMAPHORE", "semaphore"))),
264
265 Proto("XGL_RESULT", "CreateEvent",
266 (Param("XGL_DEVICE", "device"),
267 Param("const XGL_EVENT_CREATE_INFO*", "pCreateInfo"),
268 Param("XGL_EVENT*", "pEvent"))),
269
270 Proto("XGL_RESULT", "GetEventStatus",
271 (Param("XGL_EVENT", "event"))),
272
273 Proto("XGL_RESULT", "SetEvent",
274 (Param("XGL_EVENT", "event"))),
275
276 Proto("XGL_RESULT", "ResetEvent",
277 (Param("XGL_EVENT", "event"))),
278
279 Proto("XGL_RESULT", "CreateQueryPool",
280 (Param("XGL_DEVICE", "device"),
281 Param("const XGL_QUERY_POOL_CREATE_INFO*", "pCreateInfo"),
282 Param("XGL_QUERY_POOL*", "pQueryPool"))),
283
284 Proto("XGL_RESULT", "GetQueryPoolResults",
285 (Param("XGL_QUERY_POOL", "queryPool"),
286 Param("XGL_UINT", "startQuery"),
287 Param("XGL_UINT", "queryCount"),
288 Param("XGL_SIZE*", "pDataSize"),
289 Param("XGL_VOID*", "pData"))),
290
291 Proto("XGL_RESULT", "GetFormatInfo",
292 (Param("XGL_DEVICE", "device"),
293 Param("XGL_FORMAT", "format"),
294 Param("XGL_FORMAT_INFO_TYPE", "infoType"),
295 Param("XGL_SIZE*", "pDataSize"),
296 Param("XGL_VOID*", "pData"))),
297
298 Proto("XGL_RESULT", "CreateImage",
299 (Param("XGL_DEVICE", "device"),
300 Param("const XGL_IMAGE_CREATE_INFO*", "pCreateInfo"),
301 Param("XGL_IMAGE*", "pImage"))),
302
303 Proto("XGL_RESULT", "GetImageSubresourceInfo",
304 (Param("XGL_IMAGE", "image"),
305 Param("const XGL_IMAGE_SUBRESOURCE*", "pSubresource"),
306 Param("XGL_SUBRESOURCE_INFO_TYPE", "infoType"),
307 Param("XGL_SIZE*", "pDataSize"),
308 Param("XGL_VOID*", "pData"))),
309
310 Proto("XGL_RESULT", "CreateImageView",
311 (Param("XGL_DEVICE", "device"),
312 Param("const XGL_IMAGE_VIEW_CREATE_INFO*", "pCreateInfo"),
313 Param("XGL_IMAGE_VIEW*", "pView"))),
314
315 Proto("XGL_RESULT", "CreateColorAttachmentView",
316 (Param("XGL_DEVICE", "device"),
317 Param("const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO*", "pCreateInfo"),
318 Param("XGL_COLOR_ATTACHMENT_VIEW*", "pView"))),
319
320 Proto("XGL_RESULT", "CreateDepthStencilView",
321 (Param("XGL_DEVICE", "device"),
322 Param("const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO*", "pCreateInfo"),
323 Param("XGL_DEPTH_STENCIL_VIEW*", "pView"))),
324
325 Proto("XGL_RESULT", "CreateShader",
326 (Param("XGL_DEVICE", "device"),
327 Param("const XGL_SHADER_CREATE_INFO*", "pCreateInfo"),
328 Param("XGL_SHADER*", "pShader"))),
329
330 Proto("XGL_RESULT", "CreateGraphicsPipeline",
331 (Param("XGL_DEVICE", "device"),
332 Param("const XGL_GRAPHICS_PIPELINE_CREATE_INFO*", "pCreateInfo"),
333 Param("XGL_PIPELINE*", "pPipeline"))),
334
335 Proto("XGL_RESULT", "CreateComputePipeline",
336 (Param("XGL_DEVICE", "device"),
337 Param("const XGL_COMPUTE_PIPELINE_CREATE_INFO*", "pCreateInfo"),
338 Param("XGL_PIPELINE*", "pPipeline"))),
339
340 Proto("XGL_RESULT", "StorePipeline",
341 (Param("XGL_PIPELINE", "pipeline"),
342 Param("XGL_SIZE*", "pDataSize"),
343 Param("XGL_VOID*", "pData"))),
344
345 Proto("XGL_RESULT", "LoadPipeline",
346 (Param("XGL_DEVICE", "device"),
347 Param("XGL_SIZE", "dataSize"),
348 Param("const XGL_VOID*", "pData"),
349 Param("XGL_PIPELINE*", "pPipeline"))),
350
351 Proto("XGL_RESULT", "CreatePipelineDelta",
352 (Param("XGL_DEVICE", "device"),
353 Param("XGL_PIPELINE", "p1"),
354 Param("XGL_PIPELINE", "p2"),
355 Param("XGL_PIPELINE_DELTA*", "delta"))),
356
357 Proto("XGL_RESULT", "CreateSampler",
358 (Param("XGL_DEVICE", "device"),
359 Param("const XGL_SAMPLER_CREATE_INFO*", "pCreateInfo"),
360 Param("XGL_SAMPLER*", "pSampler"))),
361
362 Proto("XGL_RESULT", "CreateDescriptorSet",
363 (Param("XGL_DEVICE", "device"),
364 Param("const XGL_DESCRIPTOR_SET_CREATE_INFO*", "pCreateInfo"),
365 Param("XGL_DESCRIPTOR_SET*", "pDescriptorSet"))),
366
367 Proto("XGL_VOID", "BeginDescriptorSetUpdate",
368 (Param("XGL_DESCRIPTOR_SET", "descriptorSet"))),
369
370 Proto("XGL_VOID", "EndDescriptorSetUpdate",
371 (Param("XGL_DESCRIPTOR_SET", "descriptorSet"))),
372
373 Proto("XGL_VOID", "AttachSamplerDescriptors",
374 (Param("XGL_DESCRIPTOR_SET", "descriptorSet"),
375 Param("XGL_UINT", "startSlot"),
376 Param("XGL_UINT", "slotCount"),
377 Param("const XGL_SAMPLER*", "pSamplers"))),
378
379 Proto("XGL_VOID", "AttachImageViewDescriptors",
380 (Param("XGL_DESCRIPTOR_SET", "descriptorSet"),
381 Param("XGL_UINT", "startSlot"),
382 Param("XGL_UINT", "slotCount"),
383 Param("const XGL_IMAGE_VIEW_ATTACH_INFO*", "pImageViews"))),
384
385 Proto("XGL_VOID", "AttachMemoryViewDescriptors",
386 (Param("XGL_DESCRIPTOR_SET", "descriptorSet"),
387 Param("XGL_UINT", "startSlot"),
388 Param("XGL_UINT", "slotCount"),
389 Param("const XGL_MEMORY_VIEW_ATTACH_INFO*", "pMemViews"))),
390
391 Proto("XGL_VOID", "AttachNestedDescriptors",
392 (Param("XGL_DESCRIPTOR_SET", "descriptorSet"),
393 Param("XGL_UINT", "startSlot"),
394 Param("XGL_UINT", "slotCount"),
395 Param("const XGL_DESCRIPTOR_SET_ATTACH_INFO*", "pNestedDescriptorSets"))),
396
397 Proto("XGL_VOID", "ClearDescriptorSetSlots",
398 (Param("XGL_DESCRIPTOR_SET", "descriptorSet"),
399 Param("XGL_UINT", "startSlot"),
400 Param("XGL_UINT", "slotCount"))),
401
402 Proto("XGL_RESULT", "CreateViewportState",
403 (Param("XGL_DEVICE", "device"),
404 Param("const XGL_VIEWPORT_STATE_CREATE_INFO*", "pCreateInfo"),
405 Param("XGL_VIEWPORT_STATE_OBJECT*", "pState"))),
406
407 Proto("XGL_RESULT", "CreateRasterState",
408 (Param("XGL_DEVICE", "device"),
409 Param("const XGL_RASTER_STATE_CREATE_INFO*", "pCreateInfo"),
410 Param("XGL_RASTER_STATE_OBJECT*", "pState"))),
411
412 Proto("XGL_RESULT", "CreateMsaaState",
413 (Param("XGL_DEVICE", "device"),
414 Param("const XGL_MSAA_STATE_CREATE_INFO*", "pCreateInfo"),
415 Param("XGL_MSAA_STATE_OBJECT*", "pState"))),
416
417 Proto("XGL_RESULT", "CreateColorBlendState",
418 (Param("XGL_DEVICE", "device"),
419 Param("const XGL_COLOR_BLEND_STATE_CREATE_INFO*", "pCreateInfo"),
420 Param("XGL_COLOR_BLEND_STATE_OBJECT*", "pState"))),
421
422 Proto("XGL_RESULT", "CreateDepthStencilState",
423 (Param("XGL_DEVICE", "device"),
424 Param("const XGL_DEPTH_STENCIL_STATE_CREATE_INFO*", "pCreateInfo"),
425 Param("XGL_DEPTH_STENCIL_STATE_OBJECT*", "pState"))),
426
427 Proto("XGL_RESULT", "CreateCommandBuffer",
428 (Param("XGL_DEVICE", "device"),
429 Param("const XGL_CMD_BUFFER_CREATE_INFO*", "pCreateInfo"),
430 Param("XGL_CMD_BUFFER*", "pCmdBuffer"))),
431
432 Proto("XGL_RESULT", "BeginCommandBuffer",
433 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
434 Param("XGL_FLAGS", "flags"))),
435
436 Proto("XGL_RESULT", "EndCommandBuffer",
437 (Param("XGL_CMD_BUFFER", "cmdBuffer"))),
438
439 Proto("XGL_RESULT", "ResetCommandBuffer",
440 (Param("XGL_CMD_BUFFER", "cmdBuffer"))),
441
442 Proto("XGL_VOID", "CmdBindPipeline",
443 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
444 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
445 Param("XGL_PIPELINE", "pipeline"))),
446
447 Proto("XGL_VOID", "CmdBindPipelineDelta",
448 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
449 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
450 Param("XGL_PIPELINE_DELTA", "delta"))),
451
452 Proto("XGL_VOID", "CmdBindStateObject",
453 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
454 Param("XGL_STATE_BIND_POINT", "stateBindPoint"),
455 Param("XGL_STATE_OBJECT", "state"))),
456
457 Proto("XGL_VOID", "CmdBindDescriptorSet",
458 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
459 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
460 Param("XGL_UINT", "index"),
461 Param("XGL_DESCRIPTOR_SET", "descriptorSet"),
462 Param("XGL_UINT", "slotOffset"))),
463
464 Proto("XGL_VOID", "CmdBindDynamicMemoryView",
465 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
466 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
467 Param("const XGL_MEMORY_VIEW_ATTACH_INFO*", "pMemView"))),
468
Chia-I Wu3b04af52014-11-08 10:48:20 +0800469 Proto("XGL_VOID", "CmdBindVertexData",
470 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
471 Param("XGL_GPU_MEMORY", "mem"),
472 Param("XGL_GPU_SIZE", "offset"),
473 Param("XGL_UINT", "binding"))),
474
Chia-I Wufb2559d2014-08-01 11:19:52 +0800475 Proto("XGL_VOID", "CmdBindIndexData",
476 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
477 Param("XGL_GPU_MEMORY", "mem"),
478 Param("XGL_GPU_SIZE", "offset"),
479 Param("XGL_INDEX_TYPE", "indexType"))),
480
481 Proto("XGL_VOID", "CmdBindAttachments",
482 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
483 Param("XGL_UINT", "colorAttachmentCount"),
484 Param("const XGL_COLOR_ATTACHMENT_BIND_INFO*", "pColorAttachments"),
485 Param("const XGL_DEPTH_STENCIL_BIND_INFO*", "pDepthStencilAttachment"))),
486
487 Proto("XGL_VOID", "CmdPrepareMemoryRegions",
488 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
489 Param("XGL_UINT", "transitionCount"),
490 Param("const XGL_MEMORY_STATE_TRANSITION*", "pStateTransitions"))),
491
492 Proto("XGL_VOID", "CmdPrepareImages",
493 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
494 Param("XGL_UINT", "transitionCount"),
495 Param("const XGL_IMAGE_STATE_TRANSITION*", "pStateTransitions"))),
496
497 Proto("XGL_VOID", "CmdDraw",
498 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
499 Param("XGL_UINT", "firstVertex"),
500 Param("XGL_UINT", "vertexCount"),
501 Param("XGL_UINT", "firstInstance"),
502 Param("XGL_UINT", "instanceCount"))),
503
504 Proto("XGL_VOID", "CmdDrawIndexed",
505 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
506 Param("XGL_UINT", "firstIndex"),
507 Param("XGL_UINT", "indexCount"),
508 Param("XGL_INT", "vertexOffset"),
509 Param("XGL_UINT", "firstInstance"),
510 Param("XGL_UINT", "instanceCount"))),
511
512 Proto("XGL_VOID", "CmdDrawIndirect",
513 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
514 Param("XGL_GPU_MEMORY", "mem"),
515 Param("XGL_GPU_SIZE", "offset"),
516 Param("XGL_UINT32", "count"),
517 Param("XGL_UINT32", "stride"))),
518
519 Proto("XGL_VOID", "CmdDrawIndexedIndirect",
520 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
521 Param("XGL_GPU_MEMORY", "mem"),
522 Param("XGL_GPU_SIZE", "offset"),
523 Param("XGL_UINT32", "count"),
524 Param("XGL_UINT32", "stride"))),
525
526 Proto("XGL_VOID", "CmdDispatch",
527 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
528 Param("XGL_UINT", "x"),
529 Param("XGL_UINT", "y"),
530 Param("XGL_UINT", "z"))),
531
532 Proto("XGL_VOID", "CmdDispatchIndirect",
533 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
534 Param("XGL_GPU_MEMORY", "mem"),
535 Param("XGL_GPU_SIZE", "offset"))),
536
537 Proto("XGL_VOID", "CmdCopyMemory",
538 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
539 Param("XGL_GPU_MEMORY", "srcMem"),
540 Param("XGL_GPU_MEMORY", "destMem"),
541 Param("XGL_UINT", "regionCount"),
542 Param("const XGL_MEMORY_COPY*", "pRegions"))),
543
544 Proto("XGL_VOID", "CmdCopyImage",
545 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
546 Param("XGL_IMAGE", "srcImage"),
547 Param("XGL_IMAGE", "destImage"),
548 Param("XGL_UINT", "regionCount"),
549 Param("const XGL_IMAGE_COPY*", "pRegions"))),
550
551 Proto("XGL_VOID", "CmdCopyMemoryToImage",
552 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
553 Param("XGL_GPU_MEMORY", "srcMem"),
554 Param("XGL_IMAGE", "destImage"),
555 Param("XGL_UINT", "regionCount"),
556 Param("const XGL_MEMORY_IMAGE_COPY*", "pRegions"))),
557
558 Proto("XGL_VOID", "CmdCopyImageToMemory",
559 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
560 Param("XGL_IMAGE", "srcImage"),
561 Param("XGL_GPU_MEMORY", "destMem"),
562 Param("XGL_UINT", "regionCount"),
563 Param("const XGL_MEMORY_IMAGE_COPY*", "pRegions"))),
564
565 Proto("XGL_VOID", "CmdCloneImageData",
566 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
567 Param("XGL_IMAGE", "srcImage"),
568 Param("XGL_IMAGE_STATE", "srcImageState"),
569 Param("XGL_IMAGE", "destImage"),
570 Param("XGL_IMAGE_STATE", "destImageState"))),
571
572 Proto("XGL_VOID", "CmdUpdateMemory",
573 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
574 Param("XGL_GPU_MEMORY", "destMem"),
575 Param("XGL_GPU_SIZE", "destOffset"),
576 Param("XGL_GPU_SIZE", "dataSize"),
577 Param("const XGL_UINT32*", "pData"))),
578
579 Proto("XGL_VOID", "CmdFillMemory",
580 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
581 Param("XGL_GPU_MEMORY", "destMem"),
582 Param("XGL_GPU_SIZE", "destOffset"),
583 Param("XGL_GPU_SIZE", "fillSize"),
584 Param("XGL_UINT32", "data"))),
585
586 Proto("XGL_VOID", "CmdClearColorImage",
587 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
588 Param("XGL_IMAGE", "image"),
589 Param("const XGL_FLOAT[4]", "color"),
590 Param("XGL_UINT", "rangeCount"),
591 Param("const XGL_IMAGE_SUBRESOURCE_RANGE*", "pRanges"))),
592
593 Proto("XGL_VOID", "CmdClearColorImageRaw",
594 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
595 Param("XGL_IMAGE", "image"),
596 Param("const XGL_UINT32[4]", "color"),
597 Param("XGL_UINT", "rangeCount"),
598 Param("const XGL_IMAGE_SUBRESOURCE_RANGE*", "pRanges"))),
599
600 Proto("XGL_VOID", "CmdClearDepthStencil",
601 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
602 Param("XGL_IMAGE", "image"),
603 Param("XGL_FLOAT", "depth"),
604 Param("XGL_UINT32", "stencil"),
605 Param("XGL_UINT", "rangeCount"),
606 Param("const XGL_IMAGE_SUBRESOURCE_RANGE*", "pRanges"))),
607
608 Proto("XGL_VOID", "CmdResolveImage",
609 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
610 Param("XGL_IMAGE", "srcImage"),
611 Param("XGL_IMAGE", "destImage"),
612 Param("XGL_UINT", "rectCount"),
613 Param("const XGL_IMAGE_RESOLVE*", "pRects"))),
614
615 Proto("XGL_VOID", "CmdSetEvent",
616 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
617 Param("XGL_EVENT", "event"))),
618
619 Proto("XGL_VOID", "CmdResetEvent",
620 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
621 Param("XGL_EVENT", "event"))),
622
623 Proto("XGL_VOID", "CmdMemoryAtomic",
624 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
625 Param("XGL_GPU_MEMORY", "destMem"),
626 Param("XGL_GPU_SIZE", "destOffset"),
627 Param("XGL_UINT64", "srcData"),
628 Param("XGL_ATOMIC_OP", "atomicOp"))),
629
630 Proto("XGL_VOID", "CmdBeginQuery",
631 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
632 Param("XGL_QUERY_POOL", "queryPool"),
633 Param("XGL_UINT", "slot"),
634 Param("XGL_FLAGS", "flags"))),
635
636 Proto("XGL_VOID", "CmdEndQuery",
637 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
638 Param("XGL_QUERY_POOL", "queryPool"),
639 Param("XGL_UINT", "slot"))),
640
641 Proto("XGL_VOID", "CmdResetQueryPool",
642 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
643 Param("XGL_QUERY_POOL", "queryPool"),
644 Param("XGL_UINT", "startQuery"),
645 Param("XGL_UINT", "queryCount"))),
646
647 Proto("XGL_VOID", "CmdWriteTimestamp",
648 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
649 Param("XGL_TIMESTAMP_TYPE", "timestampType"),
650 Param("XGL_GPU_MEMORY", "destMem"),
651 Param("XGL_GPU_SIZE", "destOffset"))),
652
653 Proto("XGL_VOID", "CmdInitAtomicCounters",
654 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
655 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
656 Param("XGL_UINT", "startCounter"),
657 Param("XGL_UINT", "counterCount"),
658 Param("const XGL_UINT32*", "pData"))),
659
660 Proto("XGL_VOID", "CmdLoadAtomicCounters",
661 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
662 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
663 Param("XGL_UINT", "startCounter"),
664 Param("XGL_UINT", "counterCount"),
665 Param("XGL_GPU_MEMORY", "srcMem"),
666 Param("XGL_GPU_SIZE", "srcOffset"))),
667
668 Proto("XGL_VOID", "CmdSaveAtomicCounters",
669 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
670 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
671 Param("XGL_UINT", "startCounter"),
672 Param("XGL_UINT", "counterCount"),
673 Param("XGL_GPU_MEMORY", "destMem"),
674 Param("XGL_GPU_SIZE", "destOffset"))),
675
676 Proto("XGL_RESULT", "DbgSetValidationLevel",
677 (Param("XGL_DEVICE", "device"),
678 Param("XGL_VALIDATION_LEVEL", "validationLevel"))),
679
680 Proto("XGL_RESULT", "DbgRegisterMsgCallback",
681 (Param("XGL_DBG_MSG_CALLBACK_FUNCTION", "pfnMsgCallback"),
682 Param("XGL_VOID*", "pUserData"))),
683
684 Proto("XGL_RESULT", "DbgUnregisterMsgCallback",
685 (Param("XGL_DBG_MSG_CALLBACK_FUNCTION", "pfnMsgCallback"))),
686
687 Proto("XGL_RESULT", "DbgSetMessageFilter",
688 (Param("XGL_DEVICE", "device"),
689 Param("XGL_INT", "msgCode"),
690 Param("XGL_DBG_MSG_FILTER", "filter"))),
691
692 Proto("XGL_RESULT", "DbgSetObjectTag",
693 (Param("XGL_BASE_OBJECT", "object"),
694 Param("XGL_SIZE", "tagSize"),
695 Param("const XGL_VOID*", "pTag"))),
696
697 Proto("XGL_RESULT", "DbgSetGlobalOption",
698 (Param("XGL_DBG_GLOBAL_OPTION", "dbgOption"),
699 Param("XGL_SIZE", "dataSize"),
700 Param("const XGL_VOID*", "pData"))),
701
702 Proto("XGL_RESULT", "DbgSetDeviceOption",
703 (Param("XGL_DEVICE", "device"),
704 Param("XGL_DBG_DEVICE_OPTION", "dbgOption"),
705 Param("XGL_SIZE", "dataSize"),
706 Param("const XGL_VOID*", "pData"))),
707
708 Proto("XGL_VOID", "CmdDbgMarkerBegin",
709 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
710 Param("const XGL_CHAR*", "pMarker"))),
711
712 Proto("XGL_VOID", "CmdDbgMarkerEnd",
713 (Param("XGL_CMD_BUFFER", "cmdBuffer"))),
714)
715
Chia-I Wu6ae460f2014-09-13 13:36:06 +0800716core_headers = ("xgl.h", "xglDbg.h")
717
Chia-I Wub8dceae2014-09-23 10:37:23 +0800718ext_wsi_x11 = (
719 Proto("XGL_RESULT", "WsiX11AssociateConnection",
720 (Param("XGL_PHYSICAL_GPU", "gpu"),
721 Param("const XGL_WSI_X11_CONNECTION_INFO*", "pConnectionInfo"))),
722
723 Proto("XGL_RESULT", "WsiX11GetMSC",
724 (Param("XGL_DEVICE", "device"),
Chia-I Wu6204f342014-11-07 13:33:45 +0800725 Param("xcb_window_t", "window"),
Chia-I Wub8dceae2014-09-23 10:37:23 +0800726 Param("xcb_randr_crtc_t", "crtc"),
727 Param("XGL_UINT64*", "pMsc"))),
728
729 Proto("XGL_RESULT", "WsiX11CreatePresentableImage",
730 (Param("XGL_DEVICE", "device"),
731 Param("const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO*", "pCreateInfo"),
732 Param("XGL_IMAGE*", "pImage"),
733 Param("XGL_GPU_MEMORY*", "pMem"))),
734
735 Proto("XGL_RESULT", "WsiX11QueuePresent",
736 (Param("XGL_QUEUE", "queue"),
737 Param("const XGL_WSI_X11_PRESENT_INFO*", "pPresentInfo"),
738 Param("XGL_FENCE", "fence"))),
739)
740
741ext_wsi_x11_headers = ("xglWsiX11Ext.h",)
742
Chia-I Wufb2559d2014-08-01 11:19:52 +0800743# the dispatch table defined for ICDs
744# XXX figure out the real order
Chia-I Wu6ae460f2014-09-13 13:36:06 +0800745# XXX this is not extensible
Chia-I Wufb2559d2014-08-01 11:19:52 +0800746icd_dispatch_table = (
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600747 "GetProcAddr",
Chia-I Wufb2559d2014-08-01 11:19:52 +0800748 "InitAndEnumerateGpus",
749 "GetGpuInfo",
750 "CreateDevice",
751 "DestroyDevice",
752 "GetExtensionSupport",
Jon Ashburn96f28fc2014-10-15 15:30:23 -0600753 "EnumerateLayers",
Chia-I Wufb2559d2014-08-01 11:19:52 +0800754 "GetDeviceQueue",
755 "QueueSubmit",
756 "QueueSetGlobalMemReferences",
757 "QueueWaitIdle",
758 "DeviceWaitIdle",
759 "GetMemoryHeapCount",
760 "GetMemoryHeapInfo",
761 "AllocMemory",
762 "FreeMemory",
763 "SetMemoryPriority",
764 "MapMemory",
765 "UnmapMemory",
766 "PinSystemMemory",
767 "RemapVirtualMemoryPages",
768 "GetMultiGpuCompatibility",
769 "OpenSharedMemory",
770 "OpenSharedQueueSemaphore",
771 "OpenPeerMemory",
772 "OpenPeerImage",
773 "DestroyObject",
774 "GetObjectInfo",
775 "BindObjectMemory",
776 "CreateFence",
777 "GetFenceStatus",
778 "WaitForFences",
779 "CreateQueueSemaphore",
780 "SignalQueueSemaphore",
781 "WaitQueueSemaphore",
782 "CreateEvent",
783 "GetEventStatus",
784 "SetEvent",
785 "ResetEvent",
786 "CreateQueryPool",
787 "GetQueryPoolResults",
788 "GetFormatInfo",
789 "CreateImage",
790 "GetImageSubresourceInfo",
791 "CreateImageView",
792 "CreateColorAttachmentView",
793 "CreateDepthStencilView",
794 "CreateShader",
795 "CreateGraphicsPipeline",
796 "CreateComputePipeline",
797 "StorePipeline",
798 "LoadPipeline",
799 "CreatePipelineDelta",
800 "CreateSampler",
801 "CreateDescriptorSet",
802 "BeginDescriptorSetUpdate",
803 "EndDescriptorSetUpdate",
804 "AttachSamplerDescriptors",
805 "AttachImageViewDescriptors",
806 "AttachMemoryViewDescriptors",
807 "AttachNestedDescriptors",
808 "ClearDescriptorSetSlots",
809 "CreateViewportState",
810 "CreateRasterState",
811 "CreateMsaaState",
812 "CreateColorBlendState",
813 "CreateDepthStencilState",
814 "CreateCommandBuffer",
815 "BeginCommandBuffer",
816 "EndCommandBuffer",
817 "ResetCommandBuffer",
818 "CmdBindPipeline",
819 "CmdBindPipelineDelta",
820 "CmdBindStateObject",
821 "CmdBindDescriptorSet",
822 "CmdBindDynamicMemoryView",
Chia-I Wu3b04af52014-11-08 10:48:20 +0800823 "CmdBindVertexData",
Chia-I Wufb2559d2014-08-01 11:19:52 +0800824 "CmdBindIndexData",
825 "CmdBindAttachments",
826 "CmdPrepareMemoryRegions",
827 "CmdPrepareImages",
828 "CmdDraw",
829 "CmdDrawIndexed",
830 "CmdDrawIndirect",
831 "CmdDrawIndexedIndirect",
832 "CmdDispatch",
833 "CmdDispatchIndirect",
834 "CmdCopyMemory",
835 "CmdCopyImage",
836 "CmdCopyMemoryToImage",
837 "CmdCopyImageToMemory",
838 "CmdCloneImageData",
839 "CmdUpdateMemory",
840 "CmdFillMemory",
841 "CmdClearColorImage",
842 "CmdClearColorImageRaw",
843 "CmdClearDepthStencil",
844 "CmdResolveImage",
845 "CmdSetEvent",
846 "CmdResetEvent",
847 "CmdMemoryAtomic",
848 "CmdBeginQuery",
849 "CmdEndQuery",
850 "CmdResetQueryPool",
851 "CmdWriteTimestamp",
852 "CmdInitAtomicCounters",
853 "CmdLoadAtomicCounters",
854 "CmdSaveAtomicCounters",
855 "DbgSetValidationLevel",
856 "DbgRegisterMsgCallback",
857 "DbgUnregisterMsgCallback",
858 "DbgSetMessageFilter",
859 "DbgSetObjectTag",
860 "DbgSetGlobalOption",
861 "DbgSetDeviceOption",
862 "CmdDbgMarkerBegin",
863 "CmdDbgMarkerEnd",
Chia-I Wub8dceae2014-09-23 10:37:23 +0800864
865 "WsiX11AssociateConnection",
866 "WsiX11GetMSC",
867 "WsiX11CreatePresentableImage",
868 "WsiX11QueuePresent",
Chia-I Wufb2559d2014-08-01 11:19:52 +0800869)
Chia-I Wu900a2572014-08-01 14:44:16 +0800870
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600871def is_name_dispatchable(name):
872 return name not in (
873 "GetProcAddr",
874 "InitAndEnumerateGpus",
Jon Ashburn96f28fc2014-10-15 15:30:23 -0600875 "EnumerateLayers",
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600876 "DbgRegisterMsgCallback",
877 "DbgUnregisterMsgCallback",
878 "DbgSetGlobalOption")
879
Chia-I Wu900a2572014-08-01 14:44:16 +0800880def is_dispatchable(proto):
881 """Return true if the prototype is dispatchable.
882
883 That is, return true when the prototype takes a XGL_PHYSICAL_GPU or
884 XGL_BASE_OBJECT.
885 """
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600886 return is_name_dispatchable(proto.name)