blob: 143b3c306ada49ad16eed876096b2a1e8cada032 [file] [log] [blame]
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001/*
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#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28#include <assert.h>
29#include <pthread.h>
Tobin Ehlis266473d2014-12-16 17:34:50 -070030#include <unistd.h>
Tobin Ehlisb8154982014-10-27 14:53:17 -060031#include "xgl_struct_string_helper.h"
Tobin Ehlisa701ef02014-11-27 15:43:39 -070032#include "xgl_struct_graphviz_helper.h"
Tobin Ehlise79df942014-11-18 16:38:08 -070033#include "draw_state.h"
Tobin Ehlis8726b9f2014-10-24 12:01:45 -060034
35static XGL_LAYER_DISPATCH_TABLE nextTable;
36static XGL_BASE_LAYER_OBJECT *pCurObj;
37static pthread_once_t tabOnce = PTHREAD_ONCE_INIT;
Tobin Ehlis9e142a32014-11-21 12:04:39 -070038// Could be smarter about locking with unique locks for various tasks, but just using one for now
39pthread_mutex_t globalLock = PTHREAD_MUTEX_INITIALIZER;
Tobin Ehlise79df942014-11-18 16:38:08 -070040// Ptr to LL of dbg functions
41static XGL_LAYER_DBG_FUNCTION_NODE *pDbgFunctionHead = NULL;
42// Utility function to handle reporting
43// If callbacks are enabled, use them, otherwise use printf
44static XGL_VOID layerCbMsg(XGL_DBG_MSG_TYPE msgType,
45 XGL_VALIDATION_LEVEL validationLevel,
46 XGL_BASE_OBJECT srcObject,
47 XGL_SIZE location,
48 XGL_INT msgCode,
Chia-I Wua837c522014-12-16 10:47:33 +080049 const char* pLayerPrefix,
50 const char* pMsg)
Tobin Ehlise79df942014-11-18 16:38:08 -070051{
52 XGL_LAYER_DBG_FUNCTION_NODE *pTrav = pDbgFunctionHead;
53 if (pTrav) {
54 while (pTrav) {
Chia-I Wu7461fcf2014-12-27 15:16:07 +080055 pTrav->pfnMsgCallback(msgType, validationLevel, srcObject, location, msgCode, pMsg, pTrav->pUserData);
Tobin Ehlise79df942014-11-18 16:38:08 -070056 pTrav = pTrav->pNext;
57 }
58 }
59 else {
60 switch (msgType) {
61 case XGL_DBG_MSG_ERROR:
62 printf("{%s}ERROR : %s\n", pLayerPrefix, pMsg);
63 break;
64 case XGL_DBG_MSG_WARNING:
65 printf("{%s}WARN : %s\n", pLayerPrefix, pMsg);
66 break;
67 case XGL_DBG_MSG_PERF_WARNING:
68 printf("{%s}PERF_WARN : %s\n", pLayerPrefix, pMsg);
69 break;
70 default:
71 printf("{%s}INFO : %s\n", pLayerPrefix, pMsg);
72 break;
73 }
74 }
75}
Tobin Ehlis26092022014-11-20 09:49:17 -070076// Return the size of the underlying struct based on struct type
77static XGL_SIZE sTypeStructSize(XGL_STRUCTURE_TYPE sType)
78{
79 switch (sType)
80 {
81 case XGL_STRUCTURE_TYPE_APPLICATION_INFO:
82 return sizeof(XGL_APPLICATION_INFO);
83 case XGL_STRUCTURE_TYPE_DEVICE_CREATE_INFO:
84 return sizeof(XGL_DEVICE_CREATE_INFO);
85 case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO:
86 return sizeof(XGL_MEMORY_ALLOC_INFO);
87 case XGL_STRUCTURE_TYPE_MEMORY_OPEN_INFO:
88 return sizeof(XGL_MEMORY_OPEN_INFO);
89 case XGL_STRUCTURE_TYPE_PEER_MEMORY_OPEN_INFO:
90 return sizeof(XGL_PEER_MEMORY_OPEN_INFO);
91 case XGL_STRUCTURE_TYPE_MEMORY_VIEW_ATTACH_INFO:
92 return sizeof(XGL_MEMORY_VIEW_ATTACH_INFO);
93 case XGL_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO:
94 return sizeof(XGL_IMAGE_VIEW_ATTACH_INFO);
95 case XGL_STRUCTURE_TYPE_MEMORY_STATE_TRANSITION:
96 return sizeof(XGL_MEMORY_STATE_TRANSITION);
97 case XGL_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO:
98 return sizeof(XGL_IMAGE_VIEW_CREATE_INFO);
99 case XGL_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO:
100 return sizeof(XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO);
101 case XGL_STRUCTURE_TYPE_DEPTH_STENCIL_VIEW_CREATE_INFO:
102 return sizeof(XGL_DEPTH_STENCIL_VIEW_CREATE_INFO);
103 case XGL_STRUCTURE_TYPE_SHADER_CREATE_INFO:
104 return sizeof(XGL_SHADER_CREATE_INFO);
105 case XGL_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO:
106 return sizeof(XGL_COMPUTE_PIPELINE_CREATE_INFO);
107 case XGL_STRUCTURE_TYPE_SAMPLER_CREATE_INFO:
108 return sizeof(XGL_SAMPLER_CREATE_INFO);
109 case XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_CREATE_INFO:
110 return sizeof(XGL_DESCRIPTOR_SET_CREATE_INFO);
111 case XGL_STRUCTURE_TYPE_RASTER_STATE_CREATE_INFO:
112 return sizeof(XGL_RASTER_STATE_CREATE_INFO);
113 case XGL_STRUCTURE_TYPE_MSAA_STATE_CREATE_INFO:
114 return sizeof(XGL_MSAA_STATE_CREATE_INFO);
115 case XGL_STRUCTURE_TYPE_COLOR_BLEND_STATE_CREATE_INFO:
116 return sizeof(XGL_COLOR_BLEND_STATE_CREATE_INFO);
117 case XGL_STRUCTURE_TYPE_DEPTH_STENCIL_STATE_CREATE_INFO:
118 return sizeof(XGL_DEPTH_STENCIL_STATE_CREATE_INFO);
119 case XGL_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO:
120 return sizeof(XGL_CMD_BUFFER_CREATE_INFO);
121 case XGL_STRUCTURE_TYPE_EVENT_CREATE_INFO:
122 return sizeof(XGL_EVENT_CREATE_INFO);
123 case XGL_STRUCTURE_TYPE_FENCE_CREATE_INFO:
124 return sizeof(XGL_FENCE_CREATE_INFO);
125 case XGL_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO:
126 return sizeof(XGL_QUEUE_SEMAPHORE_CREATE_INFO);
127 case XGL_STRUCTURE_TYPE_SEMAPHORE_OPEN_INFO:
128 return sizeof(XGL_QUEUE_SEMAPHORE_OPEN_INFO);
129 case XGL_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO:
130 return sizeof(XGL_QUERY_POOL_CREATE_INFO);
131 case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:
132 return sizeof(XGL_PIPELINE_SHADER_STAGE_CREATE_INFO);
133 case XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO:
134 return sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO);
135 case XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO:
136 return sizeof(XGL_PIPELINE_IA_STATE_CREATE_INFO);
137 case XGL_STRUCTURE_TYPE_PIPELINE_DB_STATE_CREATE_INFO:
138 return sizeof(XGL_PIPELINE_DB_STATE_CREATE_INFO);
139 case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:
140 return sizeof(XGL_PIPELINE_CB_STATE);
141 case XGL_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO:
142 return sizeof(XGL_PIPELINE_RS_STATE_CREATE_INFO);
143 case XGL_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO:
144 return sizeof(XGL_PIPELINE_TESS_STATE_CREATE_INFO);
145 case XGL_STRUCTURE_TYPE_IMAGE_CREATE_INFO:
146 return sizeof(XGL_IMAGE_CREATE_INFO);
147 case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:
148 return sizeof(XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO);
149 case XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO:
150 return sizeof(XGL_LAYER_CREATE_INFO);
151 default:
152 return 0;
153 }
154}
Tobin Ehlis56a61072014-11-21 08:58:46 -0700155// Return the size of the underlying struct based on Bind Point enum
156// Have to do this b/c VIEWPORT doesn't have sType in its createinfo struct
Chia-I Wu84d7f5c2014-12-16 00:43:20 +0800157static XGL_SIZE dynStateCreateInfoSize(XGL_STATE_BIND_POINT sType)
Tobin Ehlis56a61072014-11-21 08:58:46 -0700158{
159 switch (sType)
160 {
161 case XGL_STATE_BIND_VIEWPORT:
162 return sizeof(XGL_VIEWPORT_STATE_CREATE_INFO);
163 case XGL_STATE_BIND_RASTER:
164 return sizeof(XGL_RASTER_STATE_CREATE_INFO);
165 case XGL_STATE_BIND_DEPTH_STENCIL:
166 return sizeof(XGL_DEPTH_STENCIL_STATE_CREATE_INFO);
167 case XGL_STATE_BIND_COLOR_BLEND:
168 return sizeof(XGL_COLOR_BLEND_STATE_CREATE_INFO);
169 case XGL_STATE_BIND_MSAA:
170 return sizeof(XGL_MSAA_STATE_CREATE_INFO);
171 default:
172 return 0;
173 }
174}
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600175// Block of code at start here for managing/tracking Pipeline state that this layer cares about
176// Just track 2 shaders for now
Tobin Ehlis26092022014-11-20 09:49:17 -0700177#define XGL_NUM_GRAPHICS_SHADERS XGL_SHADER_STAGE_COMPUTE
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600178#define MAX_SLOTS 2048
Tobin Ehlisb8154982014-10-27 14:53:17 -0600179
180static uint64_t drawCount[NUM_DRAW_TYPES] = {0, 0, 0, 0};
181
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600182typedef struct _SHADER_DS_MAPPING {
183 XGL_UINT slotCount;
184 XGL_DESCRIPTOR_SLOT_INFO* pShaderMappingSlot;
185} SHADER_DS_MAPPING;
186
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600187typedef struct _PIPELINE_LL_HEADER {
188 XGL_STRUCTURE_TYPE sType;
189 const XGL_VOID* pNext;
190} PIPELINE_LL_HEADER;
191
Tobin Ehlis26092022014-11-20 09:49:17 -0700192typedef struct _PIPELINE_NODE {
193 XGL_PIPELINE pipeline;
194 struct _PIPELINE_NODE *pNext;
Tobin Ehlis56a61072014-11-21 08:58:46 -0700195 XGL_GRAPHICS_PIPELINE_CREATE_INFO *pCreateTree; // Ptr to shadow of data in create tree
Tobin Ehlis26092022014-11-20 09:49:17 -0700196 // 1st dimension of array is shader type
197 SHADER_DS_MAPPING dsMapping[XGL_NUM_GRAPHICS_SHADERS][XGL_MAX_DESCRIPTOR_SETS];
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700198 // Vtx input info (if any)
199 XGL_UINT vtxBindingCount; // number of bindings
200 XGL_VERTEX_INPUT_BINDING_DESCRIPTION* pVertexBindingDescriptions;
201 XGL_UINT vtxAttributeCount; // number of attributes
202 XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION* pVertexAttributeDescriptions;
Tobin Ehlis26092022014-11-20 09:49:17 -0700203} PIPELINE_NODE;
204
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700205typedef struct _SAMPLER_NODE {
206 XGL_SAMPLER sampler;
207 XGL_SAMPLER_CREATE_INFO createInfo;
208 struct _SAMPLER_NODE *pNext;
209} SAMPLER_NODE;
210
Tobin Ehlis56a61072014-11-21 08:58:46 -0700211typedef struct _DYNAMIC_STATE_NODE {
212 XGL_STATE_OBJECT stateObj;
213 XGL_STATE_BIND_POINT sType; // Extra data as VIEWPORT CreateInfo doesn't have sType
214 PIPELINE_LL_HEADER *pCreateInfo;
215 struct _DYNAMIC_STATE_NODE *pNext;
216} DYNAMIC_STATE_NODE;
217
218// TODO : Should be tracking lastBound per cmdBuffer and when draws occur, report based on that cmd buffer lastBound
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700219// Then need to synchronize the accesses based on cmd buffer so that if I'm reading state on one cmd buffer, updates
220// to that same cmd buffer by separate thread are not changing state from underneath us
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600221static PIPELINE_NODE *pPipelineHead = NULL;
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700222static SAMPLER_NODE *pSamplerHead = NULL;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600223static XGL_PIPELINE lastBoundPipeline = NULL;
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700224#define MAX_BINDING 0xFFFFFFFF
225static XGL_UINT lastVtxBinding = MAX_BINDING;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600226
Tobin Ehlis56a61072014-11-21 08:58:46 -0700227static DYNAMIC_STATE_NODE* pDynamicStateHead[XGL_NUM_STATE_BIND_POINT] = {0};
228static DYNAMIC_STATE_NODE* pLastBoundDynamicState[XGL_NUM_STATE_BIND_POINT] = {0};
229
230// Viewport state create info doesn't have sType so we have to pass in BIND_POINT
231static void insertDynamicState(const XGL_STATE_OBJECT state, const PIPELINE_LL_HEADER* pCreateInfo, const XGL_STATE_BIND_POINT sType)
232{
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700233 pthread_mutex_lock(&globalLock);
Tobin Ehlis56a61072014-11-21 08:58:46 -0700234 // Insert new node at head of appropriate LL
235 DYNAMIC_STATE_NODE* pStateNode = (DYNAMIC_STATE_NODE*)malloc(sizeof(DYNAMIC_STATE_NODE));
236 pStateNode->pNext = pDynamicStateHead[sType];
237 pDynamicStateHead[sType] = pStateNode;
238 pStateNode->stateObj = state;
239 pStateNode->sType = sType;
240 pStateNode->pCreateInfo = (PIPELINE_LL_HEADER*)malloc(dynStateCreateInfoSize(sType));
241 memcpy(pStateNode->pCreateInfo, pCreateInfo, dynStateCreateInfoSize(sType));
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700242 pthread_mutex_unlock(&globalLock);
Tobin Ehlis56a61072014-11-21 08:58:46 -0700243}
244// Set the last bound dynamic state of given type
245// TODO : Need to track this per cmdBuffer and correlate cmdBuffer for Draw w/ last bound for that cmdBuffer?
246static void setLastBoundDynamicState(const XGL_STATE_OBJECT state, const XGL_STATE_BIND_POINT sType)
247{
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700248 pthread_mutex_lock(&globalLock);
Tobin Ehlis56a61072014-11-21 08:58:46 -0700249 DYNAMIC_STATE_NODE* pTrav = pDynamicStateHead[sType];
250 while (pTrav && (state != pTrav->stateObj)) {
251 pTrav = pTrav->pNext;
252 }
253 if (!pTrav) {
254 char str[1024];
255 sprintf(str, "Unable to find dynamic state object %p, was it ever created?", (void*)state);
256 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, state, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", str);
257 }
258 pLastBoundDynamicState[sType] = pTrav;
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700259 pthread_mutex_unlock(&globalLock);
Tobin Ehlis56a61072014-11-21 08:58:46 -0700260}
261// Print the last bound dynamic state
262static void printDynamicState()
263{
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700264 pthread_mutex_lock(&globalLock);
Tobin Ehlis56a61072014-11-21 08:58:46 -0700265 char str[1024];
266 for (uint32_t i = 0; i < XGL_NUM_STATE_BIND_POINT; i++) {
267 if (pLastBoundDynamicState[i]) {
268 sprintf(str, "Reporting CreateInfo for currently bound %s object %p", string_XGL_STATE_BIND_POINT(i), pLastBoundDynamicState[i]->stateObj);
269 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pLastBoundDynamicState[i]->stateObj, 0, DRAWSTATE_NONE, "DS", str);
270 switch (pLastBoundDynamicState[i]->sType)
271 {
272 case XGL_STATE_BIND_VIEWPORT:
273 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pLastBoundDynamicState[i]->stateObj, 0, DRAWSTATE_NONE, "DS", xgl_print_xgl_viewport_state_create_info((XGL_VIEWPORT_STATE_CREATE_INFO*)pLastBoundDynamicState[i]->pCreateInfo, " "));
274 break;
275 default:
276 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pLastBoundDynamicState[i]->stateObj, 0, DRAWSTATE_NONE, "DS", dynamic_display(pLastBoundDynamicState[i]->pCreateInfo, " "));
277 break;
278 }
279 }
280 else {
281 sprintf(str, "No dynamic state of type %s bound", string_XGL_STATE_BIND_POINT(i));
282 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", str);
283 }
284 }
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700285 pthread_mutex_unlock(&globalLock);
Tobin Ehlis56a61072014-11-21 08:58:46 -0700286}
287// Retrieve pipeline node ptr for given pipeline object
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600288static PIPELINE_NODE *getPipeline(XGL_PIPELINE pipeline)
289{
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700290 pthread_mutex_lock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600291 PIPELINE_NODE *pTrav = pPipelineHead;
292 while (pTrav) {
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700293 if (pTrav->pipeline == pipeline) {
294 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600295 return pTrav;
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700296 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600297 pTrav = pTrav->pNext;
298 }
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700299 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600300 return NULL;
301}
302
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700303// For given sampler, return a ptr to its Create Info struct, or NULL if sampler not found
304static XGL_SAMPLER_CREATE_INFO* getSamplerCreateInfo(const XGL_SAMPLER sampler)
305{
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700306 pthread_mutex_lock(&globalLock);
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700307 SAMPLER_NODE *pTrav = pSamplerHead;
308 while (pTrav) {
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700309 if (sampler == pTrav->sampler) {
310 pthread_mutex_unlock(&globalLock);
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700311 return &pTrav->createInfo;
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700312 }
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700313 pTrav = pTrav->pNext;
314 }
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700315 pthread_mutex_unlock(&globalLock);
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700316 return NULL;
317}
318
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600319// Init the pipeline mapping info based on pipeline create info LL tree
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700320// Threading note : Calls to this function should wrapped in mutex
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600321static void initPipeline(PIPELINE_NODE *pPipeline, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo)
322{
Tobin Ehlis26092022014-11-20 09:49:17 -0700323 // First init create info, we'll shadow the structs as we go down the tree
Tobin Ehlis56a61072014-11-21 08:58:46 -0700324 pPipeline->pCreateTree = (XGL_GRAPHICS_PIPELINE_CREATE_INFO*)malloc(sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO));
Tobin Ehlis26092022014-11-20 09:49:17 -0700325 memcpy(pPipeline->pCreateTree, pCreateInfo, sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO));
Tobin Ehlis56a61072014-11-21 08:58:46 -0700326 PIPELINE_LL_HEADER *pShadowTrav = (PIPELINE_LL_HEADER*)pPipeline->pCreateTree;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600327 PIPELINE_LL_HEADER *pTrav = (PIPELINE_LL_HEADER*)pCreateInfo->pNext;
328 while (pTrav) {
Tobin Ehlis26092022014-11-20 09:49:17 -0700329 // Shadow the struct
330 pShadowTrav->pNext = (PIPELINE_LL_HEADER*)malloc(sTypeStructSize(pTrav->sType));
331 // Typically pNext is const so have to cast to avoid warning when we modify it here
332 memcpy((void*)pShadowTrav->pNext, pTrav, sTypeStructSize(pTrav->sType));
333 pShadowTrav = (PIPELINE_LL_HEADER*)pShadowTrav->pNext;
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700334 // For deep copy DS Mapping into shadow
335 XGL_PIPELINE_SHADER_STAGE_CREATE_INFO *pShadowShaderCI = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pShadowTrav;
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700336 // TODO : Now that we shadow whole create info, the special copies are just a convenience that can be done away with once shadow is complete and correct
Tobin Ehlis26092022014-11-20 09:49:17 -0700337 // Special copy of DS Mapping info
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600338 if (XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO == pTrav->sType) {
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700339 XGL_PIPELINE_SHADER_STAGE_CREATE_INFO *pSSCI = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pTrav;
Tobin Ehlis26092022014-11-20 09:49:17 -0700340 for (uint32_t i = 0; i < XGL_MAX_DESCRIPTOR_SETS; i++) {
341 if (pSSCI->shader.descriptorSetMapping[i].descriptorCount > MAX_SLOTS) {
342 char str[1024];
343 sprintf(str, "descriptorCount for %s exceeds 2048 (%u), is this correct? Changing to 0", string_XGL_PIPELINE_SHADER_STAGE(pSSCI->shader.stage), pSSCI->shader.descriptorSetMapping[i].descriptorCount);
344 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pPipeline, 0, DRAWSTATE_DESCRIPTOR_MAX_EXCEEDED, "DS", str);
345 pSSCI->shader.descriptorSetMapping[i].descriptorCount = 0;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600346 }
Tobin Ehlis26092022014-11-20 09:49:17 -0700347 pPipeline->dsMapping[pSSCI->shader.stage][i].slotCount = pSSCI->shader.descriptorSetMapping[i].descriptorCount;
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700348 // Deep copy DS Slot array into our shortcut data structure
Tobin Ehlis26092022014-11-20 09:49:17 -0700349 pPipeline->dsMapping[pSSCI->shader.stage][i].pShaderMappingSlot = (XGL_DESCRIPTOR_SLOT_INFO*)malloc(sizeof(XGL_DESCRIPTOR_SLOT_INFO)*pPipeline->dsMapping[pSSCI->shader.stage][i].slotCount);
350 memcpy(pPipeline->dsMapping[pSSCI->shader.stage][i].pShaderMappingSlot, pSSCI->shader.descriptorSetMapping[i].pDescriptorInfo, sizeof(XGL_DESCRIPTOR_SLOT_INFO)*pPipeline->dsMapping[pSSCI->shader.stage][i].slotCount);
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700351 // Deep copy into shadow tree
352 pShadowShaderCI->shader.descriptorSetMapping[i].descriptorCount = pSSCI->shader.descriptorSetMapping[i].descriptorCount;
353 pShadowShaderCI->shader.descriptorSetMapping[i].pDescriptorInfo = (XGL_DESCRIPTOR_SLOT_INFO*)malloc(sizeof(XGL_DESCRIPTOR_SLOT_INFO)*pShadowShaderCI->shader.descriptorSetMapping[i].descriptorCount);
354 memcpy((XGL_DESCRIPTOR_SLOT_INFO*)pShadowShaderCI->shader.descriptorSetMapping[i].pDescriptorInfo, pSSCI->shader.descriptorSetMapping[i].pDescriptorInfo, sizeof(XGL_DESCRIPTOR_SLOT_INFO)*pShadowShaderCI->shader.descriptorSetMapping[i].descriptorCount);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600355 }
356 }
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700357 else if (XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO == pTrav->sType) {
358 // Special copy of Vtx info
359 XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pVICI = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO*)pTrav;
360 pPipeline->vtxBindingCount = pVICI->bindingCount;
361 uint32_t allocSize = pPipeline->vtxBindingCount * sizeof(XGL_VERTEX_INPUT_BINDING_DESCRIPTION);
362 pPipeline->pVertexBindingDescriptions = (XGL_VERTEX_INPUT_BINDING_DESCRIPTION*)malloc(allocSize);
363 memcpy(pPipeline->pVertexBindingDescriptions, pVICI->pVertexAttributeDescriptions, allocSize);
364 pPipeline->vtxAttributeCount = pVICI->attributeCount;
365 allocSize = pPipeline->vtxAttributeCount * sizeof(XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION);
366 pPipeline->pVertexAttributeDescriptions = (XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION*)malloc(allocSize);
367 memcpy(pPipeline->pVertexAttributeDescriptions, pVICI->pVertexAttributeDescriptions, allocSize);
368 }
Tobin Ehlisb8154982014-10-27 14:53:17 -0600369 pTrav = (PIPELINE_LL_HEADER*)pTrav->pNext;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600370 }
371}
372
373// Block of code at start here specifically for managing/tracking DSs
374#define MAPPING_MEMORY 0x00000001
375#define MAPPING_IMAGE 0x00000002
376#define MAPPING_SAMPLER 0x00000004
377#define MAPPING_DS 0x00000008
378
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600379static char* stringSlotBinding(XGL_UINT binding)
380{
381 switch (binding)
382 {
383 case MAPPING_MEMORY:
384 return "Memory View";
385 case MAPPING_IMAGE:
386 return "Image View";
387 case MAPPING_SAMPLER:
388 return "Sampler";
389 default:
390 return "UNKNOWN DS BINDING";
391 }
392}
393
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600394typedef struct _DS_SLOT {
395 XGL_UINT slot;
Tobin Ehlis26092022014-11-20 09:49:17 -0700396 XGL_DESCRIPTOR_SLOT_INFO shaderSlotInfo[XGL_NUM_GRAPHICS_SHADERS];
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600397 // Only 1 of 4 possible slot mappings active
398 XGL_UINT activeMapping;
399 XGL_UINT mappingMask; // store record of different mappings used
400 XGL_MEMORY_VIEW_ATTACH_INFO memView;
401 XGL_IMAGE_VIEW_ATTACH_INFO imageView;
402 XGL_SAMPLER sampler;
403} DS_SLOT;
404
405// Top-level node that points to start of DS
406typedef struct _DS_LL_HEAD {
407 XGL_DESCRIPTOR_SET dsID;
408 XGL_UINT numSlots;
409 struct _DS_LL_HEAD *pNextDS;
410 DS_SLOT *dsSlot; // Dynamically allocated array of DS_SLOTs
411 XGL_BOOL updateActive; // Track if DS is in an update block
412} DS_LL_HEAD;
413
414// ptr to HEAD of LL of DSs
415static DS_LL_HEAD *pDSHead = NULL;
Tobin Ehliseacc64f2014-11-24 17:09:09 -0700416// Last DS that was bound, and slotOffset for the binding
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600417static XGL_DESCRIPTOR_SET lastBoundDS[XGL_MAX_DESCRIPTOR_SETS] = {NULL, NULL};
Tobin Ehliseacc64f2014-11-24 17:09:09 -0700418static XGL_UINT lastBoundSlotOffset[XGL_MAX_DESCRIPTOR_SETS] = {0, 0};
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600419
420// Return DS Head ptr for specified ds or else NULL
421static DS_LL_HEAD* getDS(XGL_DESCRIPTOR_SET ds)
422{
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700423 pthread_mutex_lock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600424 DS_LL_HEAD *pTrav = pDSHead;
425 while (pTrav) {
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700426 if (pTrav->dsID == ds) {
427 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600428 return pTrav;
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700429 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600430 pTrav = pTrav->pNextDS;
431 }
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700432 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600433 return NULL;
434}
435
436// Initialize a DS where all slots are UNUSED for all shaders
437static void initDS(DS_LL_HEAD *pDS)
438{
439 for (uint32_t i = 0; i < pDS->numSlots; i++) {
440 memset((void*)&pDS->dsSlot[i], 0, sizeof(DS_SLOT));
441 pDS->dsSlot[i].slot = i;
442 }
443}
444
445// Return XGL_TRUE if DS Exists and is within an xglBeginDescriptorSetUpdate() call sequence, otherwise XGL_FALSE
446static XGL_BOOL dsUpdate(XGL_DESCRIPTOR_SET ds)
447{
448 DS_LL_HEAD *pTrav = getDS(ds);
449 if (pTrav)
450 return pTrav->updateActive;
451 return XGL_FALSE;
452}
453
454// Clear specified slotCount DS Slots starting at startSlot
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700455// Return XGL_TRUE if DS exists and is successfully cleared to 0s
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600456static XGL_BOOL clearDS(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount)
457{
458 DS_LL_HEAD *pTrav = getDS(descriptorSet);
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700459 pthread_mutex_lock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600460 if (!pTrav || ((startSlot + slotCount) > pTrav->numSlots)) {
461 // TODO : Log more meaningful error here
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700462 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600463 return XGL_FALSE;
464 }
465 for (uint32_t i = startSlot; i < slotCount; i++) {
466 memset((void*)&pTrav->dsSlot[i], 0, sizeof(DS_SLOT));
467 }
Tobin Ehlis9e142a32014-11-21 12:04:39 -0700468 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600469 return XGL_TRUE;
470}
471
472static void dsSetMapping(DS_SLOT* pSlot, XGL_UINT mapping)
473{
474 pSlot->mappingMask |= mapping;
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600475 pSlot->activeMapping = mapping;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600476}
Tobin Ehlise79df942014-11-18 16:38:08 -0700477// Populate pStr w/ a string noting all of the slot mappings based on mapping flag
478static char* noteSlotMapping(XGL_UINT32 mapping, char *pStr)
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600479{
480 if (MAPPING_MEMORY & mapping)
Tobin Ehlise79df942014-11-18 16:38:08 -0700481 strcat(pStr, "\n\tMemory View previously mapped");
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600482 if (MAPPING_IMAGE & mapping)
Tobin Ehlise79df942014-11-18 16:38:08 -0700483 strcat(pStr, "\n\tImage View previously mapped");
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600484 if (MAPPING_SAMPLER & mapping)
Tobin Ehlise79df942014-11-18 16:38:08 -0700485 strcat(pStr, "\n\tSampler previously mapped");
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600486 if (MAPPING_DS & mapping)
Tobin Ehlise79df942014-11-18 16:38:08 -0700487 strcat(pStr, "\n\tDESCRIPTOR SET ptr previously mapped");
488 return pStr;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600489}
490
Tobin Ehlise79df942014-11-18 16:38:08 -0700491static void dsSetMemMapping(XGL_DESCRIPTOR_SET descriptorSet, DS_SLOT* pSlot, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView)
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600492{
493 if (pSlot->mappingMask) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700494 char str[1024];
495 char map_str[1024] = {0};
496 sprintf(str, "While mapping Memory View to slot %u previous Mapping(s) identified:%s", pSlot->slot, noteSlotMapping(pSlot->mappingMask, map_str));
497 layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_SLOT_REMAPPING, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600498 }
499 memcpy(&pSlot->memView, pMemView, sizeof(XGL_MEMORY_VIEW_ATTACH_INFO));
500 dsSetMapping(pSlot, MAPPING_MEMORY);
501}
502
503static XGL_BOOL dsMemMapping(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews)
504{
505 DS_LL_HEAD *pTrav = getDS(descriptorSet);
506 if (pTrav) {
507 if (pTrav->numSlots < (startSlot + slotCount)) {
508 return XGL_FALSE;
509 }
510 for (uint32_t i = 0; i < slotCount; i++) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700511 dsSetMemMapping(descriptorSet, &pTrav->dsSlot[i+startSlot], &pMemViews[i]);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600512 }
513 }
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600514 else
515 return XGL_FALSE;
516 return XGL_TRUE;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600517}
518
Tobin Ehlise79df942014-11-18 16:38:08 -0700519static void dsSetImageMapping(XGL_DESCRIPTOR_SET descriptorSet, DS_SLOT* pSlot, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews)
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600520{
521 if (pSlot->mappingMask) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700522 char str[1024];
523 char map_str[1024] = {0};
524 sprintf(str, "While mapping Image View to slot %u previous Mapping(s) identified:%s", pSlot->slot, noteSlotMapping(pSlot->mappingMask, map_str));
525 layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_SLOT_REMAPPING, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600526 }
527 memcpy(&pSlot->imageView, pImageViews, sizeof(XGL_IMAGE_VIEW_ATTACH_INFO));
528 dsSetMapping(pSlot, MAPPING_IMAGE);
529}
530
531static XGL_BOOL dsImageMapping(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews)
532{
533 DS_LL_HEAD *pTrav = getDS(descriptorSet);
534 if (pTrav) {
535 if (pTrav->numSlots < (startSlot + slotCount)) {
536 return XGL_FALSE;
537 }
538 for (uint32_t i = 0; i < slotCount; i++) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700539 dsSetImageMapping(descriptorSet, &pTrav->dsSlot[i+startSlot], &pImageViews[i]);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600540 }
541 }
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600542 else
543 return XGL_FALSE;
544 return XGL_TRUE;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600545}
546
Tobin Ehlise79df942014-11-18 16:38:08 -0700547static void dsSetSamplerMapping(XGL_DESCRIPTOR_SET descriptorSet, DS_SLOT* pSlot, const XGL_SAMPLER sampler)
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600548{
549 if (pSlot->mappingMask) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700550 char str[1024];
551 char map_str[1024] = {0};
552 sprintf(str, "While mapping Sampler to slot %u previous Mapping(s) identified:%s", pSlot->slot, noteSlotMapping(pSlot->mappingMask, map_str));
553 layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_SLOT_REMAPPING, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600554 }
555 pSlot->sampler = sampler;
556 dsSetMapping(pSlot, MAPPING_SAMPLER);
557}
558
559static XGL_BOOL dsSamplerMapping(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers)
560{
561 DS_LL_HEAD *pTrav = getDS(descriptorSet);
562 if (pTrav) {
563 if (pTrav->numSlots < (startSlot + slotCount)) {
564 return XGL_FALSE;
565 }
566 for (uint32_t i = 0; i < slotCount; i++) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700567 dsSetSamplerMapping(descriptorSet, &pTrav->dsSlot[i+startSlot], pSamplers[i]);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600568 }
569 }
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600570 else
571 return XGL_FALSE;
572 return XGL_TRUE;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600573}
Tobin Ehlis56a61072014-11-21 08:58:46 -0700574// Print the last bound Gfx Pipeline
575static void printPipeline()
576{
577 PIPELINE_NODE *pPipeTrav = getPipeline(lastBoundPipeline);
578 if (!pPipeTrav) {
579 // nothing to print
580 }
581 else {
582 char* pipeStr = xgl_print_xgl_graphics_pipeline_create_info(pPipeTrav->pCreateTree, "{DS}");
583 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", pipeStr);
584 }
585}
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700586// Dump subgraph w/ DS info
587static void dsDumpDot(FILE* pOutFile)
588{
589 const int i = 0; // hard-coding to just the first DS index for now
590 uint32_t skipUnusedCount = 0; // track consecutive unused slots for minimal reporting
591 DS_LL_HEAD *pDS = getDS(lastBoundDS[i]);
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700592 if (pDS) {
593 fprintf(pOutFile, "subgraph DS_SLOTS\n{\nlabel=\"DS0 Slots\"\n");
594 // First create simple array node as central DS reference point
595 fprintf(pOutFile, "\"DS0_MEMORY\" [\nlabel = <<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\"> <TR><TD PORT=\"ds2\">DS0 Memory</TD></TR>");
596 uint32_t j;
597 char label[1024];
598 for (j = 0; j < pDS->numSlots; j++) {
Tobin Ehlisf1c468a2014-12-09 17:00:33 -0700599 // Don't draw unused slots
600 if (0 != pDS->dsSlot[j].activeMapping)
601 fprintf(pOutFile, "<TR><TD PORT=\"slot%u\">slot%u</TD></TR>", j, j);
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700602 }
603 fprintf(pOutFile, "</TABLE>>\n];\n");
604 // Now tie each slot to its info
605 for (j = 0; j < pDS->numSlots; j++) {
606 switch (pDS->dsSlot[j].activeMapping)
607 {
608 case MAPPING_MEMORY:
609 /*
610 if (0 != skipUnusedCount) {// finish sequence of unused slots
611 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
612 strcat(ds_config_str, tmp_str);
613 skipUnusedCount = 0;
614 }*/
615 sprintf(label, "MemAttachInfo Slot%u", j);
616 fprintf(pOutFile, "%s", xgl_gv_print_xgl_memory_view_attach_info(&pDS->dsSlot[j].memView, label));
617 fprintf(pOutFile, "\"DS0_MEMORY\":slot%u -> \"%s\" [];\n", j, label);
618 break;
619 case MAPPING_IMAGE:
620 /*if (0 != skipUnusedCount) {// finish sequence of unused slots
621 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
622 strcat(ds_config_str, tmp_str);
623 skipUnusedCount = 0;
624 }*/
625 sprintf(label, "ImageAttachInfo Slot%u", j);
626 fprintf(pOutFile, "%s", xgl_gv_print_xgl_image_view_attach_info(&pDS->dsSlot[j].imageView, label));
627 fprintf(pOutFile, "\"DS0_MEMORY\":slot%u -> \"%s\" [];\n", j, label);
628 break;
629 case MAPPING_SAMPLER:
630 /*if (0 != skipUnusedCount) {// finish sequence of unused slots
631 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
632 strcat(ds_config_str, tmp_str);
633 skipUnusedCount = 0;
634 }*/
635 sprintf(label, "ImageAttachInfo Slot%u", j);
636 fprintf(pOutFile, "%s", xgl_gv_print_xgl_sampler_create_info(getSamplerCreateInfo(pDS->dsSlot[j].sampler), label));
637 fprintf(pOutFile, "\"DS0_MEMORY\":slot%u -> \"%s\" [];\n", j, label);
638 break;
639 default:
640 /*if (!skipUnusedCount) {// only report start of unused sequences
641 sprintf(tmp_str, "----Skipping slot(s) w/o a view attached...\n");
642 strcat(ds_config_str, tmp_str);
643 }*/
644 skipUnusedCount++;
645 break;
646 }
647
648 }
649 /*if (0 != skipUnusedCount) {// finish sequence of unused slots
650 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
651 strcat(ds_config_str, tmp_str);
652 skipUnusedCount = 0;
653 }*/
654 fprintf(pOutFile, "}\n");
655 }
656}
657// Dump a GraphViz dot file showing the pipeline
658static void dumpDotFile(char *outFileName)
659{
660 PIPELINE_NODE *pPipeTrav = getPipeline(lastBoundPipeline);
661 if (pPipeTrav) {
662 FILE* pOutFile;
663 pOutFile = fopen(outFileName, "w");
664 fprintf(pOutFile, "digraph g {\ngraph [\nrankdir = \"TB\"\n];\nnode [\nfontsize = \"16\"\nshape = \"plaintext\"\n];\nedge [\n];\n");
665 fprintf(pOutFile, "subgraph PipelineStateObject\n{\nlabel=\"Pipeline State Object\"\n");
666 fprintf(pOutFile, "%s", xgl_gv_print_xgl_graphics_pipeline_create_info(pPipeTrav->pCreateTree, "PSO HEAD"));
667 fprintf(pOutFile, "}\n");
668 // TODO : Add dynamic state dump here
669 fprintf(pOutFile, "subgraph dynamicState\n{\nlabel=\"Non-Orthogonal XGL State\"\n");
670 for (uint32_t i = 0; i < XGL_NUM_STATE_BIND_POINT; i++) {
671 if (pLastBoundDynamicState[i]) {
672 switch (pLastBoundDynamicState[i]->sType)
673 {
674 case XGL_STATE_BIND_VIEWPORT:
675 fprintf(pOutFile, "%s", xgl_gv_print_xgl_viewport_state_create_info((XGL_VIEWPORT_STATE_CREATE_INFO*)pLastBoundDynamicState[i]->pCreateInfo, "VIEWPORT State"));
676 break;
677 default:
678 fprintf(pOutFile, "%s", dynamic_gv_display(pLastBoundDynamicState[i]->pCreateInfo, string_XGL_STATE_BIND_POINT(pLastBoundDynamicState[i]->sType)));
679 break;
680 }
681 }
682 }
683 fprintf(pOutFile, "}\n"); // close dynamicState subgraph
684 dsDumpDot(pOutFile);
685 fprintf(pOutFile, "}\n"); // close main graph "g"
686 fclose(pOutFile);
687 }
688}
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600689// Synch up currently bound pipeline settings with DS mappings
690static void synchDSMapping()
691{
692 // First verify that we have a bound pipeline
693 PIPELINE_NODE *pPipeTrav = getPipeline(lastBoundPipeline);
Tobin Ehlise79df942014-11-18 16:38:08 -0700694 char str[1024];
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600695 if (!pPipeTrav) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700696 sprintf(str, "Can't find last bound Pipeline %p!", (void*)lastBoundPipeline);
697 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_PIPELINE_BOUND, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600698 }
699 else {
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700700 // Synch Descriptor Set Mapping
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600701 for (uint32_t i = 0; i < XGL_MAX_DESCRIPTOR_SETS; i++) {
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600702 DS_LL_HEAD *pDS;
703 if (lastBoundDS[i]) {
704 pDS = getDS(lastBoundDS[i]);
705 if (!pDS) {
Tobin Ehlise79df942014-11-18 16:38:08 -0700706 sprintf(str, "Can't find last bound DS %p. Did you need to bind DS to index %u?", (void*)lastBoundDS[i], i);
707 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_DS_BOUND, "DS", str);
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600708 }
709 else { // We have a good DS & Pipeline, store pipeline mappings in DS
Tobin Ehliseacc64f2014-11-24 17:09:09 -0700710 XGL_UINT slotOffset = lastBoundSlotOffset[i];
Tobin Ehlis26092022014-11-20 09:49:17 -0700711 for (uint32_t j = 0; j < XGL_NUM_GRAPHICS_SHADERS; j++) { // j is shader selector
Tobin Ehliseacc64f2014-11-24 17:09:09 -0700712 if (pPipeTrav->dsMapping[j][i].slotCount > (pDS->numSlots - slotOffset)) {
713 sprintf(str, "DS Mapping for shader %u has more slots (%u) than DS %p (%u) minus slotOffset (%u) (%u slots available)!", j, pPipeTrav->dsMapping[j][i].slotCount, (void*)pDS->dsID, pDS->numSlots, slotOffset, (pDS->numSlots - slotOffset));
Tobin Ehlis21042792014-11-24 16:06:04 -0700714 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_DS_SLOT_NUM_MISMATCH, "DS", str);
715 }
716 else {
717 for (uint32_t r = 0; r < pPipeTrav->dsMapping[j][i].slotCount; r++) {
Tobin Ehliseacc64f2014-11-24 17:09:09 -0700718 pDS->dsSlot[r+slotOffset].shaderSlotInfo[j] = pPipeTrav->dsMapping[j][i].pShaderMappingSlot[r];
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600719 }
720 }
721 }
722 }
723 }
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600724 else {
Tobin Ehlis21042792014-11-24 16:06:04 -0700725 // Verify that no shader is mapping this DS
726 uint32_t dsUsed = 0;
727 for (uint32_t j = 0; j < XGL_NUM_GRAPHICS_SHADERS; j++) { // j is shader selector
728 if (pPipeTrav->dsMapping[j][i].slotCount > 0) {
729 dsUsed = 1;
730 sprintf(str, "No DS was bound to index %u, but shader type %s has slots bound to that DS.", i, string_XGL_PIPELINE_SHADER_STAGE(j));
731 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_DS_BOUND, "DS", str);
732 }
733 }
734 if (0 == dsUsed) {
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700735 sprintf(str, "No DS was bound to index %u, but no shaders are using that DS so this is not an issue.", i);
Tobin Ehlis21042792014-11-24 16:06:04 -0700736 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", str);
737 }
Tobin Ehlis0f051a52014-10-24 13:03:56 -0600738 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600739 }
Tobin Ehlis1affd3c2014-11-25 10:24:15 -0700740 // Verify Vtx binding
741 if (MAX_BINDING != lastVtxBinding) {
742 if (lastVtxBinding >= pPipeTrav->vtxBindingCount) {
743 sprintf(str, "Vtx binding Index of %u exceeds PSO pVertexBindingDescriptions max array index of %u.", lastVtxBinding, (pPipeTrav->vtxBindingCount - 1));
744 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS", str);
745 }
746 else {
747 char *tmpStr = xgl_print_xgl_vertex_input_binding_description(&pPipeTrav->pVertexBindingDescriptions[lastVtxBinding], "{DS}INFO : ");
748 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", tmpStr);
749 free(tmpStr);
750 }
751 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600752 }
753}
754
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600755// Checks to make sure that shader mapping matches slot binding
756// Print an ERROR and return XGL_FALSE if they don't line up
757static XGL_BOOL verifyShaderSlotMapping(const XGL_UINT slot, const XGL_UINT slotBinding, const XGL_UINT shaderStage, const XGL_DESCRIPTOR_SET_SLOT_TYPE shaderMapping)
758{
759 XGL_BOOL error = XGL_FALSE;
Tobin Ehlise79df942014-11-18 16:38:08 -0700760 char str[1024];
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600761 switch (shaderMapping)
762 {
Cody Northrop40316a32014-12-09 19:08:33 -0700763 case XGL_SLOT_SHADER_TEXTURE_RESOURCE:
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600764 case XGL_SLOT_SHADER_RESOURCE:
765 if (MAPPING_MEMORY != slotBinding && MAPPING_IMAGE != slotBinding)
766 error = XGL_TRUE;
767 break;
768 case XGL_SLOT_SHADER_SAMPLER:
769 if (MAPPING_SAMPLER != slotBinding)
770 error = XGL_TRUE;
771 break;
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600772 case XGL_SLOT_SHADER_UAV:
773 if (MAPPING_MEMORY != slotBinding)
774 error = XGL_TRUE;
775 break;
776 case XGL_SLOT_NEXT_DESCRIPTOR_SET:
777 if (MAPPING_DS != slotBinding)
778 error = XGL_TRUE;
779 break;
780 case XGL_SLOT_UNUSED:
781 break;
782 default:
Tobin Ehlise79df942014-11-18 16:38:08 -0700783 sprintf(str, "For DS slot %u, unknown shader slot mapping w/ value %u", slot, shaderMapping);
784 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_UNKNOWN_DS_MAPPING, "DS", str);
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600785 return XGL_FALSE;
786 }
787 if (XGL_TRUE == error) {
Tobin Ehlis26092022014-11-20 09:49:17 -0700788 sprintf(str, "DS Slot #%u binding of %s does not match %s shader mapping of %s", slot, stringSlotBinding(slotBinding), string_XGL_PIPELINE_SHADER_STAGE(shaderStage), string_XGL_DESCRIPTOR_SET_SLOT_TYPE(shaderMapping));
Tobin Ehlise79df942014-11-18 16:38:08 -0700789 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_DS_MAPPING_MISMATCH, "DS", str);
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600790 return XGL_FALSE;
791 }
792 return XGL_TRUE;
793}
794
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600795// Print details of DS config to stdout
796static void printDSConfig()
797{
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700798 uint32_t skipUnusedCount = 0; // track consecutive unused slots for minimal reporting
Tobin Ehlise79df942014-11-18 16:38:08 -0700799 char tmp_str[1024];
800 char ds_config_str[1024*256] = {0}; // TODO : Currently making this buffer HUGE w/o overrun protection. Need to be smarter, start smaller, and grow as needed.
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600801 for (uint32_t i = 0; i < XGL_MAX_DESCRIPTOR_SETS; i++) {
Tobin Ehlisb8154982014-10-27 14:53:17 -0600802 if (lastBoundDS[i]) {
803 DS_LL_HEAD *pDS = getDS(lastBoundDS[i]);
Tobin Ehliseacc64f2014-11-24 17:09:09 -0700804 XGL_UINT slotOffset = lastBoundSlotOffset[i];
Tobin Ehlisb8154982014-10-27 14:53:17 -0600805 if (pDS) {
Tobin Ehliseacc64f2014-11-24 17:09:09 -0700806 sprintf(tmp_str, "DS INFO : Slot bindings for DS[%u] (%p) - %u slots and slotOffset %u:\n", i, (void*)pDS->dsID, pDS->numSlots, slotOffset);
Tobin Ehlise79df942014-11-18 16:38:08 -0700807 strcat(ds_config_str, tmp_str);
Tobin Ehlisb8154982014-10-27 14:53:17 -0600808 for (uint32_t j = 0; j < pDS->numSlots; j++) {
Tobin Ehlisb8154982014-10-27 14:53:17 -0600809 switch (pDS->dsSlot[j].activeMapping)
810 {
811 case MAPPING_MEMORY:
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700812 if (0 != skipUnusedCount) {// finish sequence of unused slots
Tobin Ehlise79df942014-11-18 16:38:08 -0700813 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
814 strcat(ds_config_str, tmp_str);
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700815 skipUnusedCount = 0;
816 }
Tobin Ehlise79df942014-11-18 16:38:08 -0700817 sprintf(tmp_str, "----Slot %u\n Mapped to Memory View %p:\n%s", j, (void*)&pDS->dsSlot[j].memView, xgl_print_xgl_memory_view_attach_info(&pDS->dsSlot[j].memView, " "));
818 strcat(ds_config_str, tmp_str);
Tobin Ehlisb8154982014-10-27 14:53:17 -0600819 break;
820 case MAPPING_IMAGE:
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700821 if (0 != skipUnusedCount) {// finish sequence of unused slots
Tobin Ehlise79df942014-11-18 16:38:08 -0700822 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
823 strcat(ds_config_str, tmp_str);
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700824 skipUnusedCount = 0;
825 }
Tobin Ehlise79df942014-11-18 16:38:08 -0700826 sprintf(tmp_str, "----Slot %u\n Mapped to Image View %p:\n%s", j, (void*)&pDS->dsSlot[j].imageView, xgl_print_xgl_image_view_attach_info(&pDS->dsSlot[j].imageView, " "));
827 strcat(ds_config_str, tmp_str);
Tobin Ehlisb8154982014-10-27 14:53:17 -0600828 break;
829 case MAPPING_SAMPLER:
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700830 if (0 != skipUnusedCount) {// finish sequence of unused slots
Tobin Ehlise79df942014-11-18 16:38:08 -0700831 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
832 strcat(ds_config_str, tmp_str);
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700833 skipUnusedCount = 0;
834 }
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -0700835 sprintf(tmp_str, "----Slot %u\n Mapped to Sampler Object %p:\n%s", j, (void*)pDS->dsSlot[j].sampler, xgl_print_xgl_sampler_create_info(getSamplerCreateInfo(pDS->dsSlot[j].sampler), " "));
Tobin Ehlise79df942014-11-18 16:38:08 -0700836 strcat(ds_config_str, tmp_str);
Tobin Ehlisb8154982014-10-27 14:53:17 -0600837 break;
838 default:
Tobin Ehlise79df942014-11-18 16:38:08 -0700839 if (!skipUnusedCount) {// only report start of unused sequences
840 sprintf(tmp_str, "----Skipping slot(s) w/o a view attached...\n");
841 strcat(ds_config_str, tmp_str);
842 }
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700843 skipUnusedCount++;
Tobin Ehlisb8154982014-10-27 14:53:17 -0600844 break;
845 }
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600846 // For each shader type, check its mapping
Tobin Ehlis26092022014-11-20 09:49:17 -0700847 for (uint32_t k = 0; k < XGL_NUM_GRAPHICS_SHADERS; k++) {
Tobin Ehlisb8154982014-10-27 14:53:17 -0600848 if (XGL_SLOT_UNUSED != pDS->dsSlot[j].shaderSlotInfo[k].slotObjectType) {
Tobin Ehlis26092022014-11-20 09:49:17 -0700849 sprintf(tmp_str, " Shader type %s has %s slot type mapping to shaderEntityIndex %u\n", string_XGL_PIPELINE_SHADER_STAGE(k), string_XGL_DESCRIPTOR_SET_SLOT_TYPE(pDS->dsSlot[j].shaderSlotInfo[k].slotObjectType), pDS->dsSlot[j].shaderSlotInfo[k].shaderEntityIndex);
Tobin Ehlise79df942014-11-18 16:38:08 -0700850 strcat(ds_config_str, tmp_str);
Tobin Ehlis9e3d7532014-10-27 17:12:54 -0600851 verifyShaderSlotMapping(j, pDS->dsSlot[j].activeMapping, k, pDS->dsSlot[j].shaderSlotInfo[k].slotObjectType);
Tobin Ehlisb8154982014-10-27 14:53:17 -0600852 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600853 }
854 }
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700855 if (0 != skipUnusedCount) {// finish sequence of unused slots
Tobin Ehlise79df942014-11-18 16:38:08 -0700856 sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : "");
857 strcat(ds_config_str, tmp_str);
Tobin Ehlis791a49c2014-11-10 12:29:12 -0700858 skipUnusedCount = 0;
859 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600860 }
Tobin Ehlisb8154982014-10-27 14:53:17 -0600861 else {
Tobin Ehlise79df942014-11-18 16:38:08 -0700862 char str[1024];
863 sprintf(str, "Can't find last bound DS %p. Did you need to bind DS to index %u?", (void*)lastBoundDS[i], i);
864 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_DS_BOUND, "DS", str);
Tobin Ehlisb8154982014-10-27 14:53:17 -0600865 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600866 }
867 }
Tobin Ehlise79df942014-11-18 16:38:08 -0700868 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", ds_config_str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600869}
870
871static void synchAndPrintDSConfig()
872{
873 synchDSMapping();
874 printDSConfig();
Tobin Ehlis56a61072014-11-21 08:58:46 -0700875 printPipeline();
876 printDynamicState();
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700877 static int autoDumpOnce = 1;
878 if (autoDumpOnce) {
879 autoDumpOnce = 0;
880 dumpDotFile("pipeline_dump.dot");
Tobin Ehlis266473d2014-12-16 17:34:50 -0700881 // Convert dot to png if dot available
882 if(access( "/usr/bin/dot", X_OK) != -1) {
883 system("/usr/bin/dot pipeline_dump.dot -Tpng -o pipeline_dump.png");
884 }
Tobin Ehlisa701ef02014-11-27 15:43:39 -0700885 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -0600886}
887
888static void initLayerTable()
889{
890 GetProcAddrType fpNextGPA;
891 fpNextGPA = pCurObj->pGPA;
892 assert(fpNextGPA);
893
894 GetProcAddrType fpGetProcAddr = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetProcAddr");
895 nextTable.GetProcAddr = fpGetProcAddr;
896 InitAndEnumerateGpusType fpInitAndEnumerateGpus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglInitAndEnumerateGpus");
897 nextTable.InitAndEnumerateGpus = fpInitAndEnumerateGpus;
898 GetGpuInfoType fpGetGpuInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetGpuInfo");
899 nextTable.GetGpuInfo = fpGetGpuInfo;
900 CreateDeviceType fpCreateDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDevice");
901 nextTable.CreateDevice = fpCreateDevice;
902 DestroyDeviceType fpDestroyDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyDevice");
903 nextTable.DestroyDevice = fpDestroyDevice;
904 GetExtensionSupportType fpGetExtensionSupport = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetExtensionSupport");
905 nextTable.GetExtensionSupport = fpGetExtensionSupport;
906 EnumerateLayersType fpEnumerateLayers = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEnumerateLayers");
907 nextTable.EnumerateLayers = fpEnumerateLayers;
908 GetDeviceQueueType fpGetDeviceQueue = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetDeviceQueue");
909 nextTable.GetDeviceQueue = fpGetDeviceQueue;
910 QueueSubmitType fpQueueSubmit = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSubmit");
911 nextTable.QueueSubmit = fpQueueSubmit;
912 QueueSetGlobalMemReferencesType fpQueueSetGlobalMemReferences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSetGlobalMemReferences");
913 nextTable.QueueSetGlobalMemReferences = fpQueueSetGlobalMemReferences;
914 QueueWaitIdleType fpQueueWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueWaitIdle");
915 nextTable.QueueWaitIdle = fpQueueWaitIdle;
916 DeviceWaitIdleType fpDeviceWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDeviceWaitIdle");
917 nextTable.DeviceWaitIdle = fpDeviceWaitIdle;
918 GetMemoryHeapCountType fpGetMemoryHeapCount = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapCount");
919 nextTable.GetMemoryHeapCount = fpGetMemoryHeapCount;
920 GetMemoryHeapInfoType fpGetMemoryHeapInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapInfo");
921 nextTable.GetMemoryHeapInfo = fpGetMemoryHeapInfo;
922 AllocMemoryType fpAllocMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAllocMemory");
923 nextTable.AllocMemory = fpAllocMemory;
924 FreeMemoryType fpFreeMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglFreeMemory");
925 nextTable.FreeMemory = fpFreeMemory;
926 SetMemoryPriorityType fpSetMemoryPriority = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetMemoryPriority");
927 nextTable.SetMemoryPriority = fpSetMemoryPriority;
928 MapMemoryType fpMapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglMapMemory");
929 nextTable.MapMemory = fpMapMemory;
930 UnmapMemoryType fpUnmapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglUnmapMemory");
931 nextTable.UnmapMemory = fpUnmapMemory;
932 PinSystemMemoryType fpPinSystemMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglPinSystemMemory");
933 nextTable.PinSystemMemory = fpPinSystemMemory;
934 RemapVirtualMemoryPagesType fpRemapVirtualMemoryPages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglRemapVirtualMemoryPages");
935 nextTable.RemapVirtualMemoryPages = fpRemapVirtualMemoryPages;
936 GetMultiGpuCompatibilityType fpGetMultiGpuCompatibility = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMultiGpuCompatibility");
937 nextTable.GetMultiGpuCompatibility = fpGetMultiGpuCompatibility;
938 OpenSharedMemoryType fpOpenSharedMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedMemory");
939 nextTable.OpenSharedMemory = fpOpenSharedMemory;
940 OpenSharedQueueSemaphoreType fpOpenSharedQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedQueueSemaphore");
941 nextTable.OpenSharedQueueSemaphore = fpOpenSharedQueueSemaphore;
942 OpenPeerMemoryType fpOpenPeerMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerMemory");
943 nextTable.OpenPeerMemory = fpOpenPeerMemory;
944 OpenPeerImageType fpOpenPeerImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerImage");
945 nextTable.OpenPeerImage = fpOpenPeerImage;
946 DestroyObjectType fpDestroyObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyObject");
947 nextTable.DestroyObject = fpDestroyObject;
948 GetObjectInfoType fpGetObjectInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetObjectInfo");
949 nextTable.GetObjectInfo = fpGetObjectInfo;
950 BindObjectMemoryType fpBindObjectMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBindObjectMemory");
951 nextTable.BindObjectMemory = fpBindObjectMemory;
952 CreateFenceType fpCreateFence = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateFence");
953 nextTable.CreateFence = fpCreateFence;
954 GetFenceStatusType fpGetFenceStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFenceStatus");
955 nextTable.GetFenceStatus = fpGetFenceStatus;
956 WaitForFencesType fpWaitForFences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitForFences");
957 nextTable.WaitForFences = fpWaitForFences;
958 CreateQueueSemaphoreType fpCreateQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueueSemaphore");
959 nextTable.CreateQueueSemaphore = fpCreateQueueSemaphore;
960 SignalQueueSemaphoreType fpSignalQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSignalQueueSemaphore");
961 nextTable.SignalQueueSemaphore = fpSignalQueueSemaphore;
962 WaitQueueSemaphoreType fpWaitQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitQueueSemaphore");
963 nextTable.WaitQueueSemaphore = fpWaitQueueSemaphore;
964 CreateEventType fpCreateEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateEvent");
965 nextTable.CreateEvent = fpCreateEvent;
966 GetEventStatusType fpGetEventStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetEventStatus");
967 nextTable.GetEventStatus = fpGetEventStatus;
968 SetEventType fpSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetEvent");
969 nextTable.SetEvent = fpSetEvent;
970 ResetEventType fpResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetEvent");
971 nextTable.ResetEvent = fpResetEvent;
972 CreateQueryPoolType fpCreateQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueryPool");
973 nextTable.CreateQueryPool = fpCreateQueryPool;
974 GetQueryPoolResultsType fpGetQueryPoolResults = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetQueryPoolResults");
975 nextTable.GetQueryPoolResults = fpGetQueryPoolResults;
976 GetFormatInfoType fpGetFormatInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFormatInfo");
977 nextTable.GetFormatInfo = fpGetFormatInfo;
978 CreateImageType fpCreateImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImage");
979 nextTable.CreateImage = fpCreateImage;
980 GetImageSubresourceInfoType fpGetImageSubresourceInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetImageSubresourceInfo");
981 nextTable.GetImageSubresourceInfo = fpGetImageSubresourceInfo;
982 CreateImageViewType fpCreateImageView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImageView");
983 nextTable.CreateImageView = fpCreateImageView;
984 CreateColorAttachmentViewType fpCreateColorAttachmentView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorAttachmentView");
985 nextTable.CreateColorAttachmentView = fpCreateColorAttachmentView;
986 CreateDepthStencilViewType fpCreateDepthStencilView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilView");
987 nextTable.CreateDepthStencilView = fpCreateDepthStencilView;
988 CreateShaderType fpCreateShader = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateShader");
989 nextTable.CreateShader = fpCreateShader;
990 CreateGraphicsPipelineType fpCreateGraphicsPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateGraphicsPipeline");
991 nextTable.CreateGraphicsPipeline = fpCreateGraphicsPipeline;
992 CreateComputePipelineType fpCreateComputePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateComputePipeline");
993 nextTable.CreateComputePipeline = fpCreateComputePipeline;
994 StorePipelineType fpStorePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglStorePipeline");
995 nextTable.StorePipeline = fpStorePipeline;
996 LoadPipelineType fpLoadPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglLoadPipeline");
997 nextTable.LoadPipeline = fpLoadPipeline;
998 CreatePipelineDeltaType fpCreatePipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreatePipelineDelta");
999 nextTable.CreatePipelineDelta = fpCreatePipelineDelta;
1000 CreateSamplerType fpCreateSampler = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateSampler");
1001 nextTable.CreateSampler = fpCreateSampler;
1002 CreateDescriptorSetType fpCreateDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDescriptorSet");
1003 nextTable.CreateDescriptorSet = fpCreateDescriptorSet;
1004 BeginDescriptorSetUpdateType fpBeginDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginDescriptorSetUpdate");
1005 nextTable.BeginDescriptorSetUpdate = fpBeginDescriptorSetUpdate;
1006 EndDescriptorSetUpdateType fpEndDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndDescriptorSetUpdate");
1007 nextTable.EndDescriptorSetUpdate = fpEndDescriptorSetUpdate;
1008 AttachSamplerDescriptorsType fpAttachSamplerDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachSamplerDescriptors");
1009 nextTable.AttachSamplerDescriptors = fpAttachSamplerDescriptors;
1010 AttachImageViewDescriptorsType fpAttachImageViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachImageViewDescriptors");
1011 nextTable.AttachImageViewDescriptors = fpAttachImageViewDescriptors;
1012 AttachMemoryViewDescriptorsType fpAttachMemoryViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachMemoryViewDescriptors");
1013 nextTable.AttachMemoryViewDescriptors = fpAttachMemoryViewDescriptors;
1014 AttachNestedDescriptorsType fpAttachNestedDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachNestedDescriptors");
1015 nextTable.AttachNestedDescriptors = fpAttachNestedDescriptors;
1016 ClearDescriptorSetSlotsType fpClearDescriptorSetSlots = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglClearDescriptorSetSlots");
1017 nextTable.ClearDescriptorSetSlots = fpClearDescriptorSetSlots;
1018 CreateViewportStateType fpCreateViewportState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateViewportState");
1019 nextTable.CreateViewportState = fpCreateViewportState;
1020 CreateRasterStateType fpCreateRasterState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateRasterState");
1021 nextTable.CreateRasterState = fpCreateRasterState;
1022 CreateMsaaStateType fpCreateMsaaState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateMsaaState");
1023 nextTable.CreateMsaaState = fpCreateMsaaState;
1024 CreateColorBlendStateType fpCreateColorBlendState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorBlendState");
1025 nextTable.CreateColorBlendState = fpCreateColorBlendState;
1026 CreateDepthStencilStateType fpCreateDepthStencilState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilState");
1027 nextTable.CreateDepthStencilState = fpCreateDepthStencilState;
1028 CreateCommandBufferType fpCreateCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateCommandBuffer");
1029 nextTable.CreateCommandBuffer = fpCreateCommandBuffer;
1030 BeginCommandBufferType fpBeginCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginCommandBuffer");
1031 nextTable.BeginCommandBuffer = fpBeginCommandBuffer;
1032 EndCommandBufferType fpEndCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndCommandBuffer");
1033 nextTable.EndCommandBuffer = fpEndCommandBuffer;
1034 ResetCommandBufferType fpResetCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetCommandBuffer");
1035 nextTable.ResetCommandBuffer = fpResetCommandBuffer;
1036 CmdBindPipelineType fpCmdBindPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipeline");
1037 nextTable.CmdBindPipeline = fpCmdBindPipeline;
1038 CmdBindPipelineDeltaType fpCmdBindPipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipelineDelta");
1039 nextTable.CmdBindPipelineDelta = fpCmdBindPipelineDelta;
1040 CmdBindStateObjectType fpCmdBindStateObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindStateObject");
1041 nextTable.CmdBindStateObject = fpCmdBindStateObject;
1042 CmdBindDescriptorSetType fpCmdBindDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDescriptorSet");
1043 nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet;
1044 CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView");
1045 nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView;
Chia-I Wu3b04af52014-11-08 10:48:20 +08001046 CmdBindVertexDataType fpCmdBindVertexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindVertexData");
1047 nextTable.CmdBindVertexData = fpCmdBindVertexData;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001048 CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData");
1049 nextTable.CmdBindIndexData = fpCmdBindIndexData;
1050 CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments");
1051 nextTable.CmdBindAttachments = fpCmdBindAttachments;
1052 CmdPrepareMemoryRegionsType fpCmdPrepareMemoryRegions = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareMemoryRegions");
1053 nextTable.CmdPrepareMemoryRegions = fpCmdPrepareMemoryRegions;
1054 CmdPrepareImagesType fpCmdPrepareImages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareImages");
1055 nextTable.CmdPrepareImages = fpCmdPrepareImages;
1056 CmdDrawType fpCmdDraw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDraw");
1057 nextTable.CmdDraw = fpCmdDraw;
1058 CmdDrawIndexedType fpCmdDrawIndexed = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexed");
1059 nextTable.CmdDrawIndexed = fpCmdDrawIndexed;
1060 CmdDrawIndirectType fpCmdDrawIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndirect");
1061 nextTable.CmdDrawIndirect = fpCmdDrawIndirect;
1062 CmdDrawIndexedIndirectType fpCmdDrawIndexedIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexedIndirect");
1063 nextTable.CmdDrawIndexedIndirect = fpCmdDrawIndexedIndirect;
1064 CmdDispatchType fpCmdDispatch = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatch");
1065 nextTable.CmdDispatch = fpCmdDispatch;
1066 CmdDispatchIndirectType fpCmdDispatchIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatchIndirect");
1067 nextTable.CmdDispatchIndirect = fpCmdDispatchIndirect;
1068 CmdCopyMemoryType fpCmdCopyMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemory");
1069 nextTable.CmdCopyMemory = fpCmdCopyMemory;
1070 CmdCopyImageType fpCmdCopyImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImage");
1071 nextTable.CmdCopyImage = fpCmdCopyImage;
1072 CmdCopyMemoryToImageType fpCmdCopyMemoryToImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemoryToImage");
1073 nextTable.CmdCopyMemoryToImage = fpCmdCopyMemoryToImage;
1074 CmdCopyImageToMemoryType fpCmdCopyImageToMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImageToMemory");
1075 nextTable.CmdCopyImageToMemory = fpCmdCopyImageToMemory;
1076 CmdCloneImageDataType fpCmdCloneImageData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCloneImageData");
1077 nextTable.CmdCloneImageData = fpCmdCloneImageData;
1078 CmdUpdateMemoryType fpCmdUpdateMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdUpdateMemory");
1079 nextTable.CmdUpdateMemory = fpCmdUpdateMemory;
1080 CmdFillMemoryType fpCmdFillMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdFillMemory");
1081 nextTable.CmdFillMemory = fpCmdFillMemory;
1082 CmdClearColorImageType fpCmdClearColorImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImage");
1083 nextTable.CmdClearColorImage = fpCmdClearColorImage;
1084 CmdClearColorImageRawType fpCmdClearColorImageRaw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImageRaw");
1085 nextTable.CmdClearColorImageRaw = fpCmdClearColorImageRaw;
1086 CmdClearDepthStencilType fpCmdClearDepthStencil = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearDepthStencil");
1087 nextTable.CmdClearDepthStencil = fpCmdClearDepthStencil;
1088 CmdResolveImageType fpCmdResolveImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResolveImage");
1089 nextTable.CmdResolveImage = fpCmdResolveImage;
1090 CmdSetEventType fpCmdSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSetEvent");
1091 nextTable.CmdSetEvent = fpCmdSetEvent;
1092 CmdResetEventType fpCmdResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetEvent");
1093 nextTable.CmdResetEvent = fpCmdResetEvent;
1094 CmdMemoryAtomicType fpCmdMemoryAtomic = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdMemoryAtomic");
1095 nextTable.CmdMemoryAtomic = fpCmdMemoryAtomic;
1096 CmdBeginQueryType fpCmdBeginQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBeginQuery");
1097 nextTable.CmdBeginQuery = fpCmdBeginQuery;
1098 CmdEndQueryType fpCmdEndQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdEndQuery");
1099 nextTable.CmdEndQuery = fpCmdEndQuery;
1100 CmdResetQueryPoolType fpCmdResetQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetQueryPool");
1101 nextTable.CmdResetQueryPool = fpCmdResetQueryPool;
1102 CmdWriteTimestampType fpCmdWriteTimestamp = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdWriteTimestamp");
1103 nextTable.CmdWriteTimestamp = fpCmdWriteTimestamp;
1104 CmdInitAtomicCountersType fpCmdInitAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdInitAtomicCounters");
1105 nextTable.CmdInitAtomicCounters = fpCmdInitAtomicCounters;
1106 CmdLoadAtomicCountersType fpCmdLoadAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdLoadAtomicCounters");
1107 nextTable.CmdLoadAtomicCounters = fpCmdLoadAtomicCounters;
1108 CmdSaveAtomicCountersType fpCmdSaveAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSaveAtomicCounters");
1109 nextTable.CmdSaveAtomicCounters = fpCmdSaveAtomicCounters;
1110 DbgSetValidationLevelType fpDbgSetValidationLevel = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetValidationLevel");
1111 nextTable.DbgSetValidationLevel = fpDbgSetValidationLevel;
1112 DbgRegisterMsgCallbackType fpDbgRegisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgRegisterMsgCallback");
1113 nextTable.DbgRegisterMsgCallback = fpDbgRegisterMsgCallback;
1114 DbgUnregisterMsgCallbackType fpDbgUnregisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgUnregisterMsgCallback");
1115 nextTable.DbgUnregisterMsgCallback = fpDbgUnregisterMsgCallback;
1116 DbgSetMessageFilterType fpDbgSetMessageFilter = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetMessageFilter");
1117 nextTable.DbgSetMessageFilter = fpDbgSetMessageFilter;
1118 DbgSetObjectTagType fpDbgSetObjectTag = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetObjectTag");
1119 nextTable.DbgSetObjectTag = fpDbgSetObjectTag;
1120 DbgSetGlobalOptionType fpDbgSetGlobalOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetGlobalOption");
1121 nextTable.DbgSetGlobalOption = fpDbgSetGlobalOption;
1122 DbgSetDeviceOptionType fpDbgSetDeviceOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetDeviceOption");
1123 nextTable.DbgSetDeviceOption = fpDbgSetDeviceOption;
1124 CmdDbgMarkerBeginType fpCmdDbgMarkerBegin = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerBegin");
1125 nextTable.CmdDbgMarkerBegin = fpCmdDbgMarkerBegin;
1126 CmdDbgMarkerEndType fpCmdDbgMarkerEnd = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerEnd");
1127 nextTable.CmdDbgMarkerEnd = fpCmdDbgMarkerEnd;
1128 WsiX11AssociateConnectionType fpWsiX11AssociateConnection = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11AssociateConnection");
1129 nextTable.WsiX11AssociateConnection = fpWsiX11AssociateConnection;
1130 WsiX11GetMSCType fpWsiX11GetMSC = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11GetMSC");
1131 nextTable.WsiX11GetMSC = fpWsiX11GetMSC;
1132 WsiX11CreatePresentableImageType fpWsiX11CreatePresentableImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11CreatePresentableImage");
1133 nextTable.WsiX11CreatePresentableImage = fpWsiX11CreatePresentableImage;
1134 WsiX11QueuePresentType fpWsiX11QueuePresent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11QueuePresent");
1135 nextTable.WsiX11QueuePresent = fpWsiX11QueuePresent;
1136}
1137
1138
1139XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
1140{
1141 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001142 pCurObj = gpuw;
1143 pthread_once(&tabOnce, initLayerTable);
1144 XGL_RESULT result = nextTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001145 return result;
1146}
1147
1148XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice)
1149{
1150 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001151 pCurObj = gpuw;
1152 pthread_once(&tabOnce, initLayerTable);
1153 XGL_RESULT result = nextTable.CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001154 return result;
1155}
1156
1157XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(XGL_DEVICE device)
1158{
1159 XGL_RESULT result = nextTable.DestroyDevice(device);
1160 return result;
1161}
1162
1163XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pExtName)
1164{
1165 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001166 pCurObj = gpuw;
1167 pthread_once(&tabOnce, initLayerTable);
1168 XGL_RESULT result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001169 return result;
1170}
1171
Jon Ashburn6847c2b2014-11-25 12:56:49 -07001172XGL_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)
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001173{
Jon Ashburn451c16f2014-11-25 11:08:42 -07001174 if (gpu != NULL)
1175 {
1176 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
1177 pCurObj = gpuw;
1178 pthread_once(&tabOnce, initLayerTable);
Jon Ashburn6847c2b2014-11-25 12:56:49 -07001179 XGL_RESULT result = nextTable.EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved);
Jon Ashburn451c16f2014-11-25 11:08:42 -07001180 return result;
1181 } else
1182 {
1183 if (pOutLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL)
1184 return XGL_ERROR_INVALID_POINTER;
1185 // This layer compatible with all GPUs
1186 *pOutLayerCount = 1;
Chia-I Wua837c522014-12-16 10:47:33 +08001187 strncpy((char *) pOutLayers[0], "DrawState", maxStringSize);
Jon Ashburn451c16f2014-11-25 11:08:42 -07001188 return XGL_SUCCESS;
1189 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001190}
1191
1192XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetDeviceQueue(XGL_DEVICE device, XGL_QUEUE_TYPE queueType, XGL_UINT queueIndex, XGL_QUEUE* pQueue)
1193{
1194 XGL_RESULT result = nextTable.GetDeviceQueue(device, queueType, queueIndex, pQueue);
1195 return result;
1196}
1197
1198XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSubmit(XGL_QUEUE queue, XGL_UINT cmdBufferCount, const XGL_CMD_BUFFER* pCmdBuffers, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs, XGL_FENCE fence)
1199{
1200 XGL_RESULT result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, memRefCount, pMemRefs, fence);
1201 return result;
1202}
1203
1204XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSetGlobalMemReferences(XGL_QUEUE queue, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs)
1205{
1206 XGL_RESULT result = nextTable.QueueSetGlobalMemReferences(queue, memRefCount, pMemRefs);
1207 return result;
1208}
1209
1210XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueWaitIdle(XGL_QUEUE queue)
1211{
1212 XGL_RESULT result = nextTable.QueueWaitIdle(queue);
1213 return result;
1214}
1215
1216XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device)
1217{
1218 XGL_RESULT result = nextTable.DeviceWaitIdle(device);
1219 return result;
1220}
1221
1222XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount)
1223{
1224 XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount);
1225 return result;
1226}
1227
1228XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapInfo(XGL_DEVICE device, XGL_UINT heapId, XGL_MEMORY_HEAP_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
1229{
1230 XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData);
1231 return result;
1232}
1233
1234XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem)
1235{
1236 XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem);
1237 return result;
1238}
1239
1240XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglFreeMemory(XGL_GPU_MEMORY mem)
1241{
1242 XGL_RESULT result = nextTable.FreeMemory(mem);
1243 return result;
1244}
1245
1246XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetMemoryPriority(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority)
1247{
1248 XGL_RESULT result = nextTable.SetMemoryPriority(mem, priority);
1249 return result;
1250}
1251
1252XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglMapMemory(XGL_GPU_MEMORY mem, XGL_FLAGS flags, XGL_VOID** ppData)
1253{
1254 XGL_RESULT result = nextTable.MapMemory(mem, flags, ppData);
1255 return result;
1256}
1257
1258XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglUnmapMemory(XGL_GPU_MEMORY mem)
1259{
1260 XGL_RESULT result = nextTable.UnmapMemory(mem);
1261 return result;
1262}
1263
1264XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglPinSystemMemory(XGL_DEVICE device, const XGL_VOID* pSysMem, XGL_SIZE memSize, XGL_GPU_MEMORY* pMem)
1265{
1266 XGL_RESULT result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem);
1267 return result;
1268}
1269
1270XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglRemapVirtualMemoryPages(XGL_DEVICE device, XGL_UINT rangeCount, const XGL_VIRTUAL_MEMORY_REMAP_RANGE* pRanges, XGL_UINT preWaitSemaphoreCount, const XGL_QUEUE_SEMAPHORE* pPreWaitSemaphores, XGL_UINT postSignalSemaphoreCount, const XGL_QUEUE_SEMAPHORE* pPostSignalSemaphores)
1271{
1272 XGL_RESULT result = nextTable.RemapVirtualMemoryPages(device, rangeCount, pRanges, preWaitSemaphoreCount, pPreWaitSemaphores, postSignalSemaphoreCount, pPostSignalSemaphores);
1273 return result;
1274}
1275
1276XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMultiGpuCompatibility(XGL_PHYSICAL_GPU gpu0, XGL_PHYSICAL_GPU gpu1, XGL_GPU_COMPATIBILITY_INFO* pInfo)
1277{
1278 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu0;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001279 pCurObj = gpuw;
1280 pthread_once(&tabOnce, initLayerTable);
1281 XGL_RESULT result = nextTable.GetMultiGpuCompatibility((XGL_PHYSICAL_GPU)gpuw->nextObject, gpu1, pInfo);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001282 return result;
1283}
1284
1285XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedMemory(XGL_DEVICE device, const XGL_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem)
1286{
1287 XGL_RESULT result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem);
1288 return result;
1289}
1290
1291XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo, XGL_QUEUE_SEMAPHORE* pSemaphore)
1292{
1293 XGL_RESULT result = nextTable.OpenSharedQueueSemaphore(device, pOpenInfo, pSemaphore);
1294 return result;
1295}
1296
1297XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerMemory(XGL_DEVICE device, const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem)
1298{
1299 XGL_RESULT result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem);
1300 return result;
1301}
1302
1303XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerImage(XGL_DEVICE device, const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem)
1304{
1305 XGL_RESULT result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem);
1306 return result;
1307}
1308
1309XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyObject(XGL_OBJECT object)
1310{
1311 XGL_RESULT result = nextTable.DestroyObject(object);
1312 return result;
1313}
1314
1315XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetObjectInfo(XGL_BASE_OBJECT object, XGL_OBJECT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
1316{
1317 XGL_RESULT result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData);
1318 return result;
1319}
1320
1321XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBindObjectMemory(XGL_OBJECT object, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset)
1322{
1323 XGL_RESULT result = nextTable.BindObjectMemory(object, mem, offset);
1324 return result;
1325}
1326
1327XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateFence(XGL_DEVICE device, const XGL_FENCE_CREATE_INFO* pCreateInfo, XGL_FENCE* pFence)
1328{
1329 XGL_RESULT result = nextTable.CreateFence(device, pCreateInfo, pFence);
1330 return result;
1331}
1332
1333XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFenceStatus(XGL_FENCE fence)
1334{
1335 XGL_RESULT result = nextTable.GetFenceStatus(fence);
1336 return result;
1337}
1338
1339XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitForFences(XGL_DEVICE device, XGL_UINT fenceCount, const XGL_FENCE* pFences, XGL_BOOL waitAll, XGL_UINT64 timeout)
1340{
1341 XGL_RESULT result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout);
1342 return result;
1343}
1344
1345XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo, XGL_QUEUE_SEMAPHORE* pSemaphore)
1346{
1347 XGL_RESULT result = nextTable.CreateQueueSemaphore(device, pCreateInfo, pSemaphore);
1348 return result;
1349}
1350
1351XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSignalQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore)
1352{
1353 XGL_RESULT result = nextTable.SignalQueueSemaphore(queue, semaphore);
1354 return result;
1355}
1356
1357XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore)
1358{
1359 XGL_RESULT result = nextTable.WaitQueueSemaphore(queue, semaphore);
1360 return result;
1361}
1362
1363XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateEvent(XGL_DEVICE device, const XGL_EVENT_CREATE_INFO* pCreateInfo, XGL_EVENT* pEvent)
1364{
1365 XGL_RESULT result = nextTable.CreateEvent(device, pCreateInfo, pEvent);
1366 return result;
1367}
1368
1369XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetEventStatus(XGL_EVENT event)
1370{
1371 XGL_RESULT result = nextTable.GetEventStatus(event);
1372 return result;
1373}
1374
1375XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetEvent(XGL_EVENT event)
1376{
1377 XGL_RESULT result = nextTable.SetEvent(event);
1378 return result;
1379}
1380
1381XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetEvent(XGL_EVENT event)
1382{
1383 XGL_RESULT result = nextTable.ResetEvent(event);
1384 return result;
1385}
1386
1387XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueryPool(XGL_DEVICE device, const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo, XGL_QUERY_POOL* pQueryPool)
1388{
1389 XGL_RESULT result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool);
1390 return result;
1391}
1392
1393XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetQueryPoolResults(XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount, XGL_SIZE* pDataSize, XGL_VOID* pData)
1394{
1395 XGL_RESULT result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData);
1396 return result;
1397}
1398
1399XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
1400{
1401 XGL_RESULT result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData);
1402 return result;
1403}
1404
1405XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImage(XGL_DEVICE device, const XGL_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage)
1406{
1407 XGL_RESULT result = nextTable.CreateImage(device, pCreateInfo, pImage);
1408 return result;
1409}
1410
1411XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetImageSubresourceInfo(XGL_IMAGE image, const XGL_IMAGE_SUBRESOURCE* pSubresource, XGL_SUBRESOURCE_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
1412{
1413 XGL_RESULT result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData);
1414 return result;
1415}
1416
1417XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImageView(XGL_DEVICE device, const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, XGL_IMAGE_VIEW* pView)
1418{
1419 XGL_RESULT result = nextTable.CreateImageView(device, pCreateInfo, pView);
1420 return result;
1421}
1422
1423XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorAttachmentView(XGL_DEVICE device, const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, XGL_COLOR_ATTACHMENT_VIEW* pView)
1424{
1425 XGL_RESULT result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView);
1426 return result;
1427}
1428
1429XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilView(XGL_DEVICE device, const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_VIEW* pView)
1430{
1431 XGL_RESULT result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView);
1432 return result;
1433}
1434
1435XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateShader(XGL_DEVICE device, const XGL_SHADER_CREATE_INFO* pCreateInfo, XGL_SHADER* pShader)
1436{
1437 XGL_RESULT result = nextTable.CreateShader(device, pCreateInfo, pShader);
1438 return result;
1439}
1440
1441XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline)
1442{
1443 XGL_RESULT result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline);
1444 // Create LL HEAD for this Pipeline
Tobin Ehlise79df942014-11-18 16:38:08 -07001445 char str[1024];
1446 sprintf(str, "Created Gfx Pipeline %p", (void*)*pPipeline);
1447 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pPipeline, 0, DRAWSTATE_NONE, "DS", str);
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001448 pthread_mutex_lock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001449 PIPELINE_NODE *pTrav = pPipelineHead;
1450 if (pTrav) {
1451 while (pTrav->pNext)
1452 pTrav = pTrav->pNext;
1453 pTrav->pNext = (PIPELINE_NODE*)malloc(sizeof(PIPELINE_NODE));
1454 pTrav = pTrav->pNext;
1455 }
1456 else {
1457 pTrav = (PIPELINE_NODE*)malloc(sizeof(PIPELINE_NODE));
1458 pPipelineHead = pTrav;
1459 }
1460 memset((void*)pTrav, 0, sizeof(PIPELINE_NODE));
1461 pTrav->pipeline = *pPipeline;
1462 initPipeline(pTrav, pCreateInfo);
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001463 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001464 return result;
1465}
1466
1467XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateComputePipeline(XGL_DEVICE device, const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline)
1468{
1469 XGL_RESULT result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline);
1470 return result;
1471}
1472
1473XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglStorePipeline(XGL_PIPELINE pipeline, XGL_SIZE* pDataSize, XGL_VOID* pData)
1474{
1475 XGL_RESULT result = nextTable.StorePipeline(pipeline, pDataSize, pData);
1476 return result;
1477}
1478
1479XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLoadPipeline(XGL_DEVICE device, XGL_SIZE dataSize, const XGL_VOID* pData, XGL_PIPELINE* pPipeline)
1480{
1481 XGL_RESULT result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline);
1482 return result;
1483}
1484
1485XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreatePipelineDelta(XGL_DEVICE device, XGL_PIPELINE p1, XGL_PIPELINE p2, XGL_PIPELINE_DELTA* delta)
1486{
1487 XGL_RESULT result = nextTable.CreatePipelineDelta(device, p1, p2, delta);
1488 return result;
1489}
1490
1491XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateSampler(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler)
1492{
1493 XGL_RESULT result = nextTable.CreateSampler(device, pCreateInfo, pSampler);
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001494 pthread_mutex_lock(&globalLock);
Tobin Ehlis5a1d9f32014-11-20 10:48:56 -07001495 SAMPLER_NODE *pNewNode = (SAMPLER_NODE*)malloc(sizeof(SAMPLER_NODE));
1496 pNewNode->sampler = *pSampler;
1497 memcpy(&pNewNode->createInfo, pCreateInfo, sizeof(XGL_SAMPLER_CREATE_INFO));
1498 pNewNode->pNext = pSamplerHead;
1499 pSamplerHead = pNewNode;
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001500 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001501 return result;
1502}
1503
1504XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSet(XGL_DEVICE device, const XGL_DESCRIPTOR_SET_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET* pDescriptorSet)
1505{
1506 XGL_RESULT result = nextTable.CreateDescriptorSet(device, pCreateInfo, pDescriptorSet);
1507 // Create LL chain
Tobin Ehlise79df942014-11-18 16:38:08 -07001508 char str[1024];
1509 sprintf(str, "Created Descriptor Set (DS) %p", (void*)*pDescriptorSet);
1510 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pDescriptorSet, 0, DRAWSTATE_NONE, "DS", str);
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001511 pthread_mutex_lock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001512 DS_LL_HEAD *pTrav = pDSHead;
1513 if (pTrav) {
1514 // Grow existing list
1515 while (pTrav->pNextDS)
1516 pTrav = pTrav->pNextDS;
1517 pTrav->pNextDS = (DS_LL_HEAD*)malloc(sizeof(DS_LL_HEAD));
1518 pTrav = pTrav->pNextDS;
1519 }
1520 else { // Create new list
1521 pTrav = (DS_LL_HEAD*)malloc(sizeof(DS_LL_HEAD));
1522 pDSHead = pTrav;
1523 }
1524 pTrav->dsSlot = (DS_SLOT*)malloc(sizeof(DS_SLOT) * pCreateInfo->slots);
1525 pTrav->dsID = *pDescriptorSet;
1526 pTrav->numSlots = pCreateInfo->slots;
1527 pTrav->pNextDS = NULL;
1528 pTrav->updateActive = XGL_FALSE;
1529 initDS(pTrav);
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001530 pthread_mutex_unlock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001531 return result;
1532}
1533
1534XGL_LAYER_EXPORT XGL_VOID XGLAPI xglBeginDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet)
1535{
Tobin Ehlis0f051a52014-10-24 13:03:56 -06001536 DS_LL_HEAD* pDS = getDS(descriptorSet);
1537 if (!pDS) {
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001538 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001539 char str[1024];
1540 sprintf(str, "Specified Descriptor Set %p does not exist!", (void*)descriptorSet);
1541 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_INVALID_DS, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001542 }
Tobin Ehlis0f051a52014-10-24 13:03:56 -06001543 else {
1544 pDS->updateActive = XGL_TRUE;
1545 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001546 nextTable.BeginDescriptorSetUpdate(descriptorSet);
1547}
1548
1549XGL_LAYER_EXPORT XGL_VOID XGLAPI xglEndDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet)
1550{
1551 if (!dsUpdate(descriptorSet)) {
1552 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001553 char str[1024];
1554 sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglEndDescriptorSetUpdate()!", (void*)descriptorSet);
1555 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_END_WITHOUT_BEGIN, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001556 }
Tobin Ehlis0f051a52014-10-24 13:03:56 -06001557 else {
1558 DS_LL_HEAD* pDS = getDS(descriptorSet);
1559 if (!pDS) {
Tobin Ehlise79df942014-11-18 16:38:08 -07001560 char str[1024];
1561 sprintf(str, "Specified Descriptor Set %p does not exist!", (void*)descriptorSet);
1562 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_INVALID_DS, "DS", str);
Tobin Ehlis0f051a52014-10-24 13:03:56 -06001563 }
1564 else {
1565 pDS->updateActive = XGL_FALSE;
1566 }
1567 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001568 nextTable.EndDescriptorSetUpdate(descriptorSet);
1569}
1570
1571XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachSamplerDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers)
1572{
1573 if (!dsUpdate(descriptorSet)) {
1574 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001575 char str[1024];
1576 sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet);
1577 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001578 }
1579 else {
Tobin Ehlise79df942014-11-18 16:38:08 -07001580 if (!dsSamplerMapping(descriptorSet, startSlot, slotCount, pSamplers)) {
1581 char str[1024];
1582 sprintf(str, "Unable to attach sampler descriptors to DS %p!", (void*)descriptorSet);
1583 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_SAMPLE_ATTACH_FAILED, "DS", str);
1584 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001585 }
1586 nextTable.AttachSamplerDescriptors(descriptorSet, startSlot, slotCount, pSamplers);
1587}
1588
1589XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachImageViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews)
1590{
1591 if (!dsUpdate(descriptorSet)) {
1592 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001593 char str[1024];
1594 sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet);
1595 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001596 }
1597 else {
Tobin Ehlise79df942014-11-18 16:38:08 -07001598 if (!dsImageMapping(descriptorSet, startSlot, slotCount, pImageViews)) {
1599 char str[1024];
1600 sprintf(str, "Unable to attach image view descriptors to DS %p!", (void*)descriptorSet);
1601 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_IMAGE_ATTACH_FAILED, "DS", str);
1602 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001603 }
1604 nextTable.AttachImageViewDescriptors(descriptorSet, startSlot, slotCount, pImageViews);
1605}
1606
1607XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachMemoryViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews)
1608{
1609 if (!dsUpdate(descriptorSet)) {
1610 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001611 char str[1024];
1612 sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet);
1613 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001614 }
1615 else {
Tobin Ehlise79df942014-11-18 16:38:08 -07001616 if (!dsMemMapping(descriptorSet, startSlot, slotCount, pMemViews)) {
1617 char str[1024];
1618 sprintf(str, "Unable to attach memory view descriptors to DS %p!", (void*)descriptorSet);
1619 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_MEMORY_ATTACH_FAILED, "DS", str);
1620 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001621 }
1622 nextTable.AttachMemoryViewDescriptors(descriptorSet, startSlot, slotCount, pMemViews);
1623}
1624
1625XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachNestedDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_DESCRIPTOR_SET_ATTACH_INFO* pNestedDescriptorSets)
1626{
1627 if (!dsUpdate(descriptorSet)) {
1628 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001629 char str[1024];
1630 sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet);
1631 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001632 }
1633 nextTable.AttachNestedDescriptors(descriptorSet, startSlot, slotCount, pNestedDescriptorSets);
1634}
1635
1636// TODO : Does xglBeginDescriptorSetUpdate() have to be called before this function?
1637XGL_LAYER_EXPORT XGL_VOID XGLAPI xglClearDescriptorSetSlots(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount)
1638{
1639 if (!dsUpdate(descriptorSet)) {
1640 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001641 char str[1024];
1642 sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglClearDescriptorSetSlots()!", (void*)descriptorSet);
1643 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001644 }
1645 if (!clearDS(descriptorSet, startSlot, slotCount)) {
1646 // TODO : This is where we should flag a REAL error
Tobin Ehlise79df942014-11-18 16:38:08 -07001647 char str[1024];
1648 sprintf(str, "Unable to perform xglClearDescriptorSetSlots(%p, %u, %u) call!", descriptorSet, startSlot, slotCount);
1649 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_CLEAR_DS_FAILED, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001650 }
1651 nextTable.ClearDescriptorSetSlots(descriptorSet, startSlot, slotCount);
1652}
1653
1654XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateViewportState(XGL_DEVICE device, const XGL_VIEWPORT_STATE_CREATE_INFO* pCreateInfo, XGL_VIEWPORT_STATE_OBJECT* pState)
1655{
1656 XGL_RESULT result = nextTable.CreateViewportState(device, pCreateInfo, pState);
Tobin Ehlis56a61072014-11-21 08:58:46 -07001657 insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_VIEWPORT);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001658 return result;
1659}
1660
1661XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateRasterState(XGL_DEVICE device, const XGL_RASTER_STATE_CREATE_INFO* pCreateInfo, XGL_RASTER_STATE_OBJECT* pState)
1662{
1663 XGL_RESULT result = nextTable.CreateRasterState(device, pCreateInfo, pState);
Tobin Ehlis56a61072014-11-21 08:58:46 -07001664 insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_RASTER);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001665 return result;
1666}
1667
1668XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateMsaaState(XGL_DEVICE device, const XGL_MSAA_STATE_CREATE_INFO* pCreateInfo, XGL_MSAA_STATE_OBJECT* pState)
1669{
1670 XGL_RESULT result = nextTable.CreateMsaaState(device, pCreateInfo, pState);
Tobin Ehlis56a61072014-11-21 08:58:46 -07001671 insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_MSAA);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001672 return result;
1673}
1674
1675XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorBlendState(XGL_DEVICE device, const XGL_COLOR_BLEND_STATE_CREATE_INFO* pCreateInfo, XGL_COLOR_BLEND_STATE_OBJECT* pState)
1676{
1677 XGL_RESULT result = nextTable.CreateColorBlendState(device, pCreateInfo, pState);
Tobin Ehlis56a61072014-11-21 08:58:46 -07001678 insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_COLOR_BLEND);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001679 return result;
1680}
1681
1682XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilState(XGL_DEVICE device, const XGL_DEPTH_STENCIL_STATE_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_STATE_OBJECT* pState)
1683{
1684 XGL_RESULT result = nextTable.CreateDepthStencilState(device, pCreateInfo, pState);
Tobin Ehlis56a61072014-11-21 08:58:46 -07001685 insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_DEPTH_STENCIL);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001686 return result;
1687}
1688
1689XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo, XGL_CMD_BUFFER* pCmdBuffer)
1690{
1691 XGL_RESULT result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
1692 return result;
1693}
1694
1695XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBeginCommandBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_FLAGS flags)
1696{
1697 XGL_RESULT result = nextTable.BeginCommandBuffer(cmdBuffer, flags);
1698 return result;
1699}
1700
1701XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEndCommandBuffer(XGL_CMD_BUFFER cmdBuffer)
1702{
1703 XGL_RESULT result = nextTable.EndCommandBuffer(cmdBuffer);
1704 return result;
1705}
1706
1707XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetCommandBuffer(XGL_CMD_BUFFER cmdBuffer)
1708{
1709 XGL_RESULT result = nextTable.ResetCommandBuffer(cmdBuffer);
1710 return result;
1711}
1712
1713XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipeline(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline)
1714{
1715 if (getPipeline(pipeline)) {
1716 lastBoundPipeline = pipeline;
1717 }
1718 else {
Tobin Ehlise79df942014-11-18 16:38:08 -07001719 char str[1024];
1720 sprintf(str, "Attempt to bind Pipeline %p that doesn't exist!", (void*)pipeline);
1721 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pipeline, 0, DRAWSTATE_INVALID_PIPELINE, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001722 }
1723 nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
1724}
1725
1726XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipelineDelta(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE_DELTA delta)
1727{
1728 nextTable.CmdBindPipelineDelta(cmdBuffer, pipelineBindPoint, delta);
1729}
1730
1731XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindStateObject(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_STATE_OBJECT state)
1732{
Tobin Ehlis56a61072014-11-21 08:58:46 -07001733 setLastBoundDynamicState(state, stateBindPoint);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001734 nextTable.CmdBindStateObject(cmdBuffer, stateBindPoint, state);
1735}
1736
1737XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDescriptorSet(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT index, XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT slotOffset)
1738{
1739 if (getDS(descriptorSet)) {
Tobin Ehlisb8154982014-10-27 14:53:17 -06001740 assert(index < XGL_MAX_DESCRIPTOR_SETS);
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001741 pthread_mutex_lock(&globalLock);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001742 lastBoundDS[index] = descriptorSet;
Tobin Ehliseacc64f2014-11-24 17:09:09 -07001743 lastBoundSlotOffset[index] = slotOffset;
Tobin Ehlis9e142a32014-11-21 12:04:39 -07001744 pthread_mutex_unlock(&globalLock);
Tobin Ehlise79df942014-11-18 16:38:08 -07001745 char str[1024];
1746 sprintf(str, "DS %p bound to DS index %u on pipeline %s", (void*)descriptorSet, index, string_XGL_PIPELINE_BIND_POINT(pipelineBindPoint));
1747 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_NONE, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001748 }
1749 else {
Tobin Ehlise79df942014-11-18 16:38:08 -07001750 char str[1024];
1751 sprintf(str, "Attempt to bind DS %p that doesn't exist!", (void*)descriptorSet);
1752 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_INVALID_DS, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001753 }
1754 nextTable.CmdBindDescriptorSet(cmdBuffer, pipelineBindPoint, index, descriptorSet, slotOffset);
1755}
1756
1757XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDynamicMemoryView(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView)
1758{
1759 nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView);
1760}
1761
Chia-I Wu3b04af52014-11-08 10:48:20 +08001762XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindVertexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding)
1763{
Tobin Ehlis1affd3c2014-11-25 10:24:15 -07001764 lastVtxBinding = binding;
Chia-I Wu3b04af52014-11-08 10:48:20 +08001765 nextTable.CmdBindVertexData(cmdBuffer, mem, offset, binding);
1766}
1767
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001768XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType)
1769{
1770 nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType);
1771}
1772
1773XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindAttachments(XGL_CMD_BUFFER cmdBuffer, XGL_UINT colorAttachmentCount, const XGL_COLOR_ATTACHMENT_BIND_INFO* pColorAttachments, const XGL_DEPTH_STENCIL_BIND_INFO* pDepthStencilAttachment)
1774{
1775 nextTable.CmdBindAttachments(cmdBuffer, colorAttachmentCount, pColorAttachments, pDepthStencilAttachment);
1776}
1777
1778XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareMemoryRegions(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_MEMORY_STATE_TRANSITION* pStateTransitions)
1779{
1780 nextTable.CmdPrepareMemoryRegions(cmdBuffer, transitionCount, pStateTransitions);
1781}
1782
1783XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareImages(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_IMAGE_STATE_TRANSITION* pStateTransitions)
1784{
1785 nextTable.CmdPrepareImages(cmdBuffer, transitionCount, pStateTransitions);
1786}
1787
1788XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDraw(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstVertex, XGL_UINT vertexCount, XGL_UINT firstInstance, XGL_UINT instanceCount)
1789{
Tobin Ehlise79df942014-11-18 16:38:08 -07001790 char str[1024];
1791 sprintf(str, "xglCmdDraw() call #%lu, reporting DS state:", drawCount[DRAW]++);
1792 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001793 synchAndPrintDSConfig();
1794 nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount);
1795}
1796
1797XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndexed(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstIndex, XGL_UINT indexCount, XGL_INT vertexOffset, XGL_UINT firstInstance, XGL_UINT instanceCount)
1798{
Tobin Ehlise79df942014-11-18 16:38:08 -07001799 char str[1024];
Tobin Ehlis62086412014-11-19 16:19:28 -07001800 sprintf(str, "xglCmdDrawIndexed() call #%lu, reporting DS state:", drawCount[DRAW_INDEXED]++);
Tobin Ehlise79df942014-11-18 16:38:08 -07001801 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str);
Tobin Ehlisb8154982014-10-27 14:53:17 -06001802 synchAndPrintDSConfig();
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001803 nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount);
1804}
1805
1806XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride)
1807{
Tobin Ehlise79df942014-11-18 16:38:08 -07001808 char str[1024];
Tobin Ehlis62086412014-11-19 16:19:28 -07001809 sprintf(str, "xglCmdDrawIndirect() call #%lu, reporting DS state:", drawCount[DRAW_INDIRECT]++);
Tobin Ehlise79df942014-11-18 16:38:08 -07001810 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str);
Tobin Ehlisb8154982014-10-27 14:53:17 -06001811 synchAndPrintDSConfig();
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001812 nextTable.CmdDrawIndirect(cmdBuffer, mem, offset, count, stride);
1813}
1814
1815XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndexedIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride)
1816{
Tobin Ehlise79df942014-11-18 16:38:08 -07001817 char str[1024];
Tobin Ehlis62086412014-11-19 16:19:28 -07001818 sprintf(str, "xglCmdDrawIndexedIndirect() call #%lu, reporting DS state:", drawCount[DRAW_INDEXED_INDIRECT]++);
Tobin Ehlise79df942014-11-18 16:38:08 -07001819 layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str);
Tobin Ehlisb8154982014-10-27 14:53:17 -06001820 synchAndPrintDSConfig();
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001821 nextTable.CmdDrawIndexedIndirect(cmdBuffer, mem, offset, count, stride);
1822}
1823
1824XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatch(XGL_CMD_BUFFER cmdBuffer, XGL_UINT x, XGL_UINT y, XGL_UINT z)
1825{
1826 nextTable.CmdDispatch(cmdBuffer, x, y, z);
1827}
1828
1829XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatchIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset)
1830{
1831 nextTable.CmdDispatchIndirect(cmdBuffer, mem, offset);
1832}
1833
1834XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY srcMem, XGL_GPU_MEMORY destMem, XGL_UINT regionCount, const XGL_MEMORY_COPY* pRegions)
1835{
1836 nextTable.CmdCopyMemory(cmdBuffer, srcMem, destMem, regionCount, pRegions);
1837}
1838
1839XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT regionCount, const XGL_IMAGE_COPY* pRegions)
1840{
1841 nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions);
1842}
1843
1844XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyMemoryToImage(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY srcMem, XGL_IMAGE destImage, XGL_UINT regionCount, const XGL_MEMORY_IMAGE_COPY* pRegions)
1845{
1846 nextTable.CmdCopyMemoryToImage(cmdBuffer, srcMem, destImage, regionCount, pRegions);
1847}
1848
1849XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyImageToMemory(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_GPU_MEMORY destMem, XGL_UINT regionCount, const XGL_MEMORY_IMAGE_COPY* pRegions)
1850{
1851 nextTable.CmdCopyImageToMemory(cmdBuffer, srcImage, destMem, regionCount, pRegions);
1852}
1853
1854XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCloneImageData(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_STATE srcImageState, XGL_IMAGE destImage, XGL_IMAGE_STATE destImageState)
1855{
1856 nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageState, destImage, destImageState);
1857}
1858
1859XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdUpdateMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE dataSize, const XGL_UINT32* pData)
1860{
1861 nextTable.CmdUpdateMemory(cmdBuffer, destMem, destOffset, dataSize, pData);
1862}
1863
1864XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdFillMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE fillSize, XGL_UINT32 data)
1865{
1866 nextTable.CmdFillMemory(cmdBuffer, destMem, destOffset, fillSize, data);
1867}
1868
1869XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearColorImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const XGL_FLOAT color[4], XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges)
1870{
1871 nextTable.CmdClearColorImage(cmdBuffer, image, color, rangeCount, pRanges);
1872}
1873
1874XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearColorImageRaw(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const XGL_UINT32 color[4], XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges)
1875{
1876 nextTable.CmdClearColorImageRaw(cmdBuffer, image, color, rangeCount, pRanges);
1877}
1878
1879XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearDepthStencil(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, XGL_FLOAT depth, XGL_UINT32 stencil, XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges)
1880{
1881 nextTable.CmdClearDepthStencil(cmdBuffer, image, depth, stencil, rangeCount, pRanges);
1882}
1883
1884XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResolveImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT rectCount, const XGL_IMAGE_RESOLVE* pRects)
1885{
1886 nextTable.CmdResolveImage(cmdBuffer, srcImage, destImage, rectCount, pRects);
1887}
1888
1889XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event)
1890{
1891 nextTable.CmdSetEvent(cmdBuffer, event);
1892}
1893
1894XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event)
1895{
1896 nextTable.CmdResetEvent(cmdBuffer, event);
1897}
1898
1899XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdMemoryAtomic(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_UINT64 srcData, XGL_ATOMIC_OP atomicOp)
1900{
1901 nextTable.CmdMemoryAtomic(cmdBuffer, destMem, destOffset, srcData, atomicOp);
1902}
1903
1904XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBeginQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot, XGL_FLAGS flags)
1905{
1906 nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags);
1907}
1908
1909XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdEndQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot)
1910{
1911 nextTable.CmdEndQuery(cmdBuffer, queryPool, slot);
1912}
1913
1914XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetQueryPool(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount)
1915{
1916 nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount);
1917}
1918
1919XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdWriteTimestamp(XGL_CMD_BUFFER cmdBuffer, XGL_TIMESTAMP_TYPE timestampType, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset)
1920{
1921 nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destMem, destOffset);
1922}
1923
1924XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdInitAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, const XGL_UINT32* pData)
1925{
1926 nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData);
1927}
1928
1929XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdLoadAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, XGL_GPU_MEMORY srcMem, XGL_GPU_SIZE srcOffset)
1930{
1931 nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcMem, srcOffset);
1932}
1933
1934XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSaveAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset)
1935{
1936 nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destMem, destOffset);
1937}
1938
1939XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetValidationLevel(XGL_DEVICE device, XGL_VALIDATION_LEVEL validationLevel)
1940{
1941 XGL_RESULT result = nextTable.DbgSetValidationLevel(device, validationLevel);
1942 return result;
1943}
1944
1945XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgRegisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, XGL_VOID* pUserData)
1946{
Tobin Ehlise79df942014-11-18 16:38:08 -07001947 // This layer intercepts callbacks
1948 XGL_LAYER_DBG_FUNCTION_NODE *pNewDbgFuncNode = (XGL_LAYER_DBG_FUNCTION_NODE*)malloc(sizeof(XGL_LAYER_DBG_FUNCTION_NODE));
1949 if (!pNewDbgFuncNode)
1950 return XGL_ERROR_OUT_OF_MEMORY;
1951 pNewDbgFuncNode->pfnMsgCallback = pfnMsgCallback;
1952 pNewDbgFuncNode->pUserData = pUserData;
1953 pNewDbgFuncNode->pNext = pDbgFunctionHead;
1954 pDbgFunctionHead = pNewDbgFuncNode;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001955 XGL_RESULT result = nextTable.DbgRegisterMsgCallback(pfnMsgCallback, pUserData);
1956 return result;
1957}
1958
1959XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgUnregisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback)
1960{
Tobin Ehlise79df942014-11-18 16:38:08 -07001961 XGL_LAYER_DBG_FUNCTION_NODE *pTrav = pDbgFunctionHead;
1962 XGL_LAYER_DBG_FUNCTION_NODE *pPrev = pTrav;
1963 while (pTrav) {
1964 if (pTrav->pfnMsgCallback == pfnMsgCallback) {
1965 pPrev->pNext = pTrav->pNext;
1966 if (pDbgFunctionHead == pTrav)
1967 pDbgFunctionHead = pTrav->pNext;
1968 free(pTrav);
1969 break;
1970 }
1971 pPrev = pTrav;
1972 pTrav = pTrav->pNext;
1973 }
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06001974 XGL_RESULT result = nextTable.DbgUnregisterMsgCallback(pfnMsgCallback);
1975 return result;
1976}
1977
1978XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetMessageFilter(XGL_DEVICE device, XGL_INT msgCode, XGL_DBG_MSG_FILTER filter)
1979{
1980 XGL_RESULT result = nextTable.DbgSetMessageFilter(device, msgCode, filter);
1981 return result;
1982}
1983
1984XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetObjectTag(XGL_BASE_OBJECT object, XGL_SIZE tagSize, const XGL_VOID* pTag)
1985{
1986 XGL_RESULT result = nextTable.DbgSetObjectTag(object, tagSize, pTag);
1987 return result;
1988}
1989
1990XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(XGL_DBG_GLOBAL_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData)
1991{
1992 XGL_RESULT result = nextTable.DbgSetGlobalOption(dbgOption, dataSize, pData);
1993 return result;
1994}
1995
1996XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetDeviceOption(XGL_DEVICE device, XGL_DBG_DEVICE_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData)
1997{
1998 XGL_RESULT result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData);
1999 return result;
2000}
2001
2002XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerBegin(XGL_CMD_BUFFER cmdBuffer, const XGL_CHAR* pMarker)
2003{
2004 nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker);
2005}
2006
2007XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerEnd(XGL_CMD_BUFFER cmdBuffer)
2008{
2009 nextTable.CmdDbgMarkerEnd(cmdBuffer);
2010}
2011
2012XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11AssociateConnection(XGL_PHYSICAL_GPU gpu, const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo)
2013{
2014 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002015 pCurObj = gpuw;
2016 pthread_once(&tabOnce, initLayerTable);
2017 XGL_RESULT result = nextTable.WsiX11AssociateConnection((XGL_PHYSICAL_GPU)gpuw->nextObject, pConnectionInfo);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002018 return result;
2019}
2020
Chia-I Wu6204f342014-11-07 13:33:45 +08002021XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11GetMSC(XGL_DEVICE device, xcb_window_t window, xcb_randr_crtc_t crtc, XGL_UINT64* pMsc)
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002022{
Chia-I Wu6204f342014-11-07 13:33:45 +08002023 XGL_RESULT result = nextTable.WsiX11GetMSC(device, window, crtc, pMsc);
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002024 return result;
2025}
2026
2027XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11CreatePresentableImage(XGL_DEVICE device, const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem)
2028{
2029 XGL_RESULT result = nextTable.WsiX11CreatePresentableImage(device, pCreateInfo, pImage, pMem);
2030 return result;
2031}
2032
2033XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent(XGL_QUEUE queue, const XGL_WSI_X11_PRESENT_INFO* pPresentInfo, XGL_FENCE fence)
2034{
2035 XGL_RESULT result = nextTable.WsiX11QueuePresent(queue, pPresentInfo, fence);
2036 return result;
2037}
2038
Tobin Ehlisa701ef02014-11-27 15:43:39 -07002039XGL_VOID drawStateDumpDotFile(char* outFileName)
2040{
2041 dumpDotFile(outFileName);
2042}
2043
Tobin Ehlis266473d2014-12-16 17:34:50 -07002044XGL_VOID drawStateDumpPngFile(char* outFileName)
2045{
2046 char dotExe[32] = "/usr/bin/dot";
2047 if( access(dotExe, X_OK) != -1) {
2048 dumpDotFile("/tmp/tmp.dot");
2049 char dotCmd[1024];
2050 sprintf(dotCmd, "%s /tmp/tmp.dot -Tpng -o %s", dotExe, outFileName);
2051 system(dotCmd);
2052 remove("/tmp/tmp.dot");
2053 }
2054 else {
2055 char str[1024];
2056 sprintf(str, "Cannot execute dot program at (%s) to dump requested %s file.", dotExe, outFileName);
2057 layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_MISSING_DOT_PROGRAM, "DS", str);
2058 }
2059}
2060
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002061XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* funcName)
2062{
2063 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
2064 if (gpu == NULL)
2065 return NULL;
2066 pCurObj = gpuw;
2067 pthread_once(&tabOnce, initLayerTable);
2068
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002069 if (!strncmp("xglGetProcAddr", funcName, sizeof("xglGetProcAddr")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002070 return xglGetProcAddr;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002071 else if (!strncmp("xglInitAndEnumerateGpus", funcName, sizeof("xglInitAndEnumerateGpus")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002072 return nextTable.InitAndEnumerateGpus;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002073 else if (!strncmp("xglGetGpuInfo", funcName, sizeof("xglGetGpuInfo")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002074 return xglGetGpuInfo;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002075 else if (!strncmp("xglCreateDevice", funcName, sizeof("xglCreateDevice")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002076 return xglCreateDevice;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002077 else if (!strncmp("xglDestroyDevice", funcName, sizeof("xglDestroyDevice")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002078 return xglDestroyDevice;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002079 else if (!strncmp("xglGetExtensionSupport", funcName, sizeof("xglGetExtensionSupport")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002080 return xglGetExtensionSupport;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002081 else if (!strncmp("xglEnumerateLayers", funcName, sizeof("xglEnumerateLayers")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002082 return xglEnumerateLayers;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002083 else if (!strncmp("xglGetDeviceQueue", funcName, sizeof("xglGetDeviceQueue")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002084 return xglGetDeviceQueue;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002085 else if (!strncmp("xglQueueSubmit", funcName, sizeof("xglQueueSubmit")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002086 return xglQueueSubmit;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002087 else if (!strncmp("xglQueueSetGlobalMemReferences", funcName, sizeof("xglQueueSetGlobalMemReferences")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002088 return xglQueueSetGlobalMemReferences;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002089 else if (!strncmp("xglQueueWaitIdle", funcName, sizeof("xglQueueWaitIdle")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002090 return xglQueueWaitIdle;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002091 else if (!strncmp("xglDeviceWaitIdle", funcName, sizeof("xglDeviceWaitIdle")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002092 return xglDeviceWaitIdle;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002093 else if (!strncmp("drawStateDumpDotFile", funcName, sizeof("drawStateDumpDotFile")))
Tobin Ehlisa701ef02014-11-27 15:43:39 -07002094 return drawStateDumpDotFile;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002095 else if (!strncmp("drawStateDumpPngFile", funcName, sizeof("drawStateDumpPngFile")))
Tobin Ehlis266473d2014-12-16 17:34:50 -07002096 return drawStateDumpPngFile;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002097 else if (!strncmp("xglGetMemoryHeapCount", funcName, sizeof("xglGetMemoryHeapCount")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002098 return xglGetMemoryHeapCount;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002099 else if (!strncmp("xglGetMemoryHeapInfo", funcName, sizeof("xglGetMemoryHeapInfo")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002100 return xglGetMemoryHeapInfo;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002101 else if (!strncmp("xglAllocMemory", funcName, sizeof("xglAllocMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002102 return xglAllocMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002103 else if (!strncmp("xglFreeMemory", funcName, sizeof("xglFreeMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002104 return xglFreeMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002105 else if (!strncmp("xglSetMemoryPriority", funcName, sizeof("xglSetMemoryPriority")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002106 return xglSetMemoryPriority;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002107 else if (!strncmp("xglMapMemory", funcName, sizeof("xglMapMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002108 return xglMapMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002109 else if (!strncmp("xglUnmapMemory", funcName, sizeof("xglUnmapMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002110 return xglUnmapMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002111 else if (!strncmp("xglPinSystemMemory", funcName, sizeof("xglPinSystemMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002112 return xglPinSystemMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002113 else if (!strncmp("xglRemapVirtualMemoryPages", funcName, sizeof("xglRemapVirtualMemoryPages")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002114 return xglRemapVirtualMemoryPages;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002115 else if (!strncmp("xglGetMultiGpuCompatibility", funcName, sizeof("xglGetMultiGpuCompatibility")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002116 return xglGetMultiGpuCompatibility;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002117 else if (!strncmp("xglOpenSharedMemory", funcName, sizeof("xglOpenSharedMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002118 return xglOpenSharedMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002119 else if (!strncmp("xglOpenSharedQueueSemaphore", funcName, sizeof("xglOpenSharedQueueSemaphore")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002120 return xglOpenSharedQueueSemaphore;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002121 else if (!strncmp("xglOpenPeerMemory", funcName, sizeof("xglOpenPeerMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002122 return xglOpenPeerMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002123 else if (!strncmp("xglOpenPeerImage", funcName, sizeof("xglOpenPeerImage")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002124 return xglOpenPeerImage;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002125 else if (!strncmp("xglDestroyObject", funcName, sizeof("xglDestroyObject")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002126 return xglDestroyObject;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002127 else if (!strncmp("xglGetObjectInfo", funcName, sizeof("xglGetObjectInfo")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002128 return xglGetObjectInfo;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002129 else if (!strncmp("xglBindObjectMemory", funcName, sizeof("xglBindObjectMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002130 return xglBindObjectMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002131 else if (!strncmp("xglCreateFence", funcName, sizeof("xglCreateFence")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002132 return xglCreateFence;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002133 else if (!strncmp("xglGetFenceStatus", funcName, sizeof("xglGetFenceStatus")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002134 return xglGetFenceStatus;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002135 else if (!strncmp("xglWaitForFences", funcName, sizeof("xglWaitForFences")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002136 return xglWaitForFences;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002137 else if (!strncmp("xglCreateQueueSemaphore", funcName, sizeof("xglCreateQueueSemaphore")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002138 return xglCreateQueueSemaphore;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002139 else if (!strncmp("xglSignalQueueSemaphore", funcName, sizeof("xglSignalQueueSemaphore")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002140 return xglSignalQueueSemaphore;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002141 else if (!strncmp("xglWaitQueueSemaphore", funcName, sizeof("xglWaitQueueSemaphore")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002142 return xglWaitQueueSemaphore;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002143 else if (!strncmp("xglCreateEvent", funcName, sizeof("xglCreateEvent")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002144 return xglCreateEvent;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002145 else if (!strncmp("xglGetEventStatus", funcName, sizeof("xglGetEventStatus")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002146 return xglGetEventStatus;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002147 else if (!strncmp("xglSetEvent", funcName, sizeof("xglSetEvent")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002148 return xglSetEvent;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002149 else if (!strncmp("xglResetEvent", funcName, sizeof("xglResetEvent")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002150 return xglResetEvent;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002151 else if (!strncmp("xglCreateQueryPool", funcName, sizeof("xglCreateQueryPool")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002152 return xglCreateQueryPool;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002153 else if (!strncmp("xglGetQueryPoolResults", funcName, sizeof("xglGetQueryPoolResults")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002154 return xglGetQueryPoolResults;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002155 else if (!strncmp("xglGetFormatInfo", funcName, sizeof("xglGetFormatInfo")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002156 return xglGetFormatInfo;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002157 else if (!strncmp("xglCreateImage", funcName, sizeof("xglCreateImage")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002158 return xglCreateImage;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002159 else if (!strncmp("xglGetImageSubresourceInfo", funcName, sizeof("xglGetImageSubresourceInfo")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002160 return xglGetImageSubresourceInfo;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002161 else if (!strncmp("xglCreateImageView", funcName, sizeof("xglCreateImageView")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002162 return xglCreateImageView;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002163 else if (!strncmp("xglCreateColorAttachmentView", funcName, sizeof("xglCreateColorAttachmentView")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002164 return xglCreateColorAttachmentView;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002165 else if (!strncmp("xglCreateDepthStencilView", funcName, sizeof("xglCreateDepthStencilView")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002166 return xglCreateDepthStencilView;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002167 else if (!strncmp("xglCreateShader", funcName, sizeof("xglCreateShader")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002168 return xglCreateShader;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002169 else if (!strncmp("xglCreateGraphicsPipeline", funcName, sizeof("xglCreateGraphicsPipeline")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002170 return xglCreateGraphicsPipeline;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002171 else if (!strncmp("xglCreateComputePipeline", funcName, sizeof("xglCreateComputePipeline")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002172 return xglCreateComputePipeline;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002173 else if (!strncmp("xglStorePipeline", funcName, sizeof("xglStorePipeline")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002174 return xglStorePipeline;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002175 else if (!strncmp("xglLoadPipeline", funcName, sizeof("xglLoadPipeline")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002176 return xglLoadPipeline;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002177 else if (!strncmp("xglCreatePipelineDelta", funcName, sizeof("xglCreatePipelineDelta")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002178 return xglCreatePipelineDelta;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002179 else if (!strncmp("xglCreateSampler", funcName, sizeof("xglCreateSampler")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002180 return xglCreateSampler;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002181 else if (!strncmp("xglCreateDescriptorSet", funcName, sizeof("xglCreateDescriptorSet")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002182 return xglCreateDescriptorSet;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002183 else if (!strncmp("xglBeginDescriptorSetUpdate", funcName, sizeof("xglBeginDescriptorSetUpdate")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002184 return xglBeginDescriptorSetUpdate;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002185 else if (!strncmp("xglEndDescriptorSetUpdate", funcName, sizeof("xglEndDescriptorSetUpdate")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002186 return xglEndDescriptorSetUpdate;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002187 else if (!strncmp("xglAttachSamplerDescriptors", funcName, sizeof("xglAttachSamplerDescriptors")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002188 return xglAttachSamplerDescriptors;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002189 else if (!strncmp("xglAttachImageViewDescriptors", funcName, sizeof("xglAttachImageViewDescriptors")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002190 return xglAttachImageViewDescriptors;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002191 else if (!strncmp("xglAttachMemoryViewDescriptors", funcName, sizeof("xglAttachMemoryViewDescriptors")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002192 return xglAttachMemoryViewDescriptors;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002193 else if (!strncmp("xglAttachNestedDescriptors", funcName, sizeof("xglAttachNestedDescriptors")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002194 return xglAttachNestedDescriptors;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002195 else if (!strncmp("xglClearDescriptorSetSlots", funcName, sizeof("xglClearDescriptorSetSlots")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002196 return xglClearDescriptorSetSlots;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002197 else if (!strncmp("xglCreateViewportState", funcName, sizeof("xglCreateViewportState")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002198 return xglCreateViewportState;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002199 else if (!strncmp("xglCreateRasterState", funcName, sizeof("xglCreateRasterState")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002200 return xglCreateRasterState;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002201 else if (!strncmp("xglCreateMsaaState", funcName, sizeof("xglCreateMsaaState")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002202 return xglCreateMsaaState;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002203 else if (!strncmp("xglCreateColorBlendState", funcName, sizeof("xglCreateColorBlendState")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002204 return xglCreateColorBlendState;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002205 else if (!strncmp("xglCreateDepthStencilState", funcName, sizeof("xglCreateDepthStencilState")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002206 return xglCreateDepthStencilState;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002207 else if (!strncmp("xglCreateCommandBuffer", funcName, sizeof("xglCreateCommandBuffer")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002208 return xglCreateCommandBuffer;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002209 else if (!strncmp("xglBeginCommandBuffer", funcName, sizeof("xglBeginCommandBuffer")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002210 return xglBeginCommandBuffer;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002211 else if (!strncmp("xglEndCommandBuffer", funcName, sizeof("xglEndCommandBuffer")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002212 return xglEndCommandBuffer;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002213 else if (!strncmp("xglResetCommandBuffer", funcName, sizeof("xglResetCommandBuffer")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002214 return xglResetCommandBuffer;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002215 else if (!strncmp("xglCmdBindPipeline", funcName, sizeof("xglCmdBindPipeline")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002216 return xglCmdBindPipeline;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002217 else if (!strncmp("xglCmdBindPipelineDelta", funcName, sizeof("xglCmdBindPipelineDelta")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002218 return xglCmdBindPipelineDelta;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002219 else if (!strncmp("xglCmdBindStateObject", funcName, sizeof("xglCmdBindStateObject")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002220 return xglCmdBindStateObject;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002221 else if (!strncmp("xglCmdBindDescriptorSet", funcName, sizeof("xglCmdBindDescriptorSet")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002222 return xglCmdBindDescriptorSet;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002223 else if (!strncmp("xglCmdBindDynamicMemoryView", funcName, sizeof("xglCmdBindDynamicMemoryView")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002224 return xglCmdBindDynamicMemoryView;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002225 else if (!strncmp("xglCmdBindIndexData", funcName, sizeof("xglCmdBindIndexData")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002226 return xglCmdBindIndexData;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002227 else if (!strncmp("xglCmdBindAttachments", funcName, sizeof("xglCmdBindAttachments")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002228 return xglCmdBindAttachments;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002229 else if (!strncmp("xglCmdPrepareMemoryRegions", funcName, sizeof("xglCmdPrepareMemoryRegions")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002230 return xglCmdPrepareMemoryRegions;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002231 else if (!strncmp("xglCmdPrepareImages", funcName, sizeof("xglCmdPrepareImages")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002232 return xglCmdPrepareImages;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002233 else if (!strncmp("xglCmdDraw", funcName, sizeof("xglCmdDraw")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002234 return xglCmdDraw;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002235 else if (!strncmp("xglCmdDrawIndexed", funcName, sizeof("xglCmdDrawIndexed")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002236 return xglCmdDrawIndexed;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002237 else if (!strncmp("xglCmdDrawIndirect", funcName, sizeof("xglCmdDrawIndirect")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002238 return xglCmdDrawIndirect;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002239 else if (!strncmp("xglCmdDrawIndexedIndirect", funcName, sizeof("xglCmdDrawIndexedIndirect")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002240 return xglCmdDrawIndexedIndirect;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002241 else if (!strncmp("xglCmdDispatch", funcName, sizeof("xglCmdDispatch")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002242 return xglCmdDispatch;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002243 else if (!strncmp("xglCmdDispatchIndirect", funcName, sizeof("xglCmdDispatchIndirect")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002244 return xglCmdDispatchIndirect;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002245 else if (!strncmp("xglCmdCopyMemory", funcName, sizeof("xglCmdCopyMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002246 return xglCmdCopyMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002247 else if (!strncmp("xglCmdCopyImage", funcName, sizeof("xglCmdCopyImage")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002248 return xglCmdCopyImage;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002249 else if (!strncmp("xglCmdCopyMemoryToImage", funcName, sizeof("xglCmdCopyMemoryToImage")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002250 return xglCmdCopyMemoryToImage;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002251 else if (!strncmp("xglCmdCopyImageToMemory", funcName, sizeof("xglCmdCopyImageToMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002252 return xglCmdCopyImageToMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002253 else if (!strncmp("xglCmdCloneImageData", funcName, sizeof("xglCmdCloneImageData")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002254 return xglCmdCloneImageData;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002255 else if (!strncmp("xglCmdUpdateMemory", funcName, sizeof("xglCmdUpdateMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002256 return xglCmdUpdateMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002257 else if (!strncmp("xglCmdFillMemory", funcName, sizeof("xglCmdFillMemory")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002258 return xglCmdFillMemory;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002259 else if (!strncmp("xglCmdClearColorImage", funcName, sizeof("xglCmdClearColorImage")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002260 return xglCmdClearColorImage;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002261 else if (!strncmp("xglCmdClearColorImageRaw", funcName, sizeof("xglCmdClearColorImageRaw")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002262 return xglCmdClearColorImageRaw;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002263 else if (!strncmp("xglCmdClearDepthStencil", funcName, sizeof("xglCmdClearDepthStencil")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002264 return xglCmdClearDepthStencil;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002265 else if (!strncmp("xglCmdResolveImage", funcName, sizeof("xglCmdResolveImage")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002266 return xglCmdResolveImage;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002267 else if (!strncmp("xglCmdSetEvent", funcName, sizeof("xglCmdSetEvent")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002268 return xglCmdSetEvent;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002269 else if (!strncmp("xglCmdResetEvent", funcName, sizeof("xglCmdResetEvent")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002270 return xglCmdResetEvent;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002271 else if (!strncmp("xglCmdMemoryAtomic", funcName, sizeof("xglCmdMemoryAtomic")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002272 return xglCmdMemoryAtomic;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002273 else if (!strncmp("xglCmdBeginQuery", funcName, sizeof("xglCmdBeginQuery")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002274 return xglCmdBeginQuery;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002275 else if (!strncmp("xglCmdEndQuery", funcName, sizeof("xglCmdEndQuery")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002276 return xglCmdEndQuery;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002277 else if (!strncmp("xglCmdResetQueryPool", funcName, sizeof("xglCmdResetQueryPool")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002278 return xglCmdResetQueryPool;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002279 else if (!strncmp("xglCmdWriteTimestamp", funcName, sizeof("xglCmdWriteTimestamp")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002280 return xglCmdWriteTimestamp;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002281 else if (!strncmp("xglCmdInitAtomicCounters", funcName, sizeof("xglCmdInitAtomicCounters")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002282 return xglCmdInitAtomicCounters;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002283 else if (!strncmp("xglCmdLoadAtomicCounters", funcName, sizeof("xglCmdLoadAtomicCounters")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002284 return xglCmdLoadAtomicCounters;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002285 else if (!strncmp("xglCmdSaveAtomicCounters", funcName, sizeof("xglCmdSaveAtomicCounters")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002286 return xglCmdSaveAtomicCounters;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002287 else if (!strncmp("xglDbgSetValidationLevel", funcName, sizeof("xglDbgSetValidationLevel")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002288 return xglDbgSetValidationLevel;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002289 else if (!strncmp("xglDbgRegisterMsgCallback", funcName, sizeof("xglDbgRegisterMsgCallback")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002290 return xglDbgRegisterMsgCallback;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002291 else if (!strncmp("xglDbgUnregisterMsgCallback", funcName, sizeof("xglDbgUnregisterMsgCallback")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002292 return xglDbgUnregisterMsgCallback;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002293 else if (!strncmp("xglDbgSetMessageFilter", funcName, sizeof("xglDbgSetMessageFilter")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002294 return xglDbgSetMessageFilter;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002295 else if (!strncmp("xglDbgSetObjectTag", funcName, sizeof("xglDbgSetObjectTag")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002296 return xglDbgSetObjectTag;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002297 else if (!strncmp("xglDbgSetGlobalOption", funcName, sizeof("xglDbgSetGlobalOption")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002298 return xglDbgSetGlobalOption;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002299 else if (!strncmp("xglDbgSetDeviceOption", funcName, sizeof("xglDbgSetDeviceOption")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002300 return xglDbgSetDeviceOption;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002301 else if (!strncmp("xglCmdDbgMarkerBegin", funcName, sizeof("xglCmdDbgMarkerBegin")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002302 return xglCmdDbgMarkerBegin;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002303 else if (!strncmp("xglCmdDbgMarkerEnd", funcName, sizeof("xglCmdDbgMarkerEnd")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002304 return xglCmdDbgMarkerEnd;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002305 else if (!strncmp("xglWsiX11AssociateConnection", funcName, sizeof("xglWsiX11AssociateConnection")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002306 return xglWsiX11AssociateConnection;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002307 else if (!strncmp("xglWsiX11GetMSC", funcName, sizeof("xglWsiX11GetMSC")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002308 return xglWsiX11GetMSC;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002309 else if (!strncmp("xglWsiX11CreatePresentableImage", funcName, sizeof("xglWsiX11CreatePresentableImage")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002310 return xglWsiX11CreatePresentableImage;
Chia-I Wu7461fcf2014-12-27 15:16:07 +08002311 else if (!strncmp("xglWsiX11QueuePresent", funcName, sizeof("xglWsiX11QueuePresent")))
Tobin Ehlis8726b9f2014-10-24 12:01:45 -06002312 return xglWsiX11QueuePresent;
2313 else {
2314 XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
2315 if (gpuw->pGPA == NULL)
2316 return NULL;
2317 return gpuw->pGPA(gpuw->nextObject, funcName);
2318 }
2319}
2320