blob: 77f951de9443046f1be9c2777c6d8c01e1485d9a [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 *
24 */
25
26#include <string.h>
27#include <stdlib.h>
28#include <assert.h>
29#include <unordered_map>
30#include "xglLayer.h"
31
32static void initLayerTable(const XGL_BASE_LAYER_OBJECT *gpuw, XGL_LAYER_DISPATCH_TABLE *pTable, const unsigned int layerNum);
33
34/******************************** Layer multi1 functions **************************/
35static std::unordered_map<XGL_VOID *, XGL_LAYER_DISPATCH_TABLE *> tableMap1;
36static bool layer1_first_activated = false;
37
38static XGL_LAYER_DISPATCH_TABLE * getLayer1Table(const XGL_BASE_LAYER_OBJECT *gpuw)
39{
40 XGL_LAYER_DISPATCH_TABLE *pTable;
41
42 assert(gpuw);
43 std::unordered_map<XGL_VOID *, XGL_LAYER_DISPATCH_TABLE *>::const_iterator it = tableMap1.find((XGL_VOID *) gpuw);
44 if (it == tableMap1.end())
45 {
46 pTable = new XGL_LAYER_DISPATCH_TABLE;
47 tableMap1[(XGL_VOID *) gpuw] = pTable;
48 initLayerTable(gpuw, pTable, 1);
49 return pTable;
50 } else
51 {
52 return it->second;
53 }
54}
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59
60XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi1CreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo,
61 XGL_DEVICE* pDevice)
62{
63 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
64 XGL_LAYER_DISPATCH_TABLE* pTable = getLayer1Table(gpuw);
65
66 printf("At start of multi1 layer xglCreateDevice()\n");
67 XGL_RESULT result = pTable->CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice);
68 // create a mapping for the device object into the dispatch table
69 tableMap1.emplace(*pDevice, pTable);
70 printf("Completed multi1 layer xglCreateDevice()\n");
71 return result;
72}
73
74XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi1CreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo,
75 XGL_PIPELINE* pPipeline)
76{
77 XGL_LAYER_DISPATCH_TABLE* pTable = tableMap1[device];
78
79 printf("At start of multi1 layer xglCreateGraphicsPipeline()\n");
80 XGL_RESULT result = pTable->CreateGraphicsPipeline(device, pCreateInfo, pPipeline);
81 // create a mapping for the pipeline object into the dispatch table
82 tableMap1.emplace(*pPipeline, pTable);
83 printf("Completed multi1 layer xglCreateGraphicsPipeline()\n");
84 return result;
85}
86
87XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi1StorePipeline(XGL_PIPELINE pipeline, XGL_SIZE* pDataSize, XGL_VOID* pData)
88{
89 XGL_LAYER_DISPATCH_TABLE* pTable = tableMap1[pipeline];
90
91 printf("At start of multi1 layer xglStorePipeline()\n");
92 XGL_RESULT result = pTable->StorePipeline(pipeline, pDataSize, pData);
93 printf("Completed multi1 layer xglStorePipeline()\n");
94 return result;
95}
96
97XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi1EnumerateLayers(XGL_PHYSICAL_GPU gpu, XGL_SIZE maxLayerCount, XGL_SIZE maxStringSize,
98 XGL_CHAR* const* pOutLayers, XGL_SIZE * pOutLayerCount,
99 XGL_VOID* pReserved)
100{
101 if (gpu == NULL)
102 return xglEnumerateLayers(gpu, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved);
103
104 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
105 XGL_LAYER_DISPATCH_TABLE* pTable = getLayer1Table(gpuw);
106
107 printf("At start of multi1 layer xglEnumerateLayers()\n");
108 XGL_RESULT result = pTable->EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved);
109 printf("Completed multi1 layer xglEnumerateLayers()\n");
110 return result;
111}
112
113XGL_LAYER_EXPORT XGL_VOID * XGLAPI multi1GetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pName)
114{
115 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
116 if (gpu == NULL)
117 return NULL;
118 XGL_LAYER_DISPATCH_TABLE* pTable;
119 pTable = getLayer1Table(gpuw);
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800120 if (!strncmp("xglInitAndEnumerateGpus", pName, sizeof("xglInitAndEnumerateGpus")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700121 return (XGL_VOID *) pTable->InitAndEnumerateGpus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800122 else if (!strncmp("xglGetGpuInfo", pName, sizeof ("xglGetGpuInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700123 return (XGL_VOID *) pTable->GetGpuInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800124 else if (!strncmp("xglCreateDevice", pName, sizeof ("xglCreateDevice")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700125 return (XGL_VOID *) multi1CreateDevice;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800126 else if (!strncmp("xglDestroyDevice", pName, sizeof ("xglDestroyDevice")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700127 return (XGL_VOID *) pTable->DestroyDevice;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800128 else if (!strncmp("xglGetExtensionSupport", pName, sizeof ("xglGetExtensionSupport")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700129 return (XGL_VOID *) pTable->GetExtensionSupport;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800130 else if (!strncmp("xglEnumerateLayers", pName, sizeof ("xglEnumerateLayers")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700131 return (XGL_VOID *) multi1EnumerateLayers;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800132 else if (!strncmp("xglGetDeviceQueue", pName, sizeof ("xglGetDeviceQueue")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700133 return (XGL_VOID *) pTable->GetDeviceQueue;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800134 else if (!strncmp("xglQueueSubmit", pName, sizeof ("xglQueueSubmit")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700135 return (XGL_VOID *) pTable->QueueSubmit;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800136 else if (!strncmp("xglQueueSetGlobalMemReferences", pName, sizeof ("xglQueueSetGlobalMemReferences")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700137 return (XGL_VOID *) pTable->QueueSetGlobalMemReferences;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800138 else if (!strncmp("xglQueueWaitIdle", pName, sizeof ("xglQueueWaitIdle")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700139 return (XGL_VOID *) pTable->QueueWaitIdle;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800140 else if (!strncmp("xglDeviceWaitIdle", pName, sizeof ("xglDeviceWaitIdle")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700141 return (XGL_VOID *) pTable->DeviceWaitIdle;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800142 else if (!strncmp("xglGetMemoryHeapCount", pName, sizeof ("xglGetMemoryHeapCount")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700143 return (XGL_VOID *) pTable->GetMemoryHeapCount;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800144 else if (!strncmp("xglGetMemoryHeapInfo", pName, sizeof ("xglGetMemoryHeapInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700145 return (XGL_VOID *) pTable->GetMemoryHeapInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800146 else if (!strncmp("xglAllocMemory", pName, sizeof ("xglAllocMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700147 return (XGL_VOID *) pTable->AllocMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800148 else if (!strncmp("xglFreeMemory", pName, sizeof ("xglFreeMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700149 return (XGL_VOID *) pTable->FreeMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800150 else if (!strncmp("xglSetMemoryPriority", pName, sizeof ("xglSetMemoryPriority")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700151 return (XGL_VOID *) pTable->SetMemoryPriority;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800152 else if (!strncmp("xglMapMemory", pName, sizeof ("xglMapMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700153 return (XGL_VOID *) pTable->MapMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800154 else if (!strncmp("xglUnmapMemory", pName, sizeof ("xglUnmapMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700155 return (XGL_VOID *) pTable->UnmapMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800156 else if (!strncmp("xglPinSystemMemory", pName, sizeof ("xglPinSystemMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700157 return (XGL_VOID *) pTable->PinSystemMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800158 else if (!strncmp("xglRemapVirtualMemoryPages", pName, sizeof ("xglRemapVirtualMemoryPages")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700159 return (XGL_VOID *) pTable->RemapVirtualMemoryPages;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800160 else if (!strncmp("xglGetMultiGpuCompatibility", pName, sizeof ("xglGetMultiGpuCompatibility")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700161 return (XGL_VOID *) pTable->GetMultiGpuCompatibility;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800162 else if (!strncmp("xglOpenSharedMemory", pName, sizeof ("xglOpenSharedMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700163 return (XGL_VOID *) pTable->OpenSharedMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800164 else if (!strncmp("xglOpenSharedQueueSemaphore", pName, sizeof ("xglOpenSharedQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700165 return (XGL_VOID *) pTable->OpenSharedQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800166 else if (!strncmp("xglOpenPeerMemory", pName, sizeof ("xglOpenPeerMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700167 return (XGL_VOID *) pTable->OpenPeerMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800168 else if (!strncmp("xglOpenPeerImage", pName, sizeof ("xglOpenPeerImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700169 return (XGL_VOID *) pTable->OpenPeerImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800170 else if (!strncmp("xglDestroyObject", pName, sizeof ("xglDestroyObject")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700171 return (XGL_VOID *) pTable->DestroyObject;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800172 else if (!strncmp("xglGetObjectInfo", pName, sizeof ("xglGetObjectInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700173 return (XGL_VOID *) pTable->GetObjectInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800174 else if (!strncmp("xglBindObjectMemory", pName, sizeof ("xglBindObjectMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700175 return (XGL_VOID *) pTable->BindObjectMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800176 else if (!strncmp("xglCreateFence", pName, sizeof ("xgllCreateFence")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700177 return (XGL_VOID *) pTable->CreateFence;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800178 else if (!strncmp("xglGetFenceStatus", pName, sizeof ("xglGetFenceStatus")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700179 return (XGL_VOID *) pTable->GetFenceStatus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800180 else if (!strncmp("xglWaitForFences", pName, sizeof ("xglWaitForFences")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700181 return (XGL_VOID *) pTable->WaitForFences;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800182 else if (!strncmp("xglCreateQueueSemaphore", pName, sizeof ("xgllCreateQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700183 return (XGL_VOID *) pTable->CreateQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800184 else if (!strncmp("xglSignalQueueSemaphore", pName, sizeof ("xglSignalQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700185 return (XGL_VOID *) pTable->SignalQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800186 else if (!strncmp("xglWaitQueueSemaphore", pName, sizeof ("xglWaitQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700187 return (XGL_VOID *) pTable->WaitQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800188 else if (!strncmp("xglCreateEvent", pName, sizeof ("xgllCreateEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700189 return (XGL_VOID *) pTable->CreateEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800190 else if (!strncmp("xglGetEventStatus", pName, sizeof ("xglGetEventStatus")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700191 return (XGL_VOID *) pTable->GetEventStatus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800192 else if (!strncmp("xglSetEvent", pName, sizeof ("xglSetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700193 return (XGL_VOID *) pTable->SetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800194 else if (!strncmp("xglResetEvent", pName, sizeof ("xgllResetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700195 return (XGL_VOID *) pTable->ResetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800196 else if (!strncmp("xglCreateQueryPool", pName, sizeof ("xglCreateQueryPool")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700197 return (XGL_VOID *) pTable->CreateQueryPool;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800198 else if (!strncmp("xglGetQueryPoolResults", pName, sizeof ("xglGetQueryPoolResults")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700199 return (XGL_VOID *) pTable->GetQueryPoolResults;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800200 else if (!strncmp("xglGetFormatInfo", pName, sizeof ("xglGetFormatInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700201 return (XGL_VOID *) pTable->GetFormatInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800202 else if (!strncmp("xglCreateImage", pName, sizeof ("xglCreateImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700203 return (XGL_VOID *) pTable->CreateImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800204 else if (!strncmp("xglGetImageSubresourceInfo", pName, sizeof ("xglGetImageSubresourceInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700205 return (XGL_VOID *) pTable->GetImageSubresourceInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800206 else if (!strncmp("xglCreateImageView", pName, sizeof ("xglCreateImageView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700207 return (XGL_VOID *) pTable->CreateImageView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800208 else if (!strncmp("xglCreateColorAttachmentView", pName, sizeof ("xglCreateColorAttachmentView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700209 return (XGL_VOID *) pTable->CreateColorAttachmentView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800210 else if (!strncmp("xglCreateDepthStencilView", pName, sizeof ("xglCreateDepthStencilView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700211 return (XGL_VOID *) pTable->CreateDepthStencilView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800212 else if (!strncmp("xglCreateShader", pName, sizeof ("xglCreateShader")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700213 return (XGL_VOID *) pTable->CreateShader;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800214 else if (!strncmp("xglCreateGraphicsPipeline", pName, sizeof ("xglCreateGraphicsPipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700215 return (XGL_VOID *) multi1CreateGraphicsPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800216 else if (!strncmp("xglCreateComputePipeline", pName, sizeof ("xglCreateComputePipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700217 return (XGL_VOID *) pTable->CreateComputePipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800218 else if (!strncmp("xglStorePipeline", pName, sizeof ("xglStorePipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700219 return (XGL_VOID *) multi1StorePipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800220 else if (!strncmp("xglLoadPipeline", pName, sizeof ("xglLoadPipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700221 return (XGL_VOID *) pTable->LoadPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800222 else if (!strncmp("xglCreatePipelineDelta", pName, sizeof ("xglCreatePipelineDelta")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700223 return (XGL_VOID *) pTable->CreatePipelineDelta;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800224 else if (!strncmp("xglCreateSampler", pName, sizeof ("xglCreateSampler")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700225 return (XGL_VOID *) pTable->CreateSampler;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800226 else if (!strncmp("xglCreateDescriptorSet", pName, sizeof ("xglCreateDescriptorSet")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700227 return (XGL_VOID *) pTable->CreateDescriptorSet;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800228 else if (!strncmp("xglBeginDescriptorSetUpdate", pName, sizeof ("xglBeginDescriptorSetUpdate")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700229 return (XGL_VOID *) pTable->BeginDescriptorSetUpdate;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800230 else if (!strncmp("xglEndDescriptorSetUpdate", pName, sizeof ("xglEndDescriptorSetUpdate")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700231 return (XGL_VOID *) pTable->EndDescriptorSetUpdate;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800232 else if (!strncmp("xglAttachSamplerDescriptors", pName, sizeof ("xglAttachSamplerDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700233 return (XGL_VOID *) pTable->AttachSamplerDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800234 else if (!strncmp("xglAttachImageViewDescriptors", pName, sizeof ("xglAttachImageViewDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700235 return (XGL_VOID *) pTable->AttachImageViewDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800236 else if (!strncmp("xglAttachMemoryViewDescriptors", pName, sizeof ("xglAttachMemoryViewDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700237 return (XGL_VOID *) pTable->AttachMemoryViewDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800238 else if (!strncmp("xglAttachNestedDescriptors", pName, sizeof ("xglAttachNestedDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700239 return (XGL_VOID *) pTable->AttachNestedDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800240 else if (!strncmp("xglClearDescriptorSetSlots", pName, sizeof ("xglClearDescriptorSetSlots")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700241 return (XGL_VOID *) pTable->ClearDescriptorSetSlots;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800242 else if (!strncmp("xglCreateViewportState", pName, sizeof ("xglCreateViewportState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700243 return (XGL_VOID *) pTable->CreateViewportState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800244 else if (!strncmp("xglCreateRasterState", pName, sizeof ("xglCreateRasterState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700245 return (XGL_VOID *) pTable->CreateRasterState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800246 else if (!strncmp("xglCreateMsaaState", pName, sizeof ("xglCreateMsaaState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700247 return (XGL_VOID *) pTable->CreateMsaaState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800248 else if (!strncmp("xglCreateColorBlendState", pName, sizeof ("xglCreateColorBlendState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700249 return (XGL_VOID *) pTable->CreateColorBlendState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800250 else if (!strncmp("xglCreateDepthStencilState", pName, sizeof ("xglCreateDepthStencilState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700251 return (XGL_VOID *) pTable->CreateDepthStencilState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800252 else if (!strncmp("xglCreateCommandBuffer", pName, sizeof ("xglCreateCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700253 return (XGL_VOID *) pTable->CreateCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800254 else if (!strncmp("xglBeginCommandBuffer", pName, sizeof ("xglBeginCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700255 return (XGL_VOID *) pTable->BeginCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800256 else if (!strncmp("xglEndCommandBuffer", pName, sizeof ("xglEndCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700257 return (XGL_VOID *) pTable->EndCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800258 else if (!strncmp("xglResetCommandBuffer", pName, sizeof ("xglResetCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700259 return (XGL_VOID *) pTable->ResetCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800260 else if (!strncmp("xglCmdBindPipeline", pName, sizeof ("xglCmdBindPipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700261 return (XGL_VOID *) pTable->CmdBindPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800262 else if (!strncmp("xglCmdBindPipelineDelta", pName, sizeof ("xglCmdBindPipelineDelta")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700263 return (XGL_VOID *) pTable->CmdBindPipelineDelta;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800264 else if (!strncmp("xglCmdBindStateObject", pName, sizeof ("xglCmdBindStateObject")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700265 return (XGL_VOID *) pTable->CmdBindStateObject;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800266 else if (!strncmp("xglCmdBindDescriptorSet", pName, sizeof ("xglCmdBindDescriptorSet")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700267 return (XGL_VOID *) pTable->CmdBindDescriptorSet;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800268 else if (!strncmp("xglCmdBindDynamicMemoryView", pName, sizeof ("xglCmdBindDynamicMemoryView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700269 return (XGL_VOID *) pTable->CmdBindDynamicMemoryView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800270 else if (!strncmp("xglCmdBindVertexData", pName, sizeof ("xglCmdBindVertexData")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700271 return (XGL_VOID *) pTable->CmdBindVertexData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800272 else if (!strncmp("xglCmdBindIndexData", pName, sizeof ("xglCmdBindIndexData")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700273 return (XGL_VOID *) pTable->CmdBindIndexData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800274 else if (!strncmp("xglCmdBindAttachments", pName, sizeof ("xglCmdBindAttachments")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700275 return (XGL_VOID *) pTable->CmdBindAttachments;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800276 else if (!strncmp("xglCmdPrepareMemoryRegions", pName, sizeof ("xglCmdPrepareMemoryRegions")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700277 return (XGL_VOID *) pTable->CmdPrepareMemoryRegions;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800278 else if (!strncmp("xglCmdPrepareImages", pName, sizeof ("xglCmdPrepareImages")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700279 return (XGL_VOID *) pTable->CmdPrepareImages;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800280 else if (!strncmp("xglCmdDraw", pName, sizeof ("xglCmdDraw")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700281 return (XGL_VOID *) pTable->CmdDraw;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800282 else if (!strncmp("xglCmdDrawIndexed", pName, sizeof ("xglCmdDrawIndexed")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700283 return (XGL_VOID *) pTable->CmdDrawIndexed;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800284 else if (!strncmp("xglCmdDrawIndirect", pName, sizeof ("xglCmdDrawIndirect")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700285 return (XGL_VOID *) pTable->CmdDrawIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800286 else if (!strncmp("xglCmdDrawIndexedIndirect", pName, sizeof ("xglCmdDrawIndexedIndirect")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700287 return (XGL_VOID *) pTable->CmdDrawIndexedIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800288 else if (!strncmp("xglCmdDispatch", pName, sizeof ("xglCmdDispatch")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700289 return (XGL_VOID *) pTable->CmdDispatch;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800290 else if (!strncmp("xglCmdDispatchIndirect", pName, sizeof ("xglCmdDispatchIndirect")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700291 return (XGL_VOID *) pTable->CmdDispatchIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800292 else if (!strncmp("xglCmdCopyMemory", pName, sizeof ("xglCmdCopyMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700293 return (XGL_VOID *) pTable->CmdCopyMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800294 else if (!strncmp("xglCmdCopyImage", pName, sizeof ("xglCmdCopyImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700295 return (XGL_VOID *) pTable->CmdCopyImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800296 else if (!strncmp("xglCmdCopyMemoryToImage", pName, sizeof ("xglCmdCopyMemoryToImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700297 return (XGL_VOID *) pTable->CmdCopyMemoryToImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800298 else if (!strncmp("xglCmdCopyImageToMemory", pName, sizeof ("xglCmdCopyImageToMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700299 return (XGL_VOID *) pTable->CmdCopyImageToMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800300 else if (!strncmp("xglCmdCloneImageData", pName, sizeof ("xglCmdCloneImageData")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700301 return (XGL_VOID *) pTable->CmdCloneImageData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800302 else if (!strncmp("xglCmdUpdateMemory", pName, sizeof ("xglCmdUpdateMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700303 return (XGL_VOID *) pTable->CmdUpdateMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800304 else if (!strncmp("xglCmdFillMemory", pName, sizeof ("xglCmdFillMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700305 return (XGL_VOID *) pTable->CmdFillMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800306 else if (!strncmp("xglCmdClearColorImage", pName, sizeof ("xglCmdClearColorImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700307 return (XGL_VOID *) pTable->CmdClearColorImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800308 else if (!strncmp("xglCmdClearColorImageRaw", pName, sizeof ("xglCmdClearColorImageRaw")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700309 return (XGL_VOID *) pTable->CmdClearColorImageRaw;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800310 else if (!strncmp("xglCmdClearDepthStencil", pName, sizeof ("xglCmdClearDepthStencil")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700311 return (XGL_VOID *) pTable->CmdClearDepthStencil;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800312 else if (!strncmp("xglCmdResolveImage", pName, sizeof ("xglCmdResolveImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700313 return (XGL_VOID *) pTable->CmdResolveImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800314 else if (!strncmp("xglCmdSetEvent", pName, sizeof ("xglCmdSetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700315 return (XGL_VOID *) pTable->CmdSetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800316 else if (!strncmp("xglCmdResetEvent", pName, sizeof ("xglCmdResetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700317 return (XGL_VOID *) pTable->CmdResetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800318 else if (!strncmp("xglCmdMemoryAtomic", pName, sizeof ("xglCmdMemoryAtomic")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700319 return (XGL_VOID *) pTable->CmdMemoryAtomic;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800320 else if (!strncmp("xglCmdBeginQuery", pName, sizeof ("xglCmdBeginQuery")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700321 return (XGL_VOID *) pTable->CmdBeginQuery;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800322 else if (!strncmp("xglCmdEndQuery", pName, sizeof ("xglCmdEndQuery")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700323 return (XGL_VOID *) pTable->CmdEndQuery;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800324 else if (!strncmp("xglCmdResetQueryPool", pName, sizeof ("xglCmdResetQueryPool")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700325 return (XGL_VOID *) pTable->CmdResetQueryPool;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800326 else if (!strncmp("xglCmdWriteTimestamp", pName, sizeof ("xglCmdWriteTimestamp")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700327 return (XGL_VOID *) pTable->CmdWriteTimestamp;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800328 else if (!strncmp("xglCmdInitAtomicCounters", pName, sizeof ("xglCmdInitAtomicCounters")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700329 return (XGL_VOID *) pTable->CmdInitAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800330 else if (!strncmp("xglCmdLoadAtomicCounters", pName, sizeof ("xglCmdLoadAtomicCounters")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700331 return (XGL_VOID *) pTable->CmdLoadAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800332 else if (!strncmp("xglCmdSaveAtomicCounters", pName, sizeof ("xglCmdSaveAtomicCounters")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700333 return (XGL_VOID *) pTable->CmdSaveAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800334 else if (!strncmp("xglDbgSetValidationLevel", pName, sizeof ("xglDbgSetValidationLevel")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700335 return (XGL_VOID *) pTable->DbgSetValidationLevel;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800336 else if (!strncmp("xglDbgRegisterMsgCallback", pName, sizeof ("xglDbgRegisterMsgCallback")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700337 return (XGL_VOID *) pTable->DbgRegisterMsgCallback;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800338 else if (!strncmp("xglDbgUnregisterMsgCallback", pName, sizeof ("xglDbgUnregisterMsgCallback")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700339 return (XGL_VOID *) pTable->DbgUnregisterMsgCallback;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800340 else if (!strncmp("xglDbgSetMessageFilter", pName, sizeof ("xglDbgSetMessageFilter")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700341 return (XGL_VOID *) pTable->DbgSetMessageFilter;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800342 else if (!strncmp("xglDbgSetObjectTag", pName, sizeof ("xglDbgSetObjectTag")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700343 return (XGL_VOID *) pTable->DbgSetObjectTag;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800344 else if (!strncmp("xglDbgSetGlobalOption", pName, sizeof ("xglDbgSetGlobalOption")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700345 return (XGL_VOID *) pTable->DbgSetGlobalOption;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800346 else if (!strncmp("xglDbgSetDeviceOption", pName, sizeof ("xglDbgSetDeviceOption")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700347 return (XGL_VOID *) pTable->DbgSetDeviceOption;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800348 else if (!strncmp("xglCmdDbgMarkerBegin", pName, sizeof ("xglCmdDbgMarkerBegin")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700349 return (XGL_VOID *) pTable->CmdDbgMarkerBegin;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800350 else if (!strncmp("xglCmdDbgMarkerEnd", pName, sizeof ("xglCmdDbgMarkerEnd")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700351 return (XGL_VOID *) pTable->CmdDbgMarkerEnd;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800352 else if (!strncmp("xglWsiX11AssociateConnection", pName, sizeof("xglWsiX11AssociateConnection")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700353 return (XGL_VOID *) pTable->WsiX11AssociateConnection;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800354 else if (!strncmp("xglWsiX11GetMSC", pName, sizeof("xglWsiX11GetMSC")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700355 return (XGL_VOID *) pTable->WsiX11GetMSC;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800356 else if (!strncmp("xglWsiX11CreatePresentableImage", pName, sizeof("xglWsiX11CreatePresentableImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700357 return (XGL_VOID *) pTable->WsiX11CreatePresentableImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800358 else if (!strncmp("xglWsiX11QueuePresent", pName, sizeof("xglWsiX11QueuePresent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700359 return (XGL_VOID *) pTable->WsiX11QueuePresent;
360 else {
361 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
362 if (gpuw->pGPA == NULL)
363 return NULL;
364 return gpuw->pGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, pName);
365 }
366
367}
368
369/******************************** Layer multi2 functions **************************/
370static std::unordered_map<XGL_VOID *, XGL_LAYER_DISPATCH_TABLE *> tableMap2;
371static bool layer2_first_activated = false;
372
373static XGL_LAYER_DISPATCH_TABLE * getLayer2Table(const XGL_BASE_LAYER_OBJECT *gpuw)
374{
375 XGL_LAYER_DISPATCH_TABLE *pTable;
376
377 assert(gpuw);
378 std::unordered_map<XGL_VOID *, XGL_LAYER_DISPATCH_TABLE *>::const_iterator it = tableMap2.find((XGL_VOID *) gpuw);
379 if (it == tableMap2.end())
380 {
381 pTable = new XGL_LAYER_DISPATCH_TABLE;
382 tableMap2[(XGL_VOID *) gpuw] = pTable;
383 initLayerTable(gpuw, pTable, 2);
384 return pTable;
385 } else
386 {
387 return it->second;
388 }
389}
390
391XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi2CreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo,
392 XGL_DEVICE* pDevice)
393{
394 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
395 XGL_LAYER_DISPATCH_TABLE* pTable = getLayer2Table(gpuw);
396
397 printf("At start of multi2 xglCreateDevice()\n");
398 XGL_RESULT result = pTable->CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice);
399 // create a mapping for the device object into the dispatch table for layer2
400 tableMap2.emplace(*pDevice, pTable);
401 printf("Completed multi2 layer xglCreateDevice()\n");
402 return result;
403}
404
405XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi2CreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo,
406 XGL_CMD_BUFFER* pCmdBuffer)
407{
408 XGL_LAYER_DISPATCH_TABLE* pTable = tableMap2[device];
409
410 printf("At start of multi2 layer xglCreateCommandBuffer()\n");
411 XGL_RESULT result = pTable->CreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
412 // create a mapping for CmdBuffer object into the dispatch table for layer 2
413 tableMap2.emplace(*pCmdBuffer, pTable);
414 printf("Completed multi2 layer xglCreateCommandBuffer()\n");
415 return result;
416}
417
418XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi2BeginCommandBuffer( XGL_CMD_BUFFER cmdBuffer, XGL_FLAGS flags)
419{
420 XGL_LAYER_DISPATCH_TABLE* pTable = tableMap2[cmdBuffer];
421
422 printf("At start of multi2 layer xglBeginCommandBuffer()\n");
423 XGL_RESULT result = pTable->BeginCommandBuffer(cmdBuffer, flags);
424 printf("Completed multi2 layer xglBeginCommandBuffer()\n");
425 return result;
426
427}
428
429XGL_LAYER_EXPORT XGL_RESULT XGLAPI multi2EnumerateLayers(XGL_PHYSICAL_GPU gpu, XGL_SIZE maxLayerCount, XGL_SIZE maxStringSize,
430 XGL_CHAR* const* pOutLayers, XGL_SIZE * pOutLayerCount,
431 XGL_VOID* pReserved)
432{
433 if (gpu == NULL)
434 return xglEnumerateLayers(gpu, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved);
435
436 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
437 XGL_LAYER_DISPATCH_TABLE* pTable = getLayer2Table(gpuw);
438
439 printf("At start of multi2 layer xglEnumerateLayers()\n");
440 XGL_RESULT result = pTable->EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved);
441 printf("Completed multi2 layer xglEnumerateLayers()\n");
442 return result;
443}
444
445XGL_LAYER_EXPORT XGL_VOID * XGLAPI multi2GetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pName)
446{
447 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
448 if (gpu == NULL)
449 return NULL;
450 XGL_LAYER_DISPATCH_TABLE* pTable;
451 pTable = getLayer2Table(gpuw);
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800452 if (!strncmp("xglInitAndEnumerateGpus", pName, sizeof("xglInitAndEnumerateGpus")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700453 return (XGL_VOID *) pTable->InitAndEnumerateGpus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800454 else if (!strncmp("xglGetGpuInfo", pName, sizeof ("xglGetGpuInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700455 return (XGL_VOID *) pTable->GetGpuInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800456 else if (!strncmp("xglCreateDevice", pName, sizeof ("xglCreateDevice")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700457 return (XGL_VOID *) multi2CreateDevice;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800458 else if (!strncmp("xglDestroyDevice", pName, sizeof ("xglDestroyDevice")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700459 return (XGL_VOID *) pTable->DestroyDevice;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800460 else if (!strncmp("xglGetExtensionSupport", pName, sizeof ("xglGetExtensionSupport")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700461 return (XGL_VOID *) pTable->GetExtensionSupport;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800462 else if (!strncmp("xglEnumerateLayers", pName, sizeof ("xglEnumerateLayers")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700463 return (XGL_VOID *) multi2EnumerateLayers;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800464 else if (!strncmp("xglGetDeviceQueue", pName, sizeof ("xglGetDeviceQueue")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700465 return (XGL_VOID *) pTable->GetDeviceQueue;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800466 else if (!strncmp("xglQueueSubmit", pName, sizeof ("xglQueueSubmit")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700467 return (XGL_VOID *) pTable->QueueSubmit;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800468 else if (!strncmp("xglQueueSetGlobalMemReferences", pName, sizeof ("xglQueueSetGlobalMemReferences")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700469 return (XGL_VOID *) pTable->QueueSetGlobalMemReferences;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800470 else if (!strncmp("xglQueueWaitIdle", pName, sizeof ("xglQueueWaitIdle")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700471 return (XGL_VOID *) pTable->QueueWaitIdle;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800472 else if (!strncmp("xglDeviceWaitIdle", pName, sizeof ("xglDeviceWaitIdle")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700473 return (XGL_VOID *) pTable->DeviceWaitIdle;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800474 else if (!strncmp("xglGetMemoryHeapCount", pName, sizeof ("xglGetMemoryHeapCount")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700475 return (XGL_VOID *) pTable->GetMemoryHeapCount;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800476 else if (!strncmp("xglGetMemoryHeapInfo", pName, sizeof ("xglGetMemoryHeapInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700477 return (XGL_VOID *) pTable->GetMemoryHeapInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800478 else if (!strncmp("xglAllocMemory", pName, sizeof ("xglAllocMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700479 return (XGL_VOID *) pTable->AllocMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800480 else if (!strncmp("xglFreeMemory", pName, sizeof ("xglFreeMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700481 return (XGL_VOID *) pTable->FreeMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800482 else if (!strncmp("xglSetMemoryPriority", pName, sizeof ("xglSetMemoryPriority")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700483 return (XGL_VOID *) pTable->SetMemoryPriority;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800484 else if (!strncmp("xglMapMemory", pName, sizeof ("xglMapMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700485 return (XGL_VOID *) pTable->MapMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800486 else if (!strncmp("xglUnmapMemory", pName, sizeof ("xglUnmapMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700487 return (XGL_VOID *) pTable->UnmapMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800488 else if (!strncmp("xglPinSystemMemory", pName, sizeof ("xglPinSystemMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700489 return (XGL_VOID *) pTable->PinSystemMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800490 else if (!strncmp("xglRemapVirtualMemoryPages", pName, sizeof ("xglRemapVirtualMemoryPages")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700491 return (XGL_VOID *) pTable->RemapVirtualMemoryPages;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800492 else if (!strncmp("xglGetMultiGpuCompatibility", pName, sizeof ("xglGetMultiGpuCompatibility")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700493 return (XGL_VOID *) pTable->GetMultiGpuCompatibility;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800494 else if (!strncmp("xglOpenSharedMemory", pName, sizeof ("xglOpenSharedMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700495 return (XGL_VOID *) pTable->OpenSharedMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800496 else if (!strncmp("xglOpenSharedQueueSemaphore", pName, sizeof ("xglOpenSharedQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700497 return (XGL_VOID *) pTable->OpenSharedQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800498 else if (!strncmp("xglOpenPeerMemory", pName, sizeof ("xglOpenPeerMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700499 return (XGL_VOID *) pTable->OpenPeerMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800500 else if (!strncmp("xglOpenPeerImage", pName, sizeof ("xglOpenPeerImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700501 return (XGL_VOID *) pTable->OpenPeerImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800502 else if (!strncmp("xglDestroyObject", pName, sizeof ("xglDestroyObject")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700503 return (XGL_VOID *) pTable->DestroyObject;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800504 else if (!strncmp("xglGetObjectInfo", pName, sizeof ("xglGetObjectInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700505 return (XGL_VOID *) pTable->GetObjectInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800506 else if (!strncmp("xglBindObjectMemory", pName, sizeof ("xglBindObjectMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700507 return (XGL_VOID *) pTable->BindObjectMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800508 else if (!strncmp("xglCreateFence", pName, sizeof ("xgllCreateFence")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700509 return (XGL_VOID *) pTable->CreateFence;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800510 else if (!strncmp("xglGetFenceStatus", pName, sizeof ("xglGetFenceStatus")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700511 return (XGL_VOID *) pTable->GetFenceStatus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800512 else if (!strncmp("xglWaitForFences", pName, sizeof ("xglWaitForFences")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700513 return (XGL_VOID *) pTable->WaitForFences;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800514 else if (!strncmp("xglCreateQueueSemaphore", pName, sizeof ("xgllCreateQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700515 return (XGL_VOID *) pTable->CreateQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800516 else if (!strncmp("xglSignalQueueSemaphore", pName, sizeof ("xglSignalQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700517 return (XGL_VOID *) pTable->SignalQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800518 else if (!strncmp("xglWaitQueueSemaphore", pName, sizeof ("xglWaitQueueSemaphore")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700519 return (XGL_VOID *) pTable->WaitQueueSemaphore;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800520 else if (!strncmp("xglCreateEvent", pName, sizeof ("xgllCreateEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700521 return (XGL_VOID *) pTable->CreateEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800522 else if (!strncmp("xglGetEventStatus", pName, sizeof ("xglGetEventStatus")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700523 return (XGL_VOID *) pTable->GetEventStatus;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800524 else if (!strncmp("xglSetEvent", pName, sizeof ("xglSetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700525 return (XGL_VOID *) pTable->SetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800526 else if (!strncmp("xglResetEvent", pName, sizeof ("xgllResetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700527 return (XGL_VOID *) pTable->ResetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800528 else if (!strncmp("xglCreateQueryPool", pName, sizeof ("xglCreateQueryPool")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700529 return (XGL_VOID *) pTable->CreateQueryPool;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800530 else if (!strncmp("xglGetQueryPoolResults", pName, sizeof ("xglGetQueryPoolResults")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700531 return (XGL_VOID *) pTable->GetQueryPoolResults;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800532 else if (!strncmp("xglGetFormatInfo", pName, sizeof ("xglGetFormatInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700533 return (XGL_VOID *) pTable->GetFormatInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800534 else if (!strncmp("xglCreateImage", pName, sizeof ("xglCreateImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700535 return (XGL_VOID *) pTable->CreateImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800536 else if (!strncmp("xglGetImageSubresourceInfo", pName, sizeof ("xglGetImageSubresourceInfo")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700537 return (XGL_VOID *) pTable->GetImageSubresourceInfo;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800538 else if (!strncmp("xglCreateImageView", pName, sizeof ("xglCreateImageView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700539 return (XGL_VOID *) pTable->CreateImageView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800540 else if (!strncmp("xglCreateColorAttachmentView", pName, sizeof ("xglCreateColorAttachmentView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700541 return (XGL_VOID *) pTable->CreateColorAttachmentView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800542 else if (!strncmp("xglCreateDepthStencilView", pName, sizeof ("xglCreateDepthStencilView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700543 return (XGL_VOID *) pTable->CreateDepthStencilView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800544 else if (!strncmp("xglCreateShader", pName, sizeof ("xglCreateShader")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700545 return (XGL_VOID *) pTable->CreateShader;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800546 else if (!strncmp("xglCreateGraphicsPipeline", pName, sizeof ("xglCreateGraphicsPipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700547 return (XGL_VOID *) pTable->CreateGraphicsPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800548 else if (!strncmp("xglCreateComputePipeline", pName, sizeof ("xglCreateComputePipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700549 return (XGL_VOID *) pTable->CreateComputePipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800550 else if (!strncmp("xglStorePipeline", pName, sizeof ("xglStorePipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700551 return (XGL_VOID *) pTable->StorePipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800552 else if (!strncmp("xglLoadPipeline", pName, sizeof ("xglLoadPipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700553 return (XGL_VOID *) pTable->LoadPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800554 else if (!strncmp("xglCreatePipelineDelta", pName, sizeof ("xglCreatePipelineDelta")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700555 return (XGL_VOID *) pTable->CreatePipelineDelta;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800556 else if (!strncmp("xglCreateSampler", pName, sizeof ("xglCreateSampler")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700557 return (XGL_VOID *) pTable->CreateSampler;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800558 else if (!strncmp("xglCreateDescriptorSet", pName, sizeof ("xglCreateDescriptorSet")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700559 return (XGL_VOID *) pTable->CreateDescriptorSet;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800560 else if (!strncmp("xglBeginDescriptorSetUpdate", pName, sizeof ("xglBeginDescriptorSetUpdate")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700561 return (XGL_VOID *) pTable->BeginDescriptorSetUpdate;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800562 else if (!strncmp("xglEndDescriptorSetUpdate", pName, sizeof ("xglEndDescriptorSetUpdate")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700563 return (XGL_VOID *) pTable->EndDescriptorSetUpdate;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800564 else if (!strncmp("xglAttachSamplerDescriptors", pName, sizeof ("xglAttachSamplerDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700565 return (XGL_VOID *) pTable->AttachSamplerDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800566 else if (!strncmp("xglAttachImageViewDescriptors", pName, sizeof ("xglAttachImageViewDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700567 return (XGL_VOID *) pTable->AttachImageViewDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800568 else if (!strncmp("xglAttachMemoryViewDescriptors", pName, sizeof ("xglAttachMemoryViewDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700569 return (XGL_VOID *) pTable->AttachMemoryViewDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800570 else if (!strncmp("xglAttachNestedDescriptors", pName, sizeof ("xglAttachNestedDescriptors")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700571 return (XGL_VOID *) pTable->AttachNestedDescriptors;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800572 else if (!strncmp("xglClearDescriptorSetSlots", pName, sizeof ("xglClearDescriptorSetSlots")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700573 return (XGL_VOID *) pTable->ClearDescriptorSetSlots;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800574 else if (!strncmp("xglCreateViewportState", pName, sizeof ("xglCreateViewportState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700575 return (XGL_VOID *) pTable->CreateViewportState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800576 else if (!strncmp("xglCreateRasterState", pName, sizeof ("xglCreateRasterState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700577 return (XGL_VOID *) pTable->CreateRasterState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800578 else if (!strncmp("xglCreateMsaaState", pName, sizeof ("xglCreateMsaaState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700579 return (XGL_VOID *) pTable->CreateMsaaState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800580 else if (!strncmp("xglCreateColorBlendState", pName, sizeof ("xglCreateColorBlendState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700581 return (XGL_VOID *) pTable->CreateColorBlendState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800582 else if (!strncmp("xglCreateDepthStencilState", pName, sizeof ("xglCreateDepthStencilState")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700583 return (XGL_VOID *) pTable->CreateDepthStencilState;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800584 else if (!strncmp("xglCreateCommandBuffer", pName, sizeof ("xglCreateCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700585 return (XGL_VOID *) multi2CreateCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800586 else if (!strncmp("xglBeginCommandBuffer", pName, sizeof ("xglBeginCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700587 return (XGL_VOID *) multi2BeginCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800588 else if (!strncmp("xglEndCommandBuffer", pName, sizeof ("xglEndCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700589 return (XGL_VOID *) pTable->EndCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800590 else if (!strncmp("xglResetCommandBuffer", pName, sizeof ("xglResetCommandBuffer")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700591 return (XGL_VOID *) pTable->ResetCommandBuffer;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800592 else if (!strncmp("xglCmdBindPipeline", pName, sizeof ("xglCmdBindPipeline")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700593 return (XGL_VOID *) pTable->CmdBindPipeline;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800594 else if (!strncmp("xglCmdBindPipelineDelta", pName, sizeof ("xglCmdBindPipelineDelta")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700595 return (XGL_VOID *) pTable->CmdBindPipelineDelta;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800596 else if (!strncmp("xglCmdBindStateObject", pName, sizeof ("xglCmdBindStateObject")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700597 return (XGL_VOID *) pTable->CmdBindStateObject;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800598 else if (!strncmp("xglCmdBindDescriptorSet", pName, sizeof ("xglCmdBindDescriptorSet")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700599 return (XGL_VOID *) pTable->CmdBindDescriptorSet;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800600 else if (!strncmp("xglCmdBindDynamicMemoryView", pName, sizeof ("xglCmdBindDynamicMemoryView")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700601 return (XGL_VOID *) pTable->CmdBindDynamicMemoryView;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800602 else if (!strncmp("xglCmdBindVertexData", pName, sizeof ("xglCmdBindVertexData")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700603 return (XGL_VOID *) pTable->CmdBindVertexData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800604 else if (!strncmp("xglCmdBindIndexData", pName, sizeof ("xglCmdBindIndexData")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700605 return (XGL_VOID *) pTable->CmdBindIndexData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800606 else if (!strncmp("xglCmdBindAttachments", pName, sizeof ("xglCmdBindAttachments")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700607 return (XGL_VOID *) pTable->CmdBindAttachments;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800608 else if (!strncmp("xglCmdPrepareMemoryRegions", pName, sizeof ("xglCmdPrepareMemoryRegions")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700609 return (XGL_VOID *) pTable->CmdPrepareMemoryRegions;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800610 else if (!strncmp("xglCmdPrepareImages", pName, sizeof ("xglCmdPrepareImages")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700611 return (XGL_VOID *) pTable->CmdPrepareImages;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800612 else if (!strncmp("xglCmdDraw", pName, sizeof ("xglCmdDraw")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700613 return (XGL_VOID *) pTable->CmdDraw;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800614 else if (!strncmp("xglCmdDrawIndexed", pName, sizeof ("xglCmdDrawIndexed")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700615 return (XGL_VOID *) pTable->CmdDrawIndexed;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800616 else if (!strncmp("xglCmdDrawIndirect", pName, sizeof ("xglCmdDrawIndirect")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700617 return (XGL_VOID *) pTable->CmdDrawIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800618 else if (!strncmp("xglCmdDrawIndexedIndirect", pName, sizeof ("xglCmdDrawIndexedIndirect")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700619 return (XGL_VOID *) pTable->CmdDrawIndexedIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800620 else if (!strncmp("xglCmdDispatch", pName, sizeof ("xglCmdDispatch")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700621 return (XGL_VOID *) pTable->CmdDispatch;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800622 else if (!strncmp("xglCmdDispatchIndirect", pName, sizeof ("xglCmdDispatchIndirect")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700623 return (XGL_VOID *) pTable->CmdDispatchIndirect;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800624 else if (!strncmp("xglCmdCopyMemory", pName, sizeof ("xglCmdCopyMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700625 return (XGL_VOID *) pTable->CmdCopyMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800626 else if (!strncmp("xglCmdCopyImage", pName, sizeof ("xglCmdCopyImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700627 return (XGL_VOID *) pTable->CmdCopyImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800628 else if (!strncmp("xglCmdCopyMemoryToImage", pName, sizeof ("xglCmdCopyMemoryToImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700629 return (XGL_VOID *) pTable->CmdCopyMemoryToImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800630 else if (!strncmp("xglCmdCopyImageToMemory", pName, sizeof ("xglCmdCopyImageToMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700631 return (XGL_VOID *) pTable->CmdCopyImageToMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800632 else if (!strncmp("xglCmdCloneImageData", pName, sizeof ("xglCmdCloneImageData")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700633 return (XGL_VOID *) pTable->CmdCloneImageData;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800634 else if (!strncmp("xglCmdUpdateMemory", pName, sizeof ("xglCmdUpdateMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700635 return (XGL_VOID *) pTable->CmdUpdateMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800636 else if (!strncmp("xglCmdFillMemory", pName, sizeof ("xglCmdFillMemory")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700637 return (XGL_VOID *) pTable->CmdFillMemory;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800638 else if (!strncmp("xglCmdClearColorImage", pName, sizeof ("xglCmdClearColorImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700639 return (XGL_VOID *) pTable->CmdClearColorImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800640 else if (!strncmp("xglCmdClearColorImageRaw", pName, sizeof ("xglCmdClearColorImageRaw")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700641 return (XGL_VOID *) pTable->CmdClearColorImageRaw;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800642 else if (!strncmp("xglCmdClearDepthStencil", pName, sizeof ("xglCmdClearDepthStencil")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700643 return (XGL_VOID *) pTable->CmdClearDepthStencil;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800644 else if (!strncmp("xglCmdResolveImage", pName, sizeof ("xglCmdResolveImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700645 return (XGL_VOID *) pTable->CmdResolveImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800646 else if (!strncmp("xglCmdSetEvent", pName, sizeof ("xglCmdSetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700647 return (XGL_VOID *) pTable->CmdSetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800648 else if (!strncmp("xglCmdResetEvent", pName, sizeof ("xglCmdResetEvent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700649 return (XGL_VOID *) pTable->CmdResetEvent;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800650 else if (!strncmp("xglCmdMemoryAtomic", pName, sizeof ("xglCmdMemoryAtomic")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700651 return (XGL_VOID *) pTable->CmdMemoryAtomic;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800652 else if (!strncmp("xglCmdBeginQuery", pName, sizeof ("xglCmdBeginQuery")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700653 return (XGL_VOID *) pTable->CmdBeginQuery;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800654 else if (!strncmp("xglCmdEndQuery", pName, sizeof ("xglCmdEndQuery")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700655 return (XGL_VOID *) pTable->CmdEndQuery;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800656 else if (!strncmp("xglCmdResetQueryPool", pName, sizeof ("xglCmdResetQueryPool")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700657 return (XGL_VOID *) pTable->CmdResetQueryPool;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800658 else if (!strncmp("xglCmdWriteTimestamp", pName, sizeof ("xglCmdWriteTimestamp")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700659 return (XGL_VOID *) pTable->CmdWriteTimestamp;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800660 else if (!strncmp("xglCmdInitAtomicCounters", pName, sizeof ("xglCmdInitAtomicCounters")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700661 return (XGL_VOID *) pTable->CmdInitAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800662 else if (!strncmp("xglCmdLoadAtomicCounters", pName, sizeof ("xglCmdLoadAtomicCounters")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700663 return (XGL_VOID *) pTable->CmdLoadAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800664 else if (!strncmp("xglCmdSaveAtomicCounters", pName, sizeof ("xglCmdSaveAtomicCounters")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700665 return (XGL_VOID *) pTable->CmdSaveAtomicCounters;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800666 else if (!strncmp("xglDbgSetValidationLevel", pName, sizeof ("xglDbgSetValidationLevel")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700667 return (XGL_VOID *) pTable->DbgSetValidationLevel;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800668 else if (!strncmp("xglDbgRegisterMsgCallback", pName, sizeof ("xglDbgRegisterMsgCallback")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700669 return (XGL_VOID *) pTable->DbgRegisterMsgCallback;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800670 else if (!strncmp("xglDbgUnregisterMsgCallback", pName, sizeof ("xglDbgUnregisterMsgCallback")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700671 return (XGL_VOID *) pTable->DbgUnregisterMsgCallback;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800672 else if (!strncmp("xglDbgSetMessageFilter", pName, sizeof ("xglDbgSetMessageFilter")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700673 return (XGL_VOID *) pTable->DbgSetMessageFilter;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800674 else if (!strncmp("xglDbgSetObjectTag", pName, sizeof ("xglDbgSetObjectTag")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700675 return (XGL_VOID *) pTable->DbgSetObjectTag;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800676 else if (!strncmp("xglDbgSetGlobalOption", pName, sizeof ("xglDbgSetGlobalOption")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700677 return (XGL_VOID *) pTable->DbgSetGlobalOption;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800678 else if (!strncmp("xglDbgSetDeviceOption", pName, sizeof ("xglDbgSetDeviceOption")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700679 return (XGL_VOID *) pTable->DbgSetDeviceOption;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800680 else if (!strncmp("xglCmdDbgMarkerBegin", pName, sizeof ("xglCmdDbgMarkerBegin")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700681 return (XGL_VOID *) pTable->CmdDbgMarkerBegin;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800682 else if (!strncmp("xglCmdDbgMarkerEnd", pName, sizeof ("xglCmdDbgMarkerEnd")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700683 return (XGL_VOID *) pTable->CmdDbgMarkerEnd;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800684 else if (!strncmp("xglWsiX11AssociateConnection", pName, sizeof("xglWsiX11AssociateConnection")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700685 return (XGL_VOID *) pTable->WsiX11AssociateConnection;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800686 else if (!strncmp("xglWsiX11GetMSC", pName, sizeof("xglWsiX11GetMSC")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700687 return (XGL_VOID *) pTable->WsiX11GetMSC;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800688 else if (!strncmp("xglWsiX11CreatePresentableImage", pName, sizeof("xglWsiX11CreatePresentableImage")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700689 return (XGL_VOID *) pTable->WsiX11CreatePresentableImage;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800690 else if (!strncmp("xglWsiX11QueuePresent", pName, sizeof("xglWsiX11QueuePresent")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700691 return (XGL_VOID *) pTable->WsiX11QueuePresent;
692 else {
693 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
694 if (gpuw->pGPA == NULL)
695 return NULL;
696 return gpuw->pGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, pName);
697 }
698
699}
700
701/********************************* Common functions ********************************/
702XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, XGL_SIZE maxLayerCount, XGL_SIZE maxStringSize,
703 XGL_CHAR* const* pOutLayers, XGL_SIZE * pOutLayerCount,
704 XGL_VOID* pReserved)
705{
706 if (pOutLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL || pOutLayers[1] == NULL || pReserved == NULL)
707 return XGL_ERROR_INVALID_POINTER;
708
709 if (maxLayerCount < 2)
710 return XGL_ERROR_INITIALIZATION_FAILED;
711 *pOutLayerCount = 2;
712 strncpy((char *) pOutLayers[0], "multi1", maxStringSize);
713 strncpy((char *) pOutLayers[1], "multi2", maxStringSize);
714 return XGL_SUCCESS;
715}
716
717XGL_LAYER_EXPORT XGL_VOID * XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pName)
718{
719 // to find each layers GPA routine Loader will search via "<layerName>GetProcAddr"
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800720 if (!strncmp("multi1GetProcAddr", pName, sizeof("multi1GetProcAddr")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700721 return (XGL_VOID *) multi1GetProcAddr;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800722 else if (!strncmp("multi2GetProcAddr", pName, sizeof("multi2GetProcAddr")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700723 return (XGL_VOID *) multi2GetProcAddr;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800724 else if (!strncmp("xglGetProcAddr", pName, sizeof("xglGetProcAddr")))
Jon Ashburn79113cc2014-12-01 14:22:40 -0700725 return (XGL_VOID *) xglGetProcAddr;
726
727 // use first layer activated as GPA dispatch table activation happens in order
728 else if (layer1_first_activated)
729 return multi1GetProcAddr(gpu, pName);
730 else if (layer2_first_activated)
731 return multi2GetProcAddr(gpu, pName);
732 else
733 return NULL;
734
735}
736
737#ifdef __cplusplus
738} //extern "C"
739#endif
740
741static void initLayerTable(const XGL_BASE_LAYER_OBJECT *gpuw, XGL_LAYER_DISPATCH_TABLE *pTable, const unsigned int layerNum)
742{
743 GetProcAddrType fpGPA;
744 fpGPA = gpuw->pGPA;
745 assert(fpGPA);
746
747 if (layerNum == 2 && layer1_first_activated == false)
748 layer2_first_activated = true;
749 if (layerNum == 1 && layer2_first_activated == false)
750 layer1_first_activated = true;
751
752 pTable->GetProcAddr = fpGPA;
Chia-I Wuf1a5a742014-12-27 15:16:07 +0800753 pTable->InitAndEnumerateGpus = (InitAndEnumerateGpusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglInitAndEnumerateGpus");
754 pTable->GetGpuInfo = (GetGpuInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetGpuInfo");
755 pTable->CreateDevice = (CreateDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDevice");
756 pTable->DestroyDevice = (DestroyDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyDevice");
757 pTable->GetExtensionSupport = (GetExtensionSupportType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetExtensionSupport");
758 pTable->EnumerateLayers = (EnumerateLayersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEnumerateLayers");
759 pTable->GetDeviceQueue = (GetDeviceQueueType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetDeviceQueue");
760 pTable->QueueSubmit = (QueueSubmitType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSubmit");
761 pTable->QueueSetGlobalMemReferences = (QueueSetGlobalMemReferencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSetGlobalMemReferences");
762 pTable->QueueWaitIdle = (QueueWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueWaitIdle");
763 pTable->DeviceWaitIdle = (DeviceWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDeviceWaitIdle");
764 pTable->GetMemoryHeapCount = (GetMemoryHeapCountType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapCount");
765 pTable->GetMemoryHeapInfo = (GetMemoryHeapInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapInfo");
766 pTable->AllocMemory = (AllocMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAllocMemory");
767 pTable->FreeMemory = (FreeMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglFreeMemory");
768 pTable->SetMemoryPriority = (SetMemoryPriorityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetMemoryPriority");
769 pTable->MapMemory = (MapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglMapMemory");
770 pTable->UnmapMemory = (UnmapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglUnmapMemory");
771 pTable->PinSystemMemory = (PinSystemMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglPinSystemMemory");
772 pTable->RemapVirtualMemoryPages = (RemapVirtualMemoryPagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglRemapVirtualMemoryPages");
773 pTable->GetMultiGpuCompatibility = (GetMultiGpuCompatibilityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMultiGpuCompatibility");
774 pTable->OpenSharedMemory = (OpenSharedMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedMemory");
775 pTable->OpenSharedQueueSemaphore = (OpenSharedQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedQueueSemaphore");
776 pTable->OpenPeerMemory = (OpenPeerMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerMemory");
777 pTable->OpenPeerImage = (OpenPeerImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerImage");
778 pTable->DestroyObject = (DestroyObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyObject");
779 pTable->GetObjectInfo = (GetObjectInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetObjectInfo");
780 pTable->BindObjectMemory = (BindObjectMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBindObjectMemory");
781 pTable->CreateFence = (CreateFenceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateFence");
782 pTable->GetFenceStatus = (GetFenceStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFenceStatus");
783 pTable->WaitForFences = (WaitForFencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitForFences");
784 pTable->CreateQueueSemaphore = (CreateQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueueSemaphore");
785 pTable->SignalQueueSemaphore = (SignalQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSignalQueueSemaphore");
786 pTable->WaitQueueSemaphore = (WaitQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitQueueSemaphore");
787 pTable->CreateEvent = (CreateEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateEvent");
788 pTable->GetEventStatus = (GetEventStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetEventStatus");
789 pTable->SetEvent = (SetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetEvent");
790 pTable->ResetEvent = (ResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetEvent");
791 pTable->CreateQueryPool = (CreateQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueryPool");
792 pTable->GetQueryPoolResults = (GetQueryPoolResultsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetQueryPoolResults");
793 pTable->GetFormatInfo = (GetFormatInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFormatInfo");
794 pTable->CreateImage = (CreateImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImage");
795 pTable->GetImageSubresourceInfo = (GetImageSubresourceInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetImageSubresourceInfo");
796 pTable->CreateImageView = (CreateImageViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImageView");
797 pTable->CreateColorAttachmentView = (CreateColorAttachmentViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorAttachmentView");
798 pTable->CreateDepthStencilView = (CreateDepthStencilViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilView");
799 pTable->CreateShader = (CreateShaderType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateShader");
800 pTable->CreateGraphicsPipeline = (CreateGraphicsPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateGraphicsPipeline");
801 pTable->CreateComputePipeline = (CreateComputePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateComputePipeline");
802 pTable->StorePipeline = (StorePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglStorePipeline");
803 pTable->LoadPipeline = (LoadPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglLoadPipeline");
804 pTable->CreatePipelineDelta = (CreatePipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreatePipelineDelta");
805 pTable->CreateSampler = (CreateSamplerType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateSampler");
806 pTable->CreateDescriptorSet = (CreateDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDescriptorSet");
807 pTable->BeginDescriptorSetUpdate = (BeginDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginDescriptorSetUpdate");
808 pTable->EndDescriptorSetUpdate = (EndDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndDescriptorSetUpdate");
809 pTable->AttachSamplerDescriptors = (AttachSamplerDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachSamplerDescriptors");
810 pTable->AttachImageViewDescriptors = (AttachImageViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachImageViewDescriptors");
811 pTable->AttachMemoryViewDescriptors = (AttachMemoryViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachMemoryViewDescriptors");
812 pTable->AttachNestedDescriptors = (AttachNestedDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachNestedDescriptors");
813 pTable->ClearDescriptorSetSlots = (ClearDescriptorSetSlotsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglClearDescriptorSetSlots");
814 pTable->CreateViewportState = (CreateViewportStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateViewportState");
815 pTable->CreateRasterState = (CreateRasterStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateRasterState");
816 pTable->CreateMsaaState = (CreateMsaaStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateMsaaState");
817 pTable->CreateColorBlendState = (CreateColorBlendStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorBlendState");
818 pTable->CreateDepthStencilState = (CreateDepthStencilStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilState");
819 pTable->CreateCommandBuffer = (CreateCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateCommandBuffer");
820 pTable->BeginCommandBuffer = (BeginCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginCommandBuffer");
821 pTable->EndCommandBuffer = (EndCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndCommandBuffer");
822 pTable->ResetCommandBuffer = (ResetCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetCommandBuffer");
823 pTable->CmdBindPipeline = (CmdBindPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipeline");
824 pTable->CmdBindPipelineDelta = (CmdBindPipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipelineDelta");
825 pTable->CmdBindStateObject = (CmdBindStateObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindStateObject");
826 pTable->CmdBindDescriptorSet = (CmdBindDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDescriptorSet");
827 pTable->CmdBindDynamicMemoryView = (CmdBindDynamicMemoryViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDynamicMemoryView");
828 pTable->CmdBindVertexData = (CmdBindVertexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindVertexData");
829 pTable->CmdBindIndexData = (CmdBindIndexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindIndexData");
830 pTable->CmdBindAttachments = (CmdBindAttachmentsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindAttachments");
831 pTable->CmdPrepareMemoryRegions = (CmdPrepareMemoryRegionsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareMemoryRegions");
832 pTable->CmdPrepareImages = (CmdPrepareImagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareImages");
833 pTable->CmdDraw = (CmdDrawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDraw");
834 pTable->CmdDrawIndexed = (CmdDrawIndexedType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexed");
835 pTable->CmdDrawIndirect = (CmdDrawIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndirect");
836 pTable->CmdDrawIndexedIndirect = (CmdDrawIndexedIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexedIndirect");
837 pTable->CmdDispatch = (CmdDispatchType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatch");
838 pTable->CmdDispatchIndirect = (CmdDispatchIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatchIndirect");
839 pTable->CmdCopyMemory = (CmdCopyMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemory");
840 pTable->CmdCopyImage = (CmdCopyImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImage");
841 pTable->CmdCopyMemoryToImage = (CmdCopyMemoryToImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemoryToImage");
842 pTable->CmdCopyImageToMemory = (CmdCopyImageToMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImageToMemory");
843 pTable->CmdCloneImageData = (CmdCloneImageDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCloneImageData");
844 pTable->CmdUpdateMemory = (CmdUpdateMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdUpdateMemory");
845 pTable->CmdFillMemory = (CmdFillMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdFillMemory");
846 pTable->CmdClearColorImage = (CmdClearColorImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImage");
847 pTable->CmdClearColorImageRaw = (CmdClearColorImageRawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImageRaw");
848 pTable->CmdClearDepthStencil = (CmdClearDepthStencilType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearDepthStencil");
849 pTable->CmdResolveImage = (CmdResolveImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResolveImage");
850 pTable->CmdSetEvent = (CmdSetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSetEvent");
851 pTable->CmdResetEvent = (CmdResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetEvent");
852 pTable->CmdMemoryAtomic = (CmdMemoryAtomicType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdMemoryAtomic");
853 pTable->CmdBeginQuery = (CmdBeginQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBeginQuery");
854 pTable->CmdEndQuery = (CmdEndQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdEndQuery");
855 pTable->CmdResetQueryPool = (CmdResetQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetQueryPool");
856 pTable->CmdWriteTimestamp = (CmdWriteTimestampType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdWriteTimestamp");
857 pTable->CmdInitAtomicCounters = (CmdInitAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdInitAtomicCounters");
858 pTable->CmdLoadAtomicCounters = (CmdLoadAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdLoadAtomicCounters");
859 pTable->CmdSaveAtomicCounters = (CmdSaveAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSaveAtomicCounters");
860 pTable->DbgSetValidationLevel = (DbgSetValidationLevelType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetValidationLevel");
861 pTable->DbgRegisterMsgCallback = (DbgRegisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgRegisterMsgCallback");
862 pTable->DbgUnregisterMsgCallback = (DbgUnregisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgUnregisterMsgCallback");
863 pTable->DbgSetMessageFilter = (DbgSetMessageFilterType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetMessageFilter");
864 pTable->DbgSetObjectTag = (DbgSetObjectTagType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetObjectTag");
865 pTable->DbgSetGlobalOption = (DbgSetGlobalOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetGlobalOption");
866 pTable->DbgSetDeviceOption = (DbgSetDeviceOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetDeviceOption");
867 pTable->CmdDbgMarkerBegin = (CmdDbgMarkerBeginType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerBegin");
868 pTable->CmdDbgMarkerEnd = (CmdDbgMarkerEndType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerEnd");
869 pTable->WsiX11AssociateConnection = (WsiX11AssociateConnectionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11AssociateConnection");
870 pTable->WsiX11GetMSC = (WsiX11GetMSCType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11GetMSC");
871 pTable->WsiX11CreatePresentableImage = (WsiX11CreatePresentableImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11CreatePresentableImage");
872 pTable->WsiX11QueuePresent = (WsiX11QueuePresentType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11QueuePresent");
Jon Ashburn79113cc2014-12-01 14:22:40 -0700873}