Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1 | /* THIS FILE IS GENERATED. DO NOT EDIT. */ |
| 2 | |
| 3 | /* |
| 4 | * XGL |
| 5 | * |
| 6 | * Copyright (C) 2014 LunarG, Inc. |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 9 | * copy of this software and associated documentation files (the "Software"), |
| 10 | * to deal in the Software without restriction, including without limitation |
| 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 | * and/or sell copies of the Software, and to permit persons to whom the |
| 13 | * Software is furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included |
| 16 | * in all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 24 | * DEALINGS IN THE SOFTWARE. |
| 25 | */ |
| 26 | |
| 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <string.h> |
| 30 | #include <assert.h> |
| 31 | #include <pthread.h> |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 32 | #include "xgl_struct_string_helper.h" |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 33 | #include "mem_tracker.h" |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 34 | |
| 35 | static XGL_LAYER_DISPATCH_TABLE nextTable; |
| 36 | static XGL_BASE_LAYER_OBJECT *pCurObj; |
| 37 | static pthread_once_t tabOnce = PTHREAD_ONCE_INIT; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 38 | // Ptr to LL of dbg functions |
| 39 | static XGL_LAYER_DBG_FUNCTION_NODE *pDbgFunctionHead = NULL; |
| 40 | // Utility function to handle reporting |
| 41 | // If callbacks are enabled, use them, otherwise use printf |
| 42 | static XGL_VOID layerCbMsg(XGL_DBG_MSG_TYPE msgType, |
| 43 | XGL_VALIDATION_LEVEL validationLevel, |
| 44 | XGL_BASE_OBJECT srcObject, |
| 45 | XGL_SIZE location, |
| 46 | XGL_INT msgCode, |
| 47 | const XGL_CHAR* pLayerPrefix, |
| 48 | const XGL_CHAR* pMsg) |
| 49 | { |
| 50 | XGL_LAYER_DBG_FUNCTION_NODE *pTrav = pDbgFunctionHead; |
| 51 | if (pTrav) { |
| 52 | while (pTrav) { |
| 53 | pTrav->pfnMsgCallback(msgType, validationLevel, srcObject, location, msgCode, pMsg, pTrav->pUserData); |
| 54 | pTrav = pTrav->pNext; |
| 55 | } |
| 56 | } |
| 57 | else { |
| 58 | switch (msgType) { |
| 59 | case XGL_DBG_MSG_ERROR: |
| 60 | printf("{%s}ERROR : %s\n", pLayerPrefix, pMsg); |
| 61 | break; |
| 62 | case XGL_DBG_MSG_WARNING: |
| 63 | printf("{%s}WARN : %s\n", pLayerPrefix, pMsg); |
| 64 | break; |
| 65 | case XGL_DBG_MSG_PERF_WARNING: |
| 66 | printf("{%s}PERF_WARN : %s\n", pLayerPrefix, pMsg); |
| 67 | break; |
| 68 | default: |
| 69 | printf("{%s}INFO : %s\n", pLayerPrefix, pMsg); |
| 70 | break; |
| 71 | } |
| 72 | } |
| 73 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 74 | /* |
| 75 | * Data Structure overview |
| 76 | * There are 3 global Linked-Lists (LLs) |
| 77 | * pGlobalCBHead points to head of Command Buffer (CB) LL |
| 78 | * Off of each node in this LL there is a separate LL of |
| 79 | * memory objects that are referenced by this CB |
| 80 | * pGlobalMemObjHead points to head of Memory Object LL |
| 81 | * Off of each node in this LL there are 2 separate LL |
| 82 | * One is a list of all CBs referencing this mem obj |
| 83 | * Two is a list of all XGL Objects that are bound to this memory |
| 84 | * pGlobalObjHead point to head of XGL Objects w/ bound mem LL |
| 85 | * Each node of this LL contains a ptr to global Mem Obj node for bound mem |
| 86 | * |
| 87 | * The "Global" nodes are for the main LLs |
| 88 | * The "mini" nodes are for ancillary LLs that are pointed to from global nodes |
| 89 | * |
| 90 | * Algorithm overview |
| 91 | * These are the primary events that should happen related to different objects |
| 92 | * 1. Command buffers |
| 93 | * CREATION - Add node to global LL |
| 94 | * CMD BIND - If mem associated, add mem reference to mini LL |
| 95 | * DESTROY - Remove from global LL, decrement (and report) mem references |
| 96 | * 2. Mem Objects |
| 97 | * CREATION - Add node to global LL |
| 98 | * OBJ BIND - Add obj node to mini LL for that mem node |
| 99 | * CMB BIND - If mem-related add CB node to mini LL for that mem node |
| 100 | * DESTROY - Flag as errors any remaining refs and Remove from global LL |
| 101 | * 3. Generic Objects |
| 102 | * MEM BIND - DESTROY any previous binding, Add global obj node w/ ref to global mem obj node, Add obj node to mini LL for that mem node |
| 103 | * DESTROY - If mem bound, remove reference from mini LL for that mem Node, remove global obj node |
| 104 | */ |
| 105 | // TODO : Is there a way to track when Cmd Buffer finishes & remove mem references at that point? |
| 106 | // TODO : Could potentially store a list of freed mem allocs to flag when they're incorrectly used |
| 107 | |
| 108 | // Generic data struct for various "mini" Linked-Lists |
| 109 | // This just wraps some type of XGL OBJ and a pNext ptr |
| 110 | // Used for xgl obj, cmd buffer, and mem obj wrapping |
| 111 | typedef struct _MINI_NODE { |
| 112 | struct _MINI_NODE* pNext; |
| 113 | union { // different objects that can be wrapped |
| 114 | XGL_OBJECT object; |
| 115 | XGL_GPU_MEMORY mem; |
| 116 | XGL_CMD_BUFFER cmdBuffer; |
| 117 | XGL_BASE_OBJECT data; // for generic handling of data |
| 118 | }; |
| 119 | } MINI_NODE; |
| 120 | |
| 121 | struct GLOBAL_MEM_OBJ_NODE; |
| 122 | |
| 123 | // Store a single LL of command buffers |
| 124 | typedef struct _GLOBAL_CB_NODE { |
| 125 | struct _GLOBAL_CB_NODE* pNextGlobalCBNode; |
| 126 | MINI_NODE* pMemObjList; // LL of Mem objs referenced by this CB |
| 127 | XGL_CMD_BUFFER cmdBuffer; |
| 128 | XGL_FENCE fence; // fence tracking this cmd buffer |
| 129 | } GLOBAL_CB_NODE; |
| 130 | |
| 131 | // Data struct for tracking memory object |
| 132 | typedef struct _GLOBAL_MEM_OBJ_NODE { |
| 133 | struct _GLOBAL_MEM_OBJ_NODE* pNextGlobalNode; // Ptr to next mem obj in global list of all objs |
| 134 | MINI_NODE* pObjBindings; // Ptr to list of objects bound to this memory |
| 135 | MINI_NODE* pCmdBufferBindings; // Ptr to list of cmd buffers that this mem object references |
| 136 | XGL_UINT refCount; // Count of references (obj bindings or CB use) |
| 137 | XGL_GPU_MEMORY mem; |
| 138 | XGL_MEMORY_ALLOC_INFO allocInfo; |
| 139 | } GLOBAL_MEM_OBJ_NODE; |
| 140 | |
| 141 | typedef struct _GLOBAL_OBJECT_NODE { |
| 142 | struct _GLOBAL_OBJECT_NODE* pNext; |
| 143 | GLOBAL_MEM_OBJ_NODE* pMemNode; |
| 144 | XGL_OBJECT object; |
| 145 | } GLOBAL_OBJECT_NODE; |
| 146 | |
| 147 | static GLOBAL_CB_NODE* pGlobalCBHead = NULL; |
| 148 | static GLOBAL_MEM_OBJ_NODE* pGlobalMemObjHead = NULL; |
| 149 | static GLOBAL_OBJECT_NODE* pGlobalObjectHead = NULL; |
| 150 | static XGL_DEVICE globalDevice = NULL; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 151 | static uint64_t numCBNodes = 0; |
| 152 | static uint64_t numMemObjNodes = 0; |
| 153 | static uint64_t numObjectNodes = 0; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 154 | // Check list for data and if it's not included insert new node |
| 155 | // into HEAD of list pointed to by pHEAD & update pHEAD |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 156 | // Increment 'insert' if new node was inserted |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 157 | // return XGL_SUCCESS if no errors occur |
| 158 | static XGL_RESULT insertMiniNode(MINI_NODE** pHEAD, const XGL_BASE_OBJECT data, XGL_UINT* insert) |
| 159 | { |
| 160 | MINI_NODE* pTrav = *pHEAD; |
| 161 | while (pTrav && (pTrav->data != data)) { |
| 162 | pTrav = pTrav->pNext; |
| 163 | } |
| 164 | if (!pTrav) { // Add node to front of LL |
| 165 | pTrav = (MINI_NODE*)malloc(sizeof(MINI_NODE)); |
| 166 | if (!pTrav) |
| 167 | return XGL_ERROR_OUT_OF_MEMORY; |
| 168 | memset(pTrav, 0, sizeof(MINI_NODE)); |
| 169 | if (*pHEAD) |
| 170 | pTrav->pNext = *pHEAD; |
| 171 | *pHEAD = pTrav; |
| 172 | *insert += 1; |
| 173 | //pMemTrav->refCount++; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 174 | //sprintf(str, "MEM INFO : Incremented refCount for mem obj %p to %u", (void*)mem, pMemTrav->refCount); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 175 | } |
| 176 | if (pTrav->data) { // This is just FYI |
| 177 | assert(data == pTrav->data); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 178 | char str[1024]; |
| 179 | sprintf(str, "Data %p is already in data LL w/ HEAD at %p", data, *pHEAD); |
| 180 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, data, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 181 | } |
| 182 | pTrav->data = data; |
| 183 | return XGL_SUCCESS; |
| 184 | } |
| 185 | |
| 186 | // Add new CB node for this cb at end of global CB LL |
| 187 | static void insertGlobalCB(const XGL_CMD_BUFFER cb) |
| 188 | { |
| 189 | GLOBAL_CB_NODE* pTrav = pGlobalCBHead; |
| 190 | if (!pTrav) { |
| 191 | pTrav = (GLOBAL_CB_NODE*)malloc(sizeof(GLOBAL_CB_NODE)); |
| 192 | pGlobalCBHead = pTrav; |
| 193 | } |
| 194 | else { |
| 195 | while (NULL != pTrav->pNextGlobalCBNode) |
| 196 | pTrav = pTrav->pNextGlobalCBNode; |
| 197 | pTrav->pNextGlobalCBNode = (GLOBAL_CB_NODE*)malloc(sizeof(GLOBAL_CB_NODE)); |
| 198 | pTrav = pTrav->pNextGlobalCBNode; |
| 199 | } |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 200 | if (!pTrav) { |
| 201 | char str[1024]; |
| 202 | sprintf(str, "Malloc failed to alloc node for Cmd Buffer %p", (void*)cb); |
| 203 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_OUT_OF_MEMORY_ERROR, "MEM", str); |
| 204 | } |
| 205 | else { |
| 206 | numCBNodes++; |
| 207 | memset(pTrav, 0, sizeof(GLOBAL_CB_NODE)); |
| 208 | pTrav->cmdBuffer = cb; |
| 209 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | // Return ptr to node in global LL containing cb, or NULL if not found |
| 213 | static GLOBAL_CB_NODE* getGlobalCBNode(const XGL_CMD_BUFFER cb) |
| 214 | { |
| 215 | GLOBAL_CB_NODE* pTrav = pGlobalCBHead; |
| 216 | while (pTrav && (pTrav->cmdBuffer != cb)) |
| 217 | pTrav = pTrav->pNextGlobalCBNode; |
| 218 | return pTrav; |
| 219 | } |
| 220 | // Set fence for given cb in global cb node |
| 221 | static XGL_BOOL setCBFence(const XGL_CMD_BUFFER cb, const XGL_FENCE fence) |
| 222 | { |
| 223 | GLOBAL_CB_NODE* pTrav = getGlobalCBNode(cb); |
| 224 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 225 | char str[1024]; |
| 226 | sprintf(str, "Unable to find node for CB %p in order to set fence to %p", (void*)cb, (void*)fence); |
| 227 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_INVALID_CB, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 228 | return XGL_FALSE; |
| 229 | } |
| 230 | pTrav->fence = fence; |
| 231 | return XGL_TRUE; |
| 232 | } |
| 233 | |
| 234 | static XGL_BOOL validateCBMemRef(const XGL_CMD_BUFFER cb, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs) |
| 235 | { |
| 236 | GLOBAL_CB_NODE* pTrav = getGlobalCBNode(cb); |
| 237 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 238 | char str[1024]; |
| 239 | sprintf(str, "Unable to find node for CB %p in order to check memory references", (void*)cb); |
| 240 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_INVALID_CB, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 241 | return XGL_FALSE; |
| 242 | } |
| 243 | // Validate that all actual references are accounted for in pMemRefs |
| 244 | MINI_NODE* pMemNode = pTrav->pMemObjList; |
| 245 | uint32_t i; |
| 246 | uint8_t found = 0; |
| 247 | uint64_t foundCount = 0; |
| 248 | while (pMemNode) { |
| 249 | // TODO : Improve this algorithm |
| 250 | for (i = 0; i < memRefCount; i++) { |
| 251 | if (pMemNode->mem == pMemRefs[i].mem) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 252 | char str[1024]; |
| 253 | sprintf(str, "Found Mem Obj %p binding to CB %p", pMemNode->mem, cb); |
| 254 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 255 | found = 1; |
| 256 | foundCount++; |
Tobin Ehlis | c0418f9 | 2014-11-25 14:47:20 -0700 | [diff] [blame] | 257 | break; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 258 | } |
| 259 | } |
| 260 | if (!found) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 261 | char str[1024]; |
| 262 | sprintf(str, "Memory reference list for Command Buffer %p is missing ref to mem obj %p", cb, pMemNode->mem); |
| 263 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_CB_MISSING_MEM_REF, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 264 | return XGL_FALSE; |
| 265 | } |
| 266 | found = 0; |
| 267 | pMemNode = pMemNode->pNext; |
| 268 | } |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 269 | char str[1024]; |
| 270 | sprintf(str, "Verified all %lu memory dependencies for CB %p are included in pMemRefs list", foundCount, cb); |
| 271 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 272 | // TODO : Could report mem refs in pMemRefs that AREN'T in mem LL, that would be primarily informational |
| 273 | // Currently just noting that there is a difference |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 274 | if (foundCount != memRefCount) { |
| 275 | sprintf(str, "Note that %u mem refs included in pMemRefs list, but only %lu appear to be required", memRefCount, foundCount); |
| 276 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_NONE, "MEM", str); |
| 277 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 278 | return XGL_TRUE; |
| 279 | } |
| 280 | |
| 281 | static void insertGlobalMemObj(const XGL_GPU_MEMORY mem, const XGL_MEMORY_ALLOC_INFO* pAllocInfo) |
| 282 | { |
| 283 | GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; |
| 284 | if (!pTrav) { |
| 285 | pTrav = (GLOBAL_MEM_OBJ_NODE*)malloc(sizeof(GLOBAL_MEM_OBJ_NODE)); |
| 286 | pGlobalMemObjHead = pTrav; |
| 287 | } |
| 288 | else { |
| 289 | while (NULL != pTrav->pNextGlobalNode) |
| 290 | pTrav = pTrav->pNextGlobalNode; |
| 291 | pTrav->pNextGlobalNode = (GLOBAL_MEM_OBJ_NODE*)malloc(sizeof(GLOBAL_MEM_OBJ_NODE)); |
| 292 | pTrav = pTrav->pNextGlobalNode; |
| 293 | } |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 294 | if (!pTrav) { |
| 295 | char str[1024]; |
| 296 | sprintf(str, "Malloc failed to alloc node for Mem Object %p", (void*)mem); |
| 297 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_OUT_OF_MEMORY_ERROR, "MEM", str); |
| 298 | } |
| 299 | else { |
| 300 | numMemObjNodes++; |
| 301 | memset(pTrav, 0, sizeof(GLOBAL_MEM_OBJ_NODE)); |
| 302 | if (pAllocInfo) // MEM alloc created by xglWsiX11CreatePresentableImage() doesn't have alloc info struct |
| 303 | memcpy(&pTrav->allocInfo, pAllocInfo, sizeof(XGL_MEMORY_ALLOC_INFO)); |
| 304 | pTrav->mem = mem; |
| 305 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | // Return ptr to node in global LL containing mem, or NULL if not found |
| 309 | static GLOBAL_MEM_OBJ_NODE* getGlobalMemNode(const XGL_GPU_MEMORY mem) |
| 310 | { |
| 311 | GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; |
| 312 | while (pTrav && (pTrav->mem != mem)) |
| 313 | pTrav = pTrav->pNextGlobalNode; |
| 314 | return pTrav; |
| 315 | } |
| 316 | |
| 317 | // Find Global CB Node and add mem binding to mini LL |
| 318 | // Find Global Mem Obj Node and add CB binding to mini LL |
| 319 | static XGL_BOOL updateCBBinding(const XGL_CMD_BUFFER cb, const XGL_GPU_MEMORY mem) |
| 320 | { |
| 321 | // First update CB binding in MemObj mini CB list |
| 322 | GLOBAL_MEM_OBJ_NODE* pMemTrav = getGlobalMemNode(mem); |
| 323 | if (!pMemTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 324 | char str[1024]; |
| 325 | sprintf(str, "Trying to bind mem obj %p to CB %p but no Node for that mem obj.\n Was it correctly allocated? Did it already get freed?", mem, cb); |
| 326 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 327 | return XGL_FALSE; |
| 328 | } |
| 329 | |
| 330 | XGL_RESULT result = insertMiniNode(&pMemTrav->pCmdBufferBindings, cb, &pMemTrav->refCount); |
| 331 | if (XGL_SUCCESS != result) |
| 332 | return result; |
| 333 | |
| 334 | // Now update Global CB's Mini Mem binding list |
| 335 | GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); |
| 336 | if (!pCBTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 337 | char str[1024]; |
| 338 | sprintf(str, "Trying to bind mem obj %p to CB %p but no Node for that CB. Was it CB incorrectly destroyed?", mem, cb); |
| 339 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 340 | return XGL_FALSE; |
| 341 | } |
| 342 | XGL_UINT dontCare; |
| 343 | result = insertMiniNode(&pCBTrav->pMemObjList, mem, &dontCare); |
| 344 | if (XGL_SUCCESS != result) |
| 345 | return result; |
| 346 | |
| 347 | return XGL_TRUE; |
| 348 | } |
| 349 | // Clear the CB Binding for mem |
| 350 | static void clearCBBinding(const XGL_CMD_BUFFER cb, const XGL_GPU_MEMORY mem) |
| 351 | { |
| 352 | GLOBAL_MEM_OBJ_NODE* pTrav = getGlobalMemNode(mem); |
| 353 | MINI_NODE* pMiniCB = pTrav->pCmdBufferBindings; |
| 354 | MINI_NODE* pPrev = pMiniCB; |
| 355 | while (pMiniCB && (cb != pMiniCB->cmdBuffer)) { |
| 356 | pPrev = pMiniCB; |
| 357 | pMiniCB = pMiniCB->pNext; |
| 358 | } |
| 359 | if (!pMiniCB) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 360 | char str[1024]; |
| 361 | sprintf(str, "Trying to clear CB binding but CB %p not in binding list for mem obj %p", cb, mem); |
| 362 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_INTERNAL_ERROR, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 363 | } |
| 364 | else { // remove node from list & decrement refCount |
| 365 | pPrev->pNext = pMiniCB->pNext; |
| 366 | if (pMiniCB == pTrav->pCmdBufferBindings) |
| 367 | pTrav->pCmdBufferBindings = NULL; |
| 368 | free(pMiniCB); |
| 369 | pTrav->refCount--; |
| 370 | } |
| 371 | } |
| 372 | // Free bindings related to CB |
| 373 | static XGL_BOOL freeCBBindings(const XGL_CMD_BUFFER cb) |
| 374 | { |
| 375 | GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); |
| 376 | if (!pCBTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 377 | char str[1024]; |
| 378 | sprintf(str, "Unable to find global CB node %p for deletion", cb); |
| 379 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_INVALID_CB, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 380 | return XGL_FALSE; |
| 381 | } |
| 382 | MINI_NODE* pMemTrav = pCBTrav->pMemObjList; |
| 383 | MINI_NODE* pDeleteMe = NULL; |
| 384 | // We traverse LL in order and free nodes as they're cleared |
| 385 | while (pMemTrav) { |
| 386 | pDeleteMe = pMemTrav; |
| 387 | if (pMemTrav->mem) |
| 388 | clearCBBinding(cb, pMemTrav->mem); |
| 389 | pMemTrav = pMemTrav->pNext; |
| 390 | free(pDeleteMe); |
| 391 | } |
| 392 | pCBTrav->pMemObjList = NULL; |
| 393 | return XGL_TRUE; |
| 394 | } |
| 395 | // Delete Global CB Node from list along with all of it's mini mem obj node |
| 396 | // and also clear Global mem references to CB |
| 397 | // TODO : When should this be called? There's no Destroy of CBs that I see |
| 398 | static XGL_BOOL deleteGlobalCBNode(const XGL_CMD_BUFFER cb) |
| 399 | { |
| 400 | if (XGL_FALSE == freeCBBindings(cb)) |
| 401 | return XGL_FALSE; |
| 402 | // Delete the Global CB node |
| 403 | GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); |
| 404 | pCBTrav = pGlobalCBHead; |
| 405 | GLOBAL_CB_NODE* pPrev = pCBTrav; |
| 406 | while (pCBTrav && (cb != pCBTrav->cmdBuffer)) { |
| 407 | pPrev = pCBTrav; |
| 408 | pCBTrav = pCBTrav->pNextGlobalCBNode; |
| 409 | } |
| 410 | assert(cb); // We found node at start of function so it should still be here |
| 411 | pPrev->pNextGlobalCBNode = pCBTrav->pNextGlobalCBNode; |
| 412 | if (pCBTrav == pGlobalCBHead) |
| 413 | pGlobalCBHead = pCBTrav->pNextGlobalCBNode; |
| 414 | free(pCBTrav); |
| 415 | return XGL_TRUE; |
| 416 | } |
| 417 | // Delete the entire CB list |
| 418 | static XGL_BOOL deleteGlobalCBList() |
| 419 | { |
| 420 | XGL_BOOL result = XGL_TRUE; |
| 421 | GLOBAL_CB_NODE* pCBTrav = pGlobalCBHead; |
| 422 | while (pCBTrav) { |
Tobin Ehlis | c0418f9 | 2014-11-25 14:47:20 -0700 | [diff] [blame] | 423 | XGL_CMD_BUFFER cbToDelete = pCBTrav->cmdBuffer; |
| 424 | pCBTrav = pCBTrav->pNextGlobalCBNode; |
| 425 | XGL_BOOL tmpResult = deleteGlobalCBNode(cbToDelete); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 426 | // If any result is FALSE, final result should be FALSE |
| 427 | if ((XGL_FALSE == tmpResult) || (XGL_FALSE == result)) |
| 428 | result = XGL_FALSE; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 429 | } |
| 430 | return result; |
| 431 | } |
| 432 | |
| 433 | // For given MemObj node, report Obj & CB bindings |
| 434 | static void reportMemReferences(const GLOBAL_MEM_OBJ_NODE* pMemObjTrav) |
| 435 | { |
| 436 | XGL_UINT refCount = 0; // Count found references |
| 437 | MINI_NODE* pObjTrav = pMemObjTrav->pObjBindings; |
| 438 | MINI_NODE* pCBTrav = pMemObjTrav->pCmdBufferBindings; |
| 439 | while (pCBTrav) { |
| 440 | refCount++; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 441 | char str[1024]; |
| 442 | sprintf(str, "Command Buffer %p has reference to mem obj %p", pCBTrav->cmdBuffer, pMemObjTrav->mem); |
| 443 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pCBTrav->cmdBuffer, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 444 | pCBTrav = pCBTrav->pNext; |
| 445 | } |
| 446 | while (pObjTrav) { |
| 447 | refCount++; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 448 | char str[1024]; |
| 449 | sprintf(str, "XGL Object %p has reference to mem obj %p", pObjTrav->object, pMemObjTrav->mem); |
| 450 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pObjTrav->object, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 451 | pObjTrav = pObjTrav->pNext; |
| 452 | } |
| 453 | if (refCount != pMemObjTrav->refCount) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 454 | char str[1024]; |
| 455 | sprintf(str, "Refcount of %u for Mem Obj %p does't match reported refs of %u", pMemObjTrav->refCount, pMemObjTrav->mem, refCount); |
| 456 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pObjTrav->object, 0, MEMTRACK_INTERNAL_ERROR, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 457 | } |
| 458 | } |
| 459 | |
| 460 | static void deleteGlobalMemNode(XGL_GPU_MEMORY mem) |
| 461 | { |
| 462 | GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; |
| 463 | GLOBAL_MEM_OBJ_NODE* pPrev = pTrav; |
| 464 | while (pTrav && (pTrav->mem != mem)) { |
| 465 | pPrev = pTrav; |
| 466 | pTrav = pTrav->pNextGlobalNode; |
| 467 | } |
| 468 | if (pTrav) { |
| 469 | pPrev->pNextGlobalNode = pTrav->pNextGlobalNode; |
| 470 | if (pGlobalMemObjHead == pTrav) |
| 471 | pGlobalMemObjHead = pTrav->pNextGlobalNode; |
| 472 | free(pTrav); |
| 473 | } |
| 474 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 475 | char str[1024]; |
| 476 | sprintf(str, "Could not find global mem obj node for %p to delete!", mem); |
| 477 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 478 | } |
| 479 | } |
| 480 | // Check if fence for given CB is completed |
| 481 | static XGL_BOOL checkCBCompleted(const XGL_CMD_BUFFER cb) |
| 482 | { |
| 483 | GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); |
| 484 | if (!pCBTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 485 | char str[1024]; |
| 486 | sprintf(str, "Unable to find global CB node %p to check for completion", cb); |
| 487 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_INVALID_CB, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 488 | return XGL_FALSE; |
| 489 | } |
| 490 | if (!pCBTrav->fence) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 491 | char str[1024]; |
| 492 | sprintf(str, "No fence found for CB %p to check for completion", cb); |
| 493 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_CB_MISSING_FENCE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 494 | return XGL_FALSE; |
| 495 | } |
| 496 | if (XGL_SUCCESS != nextTable.GetFenceStatus(pCBTrav->fence)) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 497 | char str[1024]; |
| 498 | sprintf(str, "Fence %p for CB %p has not completed", pCBTrav->fence, cb); |
| 499 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cb, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 500 | return XGL_FALSE; |
| 501 | } |
| 502 | return XGL_TRUE; |
| 503 | } |
| 504 | |
| 505 | static XGL_BOOL freeMemNode(XGL_GPU_MEMORY mem) |
| 506 | { |
| 507 | XGL_BOOL result = XGL_TRUE; |
| 508 | // Parse global list to find node w/ mem |
| 509 | GLOBAL_MEM_OBJ_NODE* pTrav = getGlobalMemNode(mem); |
| 510 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 511 | char str[1024]; |
| 512 | sprintf(str, "Couldn't find mem node object for %p\n Was %p never allocated or previously freed?", (void*)mem, (void*)mem); |
| 513 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 514 | return XGL_FALSE; |
| 515 | } |
| 516 | else { |
| 517 | // First clear any CB bindings for completed CBs |
| 518 | // TODO : Is there a better place to do this? |
| 519 | MINI_NODE* pMiniCB = pTrav->pCmdBufferBindings; |
| 520 | while (pMiniCB) { |
| 521 | XGL_CMD_BUFFER curCB = pMiniCB->cmdBuffer; |
| 522 | pMiniCB = pMiniCB->pNext; |
| 523 | if (XGL_TRUE == checkCBCompleted(curCB)) { |
| 524 | freeCBBindings(curCB); |
| 525 | } |
| 526 | } |
| 527 | // Now verify that no references to this mem obj remain |
| 528 | if (0 != pTrav->refCount) { |
| 529 | // If references remain, report the error and can search down CB LL to find references |
| 530 | result = XGL_FALSE; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 531 | char str[1024]; |
| 532 | sprintf(str, "Freeing mem obj %p while it still has references", (void*)mem); |
| 533 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_FREED_MEM_REF, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 534 | reportMemReferences(pTrav); |
| 535 | } |
| 536 | // Delete global node |
| 537 | deleteGlobalMemNode(mem); |
| 538 | } |
| 539 | return result; |
| 540 | } |
| 541 | |
| 542 | // Return object node for 'object' or return NULL if no node exists |
| 543 | static GLOBAL_OBJECT_NODE* getGlobalObjectNode(const XGL_OBJECT object) |
| 544 | { |
| 545 | GLOBAL_OBJECT_NODE* pTrav = pGlobalObjectHead; |
| 546 | while (pTrav && (object != pTrav->object)) { |
| 547 | pTrav = pTrav->pNext; |
| 548 | } |
| 549 | return pTrav; |
| 550 | } |
| 551 | |
| 552 | static GLOBAL_OBJECT_NODE* insertGlobalObjectNode(XGL_OBJECT object) |
| 553 | { |
| 554 | GLOBAL_OBJECT_NODE* pTrav = pGlobalObjectHead; |
| 555 | if (!pTrav) { |
| 556 | pTrav = (GLOBAL_OBJECT_NODE*)malloc(sizeof(GLOBAL_OBJECT_NODE)); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 557 | memset(pTrav, 0, sizeof(GLOBAL_OBJECT_NODE)); |
| 558 | pGlobalObjectHead = pTrav; |
| 559 | } |
| 560 | else { |
| 561 | GLOBAL_OBJECT_NODE* pPrev = pTrav; |
| 562 | while (pTrav) { |
| 563 | pPrev = pTrav; |
| 564 | pTrav = pTrav->pNext; |
| 565 | } |
| 566 | pTrav = (GLOBAL_OBJECT_NODE*)malloc(sizeof(GLOBAL_OBJECT_NODE)); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 567 | memset(pTrav, 0, sizeof(GLOBAL_OBJECT_NODE)); |
| 568 | pPrev->pNext = pTrav; |
| 569 | } |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 570 | if (!pTrav) { |
| 571 | char str[1024]; |
| 572 | sprintf(str, "Malloc failed to alloc node for XGL Object %p", (void*)object); |
| 573 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_OUT_OF_MEMORY_ERROR, "MEM", str); |
| 574 | return NULL; |
| 575 | } |
| 576 | else { |
| 577 | numObjectNodes++; |
| 578 | pTrav->object = object; |
| 579 | return pTrav; |
| 580 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | // Remove object binding performs 3 tasks: |
| 584 | // 1. Remove object node from Global Mem Obj mini LL of obj bindings & free it |
| 585 | // 2. Decrement refCount for Global Mem Obj |
| 586 | // 3. Clear Global Mem Obj ptr from Global Object Node |
| 587 | static XGL_BOOL clearObjectBinding(XGL_OBJECT object) |
| 588 | { |
| 589 | GLOBAL_OBJECT_NODE* pGlobalObjTrav = getGlobalObjectNode(object); |
| 590 | if (!pGlobalObjTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 591 | char str[1024]; |
| 592 | sprintf(str, "Attempting to clear mem binding for object %p", object); |
| 593 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 594 | return XGL_FALSE; |
| 595 | } |
| 596 | if (!pGlobalObjTrav->pMemNode) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 597 | char str[1024]; |
| 598 | sprintf(str, "Attempting to clear mem binding on obj %p but it has no binding.", (void*)object); |
| 599 | layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_MEM_OBJ_CLEAR_EMPTY_BINDINGS, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 600 | return XGL_FALSE; |
| 601 | } |
| 602 | MINI_NODE* pObjTrav = pGlobalObjTrav->pMemNode->pObjBindings; |
| 603 | MINI_NODE* pPrevObj = pObjTrav; |
| 604 | while (pObjTrav) { |
| 605 | if (object == pObjTrav->object) { |
| 606 | pPrevObj->pNext = pObjTrav->pNext; |
| 607 | // check if HEAD needs to be updated |
| 608 | if (pGlobalObjTrav->pMemNode->pObjBindings == pObjTrav) |
| 609 | pGlobalObjTrav->pMemNode->pObjBindings = pObjTrav->pNext; |
| 610 | free(pObjTrav); |
| 611 | pGlobalObjTrav->pMemNode->refCount--; |
| 612 | pGlobalObjTrav->pMemNode = NULL; |
| 613 | return XGL_TRUE; |
| 614 | } |
| 615 | pPrevObj = pObjTrav; |
| 616 | pObjTrav = pObjTrav->pNext; |
| 617 | } |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 618 | char str[1024]; |
| 619 | sprintf(str, "While trying to clear mem binding for object %p, unable to find that object referenced by mem obj %p", object, pGlobalObjTrav->pMemNode->mem); |
| 620 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_INTERNAL_ERROR, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 621 | return XGL_FALSE; |
| 622 | } |
| 623 | |
| 624 | // For NULL mem case, clear any previous binding Else... |
| 625 | // Make sure given object is in global object LL |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 626 | // IF a previous binding existed, clear it |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 627 | // Add link from global object node to global memory node |
| 628 | // Add mini-object node & reference off of global obj node |
| 629 | // Return XGL_TRUE if addition is successful, XGL_FALSE otherwise |
| 630 | static XGL_BOOL updateObjectBinding(XGL_OBJECT object, XGL_GPU_MEMORY mem) |
| 631 | { |
| 632 | // Handle NULL case separately, just clear previous binding & decrement reference |
| 633 | if (mem == XGL_NULL_HANDLE) { |
| 634 | clearObjectBinding(object); |
| 635 | return XGL_TRUE; |
| 636 | } |
| 637 | // Find obj node or add it if we don't have one |
| 638 | GLOBAL_OBJECT_NODE* pGlobalObjTrav = getGlobalObjectNode(object); |
| 639 | if (!pGlobalObjTrav) |
| 640 | pGlobalObjTrav = insertGlobalObjectNode(object); |
| 641 | |
| 642 | // non-null case so should have real mem obj |
| 643 | GLOBAL_MEM_OBJ_NODE* pTrav = getGlobalMemNode(mem); |
| 644 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 645 | char str[1024]; |
| 646 | sprintf(str, "While trying to bind mem for obj %p, couldn't find node for mem obj %p", (void*)object, (void*)mem); |
| 647 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 648 | return XGL_FALSE; |
| 649 | } |
| 650 | XGL_RESULT result = insertMiniNode(&pTrav->pObjBindings, object, &pTrav->refCount); |
| 651 | if (XGL_SUCCESS != result) |
| 652 | return result; |
| 653 | |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 654 | if (pGlobalObjTrav->pMemNode) { |
| 655 | clearObjectBinding(object); // Need to clear the previous object binding before setting new binding |
| 656 | char str[1024]; |
| 657 | sprintf(str, "Updating memory binding for object %p from mem obj %p to %p", object, pGlobalObjTrav->pMemNode->mem, mem); |
| 658 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_NONE, "MEM", str); |
| 659 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 660 | pGlobalObjTrav->pMemNode = pTrav; |
| 661 | return XGL_TRUE; |
| 662 | } |
| 663 | // Print details of global Obj tracking list |
| 664 | static void printObjList() |
| 665 | { |
| 666 | GLOBAL_OBJECT_NODE* pGlobalObjTrav = pGlobalObjectHead; |
| 667 | if (!pGlobalObjTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 668 | char str[1024]; |
| 669 | sprintf(str, "Global Object list is empty :(\n"); |
| 670 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 671 | } |
| 672 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 673 | char str[1024]; |
| 674 | sprintf(str, "Details of Global Object list w/ HEAD at %p", (void*)pGlobalObjTrav); |
| 675 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 676 | while (pGlobalObjTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 677 | sprintf(str, " GlobObjNode %p has object %p, pNext %p, pMemNode %p", pGlobalObjTrav, pGlobalObjTrav->object, pGlobalObjTrav->pNext, pGlobalObjTrav->pMemNode); |
| 678 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pGlobalObjTrav->object, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 679 | pGlobalObjTrav = pGlobalObjTrav->pNext; |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | // For given Object, get 'mem' obj that it's bound to or NULL if no binding |
| 684 | static XGL_GPU_MEMORY getMemBindingFromObject(const XGL_OBJECT object) |
| 685 | { |
| 686 | XGL_GPU_MEMORY mem = NULL; |
| 687 | GLOBAL_OBJECT_NODE* pObjNode = getGlobalObjectNode(object); |
| 688 | if (pObjNode) { |
| 689 | if (pObjNode->pMemNode) { |
| 690 | mem = pObjNode->pMemNode->mem; |
| 691 | } |
| 692 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 693 | char str[1024]; |
| 694 | sprintf(str, "Trying to get mem binding for object %p but object has no mem binding", (void*)object); |
| 695 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_MISSING_MEM_BINDINGS, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 696 | printObjList(); |
| 697 | } |
| 698 | } |
| 699 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 700 | char str[1024]; |
| 701 | sprintf(str, "Trying to get mem binding for object %p but no such object in global list", (void*)object); |
| 702 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_INVALID_OBJECT, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 703 | printObjList(); |
| 704 | } |
| 705 | return mem; |
| 706 | } |
| 707 | // Print details of global Mem Obj list |
| 708 | static void printMemList() |
| 709 | { |
| 710 | GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 711 | // Just printing each msg individually for now, may want to package these into single large print |
| 712 | char str[1024]; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 713 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 714 | sprintf(str, "MEM INFO : Global Memory Object list is empty :(\n"); |
| 715 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 716 | } |
| 717 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 718 | sprintf(str, "MEM INFO : Details of Global Memory Object list w/ HEAD at %p", (void*)pTrav); |
| 719 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 720 | while (pTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 721 | sprintf(str, " ===MemObj Node at %p===", (void*)pTrav); |
| 722 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
| 723 | sprintf(str, " Mem object: %p", (void*)pTrav->mem); |
| 724 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
| 725 | sprintf(str, " Ref Count: %u", pTrav->refCount); |
| 726 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
| 727 | sprintf(str, " pNext Mem Obj Node: %p", (void*)pTrav->pNextGlobalNode); |
| 728 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
| 729 | if (0 != pTrav->allocInfo.allocationSize) |
| 730 | sprintf(str, " Mem Alloc info:\n%s", xgl_print_xgl_memory_alloc_info(&pTrav->allocInfo, "{MEM}INFO : ")); |
| 731 | else |
| 732 | sprintf(str, " Mem Alloc info is NULL (alloc done by xglWsiX11CreatePresentableImage())"); |
| 733 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 734 | MINI_NODE* pObjTrav = pTrav->pObjBindings; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 735 | if (!pObjTrav) { |
| 736 | sprintf(str, " No XGL Object bindings"); |
| 737 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
| 738 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 739 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 740 | sprintf(str, " XGL OBJECT Binding list w/ HEAD at %p:", pObjTrav); |
| 741 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 742 | while (pObjTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 743 | sprintf(str, " OBJ_NODE(%p): XGL OBJECT %p, pNext %p", pObjTrav, pObjTrav->object, pObjTrav->pNext); |
| 744 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 745 | pObjTrav = pObjTrav->pNext; |
| 746 | } |
| 747 | } |
| 748 | MINI_NODE* pCBTrav = pTrav->pCmdBufferBindings; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 749 | if (!pCBTrav) { |
| 750 | sprintf(str, " No Command Buffer bindings"); |
| 751 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
| 752 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 753 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 754 | sprintf(str, " XGL Command Buffer (CB) binding list w/ HEAD at %p:", pCBTrav); |
| 755 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 756 | while (pCBTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 757 | sprintf(str, " CB_NODE(%p): XGL CB %p, pNext %p", pCBTrav, pCBTrav->cmdBuffer, pCBTrav->pNext); |
| 758 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 759 | pCBTrav = pCBTrav->pNext; |
| 760 | } |
| 761 | } |
| 762 | pTrav = pTrav->pNextGlobalNode; |
| 763 | } |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | static void printGlobalCB() |
| 768 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 769 | char str[1024] = {0}; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 770 | GLOBAL_CB_NODE* pTrav = pGlobalCBHead; |
| 771 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 772 | sprintf(str, "Global Command Buffer (CB) list is empty :(\n"); |
| 773 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 774 | } |
| 775 | else { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 776 | sprintf(str, "Details of Global CB list w/ HEAD at %p:", (void*)pTrav); |
| 777 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 778 | while (pTrav) { |
Tobin Ehlis | c0418f9 | 2014-11-25 14:47:20 -0700 | [diff] [blame] | 779 | sprintf(str, " Global CB Node (%p) w/ pNextGlobalCBNode (%p) has CB %p, fence %p, and pMemObjList %p", (void*)pTrav, (void*)pTrav->pNextGlobalCBNode, (void*)pTrav->cmdBuffer, (void*)pTrav->fence, (void*)pTrav->pMemObjList); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 780 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 781 | MINI_NODE* pMemObjTrav = pTrav->pMemObjList; |
| 782 | while (pMemObjTrav) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 783 | sprintf(str, " MEM_NODE(%p): Mem obj %p, pNext %p", (void*)pMemObjTrav, (void*)pMemObjTrav->mem, (void*)pMemObjTrav->pNext); |
| 784 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 785 | pMemObjTrav = pMemObjTrav->pNext; |
| 786 | } |
| 787 | pTrav = pTrav->pNextGlobalCBNode; |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | static XGL_FENCE createLocalFence() |
| 793 | { |
| 794 | XGL_FENCE_CREATE_INFO fci; |
| 795 | fci.sType = XGL_STRUCTURE_TYPE_FENCE_CREATE_INFO; |
| 796 | fci.pNext = NULL; |
| 797 | fci.flags = 0; |
| 798 | XGL_FENCE fence; |
| 799 | nextTable.CreateFence(globalDevice, &fci, &fence); |
| 800 | return fence; |
| 801 | } |
| 802 | |
| 803 | static void initLayerTable() |
| 804 | { |
| 805 | GetProcAddrType fpNextGPA; |
| 806 | fpNextGPA = pCurObj->pGPA; |
| 807 | assert(fpNextGPA); |
| 808 | |
| 809 | GetProcAddrType fpGetProcAddr = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetProcAddr"); |
| 810 | nextTable.GetProcAddr = fpGetProcAddr; |
| 811 | InitAndEnumerateGpusType fpInitAndEnumerateGpus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglInitAndEnumerateGpus"); |
| 812 | nextTable.InitAndEnumerateGpus = fpInitAndEnumerateGpus; |
| 813 | GetGpuInfoType fpGetGpuInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetGpuInfo"); |
| 814 | nextTable.GetGpuInfo = fpGetGpuInfo; |
| 815 | CreateDeviceType fpCreateDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDevice"); |
| 816 | nextTable.CreateDevice = fpCreateDevice; |
| 817 | DestroyDeviceType fpDestroyDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyDevice"); |
| 818 | nextTable.DestroyDevice = fpDestroyDevice; |
| 819 | GetExtensionSupportType fpGetExtensionSupport = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetExtensionSupport"); |
| 820 | nextTable.GetExtensionSupport = fpGetExtensionSupport; |
| 821 | EnumerateLayersType fpEnumerateLayers = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEnumerateLayers"); |
| 822 | nextTable.EnumerateLayers = fpEnumerateLayers; |
| 823 | GetDeviceQueueType fpGetDeviceQueue = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetDeviceQueue"); |
| 824 | nextTable.GetDeviceQueue = fpGetDeviceQueue; |
| 825 | QueueSubmitType fpQueueSubmit = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSubmit"); |
| 826 | nextTable.QueueSubmit = fpQueueSubmit; |
| 827 | QueueSetGlobalMemReferencesType fpQueueSetGlobalMemReferences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSetGlobalMemReferences"); |
| 828 | nextTable.QueueSetGlobalMemReferences = fpQueueSetGlobalMemReferences; |
| 829 | QueueWaitIdleType fpQueueWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueWaitIdle"); |
| 830 | nextTable.QueueWaitIdle = fpQueueWaitIdle; |
| 831 | DeviceWaitIdleType fpDeviceWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDeviceWaitIdle"); |
| 832 | nextTable.DeviceWaitIdle = fpDeviceWaitIdle; |
| 833 | GetMemoryHeapCountType fpGetMemoryHeapCount = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapCount"); |
| 834 | nextTable.GetMemoryHeapCount = fpGetMemoryHeapCount; |
| 835 | GetMemoryHeapInfoType fpGetMemoryHeapInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapInfo"); |
| 836 | nextTable.GetMemoryHeapInfo = fpGetMemoryHeapInfo; |
| 837 | AllocMemoryType fpAllocMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAllocMemory"); |
| 838 | nextTable.AllocMemory = fpAllocMemory; |
| 839 | FreeMemoryType fpFreeMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglFreeMemory"); |
| 840 | nextTable.FreeMemory = fpFreeMemory; |
| 841 | SetMemoryPriorityType fpSetMemoryPriority = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetMemoryPriority"); |
| 842 | nextTable.SetMemoryPriority = fpSetMemoryPriority; |
| 843 | MapMemoryType fpMapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglMapMemory"); |
| 844 | nextTable.MapMemory = fpMapMemory; |
| 845 | UnmapMemoryType fpUnmapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglUnmapMemory"); |
| 846 | nextTable.UnmapMemory = fpUnmapMemory; |
| 847 | PinSystemMemoryType fpPinSystemMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglPinSystemMemory"); |
| 848 | nextTable.PinSystemMemory = fpPinSystemMemory; |
| 849 | RemapVirtualMemoryPagesType fpRemapVirtualMemoryPages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglRemapVirtualMemoryPages"); |
| 850 | nextTable.RemapVirtualMemoryPages = fpRemapVirtualMemoryPages; |
| 851 | GetMultiGpuCompatibilityType fpGetMultiGpuCompatibility = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMultiGpuCompatibility"); |
| 852 | nextTable.GetMultiGpuCompatibility = fpGetMultiGpuCompatibility; |
| 853 | OpenSharedMemoryType fpOpenSharedMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedMemory"); |
| 854 | nextTable.OpenSharedMemory = fpOpenSharedMemory; |
| 855 | OpenSharedQueueSemaphoreType fpOpenSharedQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedQueueSemaphore"); |
| 856 | nextTable.OpenSharedQueueSemaphore = fpOpenSharedQueueSemaphore; |
| 857 | OpenPeerMemoryType fpOpenPeerMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerMemory"); |
| 858 | nextTable.OpenPeerMemory = fpOpenPeerMemory; |
| 859 | OpenPeerImageType fpOpenPeerImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerImage"); |
| 860 | nextTable.OpenPeerImage = fpOpenPeerImage; |
| 861 | DestroyObjectType fpDestroyObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyObject"); |
| 862 | nextTable.DestroyObject = fpDestroyObject; |
| 863 | GetObjectInfoType fpGetObjectInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetObjectInfo"); |
| 864 | nextTable.GetObjectInfo = fpGetObjectInfo; |
| 865 | BindObjectMemoryType fpBindObjectMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBindObjectMemory"); |
| 866 | nextTable.BindObjectMemory = fpBindObjectMemory; |
| 867 | CreateFenceType fpCreateFence = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateFence"); |
| 868 | nextTable.CreateFence = fpCreateFence; |
| 869 | GetFenceStatusType fpGetFenceStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFenceStatus"); |
| 870 | nextTable.GetFenceStatus = fpGetFenceStatus; |
| 871 | WaitForFencesType fpWaitForFences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitForFences"); |
| 872 | nextTable.WaitForFences = fpWaitForFences; |
| 873 | CreateQueueSemaphoreType fpCreateQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueueSemaphore"); |
| 874 | nextTable.CreateQueueSemaphore = fpCreateQueueSemaphore; |
| 875 | SignalQueueSemaphoreType fpSignalQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSignalQueueSemaphore"); |
| 876 | nextTable.SignalQueueSemaphore = fpSignalQueueSemaphore; |
| 877 | WaitQueueSemaphoreType fpWaitQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitQueueSemaphore"); |
| 878 | nextTable.WaitQueueSemaphore = fpWaitQueueSemaphore; |
| 879 | CreateEventType fpCreateEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateEvent"); |
| 880 | nextTable.CreateEvent = fpCreateEvent; |
| 881 | GetEventStatusType fpGetEventStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetEventStatus"); |
| 882 | nextTable.GetEventStatus = fpGetEventStatus; |
| 883 | SetEventType fpSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetEvent"); |
| 884 | nextTable.SetEvent = fpSetEvent; |
| 885 | ResetEventType fpResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetEvent"); |
| 886 | nextTable.ResetEvent = fpResetEvent; |
| 887 | CreateQueryPoolType fpCreateQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueryPool"); |
| 888 | nextTable.CreateQueryPool = fpCreateQueryPool; |
| 889 | GetQueryPoolResultsType fpGetQueryPoolResults = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetQueryPoolResults"); |
| 890 | nextTable.GetQueryPoolResults = fpGetQueryPoolResults; |
| 891 | GetFormatInfoType fpGetFormatInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFormatInfo"); |
| 892 | nextTable.GetFormatInfo = fpGetFormatInfo; |
| 893 | CreateImageType fpCreateImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImage"); |
| 894 | nextTable.CreateImage = fpCreateImage; |
| 895 | GetImageSubresourceInfoType fpGetImageSubresourceInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetImageSubresourceInfo"); |
| 896 | nextTable.GetImageSubresourceInfo = fpGetImageSubresourceInfo; |
| 897 | CreateImageViewType fpCreateImageView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImageView"); |
| 898 | nextTable.CreateImageView = fpCreateImageView; |
| 899 | CreateColorAttachmentViewType fpCreateColorAttachmentView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorAttachmentView"); |
| 900 | nextTable.CreateColorAttachmentView = fpCreateColorAttachmentView; |
| 901 | CreateDepthStencilViewType fpCreateDepthStencilView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilView"); |
| 902 | nextTable.CreateDepthStencilView = fpCreateDepthStencilView; |
| 903 | CreateShaderType fpCreateShader = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateShader"); |
| 904 | nextTable.CreateShader = fpCreateShader; |
| 905 | CreateGraphicsPipelineType fpCreateGraphicsPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateGraphicsPipeline"); |
| 906 | nextTable.CreateGraphicsPipeline = fpCreateGraphicsPipeline; |
| 907 | CreateComputePipelineType fpCreateComputePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateComputePipeline"); |
| 908 | nextTable.CreateComputePipeline = fpCreateComputePipeline; |
| 909 | StorePipelineType fpStorePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglStorePipeline"); |
| 910 | nextTable.StorePipeline = fpStorePipeline; |
| 911 | LoadPipelineType fpLoadPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglLoadPipeline"); |
| 912 | nextTable.LoadPipeline = fpLoadPipeline; |
| 913 | CreatePipelineDeltaType fpCreatePipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreatePipelineDelta"); |
| 914 | nextTable.CreatePipelineDelta = fpCreatePipelineDelta; |
| 915 | CreateSamplerType fpCreateSampler = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateSampler"); |
| 916 | nextTable.CreateSampler = fpCreateSampler; |
| 917 | CreateDescriptorSetType fpCreateDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDescriptorSet"); |
| 918 | nextTable.CreateDescriptorSet = fpCreateDescriptorSet; |
| 919 | BeginDescriptorSetUpdateType fpBeginDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginDescriptorSetUpdate"); |
| 920 | nextTable.BeginDescriptorSetUpdate = fpBeginDescriptorSetUpdate; |
| 921 | EndDescriptorSetUpdateType fpEndDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndDescriptorSetUpdate"); |
| 922 | nextTable.EndDescriptorSetUpdate = fpEndDescriptorSetUpdate; |
| 923 | AttachSamplerDescriptorsType fpAttachSamplerDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachSamplerDescriptors"); |
| 924 | nextTable.AttachSamplerDescriptors = fpAttachSamplerDescriptors; |
| 925 | AttachImageViewDescriptorsType fpAttachImageViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachImageViewDescriptors"); |
| 926 | nextTable.AttachImageViewDescriptors = fpAttachImageViewDescriptors; |
| 927 | AttachMemoryViewDescriptorsType fpAttachMemoryViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachMemoryViewDescriptors"); |
| 928 | nextTable.AttachMemoryViewDescriptors = fpAttachMemoryViewDescriptors; |
| 929 | AttachNestedDescriptorsType fpAttachNestedDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachNestedDescriptors"); |
| 930 | nextTable.AttachNestedDescriptors = fpAttachNestedDescriptors; |
| 931 | ClearDescriptorSetSlotsType fpClearDescriptorSetSlots = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglClearDescriptorSetSlots"); |
| 932 | nextTable.ClearDescriptorSetSlots = fpClearDescriptorSetSlots; |
| 933 | CreateViewportStateType fpCreateViewportState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateViewportState"); |
| 934 | nextTable.CreateViewportState = fpCreateViewportState; |
| 935 | CreateRasterStateType fpCreateRasterState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateRasterState"); |
| 936 | nextTable.CreateRasterState = fpCreateRasterState; |
| 937 | CreateMsaaStateType fpCreateMsaaState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateMsaaState"); |
| 938 | nextTable.CreateMsaaState = fpCreateMsaaState; |
| 939 | CreateColorBlendStateType fpCreateColorBlendState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorBlendState"); |
| 940 | nextTable.CreateColorBlendState = fpCreateColorBlendState; |
| 941 | CreateDepthStencilStateType fpCreateDepthStencilState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilState"); |
| 942 | nextTable.CreateDepthStencilState = fpCreateDepthStencilState; |
| 943 | CreateCommandBufferType fpCreateCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateCommandBuffer"); |
| 944 | nextTable.CreateCommandBuffer = fpCreateCommandBuffer; |
| 945 | BeginCommandBufferType fpBeginCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginCommandBuffer"); |
| 946 | nextTable.BeginCommandBuffer = fpBeginCommandBuffer; |
| 947 | EndCommandBufferType fpEndCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndCommandBuffer"); |
| 948 | nextTable.EndCommandBuffer = fpEndCommandBuffer; |
| 949 | ResetCommandBufferType fpResetCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetCommandBuffer"); |
| 950 | nextTable.ResetCommandBuffer = fpResetCommandBuffer; |
| 951 | CmdBindPipelineType fpCmdBindPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipeline"); |
| 952 | nextTable.CmdBindPipeline = fpCmdBindPipeline; |
| 953 | CmdBindPipelineDeltaType fpCmdBindPipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipelineDelta"); |
| 954 | nextTable.CmdBindPipelineDelta = fpCmdBindPipelineDelta; |
| 955 | CmdBindStateObjectType fpCmdBindStateObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindStateObject"); |
| 956 | nextTable.CmdBindStateObject = fpCmdBindStateObject; |
| 957 | CmdBindDescriptorSetType fpCmdBindDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDescriptorSet"); |
| 958 | nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet; |
| 959 | CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView"); |
| 960 | nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView; |
| 961 | CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData"); |
| 962 | nextTable.CmdBindIndexData = fpCmdBindIndexData; |
| 963 | CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments"); |
| 964 | nextTable.CmdBindAttachments = fpCmdBindAttachments; |
| 965 | CmdPrepareMemoryRegionsType fpCmdPrepareMemoryRegions = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareMemoryRegions"); |
| 966 | nextTable.CmdPrepareMemoryRegions = fpCmdPrepareMemoryRegions; |
| 967 | CmdPrepareImagesType fpCmdPrepareImages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareImages"); |
| 968 | nextTable.CmdPrepareImages = fpCmdPrepareImages; |
| 969 | CmdDrawType fpCmdDraw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDraw"); |
| 970 | nextTable.CmdDraw = fpCmdDraw; |
| 971 | CmdDrawIndexedType fpCmdDrawIndexed = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexed"); |
| 972 | nextTable.CmdDrawIndexed = fpCmdDrawIndexed; |
| 973 | CmdDrawIndirectType fpCmdDrawIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndirect"); |
| 974 | nextTable.CmdDrawIndirect = fpCmdDrawIndirect; |
| 975 | CmdDrawIndexedIndirectType fpCmdDrawIndexedIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexedIndirect"); |
| 976 | nextTable.CmdDrawIndexedIndirect = fpCmdDrawIndexedIndirect; |
| 977 | CmdDispatchType fpCmdDispatch = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatch"); |
| 978 | nextTable.CmdDispatch = fpCmdDispatch; |
| 979 | CmdDispatchIndirectType fpCmdDispatchIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatchIndirect"); |
| 980 | nextTable.CmdDispatchIndirect = fpCmdDispatchIndirect; |
| 981 | CmdCopyMemoryType fpCmdCopyMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemory"); |
| 982 | nextTable.CmdCopyMemory = fpCmdCopyMemory; |
| 983 | CmdCopyImageType fpCmdCopyImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImage"); |
| 984 | nextTable.CmdCopyImage = fpCmdCopyImage; |
| 985 | CmdCopyMemoryToImageType fpCmdCopyMemoryToImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemoryToImage"); |
| 986 | nextTable.CmdCopyMemoryToImage = fpCmdCopyMemoryToImage; |
| 987 | CmdCopyImageToMemoryType fpCmdCopyImageToMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImageToMemory"); |
| 988 | nextTable.CmdCopyImageToMemory = fpCmdCopyImageToMemory; |
| 989 | CmdCloneImageDataType fpCmdCloneImageData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCloneImageData"); |
| 990 | nextTable.CmdCloneImageData = fpCmdCloneImageData; |
| 991 | CmdUpdateMemoryType fpCmdUpdateMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdUpdateMemory"); |
| 992 | nextTable.CmdUpdateMemory = fpCmdUpdateMemory; |
| 993 | CmdFillMemoryType fpCmdFillMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdFillMemory"); |
| 994 | nextTable.CmdFillMemory = fpCmdFillMemory; |
| 995 | CmdClearColorImageType fpCmdClearColorImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImage"); |
| 996 | nextTable.CmdClearColorImage = fpCmdClearColorImage; |
| 997 | CmdClearColorImageRawType fpCmdClearColorImageRaw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImageRaw"); |
| 998 | nextTable.CmdClearColorImageRaw = fpCmdClearColorImageRaw; |
| 999 | CmdClearDepthStencilType fpCmdClearDepthStencil = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearDepthStencil"); |
| 1000 | nextTable.CmdClearDepthStencil = fpCmdClearDepthStencil; |
| 1001 | CmdResolveImageType fpCmdResolveImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResolveImage"); |
| 1002 | nextTable.CmdResolveImage = fpCmdResolveImage; |
| 1003 | CmdSetEventType fpCmdSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSetEvent"); |
| 1004 | nextTable.CmdSetEvent = fpCmdSetEvent; |
| 1005 | CmdResetEventType fpCmdResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetEvent"); |
| 1006 | nextTable.CmdResetEvent = fpCmdResetEvent; |
| 1007 | CmdMemoryAtomicType fpCmdMemoryAtomic = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdMemoryAtomic"); |
| 1008 | nextTable.CmdMemoryAtomic = fpCmdMemoryAtomic; |
| 1009 | CmdBeginQueryType fpCmdBeginQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBeginQuery"); |
| 1010 | nextTable.CmdBeginQuery = fpCmdBeginQuery; |
| 1011 | CmdEndQueryType fpCmdEndQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdEndQuery"); |
| 1012 | nextTable.CmdEndQuery = fpCmdEndQuery; |
| 1013 | CmdResetQueryPoolType fpCmdResetQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetQueryPool"); |
| 1014 | nextTable.CmdResetQueryPool = fpCmdResetQueryPool; |
| 1015 | CmdWriteTimestampType fpCmdWriteTimestamp = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdWriteTimestamp"); |
| 1016 | nextTable.CmdWriteTimestamp = fpCmdWriteTimestamp; |
| 1017 | CmdInitAtomicCountersType fpCmdInitAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdInitAtomicCounters"); |
| 1018 | nextTable.CmdInitAtomicCounters = fpCmdInitAtomicCounters; |
| 1019 | CmdLoadAtomicCountersType fpCmdLoadAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdLoadAtomicCounters"); |
| 1020 | nextTable.CmdLoadAtomicCounters = fpCmdLoadAtomicCounters; |
| 1021 | CmdSaveAtomicCountersType fpCmdSaveAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSaveAtomicCounters"); |
| 1022 | nextTable.CmdSaveAtomicCounters = fpCmdSaveAtomicCounters; |
| 1023 | DbgSetValidationLevelType fpDbgSetValidationLevel = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetValidationLevel"); |
| 1024 | nextTable.DbgSetValidationLevel = fpDbgSetValidationLevel; |
| 1025 | DbgRegisterMsgCallbackType fpDbgRegisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgRegisterMsgCallback"); |
| 1026 | nextTable.DbgRegisterMsgCallback = fpDbgRegisterMsgCallback; |
| 1027 | DbgUnregisterMsgCallbackType fpDbgUnregisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgUnregisterMsgCallback"); |
| 1028 | nextTable.DbgUnregisterMsgCallback = fpDbgUnregisterMsgCallback; |
| 1029 | DbgSetMessageFilterType fpDbgSetMessageFilter = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetMessageFilter"); |
| 1030 | nextTable.DbgSetMessageFilter = fpDbgSetMessageFilter; |
| 1031 | DbgSetObjectTagType fpDbgSetObjectTag = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetObjectTag"); |
| 1032 | nextTable.DbgSetObjectTag = fpDbgSetObjectTag; |
| 1033 | DbgSetGlobalOptionType fpDbgSetGlobalOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetGlobalOption"); |
| 1034 | nextTable.DbgSetGlobalOption = fpDbgSetGlobalOption; |
| 1035 | DbgSetDeviceOptionType fpDbgSetDeviceOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetDeviceOption"); |
| 1036 | nextTable.DbgSetDeviceOption = fpDbgSetDeviceOption; |
| 1037 | CmdDbgMarkerBeginType fpCmdDbgMarkerBegin = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerBegin"); |
| 1038 | nextTable.CmdDbgMarkerBegin = fpCmdDbgMarkerBegin; |
| 1039 | CmdDbgMarkerEndType fpCmdDbgMarkerEnd = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerEnd"); |
| 1040 | nextTable.CmdDbgMarkerEnd = fpCmdDbgMarkerEnd; |
| 1041 | WsiX11AssociateConnectionType fpWsiX11AssociateConnection = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11AssociateConnection"); |
| 1042 | nextTable.WsiX11AssociateConnection = fpWsiX11AssociateConnection; |
| 1043 | WsiX11GetMSCType fpWsiX11GetMSC = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11GetMSC"); |
| 1044 | nextTable.WsiX11GetMSC = fpWsiX11GetMSC; |
| 1045 | WsiX11CreatePresentableImageType fpWsiX11CreatePresentableImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11CreatePresentableImage"); |
| 1046 | nextTable.WsiX11CreatePresentableImage = fpWsiX11CreatePresentableImage; |
| 1047 | WsiX11QueuePresentType fpWsiX11QueuePresent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11QueuePresent"); |
| 1048 | nextTable.WsiX11QueuePresent = fpWsiX11QueuePresent; |
| 1049 | } |
| 1050 | |
| 1051 | |
| 1052 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1053 | { |
| 1054 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 1055 | pCurObj = gpuw; |
| 1056 | pthread_once(&tabOnce, initLayerTable); |
| 1057 | XGL_RESULT result = nextTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData); |
| 1058 | return result; |
| 1059 | } |
| 1060 | |
| 1061 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice) |
| 1062 | { |
| 1063 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 1064 | pCurObj = gpuw; |
| 1065 | pthread_once(&tabOnce, initLayerTable); |
| 1066 | XGL_RESULT result = nextTable.CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice); |
| 1067 | // Save off device in case we need it to create Fences |
| 1068 | globalDevice = *pDevice; |
| 1069 | return result; |
| 1070 | } |
| 1071 | |
| 1072 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(XGL_DEVICE device) |
| 1073 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1074 | char str[1024]; |
| 1075 | sprintf(str, "Printing List details prior to xglDestroyDevice()"); |
| 1076 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, device, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1077 | printMemList(); |
| 1078 | printGlobalCB(); |
| 1079 | printObjList(); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1080 | if (XGL_FALSE == deleteGlobalCBList()) { |
| 1081 | sprintf(str, "Issue deleting global CB list in xglDestroyDevice()"); |
| 1082 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, device, 0, MEMTRACK_INTERNAL_ERROR, "MEM", str); |
| 1083 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1084 | XGL_RESULT result = nextTable.DestroyDevice(device); |
| 1085 | return result; |
| 1086 | } |
| 1087 | |
| 1088 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pExtName) |
| 1089 | { |
| 1090 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 1091 | pCurObj = gpuw; |
| 1092 | pthread_once(&tabOnce, initLayerTable); |
| 1093 | XGL_RESULT result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); |
| 1094 | return result; |
| 1095 | } |
| 1096 | |
Jon Ashburn | d586459 | 2014-11-25 12:56:49 -0700 | [diff] [blame] | 1097 | XGL_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 Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1098 | { |
Jon Ashburn | f7a0874 | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 1099 | if (gpu != NULL) |
| 1100 | { |
| 1101 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 1102 | pCurObj = gpuw; |
| 1103 | pthread_once(&tabOnce, initLayerTable); |
Jon Ashburn | d586459 | 2014-11-25 12:56:49 -0700 | [diff] [blame] | 1104 | XGL_RESULT result = nextTable.EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved); |
Jon Ashburn | f7a0874 | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 1105 | return result; |
| 1106 | } else |
| 1107 | { |
| 1108 | if (pOutLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL) |
| 1109 | return XGL_ERROR_INVALID_POINTER; |
| 1110 | // This layer compatible with all GPUs |
| 1111 | *pOutLayerCount = 1; |
Tobin Ehlis | a363cfa | 2014-11-25 16:59:27 -0700 | [diff] [blame] | 1112 | strncpy(pOutLayers[0], "MemTracker", maxStringSize); |
Jon Ashburn | f7a0874 | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 1113 | return XGL_SUCCESS; |
| 1114 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1115 | } |
| 1116 | |
| 1117 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetDeviceQueue(XGL_DEVICE device, XGL_QUEUE_TYPE queueType, XGL_UINT queueIndex, XGL_QUEUE* pQueue) |
| 1118 | { |
| 1119 | XGL_RESULT result = nextTable.GetDeviceQueue(device, queueType, queueIndex, pQueue); |
| 1120 | return result; |
| 1121 | } |
| 1122 | |
| 1123 | XGL_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) |
| 1124 | { |
| 1125 | // TODO : Need to track fence and clear mem references when fence clears |
| 1126 | XGL_FENCE localFence = fence; |
| 1127 | if (XGL_NULL_HANDLE == fence) { // allocate our own fence to track cmd buffer |
| 1128 | localFence = createLocalFence(); |
| 1129 | } |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1130 | char str[1024]; |
| 1131 | sprintf(str, "In xglQueueSubmit(), checking %u cmdBuffers with %u memRefs", cmdBufferCount, memRefCount); |
| 1132 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, queue, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1133 | printMemList(); |
| 1134 | printGlobalCB(); |
| 1135 | for (uint32_t i = 0; i < cmdBufferCount; i++) { |
| 1136 | setCBFence(pCmdBuffers[i], localFence); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1137 | sprintf(str, "Verifying mem refs for CB %p", pCmdBuffers[i]); |
| 1138 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pCmdBuffers[i], 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1139 | if (XGL_FALSE == validateCBMemRef(pCmdBuffers[i], memRefCount, pMemRefs)) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1140 | sprintf(str, "Unable to verify memory references for CB %p", (void*)pCmdBuffers[i]); |
| 1141 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pCmdBuffers[i], 0, MEMTRACK_CB_MISSING_MEM_REF, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1142 | } |
| 1143 | } |
| 1144 | printGlobalCB(); |
| 1145 | XGL_RESULT result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, memRefCount, pMemRefs, localFence); |
| 1146 | return result; |
| 1147 | } |
| 1148 | |
| 1149 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSetGlobalMemReferences(XGL_QUEUE queue, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs) |
| 1150 | { |
| 1151 | // TODO : Use global mem references as part of list checked on QueueSubmit above |
| 1152 | XGL_RESULT result = nextTable.QueueSetGlobalMemReferences(queue, memRefCount, pMemRefs); |
| 1153 | return result; |
| 1154 | } |
| 1155 | |
| 1156 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueWaitIdle(XGL_QUEUE queue) |
| 1157 | { |
| 1158 | XGL_RESULT result = nextTable.QueueWaitIdle(queue); |
| 1159 | return result; |
| 1160 | } |
| 1161 | |
| 1162 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device) |
| 1163 | { |
| 1164 | XGL_RESULT result = nextTable.DeviceWaitIdle(device); |
| 1165 | return result; |
| 1166 | } |
| 1167 | |
| 1168 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount) |
| 1169 | { |
| 1170 | // TODO : Track memory stats here |
| 1171 | XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount); |
| 1172 | return result; |
| 1173 | } |
| 1174 | |
| 1175 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapInfo(XGL_DEVICE device, XGL_UINT heapId, XGL_MEMORY_HEAP_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1176 | { |
| 1177 | // TODO : Track memory stats here |
| 1178 | XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData); |
| 1179 | return result; |
| 1180 | } |
| 1181 | |
| 1182 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem) |
| 1183 | { |
| 1184 | XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem); |
| 1185 | // TODO : Track allocations and overall size here |
| 1186 | insertGlobalMemObj(*pMem, pAllocInfo); |
| 1187 | printMemList(); |
| 1188 | return result; |
| 1189 | } |
| 1190 | |
| 1191 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglFreeMemory(XGL_GPU_MEMORY mem) |
| 1192 | { |
Tobin Ehlis | c0418f9 | 2014-11-25 14:47:20 -0700 | [diff] [blame] | 1193 | /* From spec : A memory object is freed by calling xglFreeMemory() when it is no longer needed. Before |
| 1194 | * freeing a memory object, an application must ensure the memory object is unbound from |
| 1195 | * all API objects referencing it and that it is not referenced by any queued command buffers |
| 1196 | */ |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1197 | if (XGL_FALSE == freeMemNode(mem)) { |
| 1198 | char str[1024]; |
| 1199 | sprintf(str, "Issue while freeing mem obj %p", (void*)mem); |
| 1200 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_FREE_MEM_ERROR, "MEM", str); |
| 1201 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1202 | printMemList(); |
| 1203 | printObjList(); |
| 1204 | printGlobalCB(); |
| 1205 | XGL_RESULT result = nextTable.FreeMemory(mem); |
| 1206 | return result; |
| 1207 | } |
| 1208 | |
| 1209 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetMemoryPriority(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority) |
| 1210 | { |
| 1211 | // TODO : Update tracking for this alloc |
| 1212 | // Make sure memory is not pinned, which can't have priority set |
| 1213 | XGL_RESULT result = nextTable.SetMemoryPriority(mem, priority); |
| 1214 | return result; |
| 1215 | } |
| 1216 | |
| 1217 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglMapMemory(XGL_GPU_MEMORY mem, XGL_FLAGS flags, XGL_VOID** ppData) |
| 1218 | { |
| 1219 | // TODO : Track when memory is mapped |
| 1220 | XGL_RESULT result = nextTable.MapMemory(mem, flags, ppData); |
| 1221 | return result; |
| 1222 | } |
| 1223 | |
| 1224 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglUnmapMemory(XGL_GPU_MEMORY mem) |
| 1225 | { |
| 1226 | // TODO : Track as memory gets unmapped, do we want to check what changed following map? |
| 1227 | // Make sure that memory was ever mapped to begin with |
| 1228 | XGL_RESULT result = nextTable.UnmapMemory(mem); |
| 1229 | return result; |
| 1230 | } |
| 1231 | |
| 1232 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglPinSystemMemory(XGL_DEVICE device, const XGL_VOID* pSysMem, XGL_SIZE memSize, XGL_GPU_MEMORY* pMem) |
| 1233 | { |
| 1234 | // TODO : Track this |
| 1235 | // Verify that memory is actually pinnable |
| 1236 | XGL_RESULT result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem); |
| 1237 | return result; |
| 1238 | } |
| 1239 | |
| 1240 | XGL_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) |
| 1241 | { |
| 1242 | // TODO : Track this |
| 1243 | XGL_RESULT result = nextTable.RemapVirtualMemoryPages(device, rangeCount, pRanges, preWaitSemaphoreCount, pPreWaitSemaphores, postSignalSemaphoreCount, pPostSignalSemaphores); |
| 1244 | return result; |
| 1245 | } |
| 1246 | |
| 1247 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMultiGpuCompatibility(XGL_PHYSICAL_GPU gpu0, XGL_PHYSICAL_GPU gpu1, XGL_GPU_COMPATIBILITY_INFO* pInfo) |
| 1248 | { |
| 1249 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu0; |
| 1250 | pCurObj = gpuw; |
| 1251 | pthread_once(&tabOnce, initLayerTable); |
| 1252 | XGL_RESULT result = nextTable.GetMultiGpuCompatibility((XGL_PHYSICAL_GPU)gpuw->nextObject, gpu1, pInfo); |
| 1253 | return result; |
| 1254 | } |
| 1255 | |
| 1256 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedMemory(XGL_DEVICE device, const XGL_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) |
| 1257 | { |
| 1258 | // TODO : Track this |
| 1259 | XGL_RESULT result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem); |
| 1260 | return result; |
| 1261 | } |
| 1262 | |
| 1263 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) |
| 1264 | { |
| 1265 | XGL_RESULT result = nextTable.OpenSharedQueueSemaphore(device, pOpenInfo, pSemaphore); |
| 1266 | return result; |
| 1267 | } |
| 1268 | |
| 1269 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerMemory(XGL_DEVICE device, const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) |
| 1270 | { |
| 1271 | // TODO : Track this |
| 1272 | XGL_RESULT result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem); |
| 1273 | return result; |
| 1274 | } |
| 1275 | |
| 1276 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerImage(XGL_DEVICE device, const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem) |
| 1277 | { |
| 1278 | // TODO : Track this |
| 1279 | XGL_RESULT result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem); |
| 1280 | return result; |
| 1281 | } |
| 1282 | |
| 1283 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyObject(XGL_OBJECT object) |
| 1284 | { |
| 1285 | // TODO : Verify that no memory is bound to this object at time of destruction |
Tobin Ehlis | a6c0e3c | 2014-11-25 12:27:38 -0700 | [diff] [blame] | 1286 | GLOBAL_OBJECT_NODE* pTrav = pGlobalObjectHead; |
| 1287 | GLOBAL_OBJECT_NODE* pPrev = pTrav; |
| 1288 | // First locate node in global list along with prev node |
| 1289 | while (pTrav) { |
| 1290 | if (object == pTrav->object) |
| 1291 | break; |
| 1292 | pPrev = pTrav; |
| 1293 | pTrav = pTrav->pNext; |
| 1294 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1295 | if (pTrav) { |
| 1296 | if (pTrav->pMemNode) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1297 | char str[1024]; |
| 1298 | sprintf(str, "Destroying obj %p that is still bound to memory object %p\nYou should first clear binding by calling xglBindObjectMemory(%p, 0, XGL_NULL_HANDLE)", object, (void*)pTrav->pMemNode->mem, object); |
| 1299 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_DESTROY_OBJECT_ERROR, "MEM", str); |
| 1300 | // From the spec : If an object has previous memory binding, it is required to unbind memory from an API object before it is destroyed. |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1301 | clearObjectBinding(object); |
| 1302 | } |
| 1303 | if (pGlobalObjectHead == pTrav) // update HEAD if needed |
| 1304 | pGlobalObjectHead = pTrav->pNext; |
Tobin Ehlis | a6c0e3c | 2014-11-25 12:27:38 -0700 | [diff] [blame] | 1305 | // Delete the obj node from global list |
| 1306 | pPrev->pNext = pTrav->pNext; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1307 | free(pTrav); |
| 1308 | } |
| 1309 | XGL_RESULT result = nextTable.DestroyObject(object); |
| 1310 | return result; |
| 1311 | } |
| 1312 | |
| 1313 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetObjectInfo(XGL_BASE_OBJECT object, XGL_OBJECT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1314 | { |
| 1315 | // TODO : What to track here? |
| 1316 | // Could potentially save returned mem requirements and validate values passed into BindObjectMemory for this object |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1317 | // From spec : The only objects that are guaranteed to have no external memory requirements are devices, queues, command buffers, shaders and memory objects. |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1318 | XGL_RESULT result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); |
| 1319 | return result; |
| 1320 | } |
| 1321 | |
| 1322 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBindObjectMemory(XGL_OBJECT object, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) |
| 1323 | { |
| 1324 | XGL_RESULT result = nextTable.BindObjectMemory(object, mem, offset); |
| 1325 | // Track objects tied to memory |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1326 | if (XGL_FALSE == updateObjectBinding(object, mem)) { |
| 1327 | char str[1024]; |
| 1328 | sprintf(str, "Unable to set object %p binding to mem obj %p", (void*)object, (void*)mem); |
| 1329 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1330 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1331 | printObjList(); |
| 1332 | printMemList(); |
| 1333 | return result; |
| 1334 | } |
| 1335 | |
| 1336 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateFence(XGL_DEVICE device, const XGL_FENCE_CREATE_INFO* pCreateInfo, XGL_FENCE* pFence) |
| 1337 | { |
| 1338 | XGL_RESULT result = nextTable.CreateFence(device, pCreateInfo, pFence); |
| 1339 | return result; |
| 1340 | } |
| 1341 | |
| 1342 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFenceStatus(XGL_FENCE fence) |
| 1343 | { |
| 1344 | XGL_RESULT result = nextTable.GetFenceStatus(fence); |
| 1345 | return result; |
| 1346 | } |
| 1347 | |
| 1348 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitForFences(XGL_DEVICE device, XGL_UINT fenceCount, const XGL_FENCE* pFences, XGL_BOOL waitAll, XGL_UINT64 timeout) |
| 1349 | { |
| 1350 | XGL_RESULT result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 1351 | return result; |
| 1352 | } |
| 1353 | |
| 1354 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) |
| 1355 | { |
| 1356 | XGL_RESULT result = nextTable.CreateQueueSemaphore(device, pCreateInfo, pSemaphore); |
| 1357 | return result; |
| 1358 | } |
| 1359 | |
| 1360 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSignalQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) |
| 1361 | { |
| 1362 | XGL_RESULT result = nextTable.SignalQueueSemaphore(queue, semaphore); |
| 1363 | return result; |
| 1364 | } |
| 1365 | |
| 1366 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) |
| 1367 | { |
| 1368 | XGL_RESULT result = nextTable.WaitQueueSemaphore(queue, semaphore); |
| 1369 | return result; |
| 1370 | } |
| 1371 | |
| 1372 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateEvent(XGL_DEVICE device, const XGL_EVENT_CREATE_INFO* pCreateInfo, XGL_EVENT* pEvent) |
| 1373 | { |
| 1374 | XGL_RESULT result = nextTable.CreateEvent(device, pCreateInfo, pEvent); |
| 1375 | return result; |
| 1376 | } |
| 1377 | |
| 1378 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetEventStatus(XGL_EVENT event) |
| 1379 | { |
| 1380 | XGL_RESULT result = nextTable.GetEventStatus(event); |
| 1381 | return result; |
| 1382 | } |
| 1383 | |
| 1384 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetEvent(XGL_EVENT event) |
| 1385 | { |
| 1386 | XGL_RESULT result = nextTable.SetEvent(event); |
| 1387 | return result; |
| 1388 | } |
| 1389 | |
| 1390 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetEvent(XGL_EVENT event) |
| 1391 | { |
| 1392 | XGL_RESULT result = nextTable.ResetEvent(event); |
| 1393 | return result; |
| 1394 | } |
| 1395 | |
| 1396 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueryPool(XGL_DEVICE device, const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo, XGL_QUERY_POOL* pQueryPool) |
| 1397 | { |
| 1398 | XGL_RESULT result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool); |
| 1399 | return result; |
| 1400 | } |
| 1401 | |
| 1402 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetQueryPoolResults(XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1403 | { |
| 1404 | XGL_RESULT result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData); |
| 1405 | return result; |
| 1406 | } |
| 1407 | |
| 1408 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1409 | { |
| 1410 | XGL_RESULT result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData); |
| 1411 | return result; |
| 1412 | } |
| 1413 | |
| 1414 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImage(XGL_DEVICE device, const XGL_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage) |
| 1415 | { |
| 1416 | XGL_RESULT result = nextTable.CreateImage(device, pCreateInfo, pImage); |
| 1417 | return result; |
| 1418 | } |
| 1419 | |
| 1420 | XGL_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) |
| 1421 | { |
| 1422 | XGL_RESULT result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData); |
| 1423 | return result; |
| 1424 | } |
| 1425 | |
| 1426 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImageView(XGL_DEVICE device, const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, XGL_IMAGE_VIEW* pView) |
| 1427 | { |
| 1428 | XGL_RESULT result = nextTable.CreateImageView(device, pCreateInfo, pView); |
| 1429 | return result; |
| 1430 | } |
| 1431 | |
| 1432 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorAttachmentView(XGL_DEVICE device, const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, XGL_COLOR_ATTACHMENT_VIEW* pView) |
| 1433 | { |
| 1434 | XGL_RESULT result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView); |
| 1435 | return result; |
| 1436 | } |
| 1437 | |
| 1438 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilView(XGL_DEVICE device, const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_VIEW* pView) |
| 1439 | { |
| 1440 | XGL_RESULT result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView); |
| 1441 | return result; |
| 1442 | } |
| 1443 | |
| 1444 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateShader(XGL_DEVICE device, const XGL_SHADER_CREATE_INFO* pCreateInfo, XGL_SHADER* pShader) |
| 1445 | { |
| 1446 | XGL_RESULT result = nextTable.CreateShader(device, pCreateInfo, pShader); |
| 1447 | return result; |
| 1448 | } |
| 1449 | |
| 1450 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) |
| 1451 | { |
| 1452 | XGL_RESULT result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline); |
| 1453 | return result; |
| 1454 | } |
| 1455 | |
| 1456 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateComputePipeline(XGL_DEVICE device, const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) |
| 1457 | { |
| 1458 | XGL_RESULT result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline); |
| 1459 | return result; |
| 1460 | } |
| 1461 | |
| 1462 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglStorePipeline(XGL_PIPELINE pipeline, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1463 | { |
| 1464 | XGL_RESULT result = nextTable.StorePipeline(pipeline, pDataSize, pData); |
| 1465 | return result; |
| 1466 | } |
| 1467 | |
| 1468 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLoadPipeline(XGL_DEVICE device, XGL_SIZE dataSize, const XGL_VOID* pData, XGL_PIPELINE* pPipeline) |
| 1469 | { |
| 1470 | XGL_RESULT result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline); |
| 1471 | return result; |
| 1472 | } |
| 1473 | |
| 1474 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreatePipelineDelta(XGL_DEVICE device, XGL_PIPELINE p1, XGL_PIPELINE p2, XGL_PIPELINE_DELTA* delta) |
| 1475 | { |
| 1476 | XGL_RESULT result = nextTable.CreatePipelineDelta(device, p1, p2, delta); |
| 1477 | return result; |
| 1478 | } |
| 1479 | |
| 1480 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateSampler(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler) |
| 1481 | { |
| 1482 | XGL_RESULT result = nextTable.CreateSampler(device, pCreateInfo, pSampler); |
| 1483 | return result; |
| 1484 | } |
| 1485 | |
| 1486 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSet(XGL_DEVICE device, const XGL_DESCRIPTOR_SET_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET* pDescriptorSet) |
| 1487 | { |
| 1488 | XGL_RESULT result = nextTable.CreateDescriptorSet(device, pCreateInfo, pDescriptorSet); |
| 1489 | return result; |
| 1490 | } |
| 1491 | |
| 1492 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglBeginDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) |
| 1493 | { |
| 1494 | nextTable.BeginDescriptorSetUpdate(descriptorSet); |
| 1495 | } |
| 1496 | |
| 1497 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglEndDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) |
| 1498 | { |
| 1499 | nextTable.EndDescriptorSetUpdate(descriptorSet); |
| 1500 | } |
| 1501 | |
| 1502 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachSamplerDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers) |
| 1503 | { |
| 1504 | nextTable.AttachSamplerDescriptors(descriptorSet, startSlot, slotCount, pSamplers); |
| 1505 | } |
| 1506 | |
| 1507 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachImageViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews) |
| 1508 | { |
| 1509 | nextTable.AttachImageViewDescriptors(descriptorSet, startSlot, slotCount, pImageViews); |
| 1510 | } |
| 1511 | |
| 1512 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachMemoryViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews) |
| 1513 | { |
| 1514 | nextTable.AttachMemoryViewDescriptors(descriptorSet, startSlot, slotCount, pMemViews); |
| 1515 | } |
| 1516 | |
| 1517 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachNestedDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_DESCRIPTOR_SET_ATTACH_INFO* pNestedDescriptorSets) |
| 1518 | { |
| 1519 | nextTable.AttachNestedDescriptors(descriptorSet, startSlot, slotCount, pNestedDescriptorSets); |
| 1520 | } |
| 1521 | |
| 1522 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglClearDescriptorSetSlots(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount) |
| 1523 | { |
| 1524 | nextTable.ClearDescriptorSetSlots(descriptorSet, startSlot, slotCount); |
| 1525 | } |
| 1526 | |
| 1527 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateViewportState(XGL_DEVICE device, const XGL_VIEWPORT_STATE_CREATE_INFO* pCreateInfo, XGL_VIEWPORT_STATE_OBJECT* pState) |
| 1528 | { |
| 1529 | XGL_RESULT result = nextTable.CreateViewportState(device, pCreateInfo, pState); |
| 1530 | return result; |
| 1531 | } |
| 1532 | |
| 1533 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateRasterState(XGL_DEVICE device, const XGL_RASTER_STATE_CREATE_INFO* pCreateInfo, XGL_RASTER_STATE_OBJECT* pState) |
| 1534 | { |
| 1535 | XGL_RESULT result = nextTable.CreateRasterState(device, pCreateInfo, pState); |
| 1536 | return result; |
| 1537 | } |
| 1538 | |
| 1539 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateMsaaState(XGL_DEVICE device, const XGL_MSAA_STATE_CREATE_INFO* pCreateInfo, XGL_MSAA_STATE_OBJECT* pState) |
| 1540 | { |
| 1541 | XGL_RESULT result = nextTable.CreateMsaaState(device, pCreateInfo, pState); |
| 1542 | return result; |
| 1543 | } |
| 1544 | |
| 1545 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorBlendState(XGL_DEVICE device, const XGL_COLOR_BLEND_STATE_CREATE_INFO* pCreateInfo, XGL_COLOR_BLEND_STATE_OBJECT* pState) |
| 1546 | { |
| 1547 | XGL_RESULT result = nextTable.CreateColorBlendState(device, pCreateInfo, pState); |
| 1548 | return result; |
| 1549 | } |
| 1550 | |
| 1551 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilState(XGL_DEVICE device, const XGL_DEPTH_STENCIL_STATE_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_STATE_OBJECT* pState) |
| 1552 | { |
| 1553 | XGL_RESULT result = nextTable.CreateDepthStencilState(device, pCreateInfo, pState); |
| 1554 | return result; |
| 1555 | } |
| 1556 | |
| 1557 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo, XGL_CMD_BUFFER* pCmdBuffer) |
| 1558 | { |
| 1559 | XGL_RESULT result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); |
| 1560 | // At time of cmd buffer creation, create global cmd buffer node for the returned cmd buffer |
| 1561 | if (*pCmdBuffer) |
| 1562 | insertGlobalCB(*pCmdBuffer); |
| 1563 | printGlobalCB(); |
| 1564 | return result; |
| 1565 | } |
| 1566 | |
| 1567 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBeginCommandBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_FLAGS flags) |
| 1568 | { |
| 1569 | // This implicitly resets the Cmd Buffer so clear memory references |
| 1570 | freeCBBindings(cmdBuffer); |
| 1571 | XGL_RESULT result = nextTable.BeginCommandBuffer(cmdBuffer, flags); |
| 1572 | return result; |
| 1573 | } |
| 1574 | |
| 1575 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEndCommandBuffer(XGL_CMD_BUFFER cmdBuffer) |
| 1576 | { |
| 1577 | // TODO : Anything to do here? |
| 1578 | XGL_RESULT result = nextTable.EndCommandBuffer(cmdBuffer); |
| 1579 | return result; |
| 1580 | } |
| 1581 | |
| 1582 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetCommandBuffer(XGL_CMD_BUFFER cmdBuffer) |
| 1583 | { |
| 1584 | // Clear memory references as this point. Anything else to do here? |
| 1585 | freeCBBindings(cmdBuffer); |
| 1586 | XGL_RESULT result = nextTable.ResetCommandBuffer(cmdBuffer); |
| 1587 | return result; |
| 1588 | } |
| 1589 | // TODO : For any xglCmdBind* calls that include an object which has mem bound to it, |
| 1590 | // need to account for that mem now having binding to given cmdBuffer |
| 1591 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipeline(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline) |
| 1592 | { |
| 1593 | nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline); |
| 1594 | } |
| 1595 | |
| 1596 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipelineDelta(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE_DELTA delta) |
| 1597 | { |
| 1598 | nextTable.CmdBindPipelineDelta(cmdBuffer, pipelineBindPoint, delta); |
| 1599 | } |
| 1600 | |
| 1601 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindStateObject(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_STATE_OBJECT state) |
| 1602 | { |
| 1603 | nextTable.CmdBindStateObject(cmdBuffer, stateBindPoint, state); |
| 1604 | } |
| 1605 | |
| 1606 | XGL_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) |
| 1607 | { |
| 1608 | nextTable.CmdBindDescriptorSet(cmdBuffer, pipelineBindPoint, index, descriptorSet, slotOffset); |
| 1609 | } |
| 1610 | |
| 1611 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDynamicMemoryView(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView) |
| 1612 | { |
| 1613 | nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView); |
| 1614 | } |
| 1615 | |
| 1616 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType) |
| 1617 | { |
| 1618 | // Track this memory. What exactly is this call doing? |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1619 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1620 | char str[1024]; |
| 1621 | sprintf(str, "In xglCmdBindIndexData() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1622 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1623 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1624 | nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType); |
| 1625 | } |
| 1626 | |
| 1627 | XGL_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) |
| 1628 | { |
| 1629 | nextTable.CmdBindAttachments(cmdBuffer, colorAttachmentCount, pColorAttachments, pDepthStencilAttachment); |
| 1630 | } |
| 1631 | |
| 1632 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareMemoryRegions(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_MEMORY_STATE_TRANSITION* pStateTransitions) |
| 1633 | { |
| 1634 | // TODO : Track memory state transitions |
| 1635 | // Flag incorrect transitions when states don't match |
| 1636 | XGL_GPU_MEMORY mem = pStateTransitions->mem; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1637 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1638 | char str[1024]; |
| 1639 | sprintf(str, "In xglCmdPrepareMemoryRegions() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1640 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1641 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1642 | nextTable.CmdPrepareMemoryRegions(cmdBuffer, transitionCount, pStateTransitions); |
| 1643 | } |
| 1644 | |
| 1645 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareImages(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_IMAGE_STATE_TRANSITION* pStateTransitions) |
| 1646 | { |
| 1647 | // TODO : This will have an image object that's bound to memory in the pStateTransitions struct |
| 1648 | // Need to pull object based on image and then pull mem mapping from that object |
| 1649 | XGL_GPU_MEMORY mem = getMemBindingFromObject((XGL_OBJECT)pStateTransitions->image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1650 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1651 | char str[1024]; |
| 1652 | sprintf(str, "In xglCmdPrepareImages() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1653 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1654 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1655 | nextTable.CmdPrepareImages(cmdBuffer, transitionCount, pStateTransitions); |
| 1656 | } |
| 1657 | |
| 1658 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDraw(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstVertex, XGL_UINT vertexCount, XGL_UINT firstInstance, XGL_UINT instanceCount) |
| 1659 | { |
| 1660 | nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); |
| 1661 | } |
| 1662 | |
| 1663 | XGL_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) |
| 1664 | { |
| 1665 | nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); |
| 1666 | } |
| 1667 | |
| 1668 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride) |
| 1669 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1670 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1671 | char str[1024]; |
| 1672 | sprintf(str, "In xglCmdDrawIndirect() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1673 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1674 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1675 | nextTable.CmdDrawIndirect(cmdBuffer, mem, offset, count, stride); |
| 1676 | } |
| 1677 | |
| 1678 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndexedIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride) |
| 1679 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1680 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1681 | char str[1024]; |
| 1682 | sprintf(str, "In xglCmdDrawIndexedIndirect() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1683 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1684 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1685 | nextTable.CmdDrawIndexedIndirect(cmdBuffer, mem, offset, count, stride); |
| 1686 | } |
| 1687 | |
| 1688 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatch(XGL_CMD_BUFFER cmdBuffer, XGL_UINT x, XGL_UINT y, XGL_UINT z) |
| 1689 | { |
| 1690 | nextTable.CmdDispatch(cmdBuffer, x, y, z); |
| 1691 | } |
| 1692 | |
| 1693 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatchIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) |
| 1694 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1695 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1696 | char str[1024]; |
| 1697 | sprintf(str, "In xglCmdDispatchIndirect() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1698 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1699 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1700 | nextTable.CmdDispatchIndirect(cmdBuffer, mem, offset); |
| 1701 | } |
| 1702 | |
| 1703 | XGL_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) |
| 1704 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1705 | if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) { |
| 1706 | char str[1024]; |
| 1707 | sprintf(str, "In xglCmdCopyMemory() call unable to update binding of srcMem %p to cmdBuffer %p", srcMem, cmdBuffer); |
| 1708 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1709 | } |
| 1710 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1711 | char str[1024]; |
| 1712 | sprintf(str, "In xglCmdCopyMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1713 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1714 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1715 | nextTable.CmdCopyMemory(cmdBuffer, srcMem, destMem, regionCount, pRegions); |
| 1716 | } |
| 1717 | |
| 1718 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT regionCount, const XGL_IMAGE_COPY* pRegions) |
| 1719 | { |
| 1720 | // TODO : Each image will have mem mapping so track them |
| 1721 | nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions); |
| 1722 | } |
| 1723 | |
| 1724 | XGL_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) |
| 1725 | { |
| 1726 | // TODO : Track this |
| 1727 | XGL_GPU_MEMORY mem = getMemBindingFromObject(destImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1728 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1729 | char str[1024]; |
| 1730 | sprintf(str, "In xglCmdCopyMemoryToImage() call unable to update binding of destImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1731 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1732 | } |
| 1733 | if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) { |
| 1734 | char str[1024]; |
| 1735 | sprintf(str, "In xglCmdCopyMemoryToImage() call unable to update binding of srcMem %p to cmdBuffer %p", srcMem, cmdBuffer); |
| 1736 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1737 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1738 | nextTable.CmdCopyMemoryToImage(cmdBuffer, srcMem, destImage, regionCount, pRegions); |
| 1739 | } |
| 1740 | |
| 1741 | XGL_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) |
| 1742 | { |
| 1743 | // TODO : Track this |
| 1744 | XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1745 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1746 | char str[1024]; |
| 1747 | sprintf(str, "In xglCmdCopyImageToMemory() call unable to update binding of srcImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1748 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1749 | } |
| 1750 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1751 | char str[1024]; |
| 1752 | sprintf(str, "In xglCmdCopyImageToMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1753 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1754 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1755 | nextTable.CmdCopyImageToMemory(cmdBuffer, srcImage, destMem, regionCount, pRegions); |
| 1756 | } |
| 1757 | |
| 1758 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCloneImageData(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_STATE srcImageState, XGL_IMAGE destImage, XGL_IMAGE_STATE destImageState) |
| 1759 | { |
| 1760 | // TODO : Each image will have mem mapping so track them |
| 1761 | XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1762 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1763 | char str[1024]; |
| 1764 | sprintf(str, "In xglCmdCloneImageData() call unable to update binding of srcImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1765 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1766 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1767 | mem = getMemBindingFromObject(destImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1768 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1769 | char str[1024]; |
| 1770 | sprintf(str, "In xglCmdCloneImageData() call unable to update binding of destImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1771 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1772 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1773 | nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageState, destImage, destImageState); |
| 1774 | } |
| 1775 | |
| 1776 | XGL_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) |
| 1777 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1778 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1779 | char str[1024]; |
| 1780 | sprintf(str, "In xglCmdUpdateMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1781 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1782 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1783 | nextTable.CmdUpdateMemory(cmdBuffer, destMem, destOffset, dataSize, pData); |
| 1784 | } |
| 1785 | |
| 1786 | XGL_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) |
| 1787 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1788 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1789 | char str[1024]; |
| 1790 | sprintf(str, "In xglCmdFillMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1791 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1792 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1793 | nextTable.CmdFillMemory(cmdBuffer, destMem, destOffset, fillSize, data); |
| 1794 | } |
| 1795 | |
| 1796 | XGL_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) |
| 1797 | { |
| 1798 | XGL_GPU_MEMORY mem = getMemBindingFromObject(image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1799 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1800 | char str[1024]; |
| 1801 | sprintf(str, "In xglCmdClearColorImage() call unable to update binding of image mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1802 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1803 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1804 | nextTable.CmdClearColorImage(cmdBuffer, image, color, rangeCount, pRanges); |
| 1805 | } |
| 1806 | |
| 1807 | XGL_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) |
| 1808 | { |
| 1809 | XGL_GPU_MEMORY mem = getMemBindingFromObject(image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1810 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1811 | char str[1024]; |
| 1812 | sprintf(str, "In xglCmdClearColorImageRaw() call unable to update binding of image mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1813 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1814 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1815 | nextTable.CmdClearColorImageRaw(cmdBuffer, image, color, rangeCount, pRanges); |
| 1816 | } |
| 1817 | |
| 1818 | XGL_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) |
| 1819 | { |
| 1820 | XGL_GPU_MEMORY mem = getMemBindingFromObject(image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1821 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1822 | char str[1024]; |
| 1823 | sprintf(str, "In xglCmdClearDepthStencil() call unable to update binding of image mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1824 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1825 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1826 | nextTable.CmdClearDepthStencil(cmdBuffer, image, depth, stencil, rangeCount, pRanges); |
| 1827 | } |
| 1828 | |
| 1829 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResolveImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT rectCount, const XGL_IMAGE_RESOLVE* pRects) |
| 1830 | { |
| 1831 | XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1832 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1833 | char str[1024]; |
| 1834 | sprintf(str, "In xglCmdResolveImage() call unable to update binding of srcImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1835 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1836 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1837 | mem = getMemBindingFromObject(destImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1838 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1839 | char str[1024]; |
| 1840 | sprintf(str, "In xglCmdResolveImage() call unable to update binding of destImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1841 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1842 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1843 | nextTable.CmdResolveImage(cmdBuffer, srcImage, destImage, rectCount, pRects); |
| 1844 | } |
| 1845 | |
| 1846 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) |
| 1847 | { |
| 1848 | nextTable.CmdSetEvent(cmdBuffer, event); |
| 1849 | } |
| 1850 | |
| 1851 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) |
| 1852 | { |
| 1853 | nextTable.CmdResetEvent(cmdBuffer, event); |
| 1854 | } |
| 1855 | |
| 1856 | XGL_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) |
| 1857 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1858 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1859 | char str[1024]; |
| 1860 | sprintf(str, "In xglCmdMemoryAtomic() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1861 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1862 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1863 | nextTable.CmdMemoryAtomic(cmdBuffer, destMem, destOffset, srcData, atomicOp); |
| 1864 | } |
| 1865 | |
| 1866 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBeginQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot, XGL_FLAGS flags) |
| 1867 | { |
| 1868 | XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1869 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1870 | char str[1024]; |
| 1871 | sprintf(str, "In xglCmdBeginQuery() call unable to update binding of queryPool mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1872 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1873 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1874 | nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags); |
| 1875 | } |
| 1876 | |
| 1877 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdEndQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot) |
| 1878 | { |
| 1879 | XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1880 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1881 | char str[1024]; |
| 1882 | sprintf(str, "In xglCmdEndQuery() call unable to update binding of queryPool mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1883 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1884 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1885 | nextTable.CmdEndQuery(cmdBuffer, queryPool, slot); |
| 1886 | } |
| 1887 | |
| 1888 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetQueryPool(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount) |
| 1889 | { |
| 1890 | XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1891 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1892 | char str[1024]; |
| 1893 | sprintf(str, "In xglCmdResetQueryPool() call unable to update binding of queryPool mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1894 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1895 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1896 | nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount); |
| 1897 | } |
| 1898 | |
| 1899 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdWriteTimestamp(XGL_CMD_BUFFER cmdBuffer, XGL_TIMESTAMP_TYPE timestampType, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset) |
| 1900 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1901 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1902 | char str[1024]; |
| 1903 | sprintf(str, "In xglCmdWriteTimestamp() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1904 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1905 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1906 | nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destMem, destOffset); |
| 1907 | } |
| 1908 | |
| 1909 | XGL_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) |
| 1910 | { |
| 1911 | nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData); |
| 1912 | } |
| 1913 | |
| 1914 | XGL_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) |
| 1915 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1916 | if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) { |
| 1917 | char str[1024]; |
| 1918 | sprintf(str, "In xglCmdLoadAtomicCounters() call unable to update binding of srcMem %p to cmdBuffer %p", srcMem, cmdBuffer); |
| 1919 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1920 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1921 | nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcMem, srcOffset); |
| 1922 | } |
| 1923 | |
| 1924 | XGL_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) |
| 1925 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1926 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1927 | char str[1024]; |
| 1928 | sprintf(str, "In xglCmdSaveAtomicCounters() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1929 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1930 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1931 | nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destMem, destOffset); |
| 1932 | } |
| 1933 | |
| 1934 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetValidationLevel(XGL_DEVICE device, XGL_VALIDATION_LEVEL validationLevel) |
| 1935 | { |
| 1936 | XGL_RESULT result = nextTable.DbgSetValidationLevel(device, validationLevel); |
| 1937 | return result; |
| 1938 | } |
| 1939 | |
| 1940 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgRegisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, XGL_VOID* pUserData) |
| 1941 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1942 | // This layer intercepts callbacks |
| 1943 | XGL_LAYER_DBG_FUNCTION_NODE *pNewDbgFuncNode = (XGL_LAYER_DBG_FUNCTION_NODE*)malloc(sizeof(XGL_LAYER_DBG_FUNCTION_NODE)); |
| 1944 | if (!pNewDbgFuncNode) |
| 1945 | return XGL_ERROR_OUT_OF_MEMORY; |
| 1946 | pNewDbgFuncNode->pfnMsgCallback = pfnMsgCallback; |
| 1947 | pNewDbgFuncNode->pUserData = pUserData; |
| 1948 | pNewDbgFuncNode->pNext = pDbgFunctionHead; |
| 1949 | pDbgFunctionHead = pNewDbgFuncNode; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1950 | XGL_RESULT result = nextTable.DbgRegisterMsgCallback(pfnMsgCallback, pUserData); |
| 1951 | return result; |
| 1952 | } |
| 1953 | |
| 1954 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgUnregisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback) |
| 1955 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1956 | XGL_LAYER_DBG_FUNCTION_NODE *pTrav = pDbgFunctionHead; |
| 1957 | XGL_LAYER_DBG_FUNCTION_NODE *pPrev = pTrav; |
| 1958 | while (pTrav) { |
| 1959 | if (pTrav->pfnMsgCallback == pfnMsgCallback) { |
| 1960 | pPrev->pNext = pTrav->pNext; |
| 1961 | if (pDbgFunctionHead == pTrav) |
| 1962 | pDbgFunctionHead = pTrav->pNext; |
| 1963 | free(pTrav); |
| 1964 | break; |
| 1965 | } |
| 1966 | pPrev = pTrav; |
| 1967 | pTrav = pTrav->pNext; |
| 1968 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1969 | XGL_RESULT result = nextTable.DbgUnregisterMsgCallback(pfnMsgCallback); |
| 1970 | return result; |
| 1971 | } |
| 1972 | |
| 1973 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetMessageFilter(XGL_DEVICE device, XGL_INT msgCode, XGL_DBG_MSG_FILTER filter) |
| 1974 | { |
| 1975 | XGL_RESULT result = nextTable.DbgSetMessageFilter(device, msgCode, filter); |
| 1976 | return result; |
| 1977 | } |
| 1978 | |
| 1979 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetObjectTag(XGL_BASE_OBJECT object, XGL_SIZE tagSize, const XGL_VOID* pTag) |
| 1980 | { |
| 1981 | XGL_RESULT result = nextTable.DbgSetObjectTag(object, tagSize, pTag); |
| 1982 | return result; |
| 1983 | } |
| 1984 | |
| 1985 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(XGL_DBG_GLOBAL_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) |
| 1986 | { |
| 1987 | XGL_RESULT result = nextTable.DbgSetGlobalOption(dbgOption, dataSize, pData); |
| 1988 | return result; |
| 1989 | } |
| 1990 | |
| 1991 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetDeviceOption(XGL_DEVICE device, XGL_DBG_DEVICE_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) |
| 1992 | { |
| 1993 | XGL_RESULT result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData); |
| 1994 | return result; |
| 1995 | } |
| 1996 | |
| 1997 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerBegin(XGL_CMD_BUFFER cmdBuffer, const XGL_CHAR* pMarker) |
| 1998 | { |
| 1999 | nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker); |
| 2000 | } |
| 2001 | |
| 2002 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerEnd(XGL_CMD_BUFFER cmdBuffer) |
| 2003 | { |
| 2004 | nextTable.CmdDbgMarkerEnd(cmdBuffer); |
| 2005 | } |
| 2006 | |
| 2007 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11AssociateConnection(XGL_PHYSICAL_GPU gpu, const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo) |
| 2008 | { |
| 2009 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2010 | pCurObj = gpuw; |
| 2011 | pthread_once(&tabOnce, initLayerTable); |
| 2012 | XGL_RESULT result = nextTable.WsiX11AssociateConnection((XGL_PHYSICAL_GPU)gpuw->nextObject, pConnectionInfo); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2013 | return result; |
| 2014 | } |
| 2015 | |
Tobin Ehlis | 61f36c9 | 2014-11-11 08:00:58 -0700 | [diff] [blame] | 2016 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11GetMSC(XGL_DEVICE device, xcb_window_t window, xcb_randr_crtc_t crtc, XGL_UINT64* pMsc) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2017 | { |
Tobin Ehlis | 61f36c9 | 2014-11-11 08:00:58 -0700 | [diff] [blame] | 2018 | XGL_RESULT result = nextTable.WsiX11GetMSC(device, window, crtc, pMsc); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2019 | return result; |
| 2020 | } |
| 2021 | |
| 2022 | XGL_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) |
| 2023 | { |
| 2024 | XGL_RESULT result = nextTable.WsiX11CreatePresentableImage(device, pCreateInfo, pImage, pMem); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 2025 | // First insert the new Mem Object and then bind it to created image |
| 2026 | insertGlobalMemObj(*pMem, NULL); |
| 2027 | if (XGL_FALSE == updateObjectBinding(*pImage, *pMem)) { |
| 2028 | char str[1024]; |
| 2029 | sprintf(str, "In xglWsiX11CreatePresentableImage(), unable to set image %p binding to mem obj %p", (void*)*pImage, (void*)*pMem); |
| 2030 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, *pImage, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 2031 | } |
| 2032 | printObjList(); |
| 2033 | printMemList(); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2034 | return result; |
| 2035 | } |
| 2036 | |
| 2037 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent(XGL_QUEUE queue, const XGL_WSI_X11_PRESENT_INFO* pPresentInfo, XGL_FENCE fence) |
| 2038 | { |
| 2039 | XGL_RESULT result = nextTable.WsiX11QueuePresent(queue, pPresentInfo, fence); |
| 2040 | return result; |
| 2041 | } |
| 2042 | |
| 2043 | XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* funcName) |
| 2044 | { |
| 2045 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 2046 | if (gpu == NULL) |
| 2047 | return NULL; |
| 2048 | pCurObj = gpuw; |
| 2049 | pthread_once(&tabOnce, initLayerTable); |
| 2050 | |
| 2051 | if (!strncmp("xglGetProcAddr", (const char *) funcName, sizeof("xglGetProcAddr"))) |
| 2052 | return xglGetProcAddr; |
| 2053 | else if (!strncmp("xglInitAndEnumerateGpus", (const char *) funcName, sizeof("xglInitAndEnumerateGpus"))) |
| 2054 | return nextTable.InitAndEnumerateGpus; |
| 2055 | else if (!strncmp("xglGetGpuInfo", (const char *) funcName, sizeof("xglGetGpuInfo"))) |
| 2056 | return xglGetGpuInfo; |
| 2057 | else if (!strncmp("xglCreateDevice", (const char *) funcName, sizeof("xglCreateDevice"))) |
| 2058 | return xglCreateDevice; |
| 2059 | else if (!strncmp("xglDestroyDevice", (const char *) funcName, sizeof("xglDestroyDevice"))) |
| 2060 | return xglDestroyDevice; |
| 2061 | else if (!strncmp("xglGetExtensionSupport", (const char *) funcName, sizeof("xglGetExtensionSupport"))) |
| 2062 | return xglGetExtensionSupport; |
| 2063 | else if (!strncmp("xglEnumerateLayers", (const char *) funcName, sizeof("xglEnumerateLayers"))) |
| 2064 | return xglEnumerateLayers; |
| 2065 | else if (!strncmp("xglGetDeviceQueue", (const char *) funcName, sizeof("xglGetDeviceQueue"))) |
| 2066 | return xglGetDeviceQueue; |
| 2067 | else if (!strncmp("xglQueueSubmit", (const char *) funcName, sizeof("xglQueueSubmit"))) |
| 2068 | return xglQueueSubmit; |
| 2069 | else if (!strncmp("xglQueueSetGlobalMemReferences", (const char *) funcName, sizeof("xglQueueSetGlobalMemReferences"))) |
| 2070 | return xglQueueSetGlobalMemReferences; |
| 2071 | else if (!strncmp("xglQueueWaitIdle", (const char *) funcName, sizeof("xglQueueWaitIdle"))) |
| 2072 | return xglQueueWaitIdle; |
| 2073 | else if (!strncmp("xglDeviceWaitIdle", (const char *) funcName, sizeof("xglDeviceWaitIdle"))) |
| 2074 | return xglDeviceWaitIdle; |
| 2075 | else if (!strncmp("xglGetMemoryHeapCount", (const char *) funcName, sizeof("xglGetMemoryHeapCount"))) |
| 2076 | return xglGetMemoryHeapCount; |
| 2077 | else if (!strncmp("xglGetMemoryHeapInfo", (const char *) funcName, sizeof("xglGetMemoryHeapInfo"))) |
| 2078 | return xglGetMemoryHeapInfo; |
| 2079 | else if (!strncmp("xglAllocMemory", (const char *) funcName, sizeof("xglAllocMemory"))) |
| 2080 | return xglAllocMemory; |
| 2081 | else if (!strncmp("xglFreeMemory", (const char *) funcName, sizeof("xglFreeMemory"))) |
| 2082 | return xglFreeMemory; |
| 2083 | else if (!strncmp("xglSetMemoryPriority", (const char *) funcName, sizeof("xglSetMemoryPriority"))) |
| 2084 | return xglSetMemoryPriority; |
| 2085 | else if (!strncmp("xglMapMemory", (const char *) funcName, sizeof("xglMapMemory"))) |
| 2086 | return xglMapMemory; |
| 2087 | else if (!strncmp("xglUnmapMemory", (const char *) funcName, sizeof("xglUnmapMemory"))) |
| 2088 | return xglUnmapMemory; |
| 2089 | else if (!strncmp("xglPinSystemMemory", (const char *) funcName, sizeof("xglPinSystemMemory"))) |
| 2090 | return xglPinSystemMemory; |
| 2091 | else if (!strncmp("xglRemapVirtualMemoryPages", (const char *) funcName, sizeof("xglRemapVirtualMemoryPages"))) |
| 2092 | return xglRemapVirtualMemoryPages; |
| 2093 | else if (!strncmp("xglGetMultiGpuCompatibility", (const char *) funcName, sizeof("xglGetMultiGpuCompatibility"))) |
| 2094 | return xglGetMultiGpuCompatibility; |
| 2095 | else if (!strncmp("xglOpenSharedMemory", (const char *) funcName, sizeof("xglOpenSharedMemory"))) |
| 2096 | return xglOpenSharedMemory; |
| 2097 | else if (!strncmp("xglOpenSharedQueueSemaphore", (const char *) funcName, sizeof("xglOpenSharedQueueSemaphore"))) |
| 2098 | return xglOpenSharedQueueSemaphore; |
| 2099 | else if (!strncmp("xglOpenPeerMemory", (const char *) funcName, sizeof("xglOpenPeerMemory"))) |
| 2100 | return xglOpenPeerMemory; |
| 2101 | else if (!strncmp("xglOpenPeerImage", (const char *) funcName, sizeof("xglOpenPeerImage"))) |
| 2102 | return xglOpenPeerImage; |
| 2103 | else if (!strncmp("xglDestroyObject", (const char *) funcName, sizeof("xglDestroyObject"))) |
| 2104 | return xglDestroyObject; |
| 2105 | else if (!strncmp("xglGetObjectInfo", (const char *) funcName, sizeof("xglGetObjectInfo"))) |
| 2106 | return xglGetObjectInfo; |
| 2107 | else if (!strncmp("xglBindObjectMemory", (const char *) funcName, sizeof("xglBindObjectMemory"))) |
| 2108 | return xglBindObjectMemory; |
| 2109 | else if (!strncmp("xglCreateFence", (const char *) funcName, sizeof("xglCreateFence"))) |
| 2110 | return xglCreateFence; |
| 2111 | else if (!strncmp("xglGetFenceStatus", (const char *) funcName, sizeof("xglGetFenceStatus"))) |
| 2112 | return xglGetFenceStatus; |
| 2113 | else if (!strncmp("xglWaitForFences", (const char *) funcName, sizeof("xglWaitForFences"))) |
| 2114 | return xglWaitForFences; |
| 2115 | else if (!strncmp("xglCreateQueueSemaphore", (const char *) funcName, sizeof("xglCreateQueueSemaphore"))) |
| 2116 | return xglCreateQueueSemaphore; |
| 2117 | else if (!strncmp("xglSignalQueueSemaphore", (const char *) funcName, sizeof("xglSignalQueueSemaphore"))) |
| 2118 | return xglSignalQueueSemaphore; |
| 2119 | else if (!strncmp("xglWaitQueueSemaphore", (const char *) funcName, sizeof("xglWaitQueueSemaphore"))) |
| 2120 | return xglWaitQueueSemaphore; |
| 2121 | else if (!strncmp("xglCreateEvent", (const char *) funcName, sizeof("xglCreateEvent"))) |
| 2122 | return xglCreateEvent; |
| 2123 | else if (!strncmp("xglGetEventStatus", (const char *) funcName, sizeof("xglGetEventStatus"))) |
| 2124 | return xglGetEventStatus; |
| 2125 | else if (!strncmp("xglSetEvent", (const char *) funcName, sizeof("xglSetEvent"))) |
| 2126 | return xglSetEvent; |
| 2127 | else if (!strncmp("xglResetEvent", (const char *) funcName, sizeof("xglResetEvent"))) |
| 2128 | return xglResetEvent; |
| 2129 | else if (!strncmp("xglCreateQueryPool", (const char *) funcName, sizeof("xglCreateQueryPool"))) |
| 2130 | return xglCreateQueryPool; |
| 2131 | else if (!strncmp("xglGetQueryPoolResults", (const char *) funcName, sizeof("xglGetQueryPoolResults"))) |
| 2132 | return xglGetQueryPoolResults; |
| 2133 | else if (!strncmp("xglGetFormatInfo", (const char *) funcName, sizeof("xglGetFormatInfo"))) |
| 2134 | return xglGetFormatInfo; |
| 2135 | else if (!strncmp("xglCreateImage", (const char *) funcName, sizeof("xglCreateImage"))) |
| 2136 | return xglCreateImage; |
| 2137 | else if (!strncmp("xglGetImageSubresourceInfo", (const char *) funcName, sizeof("xglGetImageSubresourceInfo"))) |
| 2138 | return xglGetImageSubresourceInfo; |
| 2139 | else if (!strncmp("xglCreateImageView", (const char *) funcName, sizeof("xglCreateImageView"))) |
| 2140 | return xglCreateImageView; |
| 2141 | else if (!strncmp("xglCreateColorAttachmentView", (const char *) funcName, sizeof("xglCreateColorAttachmentView"))) |
| 2142 | return xglCreateColorAttachmentView; |
| 2143 | else if (!strncmp("xglCreateDepthStencilView", (const char *) funcName, sizeof("xglCreateDepthStencilView"))) |
| 2144 | return xglCreateDepthStencilView; |
| 2145 | else if (!strncmp("xglCreateShader", (const char *) funcName, sizeof("xglCreateShader"))) |
| 2146 | return xglCreateShader; |
| 2147 | else if (!strncmp("xglCreateGraphicsPipeline", (const char *) funcName, sizeof("xglCreateGraphicsPipeline"))) |
| 2148 | return xglCreateGraphicsPipeline; |
| 2149 | else if (!strncmp("xglCreateComputePipeline", (const char *) funcName, sizeof("xglCreateComputePipeline"))) |
| 2150 | return xglCreateComputePipeline; |
| 2151 | else if (!strncmp("xglStorePipeline", (const char *) funcName, sizeof("xglStorePipeline"))) |
| 2152 | return xglStorePipeline; |
| 2153 | else if (!strncmp("xglLoadPipeline", (const char *) funcName, sizeof("xglLoadPipeline"))) |
| 2154 | return xglLoadPipeline; |
| 2155 | else if (!strncmp("xglCreatePipelineDelta", (const char *) funcName, sizeof("xglCreatePipelineDelta"))) |
| 2156 | return xglCreatePipelineDelta; |
| 2157 | else if (!strncmp("xglCreateSampler", (const char *) funcName, sizeof("xglCreateSampler"))) |
| 2158 | return xglCreateSampler; |
| 2159 | else if (!strncmp("xglCreateDescriptorSet", (const char *) funcName, sizeof("xglCreateDescriptorSet"))) |
| 2160 | return xglCreateDescriptorSet; |
| 2161 | else if (!strncmp("xglBeginDescriptorSetUpdate", (const char *) funcName, sizeof("xglBeginDescriptorSetUpdate"))) |
| 2162 | return xglBeginDescriptorSetUpdate; |
| 2163 | else if (!strncmp("xglEndDescriptorSetUpdate", (const char *) funcName, sizeof("xglEndDescriptorSetUpdate"))) |
| 2164 | return xglEndDescriptorSetUpdate; |
| 2165 | else if (!strncmp("xglAttachSamplerDescriptors", (const char *) funcName, sizeof("xglAttachSamplerDescriptors"))) |
| 2166 | return xglAttachSamplerDescriptors; |
| 2167 | else if (!strncmp("xglAttachImageViewDescriptors", (const char *) funcName, sizeof("xglAttachImageViewDescriptors"))) |
| 2168 | return xglAttachImageViewDescriptors; |
| 2169 | else if (!strncmp("xglAttachMemoryViewDescriptors", (const char *) funcName, sizeof("xglAttachMemoryViewDescriptors"))) |
| 2170 | return xglAttachMemoryViewDescriptors; |
| 2171 | else if (!strncmp("xglAttachNestedDescriptors", (const char *) funcName, sizeof("xglAttachNestedDescriptors"))) |
| 2172 | return xglAttachNestedDescriptors; |
| 2173 | else if (!strncmp("xglClearDescriptorSetSlots", (const char *) funcName, sizeof("xglClearDescriptorSetSlots"))) |
| 2174 | return xglClearDescriptorSetSlots; |
| 2175 | else if (!strncmp("xglCreateViewportState", (const char *) funcName, sizeof("xglCreateViewportState"))) |
| 2176 | return xglCreateViewportState; |
| 2177 | else if (!strncmp("xglCreateRasterState", (const char *) funcName, sizeof("xglCreateRasterState"))) |
| 2178 | return xglCreateRasterState; |
| 2179 | else if (!strncmp("xglCreateMsaaState", (const char *) funcName, sizeof("xglCreateMsaaState"))) |
| 2180 | return xglCreateMsaaState; |
| 2181 | else if (!strncmp("xglCreateColorBlendState", (const char *) funcName, sizeof("xglCreateColorBlendState"))) |
| 2182 | return xglCreateColorBlendState; |
| 2183 | else if (!strncmp("xglCreateDepthStencilState", (const char *) funcName, sizeof("xglCreateDepthStencilState"))) |
| 2184 | return xglCreateDepthStencilState; |
| 2185 | else if (!strncmp("xglCreateCommandBuffer", (const char *) funcName, sizeof("xglCreateCommandBuffer"))) |
| 2186 | return xglCreateCommandBuffer; |
| 2187 | else if (!strncmp("xglBeginCommandBuffer", (const char *) funcName, sizeof("xglBeginCommandBuffer"))) |
| 2188 | return xglBeginCommandBuffer; |
| 2189 | else if (!strncmp("xglEndCommandBuffer", (const char *) funcName, sizeof("xglEndCommandBuffer"))) |
| 2190 | return xglEndCommandBuffer; |
| 2191 | else if (!strncmp("xglResetCommandBuffer", (const char *) funcName, sizeof("xglResetCommandBuffer"))) |
| 2192 | return xglResetCommandBuffer; |
| 2193 | else if (!strncmp("xglCmdBindPipeline", (const char *) funcName, sizeof("xglCmdBindPipeline"))) |
| 2194 | return xglCmdBindPipeline; |
| 2195 | else if (!strncmp("xglCmdBindPipelineDelta", (const char *) funcName, sizeof("xglCmdBindPipelineDelta"))) |
| 2196 | return xglCmdBindPipelineDelta; |
| 2197 | else if (!strncmp("xglCmdBindStateObject", (const char *) funcName, sizeof("xglCmdBindStateObject"))) |
| 2198 | return xglCmdBindStateObject; |
| 2199 | else if (!strncmp("xglCmdBindDescriptorSet", (const char *) funcName, sizeof("xglCmdBindDescriptorSet"))) |
| 2200 | return xglCmdBindDescriptorSet; |
| 2201 | else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) funcName, sizeof("xglCmdBindDynamicMemoryView"))) |
| 2202 | return xglCmdBindDynamicMemoryView; |
| 2203 | else if (!strncmp("xglCmdBindIndexData", (const char *) funcName, sizeof("xglCmdBindIndexData"))) |
| 2204 | return xglCmdBindIndexData; |
| 2205 | else if (!strncmp("xglCmdBindAttachments", (const char *) funcName, sizeof("xglCmdBindAttachments"))) |
| 2206 | return xglCmdBindAttachments; |
| 2207 | else if (!strncmp("xglCmdPrepareMemoryRegions", (const char *) funcName, sizeof("xglCmdPrepareMemoryRegions"))) |
| 2208 | return xglCmdPrepareMemoryRegions; |
| 2209 | else if (!strncmp("xglCmdPrepareImages", (const char *) funcName, sizeof("xglCmdPrepareImages"))) |
| 2210 | return xglCmdPrepareImages; |
| 2211 | else if (!strncmp("xglCmdDraw", (const char *) funcName, sizeof("xglCmdDraw"))) |
| 2212 | return xglCmdDraw; |
| 2213 | else if (!strncmp("xglCmdDrawIndexed", (const char *) funcName, sizeof("xglCmdDrawIndexed"))) |
| 2214 | return xglCmdDrawIndexed; |
| 2215 | else if (!strncmp("xglCmdDrawIndirect", (const char *) funcName, sizeof("xglCmdDrawIndirect"))) |
| 2216 | return xglCmdDrawIndirect; |
| 2217 | else if (!strncmp("xglCmdDrawIndexedIndirect", (const char *) funcName, sizeof("xglCmdDrawIndexedIndirect"))) |
| 2218 | return xglCmdDrawIndexedIndirect; |
| 2219 | else if (!strncmp("xglCmdDispatch", (const char *) funcName, sizeof("xglCmdDispatch"))) |
| 2220 | return xglCmdDispatch; |
| 2221 | else if (!strncmp("xglCmdDispatchIndirect", (const char *) funcName, sizeof("xglCmdDispatchIndirect"))) |
| 2222 | return xglCmdDispatchIndirect; |
| 2223 | else if (!strncmp("xglCmdCopyMemory", (const char *) funcName, sizeof("xglCmdCopyMemory"))) |
| 2224 | return xglCmdCopyMemory; |
| 2225 | else if (!strncmp("xglCmdCopyImage", (const char *) funcName, sizeof("xglCmdCopyImage"))) |
| 2226 | return xglCmdCopyImage; |
| 2227 | else if (!strncmp("xglCmdCopyMemoryToImage", (const char *) funcName, sizeof("xglCmdCopyMemoryToImage"))) |
| 2228 | return xglCmdCopyMemoryToImage; |
| 2229 | else if (!strncmp("xglCmdCopyImageToMemory", (const char *) funcName, sizeof("xglCmdCopyImageToMemory"))) |
| 2230 | return xglCmdCopyImageToMemory; |
| 2231 | else if (!strncmp("xglCmdCloneImageData", (const char *) funcName, sizeof("xglCmdCloneImageData"))) |
| 2232 | return xglCmdCloneImageData; |
| 2233 | else if (!strncmp("xglCmdUpdateMemory", (const char *) funcName, sizeof("xglCmdUpdateMemory"))) |
| 2234 | return xglCmdUpdateMemory; |
| 2235 | else if (!strncmp("xglCmdFillMemory", (const char *) funcName, sizeof("xglCmdFillMemory"))) |
| 2236 | return xglCmdFillMemory; |
| 2237 | else if (!strncmp("xglCmdClearColorImage", (const char *) funcName, sizeof("xglCmdClearColorImage"))) |
| 2238 | return xglCmdClearColorImage; |
| 2239 | else if (!strncmp("xglCmdClearColorImageRaw", (const char *) funcName, sizeof("xglCmdClearColorImageRaw"))) |
| 2240 | return xglCmdClearColorImageRaw; |
| 2241 | else if (!strncmp("xglCmdClearDepthStencil", (const char *) funcName, sizeof("xglCmdClearDepthStencil"))) |
| 2242 | return xglCmdClearDepthStencil; |
| 2243 | else if (!strncmp("xglCmdResolveImage", (const char *) funcName, sizeof("xglCmdResolveImage"))) |
| 2244 | return xglCmdResolveImage; |
| 2245 | else if (!strncmp("xglCmdSetEvent", (const char *) funcName, sizeof("xglCmdSetEvent"))) |
| 2246 | return xglCmdSetEvent; |
| 2247 | else if (!strncmp("xglCmdResetEvent", (const char *) funcName, sizeof("xglCmdResetEvent"))) |
| 2248 | return xglCmdResetEvent; |
| 2249 | else if (!strncmp("xglCmdMemoryAtomic", (const char *) funcName, sizeof("xglCmdMemoryAtomic"))) |
| 2250 | return xglCmdMemoryAtomic; |
| 2251 | else if (!strncmp("xglCmdBeginQuery", (const char *) funcName, sizeof("xglCmdBeginQuery"))) |
| 2252 | return xglCmdBeginQuery; |
| 2253 | else if (!strncmp("xglCmdEndQuery", (const char *) funcName, sizeof("xglCmdEndQuery"))) |
| 2254 | return xglCmdEndQuery; |
| 2255 | else if (!strncmp("xglCmdResetQueryPool", (const char *) funcName, sizeof("xglCmdResetQueryPool"))) |
| 2256 | return xglCmdResetQueryPool; |
| 2257 | else if (!strncmp("xglCmdWriteTimestamp", (const char *) funcName, sizeof("xglCmdWriteTimestamp"))) |
| 2258 | return xglCmdWriteTimestamp; |
| 2259 | else if (!strncmp("xglCmdInitAtomicCounters", (const char *) funcName, sizeof("xglCmdInitAtomicCounters"))) |
| 2260 | return xglCmdInitAtomicCounters; |
| 2261 | else if (!strncmp("xglCmdLoadAtomicCounters", (const char *) funcName, sizeof("xglCmdLoadAtomicCounters"))) |
| 2262 | return xglCmdLoadAtomicCounters; |
| 2263 | else if (!strncmp("xglCmdSaveAtomicCounters", (const char *) funcName, sizeof("xglCmdSaveAtomicCounters"))) |
| 2264 | return xglCmdSaveAtomicCounters; |
| 2265 | else if (!strncmp("xglDbgSetValidationLevel", (const char *) funcName, sizeof("xglDbgSetValidationLevel"))) |
| 2266 | return xglDbgSetValidationLevel; |
| 2267 | else if (!strncmp("xglDbgRegisterMsgCallback", (const char *) funcName, sizeof("xglDbgRegisterMsgCallback"))) |
| 2268 | return xglDbgRegisterMsgCallback; |
| 2269 | else if (!strncmp("xglDbgUnregisterMsgCallback", (const char *) funcName, sizeof("xglDbgUnregisterMsgCallback"))) |
| 2270 | return xglDbgUnregisterMsgCallback; |
| 2271 | else if (!strncmp("xglDbgSetMessageFilter", (const char *) funcName, sizeof("xglDbgSetMessageFilter"))) |
| 2272 | return xglDbgSetMessageFilter; |
| 2273 | else if (!strncmp("xglDbgSetObjectTag", (const char *) funcName, sizeof("xglDbgSetObjectTag"))) |
| 2274 | return xglDbgSetObjectTag; |
| 2275 | else if (!strncmp("xglDbgSetGlobalOption", (const char *) funcName, sizeof("xglDbgSetGlobalOption"))) |
| 2276 | return xglDbgSetGlobalOption; |
| 2277 | else if (!strncmp("xglDbgSetDeviceOption", (const char *) funcName, sizeof("xglDbgSetDeviceOption"))) |
| 2278 | return xglDbgSetDeviceOption; |
| 2279 | else if (!strncmp("xglCmdDbgMarkerBegin", (const char *) funcName, sizeof("xglCmdDbgMarkerBegin"))) |
| 2280 | return xglCmdDbgMarkerBegin; |
| 2281 | else if (!strncmp("xglCmdDbgMarkerEnd", (const char *) funcName, sizeof("xglCmdDbgMarkerEnd"))) |
| 2282 | return xglCmdDbgMarkerEnd; |
| 2283 | else if (!strncmp("xglWsiX11AssociateConnection", (const char *) funcName, sizeof("xglWsiX11AssociateConnection"))) |
| 2284 | return xglWsiX11AssociateConnection; |
| 2285 | else if (!strncmp("xglWsiX11GetMSC", (const char *) funcName, sizeof("xglWsiX11GetMSC"))) |
| 2286 | return xglWsiX11GetMSC; |
| 2287 | else if (!strncmp("xglWsiX11CreatePresentableImage", (const char *) funcName, sizeof("xglWsiX11CreatePresentableImage"))) |
| 2288 | return xglWsiX11CreatePresentableImage; |
| 2289 | else if (!strncmp("xglWsiX11QueuePresent", (const char *) funcName, sizeof("xglWsiX11QueuePresent"))) |
| 2290 | return xglWsiX11QueuePresent; |
| 2291 | else { |
| 2292 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 2293 | if (gpuw->pGPA == NULL) |
| 2294 | return NULL; |
| 2295 | return gpuw->pGPA(gpuw->nextObject, funcName); |
| 2296 | } |
| 2297 | } |