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