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