blob: 857eea7cbff382e4ba54852c95eb3b67aa1c631b [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 Ashburne50fae52014-10-17 15:31:22 -060090 Proto("XGL_VOID *", "GetProcAddr",
Jon Ashburnd38bfb12014-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 Ashburnf7bcf9b2014-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
469 Proto("XGL_VOID", "CmdBindIndexData",
470 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
471 Param("XGL_GPU_MEMORY", "mem"),
472 Param("XGL_GPU_SIZE", "offset"),
473 Param("XGL_INDEX_TYPE", "indexType"))),
474
475 Proto("XGL_VOID", "CmdBindAttachments",
476 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
477 Param("XGL_UINT", "colorAttachmentCount"),
478 Param("const XGL_COLOR_ATTACHMENT_BIND_INFO*", "pColorAttachments"),
479 Param("const XGL_DEPTH_STENCIL_BIND_INFO*", "pDepthStencilAttachment"))),
480
481 Proto("XGL_VOID", "CmdPrepareMemoryRegions",
482 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
483 Param("XGL_UINT", "transitionCount"),
484 Param("const XGL_MEMORY_STATE_TRANSITION*", "pStateTransitions"))),
485
486 Proto("XGL_VOID", "CmdPrepareImages",
487 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
488 Param("XGL_UINT", "transitionCount"),
489 Param("const XGL_IMAGE_STATE_TRANSITION*", "pStateTransitions"))),
490
491 Proto("XGL_VOID", "CmdDraw",
492 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
493 Param("XGL_UINT", "firstVertex"),
494 Param("XGL_UINT", "vertexCount"),
495 Param("XGL_UINT", "firstInstance"),
496 Param("XGL_UINT", "instanceCount"))),
497
498 Proto("XGL_VOID", "CmdDrawIndexed",
499 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
500 Param("XGL_UINT", "firstIndex"),
501 Param("XGL_UINT", "indexCount"),
502 Param("XGL_INT", "vertexOffset"),
503 Param("XGL_UINT", "firstInstance"),
504 Param("XGL_UINT", "instanceCount"))),
505
506 Proto("XGL_VOID", "CmdDrawIndirect",
507 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
508 Param("XGL_GPU_MEMORY", "mem"),
509 Param("XGL_GPU_SIZE", "offset"),
510 Param("XGL_UINT32", "count"),
511 Param("XGL_UINT32", "stride"))),
512
513 Proto("XGL_VOID", "CmdDrawIndexedIndirect",
514 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
515 Param("XGL_GPU_MEMORY", "mem"),
516 Param("XGL_GPU_SIZE", "offset"),
517 Param("XGL_UINT32", "count"),
518 Param("XGL_UINT32", "stride"))),
519
520 Proto("XGL_VOID", "CmdDispatch",
521 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
522 Param("XGL_UINT", "x"),
523 Param("XGL_UINT", "y"),
524 Param("XGL_UINT", "z"))),
525
526 Proto("XGL_VOID", "CmdDispatchIndirect",
527 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
528 Param("XGL_GPU_MEMORY", "mem"),
529 Param("XGL_GPU_SIZE", "offset"))),
530
531 Proto("XGL_VOID", "CmdCopyMemory",
532 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
533 Param("XGL_GPU_MEMORY", "srcMem"),
534 Param("XGL_GPU_MEMORY", "destMem"),
535 Param("XGL_UINT", "regionCount"),
536 Param("const XGL_MEMORY_COPY*", "pRegions"))),
537
538 Proto("XGL_VOID", "CmdCopyImage",
539 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
540 Param("XGL_IMAGE", "srcImage"),
541 Param("XGL_IMAGE", "destImage"),
542 Param("XGL_UINT", "regionCount"),
543 Param("const XGL_IMAGE_COPY*", "pRegions"))),
544
545 Proto("XGL_VOID", "CmdCopyMemoryToImage",
546 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
547 Param("XGL_GPU_MEMORY", "srcMem"),
548 Param("XGL_IMAGE", "destImage"),
549 Param("XGL_UINT", "regionCount"),
550 Param("const XGL_MEMORY_IMAGE_COPY*", "pRegions"))),
551
552 Proto("XGL_VOID", "CmdCopyImageToMemory",
553 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
554 Param("XGL_IMAGE", "srcImage"),
555 Param("XGL_GPU_MEMORY", "destMem"),
556 Param("XGL_UINT", "regionCount"),
557 Param("const XGL_MEMORY_IMAGE_COPY*", "pRegions"))),
558
559 Proto("XGL_VOID", "CmdCloneImageData",
560 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
561 Param("XGL_IMAGE", "srcImage"),
562 Param("XGL_IMAGE_STATE", "srcImageState"),
563 Param("XGL_IMAGE", "destImage"),
564 Param("XGL_IMAGE_STATE", "destImageState"))),
565
566 Proto("XGL_VOID", "CmdUpdateMemory",
567 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
568 Param("XGL_GPU_MEMORY", "destMem"),
569 Param("XGL_GPU_SIZE", "destOffset"),
570 Param("XGL_GPU_SIZE", "dataSize"),
571 Param("const XGL_UINT32*", "pData"))),
572
573 Proto("XGL_VOID", "CmdFillMemory",
574 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
575 Param("XGL_GPU_MEMORY", "destMem"),
576 Param("XGL_GPU_SIZE", "destOffset"),
577 Param("XGL_GPU_SIZE", "fillSize"),
578 Param("XGL_UINT32", "data"))),
579
580 Proto("XGL_VOID", "CmdClearColorImage",
581 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
582 Param("XGL_IMAGE", "image"),
583 Param("const XGL_FLOAT[4]", "color"),
584 Param("XGL_UINT", "rangeCount"),
585 Param("const XGL_IMAGE_SUBRESOURCE_RANGE*", "pRanges"))),
586
587 Proto("XGL_VOID", "CmdClearColorImageRaw",
588 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
589 Param("XGL_IMAGE", "image"),
590 Param("const XGL_UINT32[4]", "color"),
591 Param("XGL_UINT", "rangeCount"),
592 Param("const XGL_IMAGE_SUBRESOURCE_RANGE*", "pRanges"))),
593
594 Proto("XGL_VOID", "CmdClearDepthStencil",
595 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
596 Param("XGL_IMAGE", "image"),
597 Param("XGL_FLOAT", "depth"),
598 Param("XGL_UINT32", "stencil"),
599 Param("XGL_UINT", "rangeCount"),
600 Param("const XGL_IMAGE_SUBRESOURCE_RANGE*", "pRanges"))),
601
602 Proto("XGL_VOID", "CmdResolveImage",
603 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
604 Param("XGL_IMAGE", "srcImage"),
605 Param("XGL_IMAGE", "destImage"),
606 Param("XGL_UINT", "rectCount"),
607 Param("const XGL_IMAGE_RESOLVE*", "pRects"))),
608
609 Proto("XGL_VOID", "CmdSetEvent",
610 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
611 Param("XGL_EVENT", "event"))),
612
613 Proto("XGL_VOID", "CmdResetEvent",
614 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
615 Param("XGL_EVENT", "event"))),
616
617 Proto("XGL_VOID", "CmdMemoryAtomic",
618 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
619 Param("XGL_GPU_MEMORY", "destMem"),
620 Param("XGL_GPU_SIZE", "destOffset"),
621 Param("XGL_UINT64", "srcData"),
622 Param("XGL_ATOMIC_OP", "atomicOp"))),
623
624 Proto("XGL_VOID", "CmdBeginQuery",
625 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
626 Param("XGL_QUERY_POOL", "queryPool"),
627 Param("XGL_UINT", "slot"),
628 Param("XGL_FLAGS", "flags"))),
629
630 Proto("XGL_VOID", "CmdEndQuery",
631 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
632 Param("XGL_QUERY_POOL", "queryPool"),
633 Param("XGL_UINT", "slot"))),
634
635 Proto("XGL_VOID", "CmdResetQueryPool",
636 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
637 Param("XGL_QUERY_POOL", "queryPool"),
638 Param("XGL_UINT", "startQuery"),
639 Param("XGL_UINT", "queryCount"))),
640
641 Proto("XGL_VOID", "CmdWriteTimestamp",
642 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
643 Param("XGL_TIMESTAMP_TYPE", "timestampType"),
644 Param("XGL_GPU_MEMORY", "destMem"),
645 Param("XGL_GPU_SIZE", "destOffset"))),
646
647 Proto("XGL_VOID", "CmdInitAtomicCounters",
648 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
649 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
650 Param("XGL_UINT", "startCounter"),
651 Param("XGL_UINT", "counterCount"),
652 Param("const XGL_UINT32*", "pData"))),
653
654 Proto("XGL_VOID", "CmdLoadAtomicCounters",
655 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
656 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
657 Param("XGL_UINT", "startCounter"),
658 Param("XGL_UINT", "counterCount"),
659 Param("XGL_GPU_MEMORY", "srcMem"),
660 Param("XGL_GPU_SIZE", "srcOffset"))),
661
662 Proto("XGL_VOID", "CmdSaveAtomicCounters",
663 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
664 Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
665 Param("XGL_UINT", "startCounter"),
666 Param("XGL_UINT", "counterCount"),
667 Param("XGL_GPU_MEMORY", "destMem"),
668 Param("XGL_GPU_SIZE", "destOffset"))),
669
670 Proto("XGL_RESULT", "DbgSetValidationLevel",
671 (Param("XGL_DEVICE", "device"),
672 Param("XGL_VALIDATION_LEVEL", "validationLevel"))),
673
674 Proto("XGL_RESULT", "DbgRegisterMsgCallback",
675 (Param("XGL_DBG_MSG_CALLBACK_FUNCTION", "pfnMsgCallback"),
676 Param("XGL_VOID*", "pUserData"))),
677
678 Proto("XGL_RESULT", "DbgUnregisterMsgCallback",
679 (Param("XGL_DBG_MSG_CALLBACK_FUNCTION", "pfnMsgCallback"))),
680
681 Proto("XGL_RESULT", "DbgSetMessageFilter",
682 (Param("XGL_DEVICE", "device"),
683 Param("XGL_INT", "msgCode"),
684 Param("XGL_DBG_MSG_FILTER", "filter"))),
685
686 Proto("XGL_RESULT", "DbgSetObjectTag",
687 (Param("XGL_BASE_OBJECT", "object"),
688 Param("XGL_SIZE", "tagSize"),
689 Param("const XGL_VOID*", "pTag"))),
690
691 Proto("XGL_RESULT", "DbgSetGlobalOption",
692 (Param("XGL_DBG_GLOBAL_OPTION", "dbgOption"),
693 Param("XGL_SIZE", "dataSize"),
694 Param("const XGL_VOID*", "pData"))),
695
696 Proto("XGL_RESULT", "DbgSetDeviceOption",
697 (Param("XGL_DEVICE", "device"),
698 Param("XGL_DBG_DEVICE_OPTION", "dbgOption"),
699 Param("XGL_SIZE", "dataSize"),
700 Param("const XGL_VOID*", "pData"))),
701
702 Proto("XGL_VOID", "CmdDbgMarkerBegin",
703 (Param("XGL_CMD_BUFFER", "cmdBuffer"),
704 Param("const XGL_CHAR*", "pMarker"))),
705
706 Proto("XGL_VOID", "CmdDbgMarkerEnd",
707 (Param("XGL_CMD_BUFFER", "cmdBuffer"))),
708)
709
Chia-I Wu6bdf0192014-09-13 13:36:06 +0800710core_headers = ("xgl.h", "xglDbg.h")
711
Chia-I Wu6dee8b82014-09-23 10:37:23 +0800712ext_wsi_x11 = (
713 Proto("XGL_RESULT", "WsiX11AssociateConnection",
714 (Param("XGL_PHYSICAL_GPU", "gpu"),
715 Param("const XGL_WSI_X11_CONNECTION_INFO*", "pConnectionInfo"))),
716
717 Proto("XGL_RESULT", "WsiX11GetMSC",
718 (Param("XGL_DEVICE", "device"),
719 Param("xcb_randr_crtc_t", "crtc"),
720 Param("XGL_UINT64*", "pMsc"))),
721
722 Proto("XGL_RESULT", "WsiX11CreatePresentableImage",
723 (Param("XGL_DEVICE", "device"),
724 Param("const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO*", "pCreateInfo"),
725 Param("XGL_IMAGE*", "pImage"),
726 Param("XGL_GPU_MEMORY*", "pMem"))),
727
728 Proto("XGL_RESULT", "WsiX11QueuePresent",
729 (Param("XGL_QUEUE", "queue"),
730 Param("const XGL_WSI_X11_PRESENT_INFO*", "pPresentInfo"),
731 Param("XGL_FENCE", "fence"))),
732)
733
734ext_wsi_x11_headers = ("xglWsiX11Ext.h",)
735
Chia-I Wufb2559d2014-08-01 11:19:52 +0800736# the dispatch table defined for ICDs
737# XXX figure out the real order
Chia-I Wu6bdf0192014-09-13 13:36:06 +0800738# XXX this is not extensible
Chia-I Wufb2559d2014-08-01 11:19:52 +0800739icd_dispatch_table = (
Jon Ashburnd38bfb12014-10-14 19:15:22 -0600740 "GetProcAddr",
Chia-I Wufb2559d2014-08-01 11:19:52 +0800741 "InitAndEnumerateGpus",
742 "GetGpuInfo",
743 "CreateDevice",
744 "DestroyDevice",
745 "GetExtensionSupport",
Jon Ashburnf7bcf9b2014-10-15 15:30:23 -0600746 "EnumerateLayers",
Chia-I Wufb2559d2014-08-01 11:19:52 +0800747 "GetDeviceQueue",
748 "QueueSubmit",
749 "QueueSetGlobalMemReferences",
750 "QueueWaitIdle",
751 "DeviceWaitIdle",
752 "GetMemoryHeapCount",
753 "GetMemoryHeapInfo",
754 "AllocMemory",
755 "FreeMemory",
756 "SetMemoryPriority",
757 "MapMemory",
758 "UnmapMemory",
759 "PinSystemMemory",
760 "RemapVirtualMemoryPages",
761 "GetMultiGpuCompatibility",
762 "OpenSharedMemory",
763 "OpenSharedQueueSemaphore",
764 "OpenPeerMemory",
765 "OpenPeerImage",
766 "DestroyObject",
767 "GetObjectInfo",
768 "BindObjectMemory",
769 "CreateFence",
770 "GetFenceStatus",
771 "WaitForFences",
772 "CreateQueueSemaphore",
773 "SignalQueueSemaphore",
774 "WaitQueueSemaphore",
775 "CreateEvent",
776 "GetEventStatus",
777 "SetEvent",
778 "ResetEvent",
779 "CreateQueryPool",
780 "GetQueryPoolResults",
781 "GetFormatInfo",
782 "CreateImage",
783 "GetImageSubresourceInfo",
784 "CreateImageView",
785 "CreateColorAttachmentView",
786 "CreateDepthStencilView",
787 "CreateShader",
788 "CreateGraphicsPipeline",
789 "CreateComputePipeline",
790 "StorePipeline",
791 "LoadPipeline",
792 "CreatePipelineDelta",
793 "CreateSampler",
794 "CreateDescriptorSet",
795 "BeginDescriptorSetUpdate",
796 "EndDescriptorSetUpdate",
797 "AttachSamplerDescriptors",
798 "AttachImageViewDescriptors",
799 "AttachMemoryViewDescriptors",
800 "AttachNestedDescriptors",
801 "ClearDescriptorSetSlots",
802 "CreateViewportState",
803 "CreateRasterState",
804 "CreateMsaaState",
805 "CreateColorBlendState",
806 "CreateDepthStencilState",
807 "CreateCommandBuffer",
808 "BeginCommandBuffer",
809 "EndCommandBuffer",
810 "ResetCommandBuffer",
811 "CmdBindPipeline",
812 "CmdBindPipelineDelta",
813 "CmdBindStateObject",
814 "CmdBindDescriptorSet",
815 "CmdBindDynamicMemoryView",
816 "CmdBindIndexData",
817 "CmdBindAttachments",
818 "CmdPrepareMemoryRegions",
819 "CmdPrepareImages",
820 "CmdDraw",
821 "CmdDrawIndexed",
822 "CmdDrawIndirect",
823 "CmdDrawIndexedIndirect",
824 "CmdDispatch",
825 "CmdDispatchIndirect",
826 "CmdCopyMemory",
827 "CmdCopyImage",
828 "CmdCopyMemoryToImage",
829 "CmdCopyImageToMemory",
830 "CmdCloneImageData",
831 "CmdUpdateMemory",
832 "CmdFillMemory",
833 "CmdClearColorImage",
834 "CmdClearColorImageRaw",
835 "CmdClearDepthStencil",
836 "CmdResolveImage",
837 "CmdSetEvent",
838 "CmdResetEvent",
839 "CmdMemoryAtomic",
840 "CmdBeginQuery",
841 "CmdEndQuery",
842 "CmdResetQueryPool",
843 "CmdWriteTimestamp",
844 "CmdInitAtomicCounters",
845 "CmdLoadAtomicCounters",
846 "CmdSaveAtomicCounters",
847 "DbgSetValidationLevel",
848 "DbgRegisterMsgCallback",
849 "DbgUnregisterMsgCallback",
850 "DbgSetMessageFilter",
851 "DbgSetObjectTag",
852 "DbgSetGlobalOption",
853 "DbgSetDeviceOption",
854 "CmdDbgMarkerBegin",
855 "CmdDbgMarkerEnd",
Chia-I Wu6dee8b82014-09-23 10:37:23 +0800856
857 "WsiX11AssociateConnection",
858 "WsiX11GetMSC",
859 "WsiX11CreatePresentableImage",
860 "WsiX11QueuePresent",
Chia-I Wufb2559d2014-08-01 11:19:52 +0800861)
Chia-I Wu900a2572014-08-01 14:44:16 +0800862
Jon Ashburnd38bfb12014-10-14 19:15:22 -0600863def is_name_dispatchable(name):
864 return name not in (
865 "GetProcAddr",
866 "InitAndEnumerateGpus",
Jon Ashburnf7bcf9b2014-10-15 15:30:23 -0600867 "EnumerateLayers",
Jon Ashburnd38bfb12014-10-14 19:15:22 -0600868 "DbgRegisterMsgCallback",
869 "DbgUnregisterMsgCallback",
870 "DbgSetGlobalOption")
871
Chia-I Wu900a2572014-08-01 14:44:16 +0800872def is_dispatchable(proto):
873 """Return true if the prototype is dispatchable.
874
875 That is, return true when the prototype takes a XGL_PHYSICAL_GPU or
876 XGL_BASE_OBJECT.
877 """
Jon Ashburnd38bfb12014-10-14 19:15:22 -0600878 return is_name_dispatchable(proto.name)