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