blob: 221dc98ba5d3a0c3932a35fd1a8d3b70ec0a383c [file] [log] [blame]
Jon Ashburn79113cc2014-12-01 14:22:40 -07001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
Jon Ashburn1fec4242014-11-26 11:10:26 -070024#include <string.h>
25#include <stdlib.h>
26#include <assert.h>
27#include <unordered_map>
28#include "xglLayer.h"
29
30static std::unordered_map<XGL_VOID *, XGL_LAYER_DISPATCH_TABLE *> tableMap;
31
32static XGL_LAYER_DISPATCH_TABLE * initLayerTable(const XGL_BASE_LAYER_OBJECT *gpuw)
33{
34 GetProcAddrType fpGPA;
35 XGL_LAYER_DISPATCH_TABLE *pTable;
36
37 assert(gpuw);
38 std::unordered_map<XGL_VOID *, XGL_LAYER_DISPATCH_TABLE *>::const_iterator it = tableMap.find((XGL_VOID *) gpuw);
39 if (it == tableMap.end())
40 {
41 pTable = new XGL_LAYER_DISPATCH_TABLE;
42 tableMap[(XGL_VOID *) gpuw] = pTable;
43 } else
44 {
45 return it->second;
46 }
47 fpGPA = gpuw->pGPA;
48 assert(fpGPA);
49 pTable->GetProcAddr = fpGPA;
50 pTable->InitAndEnumerateGpus = (InitAndEnumerateGpusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglInitAndEnumerateGpus");
51 pTable->GetGpuInfo = (GetGpuInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetGpuInfo");
52 pTable->CreateDevice = (CreateDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateDevice");
53 pTable->DestroyDevice = (DestroyDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDestroyDevice");
54 pTable->GetExtensionSupport = (GetExtensionSupportType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetExtensionSupport");
55 pTable->EnumerateLayers = (EnumerateLayersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglEnumerateLayers");
56 pTable->GetDeviceQueue = (GetDeviceQueueType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetDeviceQueue");
57 pTable->QueueSubmit = (QueueSubmitType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglQueueSubmit");
58 pTable->QueueSetGlobalMemReferences = (QueueSetGlobalMemReferencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglQueueSetGlobalMemReferences");
59 pTable->QueueWaitIdle = (QueueWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglQueueWaitIdle");
60 pTable->DeviceWaitIdle = (DeviceWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDeviceWaitIdle");
61 pTable->GetMemoryHeapCount = (GetMemoryHeapCountType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetMemoryHeapCount");
62 pTable->GetMemoryHeapInfo = (GetMemoryHeapInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetMemoryHeapInfo");
63 pTable->AllocMemory = (AllocMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglAllocMemory");
64 pTable->FreeMemory = (FreeMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglFreeMemory");
65 pTable->SetMemoryPriority = (SetMemoryPriorityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglSetMemoryPriority");
66 pTable->MapMemory = (MapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglMapMemory");
67 pTable->UnmapMemory = (UnmapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglUnmapMemory");
68 pTable->PinSystemMemory = (PinSystemMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglPinSystemMemory");
69 pTable->RemapVirtualMemoryPages = (RemapVirtualMemoryPagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglRemapVirtualMemoryPages");
70 pTable->GetMultiGpuCompatibility = (GetMultiGpuCompatibilityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetMultiGpuCompatibility");
71 pTable->OpenSharedMemory = (OpenSharedMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglOpenSharedMemory");
72 pTable->OpenSharedQueueSemaphore = (OpenSharedQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglOpenSharedQueueSemaphore");
73 pTable->OpenPeerMemory = (OpenPeerMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglOpenPeerMemory");
74 pTable->OpenPeerImage = (OpenPeerImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglOpenPeerImage");
75 pTable->DestroyObject = (DestroyObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDestroyObject");
76 pTable->GetObjectInfo = (GetObjectInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetObjectInfo");
77 pTable->BindObjectMemory = (BindObjectMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglBindObjectMemory");
78 pTable->CreateFence = (CreateFenceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateFence");
79 pTable->GetFenceStatus = (GetFenceStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetFenceStatus");
80 pTable->WaitForFences = (WaitForFencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglWaitForFences");
81 pTable->CreateQueueSemaphore = (CreateQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateQueueSemaphore");
82 pTable->SignalQueueSemaphore = (SignalQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglSignalQueueSemaphore");
83 pTable->WaitQueueSemaphore = (WaitQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglWaitQueueSemaphore");
84 pTable->CreateEvent = (CreateEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateEvent");
85 pTable->GetEventStatus = (GetEventStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetEventStatus");
86 pTable->SetEvent = (SetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglSetEvent");
87 pTable->ResetEvent = (ResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglResetEvent");
88 pTable->CreateQueryPool = (CreateQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateQueryPool");
89 pTable->GetQueryPoolResults = (GetQueryPoolResultsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetQueryPoolResults");
90 pTable->GetFormatInfo = (GetFormatInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetFormatInfo");
91 pTable->CreateImage = (CreateImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateImage");
92 pTable->GetImageSubresourceInfo = (GetImageSubresourceInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetImageSubresourceInfo");
93 pTable->CreateImageView = (CreateImageViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateImageView");
94 pTable->CreateColorAttachmentView = (CreateColorAttachmentViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateColorAttachmentView");
95 pTable->CreateDepthStencilView = (CreateDepthStencilViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateDepthStencilView");
96 pTable->CreateShader = (CreateShaderType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateShader");
97 pTable->CreateGraphicsPipeline = (CreateGraphicsPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateGraphicsPipeline");
98 pTable->CreateComputePipeline = (CreateComputePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateComputePipeline");
99 pTable->StorePipeline = (StorePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglStorePipeline");
100 pTable->LoadPipeline = (LoadPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglLoadPipeline");
101 pTable->CreatePipelineDelta = (CreatePipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreatePipelineDelta");
102 pTable->CreateSampler = (CreateSamplerType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateSampler");
103 pTable->CreateDescriptorSet = (CreateDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateDescriptorSet");
104 pTable->BeginDescriptorSetUpdate = (BeginDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglBeginDescriptorSetUpdate");
105 pTable->EndDescriptorSetUpdate = (EndDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglEndDescriptorSetUpdate");
106 pTable->AttachSamplerDescriptors = (AttachSamplerDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglAttachSamplerDescriptors");
107 pTable->AttachImageViewDescriptors = (AttachImageViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglAttachImageViewDescriptors");
108 pTable->AttachMemoryViewDescriptors = (AttachMemoryViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglAttachMemoryViewDescriptors");
109 pTable->AttachNestedDescriptors = (AttachNestedDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglAttachNestedDescriptors");
110 pTable->ClearDescriptorSetSlots = (ClearDescriptorSetSlotsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglClearDescriptorSetSlots");
111 pTable->CreateViewportState = (CreateViewportStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateViewportState");
112 pTable->CreateRasterState = (CreateRasterStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateRasterState");
113 pTable->CreateMsaaState = (CreateMsaaStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateMsaaState");
114 pTable->CreateColorBlendState = (CreateColorBlendStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateColorBlendState");
115 pTable->CreateDepthStencilState = (CreateDepthStencilStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateDepthStencilState");
116 pTable->CreateCommandBuffer = (CreateCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCreateCommandBuffer");
117 pTable->BeginCommandBuffer = (BeginCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglBeginCommandBuffer");
118 pTable->EndCommandBuffer = (EndCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglEndCommandBuffer");
119 pTable->ResetCommandBuffer = (ResetCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglResetCommandBuffer");
120 pTable->CmdBindPipeline = (CmdBindPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindPipeline");
121 pTable->CmdBindPipelineDelta = (CmdBindPipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindPipelineDelta");
122 pTable->CmdBindStateObject = (CmdBindStateObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindStateObject");
123 pTable->CmdBindDescriptorSet = (CmdBindDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindDescriptorSet");
124 pTable->CmdBindDynamicMemoryView = (CmdBindDynamicMemoryViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindDynamicMemoryView");
125 pTable->CmdBindVertexData = (CmdBindVertexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindVertexData");
126 pTable->CmdBindIndexData = (CmdBindIndexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindIndexData");
127 pTable->CmdBindAttachments = (CmdBindAttachmentsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBindAttachments");
128 pTable->CmdPrepareMemoryRegions = (CmdPrepareMemoryRegionsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdPrepareMemoryRegions");
129 pTable->CmdPrepareImages = (CmdPrepareImagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdPrepareImages");
130 pTable->CmdDraw = (CmdDrawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDraw");
131 pTable->CmdDrawIndexed = (CmdDrawIndexedType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDrawIndexed");
132 pTable->CmdDrawIndirect = (CmdDrawIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDrawIndirect");
133 pTable->CmdDrawIndexedIndirect = (CmdDrawIndexedIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDrawIndexedIndirect");
134 pTable->CmdDispatch = (CmdDispatchType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDispatch");
135 pTable->CmdDispatchIndirect = (CmdDispatchIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDispatchIndirect");
136 pTable->CmdCopyMemory = (CmdCopyMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdCopyMemory");
137 pTable->CmdCopyImage = (CmdCopyImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdCopyImage");
138 pTable->CmdCopyMemoryToImage = (CmdCopyMemoryToImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdCopyMemoryToImage");
139 pTable->CmdCopyImageToMemory = (CmdCopyImageToMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdCopyImageToMemory");
140 pTable->CmdCloneImageData = (CmdCloneImageDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdCloneImageData");
141 pTable->CmdUpdateMemory = (CmdUpdateMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdUpdateMemory");
142 pTable->CmdFillMemory = (CmdFillMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdFillMemory");
143 pTable->CmdClearColorImage = (CmdClearColorImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdClearColorImage");
144 pTable->CmdClearColorImageRaw = (CmdClearColorImageRawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdClearColorImageRaw");
145 pTable->CmdClearDepthStencil = (CmdClearDepthStencilType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdClearDepthStencil");
146 pTable->CmdResolveImage = (CmdResolveImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdResolveImage");
147 pTable->CmdSetEvent = (CmdSetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdSetEvent");
148 pTable->CmdResetEvent = (CmdResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdResetEvent");
149 pTable->CmdMemoryAtomic = (CmdMemoryAtomicType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdMemoryAtomic");
150 pTable->CmdBeginQuery = (CmdBeginQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdBeginQuery");
151 pTable->CmdEndQuery = (CmdEndQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdEndQuery");
152 pTable->CmdResetQueryPool = (CmdResetQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdResetQueryPool");
153 pTable->CmdWriteTimestamp = (CmdWriteTimestampType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdWriteTimestamp");
154 pTable->CmdInitAtomicCounters = (CmdInitAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdInitAtomicCounters");
155 pTable->CmdLoadAtomicCounters = (CmdLoadAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdLoadAtomicCounters");
156 pTable->CmdSaveAtomicCounters = (CmdSaveAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdSaveAtomicCounters");
157 pTable->DbgSetValidationLevel = (DbgSetValidationLevelType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDbgSetValidationLevel");
158 pTable->DbgRegisterMsgCallback = (DbgRegisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDbgRegisterMsgCallback");
159 pTable->DbgUnregisterMsgCallback = (DbgUnregisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDbgUnregisterMsgCallback");
160 pTable->DbgSetMessageFilter = (DbgSetMessageFilterType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDbgSetMessageFilter");
161 pTable->DbgSetObjectTag = (DbgSetObjectTagType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDbgSetObjectTag");
162 pTable->DbgSetGlobalOption = (DbgSetGlobalOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDbgSetGlobalOption");
163 pTable->DbgSetDeviceOption = (DbgSetDeviceOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglDbgSetDeviceOption");
164 pTable->CmdDbgMarkerBegin = (CmdDbgMarkerBeginType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDbgMarkerBegin");
165 pTable->CmdDbgMarkerEnd = (CmdDbgMarkerEndType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglCmdDbgMarkerEnd");
166 pTable->WsiX11AssociateConnection = (WsiX11AssociateConnectionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglWsiX11AssociateConnection");
167 pTable->WsiX11GetMSC = (WsiX11GetMSCType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglWsiX11GetMSC");
168 pTable->WsiX11CreatePresentableImage = (WsiX11CreatePresentableImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglWsiX11CreatePresentableImage");
169 pTable->WsiX11QueuePresent = (WsiX11QueuePresentType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglWsiX11QueuePresent");
170 return pTable;
171}
172
173XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLayerExtension1(XGL_DEVICE device)
174{
175 printf("In xglLayerExtension1() call w/ device: %p\n", (void*)device);
176 printf("xglLayerExtension1 returning SUCCESS\n");
177 return XGL_SUCCESS;
178}
179
180XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pExtName)
181{
182 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
183 XGL_RESULT result;
184 XGL_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw);
185
186 printf("At start of wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
187 if (!strncmp((const char *) pExtName, "xglLayerExtension1", strlen("xglLayerExtension1")))
188 result = XGL_SUCCESS;
189 else
190 result = pTable->GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName);
191 printf("Completed wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
192 return result;
193}
194
195XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice)
196{
197 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
198 XGL_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw);
199
200 printf("At start of wrapped xglCreateDevice() call w/ gpu: %p\n", (void*)gpu);
201 XGL_RESULT result = pTable->CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice);
202 // create a mapping for the device object into the dispatch table
203 tableMap.emplace(*pDevice, pTable);
204 printf("Completed wrapped xglCreateDevice() call w/ pDevice, Device %p: %p\n", (void*)pDevice, (void *) *pDevice);
205 return result;
206}
207XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
208{
209 XGL_LAYER_DISPATCH_TABLE* pTable = tableMap[device];
210
211 printf("At start of wrapped xglGetFormatInfo() call w/ device: %p\n", (void*)device);
212 XGL_RESULT result = pTable->GetFormatInfo(device, format, infoType, pDataSize, pData);
213 printf("Completed wrapped xglGetFormatInfo() call w/ device: %p\n", (void*)device);
214 return result;
215}
216
217XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, XGL_SIZE maxLayerCount, XGL_SIZE maxStringSize, XGL_CHAR* const* pOutLayers, XGL_SIZE * pOutLayerCount, XGL_VOID* pReserved)
218{
219 if (gpu != NULL)
220 {
221 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
222 XGL_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw);
223
224 printf("At start of wrapped xglEnumerateLayers() call w/ gpu: %p\n", gpu);
225 XGL_RESULT result = pTable->EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved);
226 return result;
227 } else
228 {
229 if (pOutLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL || pReserved == NULL)
230 return XGL_ERROR_INVALID_POINTER;
231
232 // Example of a layer that is only compatible with Intel's GPUs
233 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT*) pReserved;
234 GetGpuInfoType fpGetGpuInfo;
235 XGL_PHYSICAL_GPU_PROPERTIES gpuProps;
236 XGL_SIZE dataSize = sizeof(XGL_PHYSICAL_GPU_PROPERTIES);
237 fpGetGpuInfo = (GetGpuInfoType) gpuw->pGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, (const XGL_CHAR *) "xglGetGpuInfo");
238 fpGetGpuInfo((XGL_PHYSICAL_GPU) gpuw->nextObject, XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES, &dataSize, &gpuProps);
239 if (gpuProps.vendorId == 0x8086)
240 {
241 *pOutLayerCount = 1;
242 strncpy((char *) pOutLayers[0], "Basic", maxStringSize);
243 } else
244 {
245 *pOutLayerCount = 0;
246 }
247 return XGL_SUCCESS;
248 }
249}
250
Jon Ashburn79113cc2014-12-01 14:22:40 -0700251XGL_LAYER_EXPORT XGL_VOID * XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pName)
252{
Jon Ashburn1fec4242014-11-26 11:10:26 -0700253 XGL_LAYER_DISPATCH_TABLE* pTable;
Jon Ashburn79113cc2014-12-01 14:22:40 -0700254
Jon Ashburn1fec4242014-11-26 11:10:26 -0700255 if (gpu == NULL)
256 return NULL;
Jon Ashburn79113cc2014-12-01 14:22:40 -0700257 pTable = initLayerTable((const XGL_BASE_LAYER_OBJECT *) gpu);
Jon Ashburn1fec4242014-11-26 11:10:26 -0700258 if (!strncmp("xglGetProcAddr", (const char *) pName, sizeof("xglGetProcAddr")))
259 return (XGL_VOID *) xglGetProcAddr;
260 else if (!strncmp("xglInitAndEnumerateGpus", (const char *) pName, sizeof("xglInitAndEnumerateGpus")))
261 return (XGL_VOID *) pTable->InitAndEnumerateGpus;
262 if (!strncmp("xglGetGpuInfo", (const char *) pName, sizeof ("xglGetGpuInfo")))
263 return (XGL_VOID *) pTable->GetGpuInfo;
264 else if (!strncmp("xglCreateDevice", (const char *) pName, sizeof ("xglCreateDevice")))
265 return (XGL_VOID *) xglCreateDevice;
266 else if (!strncmp("xglDestroyDevice", (const char *) pName, sizeof ("xglDestroyDevice")))
267 return (XGL_VOID *) pTable->DestroyDevice;
268 else if (!strncmp("xglGetExtensionSupport", (const char *) pName, sizeof ("xglGetExtensionSupport")))
269 return (XGL_VOID *) xglGetExtensionSupport;
270 else if (!strncmp("xglEnumerateLayers", (const char *) pName, sizeof ("xglEnumerateLayers")))
271 return (XGL_VOID *) xglEnumerateLayers;
272 else if (!strncmp("xglGetDeviceQueue", (const char *) pName, sizeof ("xglGetDeviceQueue")))
273 return (XGL_VOID *) pTable->GetDeviceQueue;
274 else if (!strncmp("xglQueueSubmit", (const char *) pName, sizeof ("xglQueueSubmit")))
275 return (XGL_VOID *) pTable->QueueSubmit;
276 else if (!strncmp("xglQueueSetGlobalMemReferences", (const char *) pName, sizeof ("xglQueueSetGlobalMemReferences")))
277 return (XGL_VOID *) pTable->QueueSetGlobalMemReferences;
278 else if (!strncmp("xglQueueWaitIdle", (const char *) pName, sizeof ("xglQueueWaitIdle")))
279 return (XGL_VOID *) pTable->QueueWaitIdle;
280 else if (!strncmp("xglDeviceWaitIdle", (const char *) pName, sizeof ("xglDeviceWaitIdle")))
281 return (XGL_VOID *) pTable->DeviceWaitIdle;
282 else if (!strncmp("xglGetMemoryHeapCount", (const char *) pName, sizeof ("xglGetMemoryHeapCount")))
283 return (XGL_VOID *) pTable->GetMemoryHeapCount;
284 else if (!strncmp("xglGetMemoryHeapInfo", (const char *) pName, sizeof ("xglGetMemoryHeapInfo")))
285 return (XGL_VOID *) pTable->GetMemoryHeapInfo;
286 else if (!strncmp("xglAllocMemory", (const char *) pName, sizeof ("xglAllocMemory")))
287 return (XGL_VOID *) pTable->AllocMemory;
288 else if (!strncmp("xglFreeMemory", (const char *) pName, sizeof ("xglFreeMemory")))
289 return (XGL_VOID *) pTable->FreeMemory;
290 else if (!strncmp("xglSetMemoryPriority", (const char *) pName, sizeof ("xglSetMemoryPriority")))
291 return (XGL_VOID *) pTable->SetMemoryPriority;
292 else if (!strncmp("xglMapMemory", (const char *) pName, sizeof ("xglMapMemory")))
293 return (XGL_VOID *) pTable->MapMemory;
294 else if (!strncmp("xglUnmapMemory", (const char *) pName, sizeof ("xglUnmapMemory")))
295 return (XGL_VOID *) pTable->UnmapMemory;
296 else if (!strncmp("xglPinSystemMemory", (const char *) pName, sizeof ("xglPinSystemMemory")))
297 return (XGL_VOID *) pTable->PinSystemMemory;
298 else if (!strncmp("xglRemapVirtualMemoryPages", (const char *) pName, sizeof ("xglRemapVirtualMemoryPages")))
299 return (XGL_VOID *) pTable->RemapVirtualMemoryPages;
300 else if (!strncmp("xglGetMultiGpuCompatibility", (const char *) pName, sizeof ("xglGetMultiGpuCompatibility")))
301 return (XGL_VOID *) pTable->GetMultiGpuCompatibility;
302 else if (!strncmp("xglOpenSharedMemory", (const char *) pName, sizeof ("xglOpenSharedMemory")))
303 return (XGL_VOID *) pTable->OpenSharedMemory;
304 else if (!strncmp("xglOpenSharedQueueSemaphore", (const char *) pName, sizeof ("xglOpenSharedQueueSemaphore")))
305 return (XGL_VOID *) pTable->OpenSharedQueueSemaphore;
306 else if (!strncmp("xglOpenPeerMemory", (const char *) pName, sizeof ("xglOpenPeerMemory")))
307 return (XGL_VOID *) pTable->OpenPeerMemory;
308 else if (!strncmp("xglOpenPeerImage", (const char *) pName, sizeof ("xglOpenPeerImage")))
309 return (XGL_VOID *) pTable->OpenPeerImage;
310 else if (!strncmp("xglDestroyObject", (const char *) pName, sizeof ("xglDestroyObject")))
311 return (XGL_VOID *) pTable->DestroyObject;
312 else if (!strncmp("xglGetObjectInfo", (const char *) pName, sizeof ("xglGetObjectInfo")))
313 return (XGL_VOID *) pTable->GetObjectInfo;
314 else if (!strncmp("xglBindObjectMemory", (const char *) pName, sizeof ("xglBindObjectMemory")))
315 return (XGL_VOID *) pTable->BindObjectMemory;
316 else if (!strncmp("xglCreateFence", (const char *) pName, sizeof ("xgllCreateFence")))
317 return (XGL_VOID *) pTable->CreateFence;
318 else if (!strncmp("xglGetFenceStatus", (const char *) pName, sizeof ("xglGetFenceStatus")))
319 return (XGL_VOID *) pTable->GetFenceStatus;
320 else if (!strncmp("xglWaitForFences", (const char *) pName, sizeof ("xglWaitForFences")))
321 return (XGL_VOID *) pTable->WaitForFences;
322 else if (!strncmp("xglCreateQueueSemaphore", (const char *) pName, sizeof ("xgllCreateQueueSemaphore")))
323 return (XGL_VOID *) pTable->CreateQueueSemaphore;
324 else if (!strncmp("xglSignalQueueSemaphore", (const char *) pName, sizeof ("xglSignalQueueSemaphore")))
325 return (XGL_VOID *) pTable->SignalQueueSemaphore;
326 else if (!strncmp("xglWaitQueueSemaphore", (const char *) pName, sizeof ("xglWaitQueueSemaphore")))
327 return (XGL_VOID *) pTable->WaitQueueSemaphore;
328 else if (!strncmp("xglCreateEvent", (const char *) pName, sizeof ("xgllCreateEvent")))
329 return (XGL_VOID *) pTable->CreateEvent;
330 else if (!strncmp("xglGetEventStatus", (const char *) pName, sizeof ("xglGetEventStatus")))
331 return (XGL_VOID *) pTable->GetEventStatus;
332 else if (!strncmp("xglSetEvent", (const char *) pName, sizeof ("xglSetEvent")))
333 return (XGL_VOID *) pTable->SetEvent;
334 else if (!strncmp("xglResetEvent", (const char *) pName, sizeof ("xgllResetEvent")))
335 return (XGL_VOID *) pTable->ResetEvent;
336 else if (!strncmp("xglCreateQueryPool", (const char *) pName, sizeof ("xglCreateQueryPool")))
337 return (XGL_VOID *) pTable->CreateQueryPool;
338 else if (!strncmp("xglGetQueryPoolResults", (const char *) pName, sizeof ("xglGetQueryPoolResults")))
339 return (XGL_VOID *) pTable->GetQueryPoolResults;
340 else if (!strncmp("xglGetFormatInfo", (const char *) pName, sizeof ("xglGetFormatInfo")))
341 return (XGL_VOID *) xglGetFormatInfo;
342 else if (!strncmp("xglCreateImage", (const char *) pName, sizeof ("xglCreateImage")))
343 return (XGL_VOID *) pTable->CreateImage;
344 else if (!strncmp("xglGetImageSubresourceInfo", (const char *) pName, sizeof ("xglGetImageSubresourceInfo")))
345 return (XGL_VOID *) pTable->GetImageSubresourceInfo;
346 else if (!strncmp("xglCreateImageView", (const char *) pName, sizeof ("xglCreateImageView")))
347 return (XGL_VOID *) pTable->CreateImageView;
348 else if (!strncmp("xglCreateColorAttachmentView", (const char *) pName, sizeof ("xglCreateColorAttachmentView")))
349 return (XGL_VOID *) pTable->CreateColorAttachmentView;
350 else if (!strncmp("xglCreateDepthStencilView", (const char *) pName, sizeof ("xglCreateDepthStencilView")))
351 return (XGL_VOID *) pTable->CreateDepthStencilView;
352 else if (!strncmp("xglCreateShader", (const char *) pName, sizeof ("xglCreateShader")))
353 return (XGL_VOID *) pTable->CreateShader;
354 else if (!strncmp("xglCreateGraphicsPipeline", (const char *) pName, sizeof ("xglCreateGraphicsPipeline")))
355 return (XGL_VOID *) pTable->CreateGraphicsPipeline;
356 else if (!strncmp("xglCreateComputePipeline", (const char *) pName, sizeof ("xglCreateComputePipeline")))
357 return (XGL_VOID *) pTable->CreateComputePipeline;
358 else if (!strncmp("xglStorePipeline", (const char *) pName, sizeof ("xglStorePipeline")))
359 return (XGL_VOID *) pTable->StorePipeline;
360 else if (!strncmp("xglLoadPipeline", (const char *) pName, sizeof ("xglLoadPipeline")))
361 return (XGL_VOID *) pTable->LoadPipeline;
362 else if (!strncmp("xglCreatePipelineDelta", (const char *) pName, sizeof ("xglCreatePipelineDelta")))
363 return (XGL_VOID *) pTable->CreatePipelineDelta;
364 else if (!strncmp("xglCreateSampler", (const char *) pName, sizeof ("xglCreateSampler")))
365 return (XGL_VOID *) pTable->CreateSampler;
366 else if (!strncmp("xglCreateDescriptorSet", (const char *) pName, sizeof ("xglCreateDescriptorSet")))
367 return (XGL_VOID *) pTable->CreateDescriptorSet;
368 else if (!strncmp("xglBeginDescriptorSetUpdate", (const char *) pName, sizeof ("xglBeginDescriptorSetUpdate")))
369 return (XGL_VOID *) pTable->BeginDescriptorSetUpdate;
370 else if (!strncmp("xglEndDescriptorSetUpdate", (const char *) pName, sizeof ("xglEndDescriptorSetUpdate")))
371 return (XGL_VOID *) pTable->EndDescriptorSetUpdate;
372 else if (!strncmp("xglAttachSamplerDescriptors", (const char *) pName, sizeof ("xglAttachSamplerDescriptors")))
373 return (XGL_VOID *) pTable->AttachSamplerDescriptors;
374 else if (!strncmp("xglAttachImageViewDescriptors", (const char *) pName, sizeof ("xglAttachImageViewDescriptors")))
375 return (XGL_VOID *) pTable->AttachImageViewDescriptors;
376 else if (!strncmp("xglAttachMemoryViewDescriptors", (const char *) pName, sizeof ("xglAttachMemoryViewDescriptors")))
377 return (XGL_VOID *) pTable->AttachMemoryViewDescriptors;
378 else if (!strncmp("xglAttachNestedDescriptors", (const char *) pName, sizeof ("xglAttachNestedDescriptors")))
379 return (XGL_VOID *) pTable->AttachNestedDescriptors;
380 else if (!strncmp("xglClearDescriptorSetSlots", (const char *) pName, sizeof ("xglClearDescriptorSetSlots")))
381 return (XGL_VOID *) pTable->ClearDescriptorSetSlots;
382 else if (!strncmp("xglCreateViewportState", (const char *) pName, sizeof ("xglCreateViewportState")))
383 return (XGL_VOID *) pTable->CreateViewportState;
384 else if (!strncmp("xglCreateRasterState", (const char *) pName, sizeof ("xglCreateRasterState")))
385 return (XGL_VOID *) pTable->CreateRasterState;
386 else if (!strncmp("xglCreateMsaaState", (const char *) pName, sizeof ("xglCreateMsaaState")))
387 return (XGL_VOID *) pTable->CreateMsaaState;
388 else if (!strncmp("xglCreateColorBlendState", (const char *) pName, sizeof ("xglCreateColorBlendState")))
389 return (XGL_VOID *) pTable->CreateColorBlendState;
390 else if (!strncmp("xglCreateDepthStencilState", (const char *) pName, sizeof ("xglCreateDepthStencilState")))
391 return (XGL_VOID *) pTable->CreateDepthStencilState;
392 else if (!strncmp("xglCreateCommandBuffer", (const char *) pName, sizeof ("xglCreateCommandBuffer")))
393 return (XGL_VOID *) pTable->CreateCommandBuffer;
394 else if (!strncmp("xglBeginCommandBuffer", (const char *) pName, sizeof ("xglBeginCommandBuffer")))
395 return (XGL_VOID *) pTable->BeginCommandBuffer;
396 else if (!strncmp("xglEndCommandBuffer", (const char *) pName, sizeof ("xglEndCommandBuffer")))
397 return (XGL_VOID *) pTable->EndCommandBuffer;
398 else if (!strncmp("xglResetCommandBuffer", (const char *) pName, sizeof ("xglResetCommandBuffer")))
399 return (XGL_VOID *) pTable->ResetCommandBuffer;
400 else if (!strncmp("xglCmdBindPipeline", (const char *) pName, sizeof ("xglCmdBindPipeline")))
401 return (XGL_VOID *) pTable->CmdBindPipeline;
402 else if (!strncmp("xglCmdBindPipelineDelta", (const char *) pName, sizeof ("xglCmdBindPipelineDelta")))
403 return (XGL_VOID *) pTable->CmdBindPipelineDelta;
404 else if (!strncmp("xglCmdBindStateObject", (const char *) pName, sizeof ("xglCmdBindStateObject")))
405 return (XGL_VOID *) pTable->CmdBindStateObject;
406 else if (!strncmp("xglCmdBindDescriptorSet", (const char *) pName, sizeof ("xglCmdBindDescriptorSet")))
407 return (XGL_VOID *) pTable->CmdBindDescriptorSet;
408 else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) pName, sizeof ("xglCmdBindDynamicMemoryView")))
409 return (XGL_VOID *) pTable->CmdBindDynamicMemoryView;
410 else if (!strncmp("xglCmdBindVertexData", (const char *) pName, sizeof ("xglCmdBindVertexData")))
411 return (XGL_VOID *) pTable->CmdBindVertexData;
412 else if (!strncmp("xglCmdBindIndexData", (const char *) pName, sizeof ("xglCmdBindIndexData")))
413 return (XGL_VOID *) pTable->CmdBindIndexData;
414 else if (!strncmp("xglCmdBindAttachments", (const char *) pName, sizeof ("xglCmdBindAttachments")))
415 return (XGL_VOID *) pTable->CmdBindAttachments;
416 else if (!strncmp("xglCmdPrepareMemoryRegions", (const char *) pName, sizeof ("xglCmdPrepareMemoryRegions")))
417 return (XGL_VOID *) pTable->CmdPrepareMemoryRegions;
418 else if (!strncmp("xglCmdPrepareImages", (const char *) pName, sizeof ("xglCmdPrepareImages")))
419 return (XGL_VOID *) pTable->CmdPrepareImages;
420 else if (!strncmp("xglCmdDraw", (const char *) pName, sizeof ("xglCmdDraw")))
421 return (XGL_VOID *) pTable->CmdDraw;
422 else if (!strncmp("xglCmdDrawIndexed", (const char *) pName, sizeof ("xglCmdDrawIndexed")))
423 return (XGL_VOID *) pTable->CmdDrawIndexed;
424 else if (!strncmp("xglCmdDrawIndirect", (const char *) pName, sizeof ("xglCmdDrawIndirect")))
425 return (XGL_VOID *) pTable->CmdDrawIndirect;
426 else if (!strncmp("xglCmdDrawIndexedIndirect", (const char *) pName, sizeof ("xglCmdDrawIndexedIndirect")))
427 return (XGL_VOID *) pTable->CmdDrawIndexedIndirect;
428 else if (!strncmp("xglCmdDispatch", (const char *) pName, sizeof ("xglCmdDispatch")))
429 return (XGL_VOID *) pTable->CmdDispatch;
430 else if (!strncmp("xglCmdDispatchIndirect", (const char *) pName, sizeof ("xglCmdDispatchIndirect")))
431 return (XGL_VOID *) pTable->CmdDispatchIndirect;
432 else if (!strncmp("xglCmdCopyMemory", (const char *) pName, sizeof ("xglCmdCopyMemory")))
433 return (XGL_VOID *) pTable->CmdCopyMemory;
434 else if (!strncmp("xglCmdCopyImage", (const char *) pName, sizeof ("xglCmdCopyImage")))
435 return (XGL_VOID *) pTable->CmdCopyImage;
436 else if (!strncmp("xglCmdCopyMemoryToImage", (const char *) pName, sizeof ("xglCmdCopyMemoryToImage")))
437 return (XGL_VOID *) pTable->CmdCopyMemoryToImage;
438 else if (!strncmp("xglCmdCopyImageToMemory", (const char *) pName, sizeof ("xglCmdCopyImageToMemory")))
439 return (XGL_VOID *) pTable->CmdCopyImageToMemory;
440 else if (!strncmp("xglCmdCloneImageData", (const char *) pName, sizeof ("xglCmdCloneImageData")))
441 return (XGL_VOID *) pTable->CmdCloneImageData;
442 else if (!strncmp("xglCmdUpdateMemory", (const char *) pName, sizeof ("xglCmdUpdateMemory")))
443 return (XGL_VOID *) pTable->CmdUpdateMemory;
444 else if (!strncmp("xglCmdFillMemory", (const char *) pName, sizeof ("xglCmdFillMemory")))
445 return (XGL_VOID *) pTable->CmdFillMemory;
446 else if (!strncmp("xglCmdClearColorImage", (const char *) pName, sizeof ("xglCmdClearColorImage")))
447 return (XGL_VOID *) pTable->CmdClearColorImage;
448 else if (!strncmp("xglCmdClearColorImageRaw", (const char *) pName, sizeof ("xglCmdClearColorImageRaw")))
449 return (XGL_VOID *) pTable->CmdClearColorImageRaw;
450 else if (!strncmp("xglCmdClearDepthStencil", (const char *) pName, sizeof ("xglCmdClearDepthStencil")))
451 return (XGL_VOID *) pTable->CmdClearDepthStencil;
452 else if (!strncmp("xglCmdResolveImage", (const char *) pName, sizeof ("xglCmdResolveImage")))
453 return (XGL_VOID *) pTable->CmdResolveImage;
454 else if (!strncmp("xglCmdSetEvent", (const char *) pName, sizeof ("xglCmdSetEvent")))
455 return (XGL_VOID *) pTable->CmdSetEvent;
456 else if (!strncmp("xglCmdResetEvent", (const char *) pName, sizeof ("xglCmdResetEvent")))
457 return (XGL_VOID *) pTable->CmdResetEvent;
458 else if (!strncmp("xglCmdMemoryAtomic", (const char *) pName, sizeof ("xglCmdMemoryAtomic")))
459 return (XGL_VOID *) pTable->CmdMemoryAtomic;
460 else if (!strncmp("xglCmdBeginQuery", (const char *) pName, sizeof ("xglCmdBeginQuery")))
461 return (XGL_VOID *) pTable->CmdBeginQuery;
462 else if (!strncmp("xglCmdEndQuery", (const char *) pName, sizeof ("xglCmdEndQuery")))
463 return (XGL_VOID *) pTable->CmdEndQuery;
464 else if (!strncmp("xglCmdResetQueryPool", (const char *) pName, sizeof ("xglCmdResetQueryPool")))
465 return (XGL_VOID *) pTable->CmdResetQueryPool;
466 else if (!strncmp("xglCmdWriteTimestamp", (const char *) pName, sizeof ("xglCmdWriteTimestamp")))
467 return (XGL_VOID *) pTable->CmdWriteTimestamp;
468 else if (!strncmp("xglCmdInitAtomicCounters", (const char *) pName, sizeof ("xglCmdInitAtomicCounters")))
469 return (XGL_VOID *) pTable->CmdInitAtomicCounters;
470 else if (!strncmp("xglCmdLoadAtomicCounters", (const char *) pName, sizeof ("xglCmdLoadAtomicCounters")))
471 return (XGL_VOID *) pTable->CmdLoadAtomicCounters;
472 else if (!strncmp("xglCmdSaveAtomicCounters", (const char *) pName, sizeof ("xglCmdSaveAtomicCounters")))
473 return (XGL_VOID *) pTable->CmdSaveAtomicCounters;
474 else if (!strncmp("xglDbgSetValidationLevel", (const char *) pName, sizeof ("xglDbgSetValidationLevel")))
475 return (XGL_VOID *) pTable->DbgSetValidationLevel;
476 else if (!strncmp("xglDbgRegisterMsgCallback", (const char *) pName, sizeof ("xglDbgRegisterMsgCallback")))
477 return (XGL_VOID *) pTable->DbgRegisterMsgCallback;
478 else if (!strncmp("xglDbgUnregisterMsgCallback", (const char *) pName, sizeof ("xglDbgUnregisterMsgCallback")))
479 return (XGL_VOID *) pTable->DbgUnregisterMsgCallback;
480 else if (!strncmp("xglDbgSetMessageFilter", (const char *) pName, sizeof ("xglDbgSetMessageFilter")))
481 return (XGL_VOID *) pTable->DbgSetMessageFilter;
482 else if (!strncmp("xglDbgSetObjectTag", (const char *) pName, sizeof ("xglDbgSetObjectTag")))
483 return (XGL_VOID *) pTable->DbgSetObjectTag;
484 else if (!strncmp("xglDbgSetGlobalOption", (const char *) pName, sizeof ("xglDbgSetGlobalOption")))
485 return (XGL_VOID *) pTable->DbgSetGlobalOption;
486 else if (!strncmp("xglDbgSetDeviceOption", (const char *) pName, sizeof ("xglDbgSetDeviceOption")))
487 return (XGL_VOID *) pTable->DbgSetDeviceOption;
488 else if (!strncmp("xglCmdDbgMarkerBegin", (const char *) pName, sizeof ("xglCmdDbgMarkerBegin")))
489 return (XGL_VOID *) pTable->CmdDbgMarkerBegin;
490 else if (!strncmp("xglCmdDbgMarkerEnd", (const char *) pName, sizeof ("xglCmdDbgMarkerEnd")))
491 return (XGL_VOID *) pTable->CmdDbgMarkerEnd;
492 else if (!strncmp("xglWsiX11AssociateConnection", (const char *) pName, sizeof("xglWsiX11AssociateConnection")))
493 return (XGL_VOID *) pTable->WsiX11AssociateConnection;
494 else if (!strncmp("xglWsiX11GetMSC", (const char *) pName, sizeof("xglWsiX11GetMSC")))
495 return (XGL_VOID *) pTable->WsiX11GetMSC;
496 else if (!strncmp("xglWsiX11CreatePresentableImage", (const char *) pName, sizeof("xglWsiX11CreatePresentableImage")))
497 return (XGL_VOID *) pTable->WsiX11CreatePresentableImage;
498 else if (!strncmp("xglWsiX11QueuePresent", (const char *) pName, sizeof("xglWsiX11QueuePresent")))
499 return (XGL_VOID *) pTable->WsiX11QueuePresent;
500 else if (!strncmp("xglLayerExtension1", (const char *) pName, sizeof("xglLayerExtension1")))
501 return (XGL_VOID *) xglLayerExtension1;
502 else {
503 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
504 if (gpuw->pGPA == NULL)
505 return NULL;
506 return gpuw->pGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, pName);
507 }
508}