blob: 8e9efd0cd566f5033a089f158e54a9c0a4028f5f [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;
Chia-I Wuf1a5a742014-12-27 15:16:07 +080050 pTable->InitAndEnumerateGpus = (InitAndEnumerateGpusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglInitAndEnumerateGpus");
51 pTable->GetGpuInfo = (GetGpuInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetGpuInfo");
52 pTable->CreateDevice = (CreateDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDevice");
53 pTable->DestroyDevice = (DestroyDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyDevice");
54 pTable->GetExtensionSupport = (GetExtensionSupportType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetExtensionSupport");
55 pTable->EnumerateLayers = (EnumerateLayersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEnumerateLayers");
56 pTable->GetDeviceQueue = (GetDeviceQueueType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetDeviceQueue");
57 pTable->QueueSubmit = (QueueSubmitType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSubmit");
58 pTable->QueueSetGlobalMemReferences = (QueueSetGlobalMemReferencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSetGlobalMemReferences");
59 pTable->QueueWaitIdle = (QueueWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueWaitIdle");
60 pTable->DeviceWaitIdle = (DeviceWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDeviceWaitIdle");
61 pTable->GetMemoryHeapCount = (GetMemoryHeapCountType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapCount");
62 pTable->GetMemoryHeapInfo = (GetMemoryHeapInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapInfo");
63 pTable->AllocMemory = (AllocMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAllocMemory");
64 pTable->FreeMemory = (FreeMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglFreeMemory");
65 pTable->SetMemoryPriority = (SetMemoryPriorityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetMemoryPriority");
66 pTable->MapMemory = (MapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglMapMemory");
67 pTable->UnmapMemory = (UnmapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglUnmapMemory");
68 pTable->PinSystemMemory = (PinSystemMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglPinSystemMemory");
69 pTable->RemapVirtualMemoryPages = (RemapVirtualMemoryPagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglRemapVirtualMemoryPages");
70 pTable->GetMultiGpuCompatibility = (GetMultiGpuCompatibilityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMultiGpuCompatibility");
71 pTable->OpenSharedMemory = (OpenSharedMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedMemory");
72 pTable->OpenSharedQueueSemaphore = (OpenSharedQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedQueueSemaphore");
73 pTable->OpenPeerMemory = (OpenPeerMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerMemory");
74 pTable->OpenPeerImage = (OpenPeerImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerImage");
75 pTable->DestroyObject = (DestroyObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyObject");
76 pTable->GetObjectInfo = (GetObjectInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetObjectInfo");
77 pTable->BindObjectMemory = (BindObjectMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBindObjectMemory");
78 pTable->CreateFence = (CreateFenceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateFence");
79 pTable->GetFenceStatus = (GetFenceStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFenceStatus");
80 pTable->WaitForFences = (WaitForFencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitForFences");
81 pTable->CreateQueueSemaphore = (CreateQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueueSemaphore");
82 pTable->SignalQueueSemaphore = (SignalQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSignalQueueSemaphore");
83 pTable->WaitQueueSemaphore = (WaitQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitQueueSemaphore");
84 pTable->CreateEvent = (CreateEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateEvent");
85 pTable->GetEventStatus = (GetEventStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetEventStatus");
86 pTable->SetEvent = (SetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetEvent");
87 pTable->ResetEvent = (ResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetEvent");
88 pTable->CreateQueryPool = (CreateQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueryPool");
89 pTable->GetQueryPoolResults = (GetQueryPoolResultsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetQueryPoolResults");
90 pTable->GetFormatInfo = (GetFormatInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFormatInfo");
91 pTable->CreateImage = (CreateImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImage");
92 pTable->GetImageSubresourceInfo = (GetImageSubresourceInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetImageSubresourceInfo");
93 pTable->CreateImageView = (CreateImageViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImageView");
94 pTable->CreateColorAttachmentView = (CreateColorAttachmentViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorAttachmentView");
95 pTable->CreateDepthStencilView = (CreateDepthStencilViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilView");
96 pTable->CreateShader = (CreateShaderType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateShader");
97 pTable->CreateGraphicsPipeline = (CreateGraphicsPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateGraphicsPipeline");
98 pTable->CreateComputePipeline = (CreateComputePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateComputePipeline");
99 pTable->StorePipeline = (StorePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglStorePipeline");
100 pTable->LoadPipeline = (LoadPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglLoadPipeline");
101 pTable->CreatePipelineDelta = (CreatePipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreatePipelineDelta");
102 pTable->CreateSampler = (CreateSamplerType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateSampler");
103 pTable->CreateDescriptorSet = (CreateDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDescriptorSet");
104 pTable->BeginDescriptorSetUpdate = (BeginDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginDescriptorSetUpdate");
105 pTable->EndDescriptorSetUpdate = (EndDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndDescriptorSetUpdate");
106 pTable->AttachSamplerDescriptors = (AttachSamplerDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachSamplerDescriptors");
107 pTable->AttachImageViewDescriptors = (AttachImageViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachImageViewDescriptors");
108 pTable->AttachMemoryViewDescriptors = (AttachMemoryViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachMemoryViewDescriptors");
109 pTable->AttachNestedDescriptors = (AttachNestedDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachNestedDescriptors");
110 pTable->ClearDescriptorSetSlots = (ClearDescriptorSetSlotsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglClearDescriptorSetSlots");
111 pTable->CreateViewportState = (CreateViewportStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateViewportState");
112 pTable->CreateRasterState = (CreateRasterStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateRasterState");
113 pTable->CreateMsaaState = (CreateMsaaStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateMsaaState");
114 pTable->CreateColorBlendState = (CreateColorBlendStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorBlendState");
115 pTable->CreateDepthStencilState = (CreateDepthStencilStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilState");
116 pTable->CreateCommandBuffer = (CreateCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateCommandBuffer");
117 pTable->BeginCommandBuffer = (BeginCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginCommandBuffer");
118 pTable->EndCommandBuffer = (EndCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndCommandBuffer");
119 pTable->ResetCommandBuffer = (ResetCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetCommandBuffer");
120 pTable->CmdBindPipeline = (CmdBindPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipeline");
121 pTable->CmdBindPipelineDelta = (CmdBindPipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipelineDelta");
122 pTable->CmdBindStateObject = (CmdBindStateObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindStateObject");
123 pTable->CmdBindDescriptorSet = (CmdBindDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDescriptorSet");
124 pTable->CmdBindDynamicMemoryView = (CmdBindDynamicMemoryViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDynamicMemoryView");
125 pTable->CmdBindVertexData = (CmdBindVertexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindVertexData");
126 pTable->CmdBindIndexData = (CmdBindIndexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindIndexData");
127 pTable->CmdBindAttachments = (CmdBindAttachmentsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindAttachments");
128 pTable->CmdPrepareMemoryRegions = (CmdPrepareMemoryRegionsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareMemoryRegions");
129 pTable->CmdPrepareImages = (CmdPrepareImagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareImages");
130 pTable->CmdDraw = (CmdDrawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDraw");
131 pTable->CmdDrawIndexed = (CmdDrawIndexedType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexed");
132 pTable->CmdDrawIndirect = (CmdDrawIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndirect");
133 pTable->CmdDrawIndexedIndirect = (CmdDrawIndexedIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexedIndirect");
134 pTable->CmdDispatch = (CmdDispatchType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatch");
135 pTable->CmdDispatchIndirect = (CmdDispatchIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatchIndirect");
136 pTable->CmdCopyMemory = (CmdCopyMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemory");
137 pTable->CmdCopyImage = (CmdCopyImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImage");
138 pTable->CmdCopyMemoryToImage = (CmdCopyMemoryToImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemoryToImage");
139 pTable->CmdCopyImageToMemory = (CmdCopyImageToMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImageToMemory");
140 pTable->CmdCloneImageData = (CmdCloneImageDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCloneImageData");
141 pTable->CmdUpdateMemory = (CmdUpdateMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdUpdateMemory");
142 pTable->CmdFillMemory = (CmdFillMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdFillMemory");
143 pTable->CmdClearColorImage = (CmdClearColorImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImage");
144 pTable->CmdClearColorImageRaw = (CmdClearColorImageRawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImageRaw");
145 pTable->CmdClearDepthStencil = (CmdClearDepthStencilType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearDepthStencil");
146 pTable->CmdResolveImage = (CmdResolveImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResolveImage");
147 pTable->CmdSetEvent = (CmdSetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSetEvent");
148 pTable->CmdResetEvent = (CmdResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetEvent");
149 pTable->CmdMemoryAtomic = (CmdMemoryAtomicType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdMemoryAtomic");
150 pTable->CmdBeginQuery = (CmdBeginQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBeginQuery");
151 pTable->CmdEndQuery = (CmdEndQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdEndQuery");
152 pTable->CmdResetQueryPool = (CmdResetQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetQueryPool");
153 pTable->CmdWriteTimestamp = (CmdWriteTimestampType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdWriteTimestamp");
154 pTable->CmdInitAtomicCounters = (CmdInitAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdInitAtomicCounters");
155 pTable->CmdLoadAtomicCounters = (CmdLoadAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdLoadAtomicCounters");
156 pTable->CmdSaveAtomicCounters = (CmdSaveAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSaveAtomicCounters");
157 pTable->DbgSetValidationLevel = (DbgSetValidationLevelType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetValidationLevel");
158 pTable->DbgRegisterMsgCallback = (DbgRegisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgRegisterMsgCallback");
159 pTable->DbgUnregisterMsgCallback = (DbgUnregisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgUnregisterMsgCallback");
160 pTable->DbgSetMessageFilter = (DbgSetMessageFilterType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetMessageFilter");
161 pTable->DbgSetObjectTag = (DbgSetObjectTagType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetObjectTag");
162 pTable->DbgSetGlobalOption = (DbgSetGlobalOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetGlobalOption");
163 pTable->DbgSetDeviceOption = (DbgSetDeviceOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetDeviceOption");
164 pTable->CmdDbgMarkerBegin = (CmdDbgMarkerBeginType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerBegin");
165 pTable->CmdDbgMarkerEnd = (CmdDbgMarkerEndType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerEnd");
166 pTable->WsiX11AssociateConnection = (WsiX11AssociateConnectionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11AssociateConnection");
167 pTable->WsiX11GetMSC = (WsiX11GetMSCType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11GetMSC");
168 pTable->WsiX11CreatePresentableImage = (WsiX11CreatePresentableImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11CreatePresentableImage");
169 pTable->WsiX11QueuePresent = (WsiX11QueuePresentType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11QueuePresent");
Jon Ashburn1fec4242014-11-26 11:10:26 -0700170 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);
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800187 if (!strncmp(pExtName, "xglLayerExtension1", strlen("xglLayerExtension1")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700188 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);
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800237 fpGetGpuInfo = (GetGpuInfoType) gpuw->pGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetGpuInfo");
Jon Ashburn1fec4242014-11-26 11:10:26 -0700238 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);
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800258 if (!strncmp("xglGetProcAddr", pName, sizeof("xglGetProcAddr")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700259 return (XGL_VOID *) xglGetProcAddr;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800260 else if (!strncmp("xglInitAndEnumerateGpus", pName, sizeof("xglInitAndEnumerateGpus")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700261 return (XGL_VOID *) pTable->InitAndEnumerateGpus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800262 if (!strncmp("xglGetGpuInfo", pName, sizeof ("xglGetGpuInfo")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700263 return (XGL_VOID *) pTable->GetGpuInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800264 else if (!strncmp("xglCreateDevice", pName, sizeof ("xglCreateDevice")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700265 return (XGL_VOID *) xglCreateDevice;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800266 else if (!strncmp("xglDestroyDevice", pName, sizeof ("xglDestroyDevice")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700267 return (XGL_VOID *) pTable->DestroyDevice;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800268 else if (!strncmp("xglGetExtensionSupport", pName, sizeof ("xglGetExtensionSupport")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700269 return (XGL_VOID *) xglGetExtensionSupport;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800270 else if (!strncmp("xglEnumerateLayers", pName, sizeof ("xglEnumerateLayers")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700271 return (XGL_VOID *) xglEnumerateLayers;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800272 else if (!strncmp("xglGetDeviceQueue", pName, sizeof ("xglGetDeviceQueue")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700273 return (XGL_VOID *) pTable->GetDeviceQueue;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800274 else if (!strncmp("xglQueueSubmit", pName, sizeof ("xglQueueSubmit")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700275 return (XGL_VOID *) pTable->QueueSubmit;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800276 else if (!strncmp("xglQueueSetGlobalMemReferences", pName, sizeof ("xglQueueSetGlobalMemReferences")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700277 return (XGL_VOID *) pTable->QueueSetGlobalMemReferences;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800278 else if (!strncmp("xglQueueWaitIdle", pName, sizeof ("xglQueueWaitIdle")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700279 return (XGL_VOID *) pTable->QueueWaitIdle;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800280 else if (!strncmp("xglDeviceWaitIdle", pName, sizeof ("xglDeviceWaitIdle")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700281 return (XGL_VOID *) pTable->DeviceWaitIdle;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800282 else if (!strncmp("xglGetMemoryHeapCount", pName, sizeof ("xglGetMemoryHeapCount")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700283 return (XGL_VOID *) pTable->GetMemoryHeapCount;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800284 else if (!strncmp("xglGetMemoryHeapInfo", pName, sizeof ("xglGetMemoryHeapInfo")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700285 return (XGL_VOID *) pTable->GetMemoryHeapInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800286 else if (!strncmp("xglAllocMemory", pName, sizeof ("xglAllocMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700287 return (XGL_VOID *) pTable->AllocMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800288 else if (!strncmp("xglFreeMemory", pName, sizeof ("xglFreeMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700289 return (XGL_VOID *) pTable->FreeMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800290 else if (!strncmp("xglSetMemoryPriority", pName, sizeof ("xglSetMemoryPriority")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700291 return (XGL_VOID *) pTable->SetMemoryPriority;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800292 else if (!strncmp("xglMapMemory", pName, sizeof ("xglMapMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700293 return (XGL_VOID *) pTable->MapMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800294 else if (!strncmp("xglUnmapMemory", pName, sizeof ("xglUnmapMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700295 return (XGL_VOID *) pTable->UnmapMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800296 else if (!strncmp("xglPinSystemMemory", pName, sizeof ("xglPinSystemMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700297 return (XGL_VOID *) pTable->PinSystemMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800298 else if (!strncmp("xglRemapVirtualMemoryPages", pName, sizeof ("xglRemapVirtualMemoryPages")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700299 return (XGL_VOID *) pTable->RemapVirtualMemoryPages;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800300 else if (!strncmp("xglGetMultiGpuCompatibility", pName, sizeof ("xglGetMultiGpuCompatibility")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700301 return (XGL_VOID *) pTable->GetMultiGpuCompatibility;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800302 else if (!strncmp("xglOpenSharedMemory", pName, sizeof ("xglOpenSharedMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700303 return (XGL_VOID *) pTable->OpenSharedMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800304 else if (!strncmp("xglOpenSharedQueueSemaphore", pName, sizeof ("xglOpenSharedQueueSemaphore")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700305 return (XGL_VOID *) pTable->OpenSharedQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800306 else if (!strncmp("xglOpenPeerMemory", pName, sizeof ("xglOpenPeerMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700307 return (XGL_VOID *) pTable->OpenPeerMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800308 else if (!strncmp("xglOpenPeerImage", pName, sizeof ("xglOpenPeerImage")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700309 return (XGL_VOID *) pTable->OpenPeerImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800310 else if (!strncmp("xglDestroyObject", pName, sizeof ("xglDestroyObject")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700311 return (XGL_VOID *) pTable->DestroyObject;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800312 else if (!strncmp("xglGetObjectInfo", pName, sizeof ("xglGetObjectInfo")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700313 return (XGL_VOID *) pTable->GetObjectInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800314 else if (!strncmp("xglBindObjectMemory", pName, sizeof ("xglBindObjectMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700315 return (XGL_VOID *) pTable->BindObjectMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800316 else if (!strncmp("xglCreateFence", pName, sizeof ("xgllCreateFence")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700317 return (XGL_VOID *) pTable->CreateFence;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800318 else if (!strncmp("xglGetFenceStatus", pName, sizeof ("xglGetFenceStatus")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700319 return (XGL_VOID *) pTable->GetFenceStatus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800320 else if (!strncmp("xglWaitForFences", pName, sizeof ("xglWaitForFences")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700321 return (XGL_VOID *) pTable->WaitForFences;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800322 else if (!strncmp("xglCreateQueueSemaphore", pName, sizeof ("xgllCreateQueueSemaphore")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700323 return (XGL_VOID *) pTable->CreateQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800324 else if (!strncmp("xglSignalQueueSemaphore", pName, sizeof ("xglSignalQueueSemaphore")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700325 return (XGL_VOID *) pTable->SignalQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800326 else if (!strncmp("xglWaitQueueSemaphore", pName, sizeof ("xglWaitQueueSemaphore")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700327 return (XGL_VOID *) pTable->WaitQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800328 else if (!strncmp("xglCreateEvent", pName, sizeof ("xgllCreateEvent")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700329 return (XGL_VOID *) pTable->CreateEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800330 else if (!strncmp("xglGetEventStatus", pName, sizeof ("xglGetEventStatus")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700331 return (XGL_VOID *) pTable->GetEventStatus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800332 else if (!strncmp("xglSetEvent", pName, sizeof ("xglSetEvent")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700333 return (XGL_VOID *) pTable->SetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800334 else if (!strncmp("xglResetEvent", pName, sizeof ("xgllResetEvent")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700335 return (XGL_VOID *) pTable->ResetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800336 else if (!strncmp("xglCreateQueryPool", pName, sizeof ("xglCreateQueryPool")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700337 return (XGL_VOID *) pTable->CreateQueryPool;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800338 else if (!strncmp("xglGetQueryPoolResults", pName, sizeof ("xglGetQueryPoolResults")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700339 return (XGL_VOID *) pTable->GetQueryPoolResults;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800340 else if (!strncmp("xglGetFormatInfo", pName, sizeof ("xglGetFormatInfo")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700341 return (XGL_VOID *) xglGetFormatInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800342 else if (!strncmp("xglCreateImage", pName, sizeof ("xglCreateImage")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700343 return (XGL_VOID *) pTable->CreateImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800344 else if (!strncmp("xglGetImageSubresourceInfo", pName, sizeof ("xglGetImageSubresourceInfo")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700345 return (XGL_VOID *) pTable->GetImageSubresourceInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800346 else if (!strncmp("xglCreateImageView", pName, sizeof ("xglCreateImageView")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700347 return (XGL_VOID *) pTable->CreateImageView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800348 else if (!strncmp("xglCreateColorAttachmentView", pName, sizeof ("xglCreateColorAttachmentView")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700349 return (XGL_VOID *) pTable->CreateColorAttachmentView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800350 else if (!strncmp("xglCreateDepthStencilView", pName, sizeof ("xglCreateDepthStencilView")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700351 return (XGL_VOID *) pTable->CreateDepthStencilView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800352 else if (!strncmp("xglCreateShader", pName, sizeof ("xglCreateShader")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700353 return (XGL_VOID *) pTable->CreateShader;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800354 else if (!strncmp("xglCreateGraphicsPipeline", pName, sizeof ("xglCreateGraphicsPipeline")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700355 return (XGL_VOID *) pTable->CreateGraphicsPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800356 else if (!strncmp("xglCreateComputePipeline", pName, sizeof ("xglCreateComputePipeline")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700357 return (XGL_VOID *) pTable->CreateComputePipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800358 else if (!strncmp("xglStorePipeline", pName, sizeof ("xglStorePipeline")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700359 return (XGL_VOID *) pTable->StorePipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800360 else if (!strncmp("xglLoadPipeline", pName, sizeof ("xglLoadPipeline")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700361 return (XGL_VOID *) pTable->LoadPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800362 else if (!strncmp("xglCreatePipelineDelta", pName, sizeof ("xglCreatePipelineDelta")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700363 return (XGL_VOID *) pTable->CreatePipelineDelta;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800364 else if (!strncmp("xglCreateSampler", pName, sizeof ("xglCreateSampler")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700365 return (XGL_VOID *) pTable->CreateSampler;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800366 else if (!strncmp("xglCreateDescriptorSet", pName, sizeof ("xglCreateDescriptorSet")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700367 return (XGL_VOID *) pTable->CreateDescriptorSet;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800368 else if (!strncmp("xglBeginDescriptorSetUpdate", pName, sizeof ("xglBeginDescriptorSetUpdate")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700369 return (XGL_VOID *) pTable->BeginDescriptorSetUpdate;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800370 else if (!strncmp("xglEndDescriptorSetUpdate", pName, sizeof ("xglEndDescriptorSetUpdate")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700371 return (XGL_VOID *) pTable->EndDescriptorSetUpdate;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800372 else if (!strncmp("xglAttachSamplerDescriptors", pName, sizeof ("xglAttachSamplerDescriptors")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700373 return (XGL_VOID *) pTable->AttachSamplerDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800374 else if (!strncmp("xglAttachImageViewDescriptors", pName, sizeof ("xglAttachImageViewDescriptors")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700375 return (XGL_VOID *) pTable->AttachImageViewDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800376 else if (!strncmp("xglAttachMemoryViewDescriptors", pName, sizeof ("xglAttachMemoryViewDescriptors")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700377 return (XGL_VOID *) pTable->AttachMemoryViewDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800378 else if (!strncmp("xglAttachNestedDescriptors", pName, sizeof ("xglAttachNestedDescriptors")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700379 return (XGL_VOID *) pTable->AttachNestedDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800380 else if (!strncmp("xglClearDescriptorSetSlots", pName, sizeof ("xglClearDescriptorSetSlots")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700381 return (XGL_VOID *) pTable->ClearDescriptorSetSlots;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800382 else if (!strncmp("xglCreateViewportState", pName, sizeof ("xglCreateViewportState")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700383 return (XGL_VOID *) pTable->CreateViewportState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800384 else if (!strncmp("xglCreateRasterState", pName, sizeof ("xglCreateRasterState")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700385 return (XGL_VOID *) pTable->CreateRasterState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800386 else if (!strncmp("xglCreateMsaaState", pName, sizeof ("xglCreateMsaaState")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700387 return (XGL_VOID *) pTable->CreateMsaaState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800388 else if (!strncmp("xglCreateColorBlendState", pName, sizeof ("xglCreateColorBlendState")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700389 return (XGL_VOID *) pTable->CreateColorBlendState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800390 else if (!strncmp("xglCreateDepthStencilState", pName, sizeof ("xglCreateDepthStencilState")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700391 return (XGL_VOID *) pTable->CreateDepthStencilState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800392 else if (!strncmp("xglCreateCommandBuffer", pName, sizeof ("xglCreateCommandBuffer")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700393 return (XGL_VOID *) pTable->CreateCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800394 else if (!strncmp("xglBeginCommandBuffer", pName, sizeof ("xglBeginCommandBuffer")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700395 return (XGL_VOID *) pTable->BeginCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800396 else if (!strncmp("xglEndCommandBuffer", pName, sizeof ("xglEndCommandBuffer")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700397 return (XGL_VOID *) pTable->EndCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800398 else if (!strncmp("xglResetCommandBuffer", pName, sizeof ("xglResetCommandBuffer")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700399 return (XGL_VOID *) pTable->ResetCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800400 else if (!strncmp("xglCmdBindPipeline", pName, sizeof ("xglCmdBindPipeline")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700401 return (XGL_VOID *) pTable->CmdBindPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800402 else if (!strncmp("xglCmdBindPipelineDelta", pName, sizeof ("xglCmdBindPipelineDelta")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700403 return (XGL_VOID *) pTable->CmdBindPipelineDelta;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800404 else if (!strncmp("xglCmdBindStateObject", pName, sizeof ("xglCmdBindStateObject")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700405 return (XGL_VOID *) pTable->CmdBindStateObject;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800406 else if (!strncmp("xglCmdBindDescriptorSet", pName, sizeof ("xglCmdBindDescriptorSet")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700407 return (XGL_VOID *) pTable->CmdBindDescriptorSet;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800408 else if (!strncmp("xglCmdBindDynamicMemoryView", pName, sizeof ("xglCmdBindDynamicMemoryView")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700409 return (XGL_VOID *) pTable->CmdBindDynamicMemoryView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800410 else if (!strncmp("xglCmdBindVertexData", pName, sizeof ("xglCmdBindVertexData")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700411 return (XGL_VOID *) pTable->CmdBindVertexData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800412 else if (!strncmp("xglCmdBindIndexData", pName, sizeof ("xglCmdBindIndexData")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700413 return (XGL_VOID *) pTable->CmdBindIndexData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800414 else if (!strncmp("xglCmdBindAttachments", pName, sizeof ("xglCmdBindAttachments")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700415 return (XGL_VOID *) pTable->CmdBindAttachments;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800416 else if (!strncmp("xglCmdPrepareMemoryRegions", pName, sizeof ("xglCmdPrepareMemoryRegions")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700417 return (XGL_VOID *) pTable->CmdPrepareMemoryRegions;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800418 else if (!strncmp("xglCmdPrepareImages", pName, sizeof ("xglCmdPrepareImages")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700419 return (XGL_VOID *) pTable->CmdPrepareImages;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800420 else if (!strncmp("xglCmdDraw", pName, sizeof ("xglCmdDraw")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700421 return (XGL_VOID *) pTable->CmdDraw;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800422 else if (!strncmp("xglCmdDrawIndexed", pName, sizeof ("xglCmdDrawIndexed")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700423 return (XGL_VOID *) pTable->CmdDrawIndexed;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800424 else if (!strncmp("xglCmdDrawIndirect", pName, sizeof ("xglCmdDrawIndirect")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700425 return (XGL_VOID *) pTable->CmdDrawIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800426 else if (!strncmp("xglCmdDrawIndexedIndirect", pName, sizeof ("xglCmdDrawIndexedIndirect")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700427 return (XGL_VOID *) pTable->CmdDrawIndexedIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800428 else if (!strncmp("xglCmdDispatch", pName, sizeof ("xglCmdDispatch")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700429 return (XGL_VOID *) pTable->CmdDispatch;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800430 else if (!strncmp("xglCmdDispatchIndirect", pName, sizeof ("xglCmdDispatchIndirect")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700431 return (XGL_VOID *) pTable->CmdDispatchIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800432 else if (!strncmp("xglCmdCopyMemory", pName, sizeof ("xglCmdCopyMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700433 return (XGL_VOID *) pTable->CmdCopyMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800434 else if (!strncmp("xglCmdCopyImage", pName, sizeof ("xglCmdCopyImage")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700435 return (XGL_VOID *) pTable->CmdCopyImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800436 else if (!strncmp("xglCmdCopyMemoryToImage", pName, sizeof ("xglCmdCopyMemoryToImage")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700437 return (XGL_VOID *) pTable->CmdCopyMemoryToImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800438 else if (!strncmp("xglCmdCopyImageToMemory", pName, sizeof ("xglCmdCopyImageToMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700439 return (XGL_VOID *) pTable->CmdCopyImageToMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800440 else if (!strncmp("xglCmdCloneImageData", pName, sizeof ("xglCmdCloneImageData")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700441 return (XGL_VOID *) pTable->CmdCloneImageData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800442 else if (!strncmp("xglCmdUpdateMemory", pName, sizeof ("xglCmdUpdateMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700443 return (XGL_VOID *) pTable->CmdUpdateMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800444 else if (!strncmp("xglCmdFillMemory", pName, sizeof ("xglCmdFillMemory")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700445 return (XGL_VOID *) pTable->CmdFillMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800446 else if (!strncmp("xglCmdClearColorImage", pName, sizeof ("xglCmdClearColorImage")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700447 return (XGL_VOID *) pTable->CmdClearColorImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800448 else if (!strncmp("xglCmdClearColorImageRaw", pName, sizeof ("xglCmdClearColorImageRaw")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700449 return (XGL_VOID *) pTable->CmdClearColorImageRaw;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800450 else if (!strncmp("xglCmdClearDepthStencil", pName, sizeof ("xglCmdClearDepthStencil")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700451 return (XGL_VOID *) pTable->CmdClearDepthStencil;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800452 else if (!strncmp("xglCmdResolveImage", pName, sizeof ("xglCmdResolveImage")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700453 return (XGL_VOID *) pTable->CmdResolveImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800454 else if (!strncmp("xglCmdSetEvent", pName, sizeof ("xglCmdSetEvent")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700455 return (XGL_VOID *) pTable->CmdSetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800456 else if (!strncmp("xglCmdResetEvent", pName, sizeof ("xglCmdResetEvent")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700457 return (XGL_VOID *) pTable->CmdResetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800458 else if (!strncmp("xglCmdMemoryAtomic", pName, sizeof ("xglCmdMemoryAtomic")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700459 return (XGL_VOID *) pTable->CmdMemoryAtomic;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800460 else if (!strncmp("xglCmdBeginQuery", pName, sizeof ("xglCmdBeginQuery")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700461 return (XGL_VOID *) pTable->CmdBeginQuery;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800462 else if (!strncmp("xglCmdEndQuery", pName, sizeof ("xglCmdEndQuery")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700463 return (XGL_VOID *) pTable->CmdEndQuery;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800464 else if (!strncmp("xglCmdResetQueryPool", pName, sizeof ("xglCmdResetQueryPool")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700465 return (XGL_VOID *) pTable->CmdResetQueryPool;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800466 else if (!strncmp("xglCmdWriteTimestamp", pName, sizeof ("xglCmdWriteTimestamp")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700467 return (XGL_VOID *) pTable->CmdWriteTimestamp;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800468 else if (!strncmp("xglCmdInitAtomicCounters", pName, sizeof ("xglCmdInitAtomicCounters")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700469 return (XGL_VOID *) pTable->CmdInitAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800470 else if (!strncmp("xglCmdLoadAtomicCounters", pName, sizeof ("xglCmdLoadAtomicCounters")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700471 return (XGL_VOID *) pTable->CmdLoadAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800472 else if (!strncmp("xglCmdSaveAtomicCounters", pName, sizeof ("xglCmdSaveAtomicCounters")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700473 return (XGL_VOID *) pTable->CmdSaveAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800474 else if (!strncmp("xglDbgSetValidationLevel", pName, sizeof ("xglDbgSetValidationLevel")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700475 return (XGL_VOID *) pTable->DbgSetValidationLevel;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800476 else if (!strncmp("xglDbgRegisterMsgCallback", pName, sizeof ("xglDbgRegisterMsgCallback")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700477 return (XGL_VOID *) pTable->DbgRegisterMsgCallback;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800478 else if (!strncmp("xglDbgUnregisterMsgCallback", pName, sizeof ("xglDbgUnregisterMsgCallback")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700479 return (XGL_VOID *) pTable->DbgUnregisterMsgCallback;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800480 else if (!strncmp("xglDbgSetMessageFilter", pName, sizeof ("xglDbgSetMessageFilter")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700481 return (XGL_VOID *) pTable->DbgSetMessageFilter;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800482 else if (!strncmp("xglDbgSetObjectTag", pName, sizeof ("xglDbgSetObjectTag")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700483 return (XGL_VOID *) pTable->DbgSetObjectTag;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800484 else if (!strncmp("xglDbgSetGlobalOption", pName, sizeof ("xglDbgSetGlobalOption")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700485 return (XGL_VOID *) pTable->DbgSetGlobalOption;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800486 else if (!strncmp("xglDbgSetDeviceOption", pName, sizeof ("xglDbgSetDeviceOption")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700487 return (XGL_VOID *) pTable->DbgSetDeviceOption;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800488 else if (!strncmp("xglCmdDbgMarkerBegin", pName, sizeof ("xglCmdDbgMarkerBegin")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700489 return (XGL_VOID *) pTable->CmdDbgMarkerBegin;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800490 else if (!strncmp("xglCmdDbgMarkerEnd", pName, sizeof ("xglCmdDbgMarkerEnd")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700491 return (XGL_VOID *) pTable->CmdDbgMarkerEnd;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800492 else if (!strncmp("xglWsiX11AssociateConnection", pName, sizeof("xglWsiX11AssociateConnection")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700493 return (XGL_VOID *) pTable->WsiX11AssociateConnection;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800494 else if (!strncmp("xglWsiX11GetMSC", pName, sizeof("xglWsiX11GetMSC")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700495 return (XGL_VOID *) pTable->WsiX11GetMSC;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800496 else if (!strncmp("xglWsiX11CreatePresentableImage", pName, sizeof("xglWsiX11CreatePresentableImage")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700497 return (XGL_VOID *) pTable->WsiX11CreatePresentableImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800498 else if (!strncmp("xglWsiX11QueuePresent", pName, sizeof("xglWsiX11QueuePresent")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700499 return (XGL_VOID *) pTable->WsiX11QueuePresent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800500 else if (!strncmp("xglLayerExtension1", pName, sizeof("xglLayerExtension1")))
Jon Ashburn1fec4242014-11-26 11:10:26 -0700501 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}