Tobin Ehlis | 6663f49 | 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 | aa4121f | 2015-01-04 23:11:43 +0800 | [diff] [blame] | 30 | #include "xgl_dispatch_table_helper.h" |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 31 | #include "xgl_struct_string_helper.h" |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 32 | #include "mem_tracker.h" |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 33 | #include "layers_config.h" |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 34 | |
| 35 | static XGL_LAYER_DISPATCH_TABLE nextTable; |
| 36 | static XGL_BASE_LAYER_OBJECT *pCurObj; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 37 | static pthread_once_t g_initOnce = PTHREAD_ONCE_INIT; |
| 38 | |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 39 | // Ptr to LL of dbg functions |
Jon Ashburn | 7d7b3cf | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 45 | // Utility function to handle reporting |
Tobin Ehlis | cd9223b | 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 | 1da4b9f | 2014-12-16 10:47:33 +0800 | [diff] [blame] | 51 | const char* pLayerPrefix, |
| 52 | const char* pMsg) |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 53 | { |
Jon Ashburn | 7d7b3cf | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 57 | case XGL_DBG_MSG_ERROR: |
Jon Ashburn | 7d7b3cf | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 67 | break; |
| 68 | case XGL_DBG_MSG_WARNING: |
Jon Ashburn | 7d7b3cf | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 78 | break; |
| 79 | case XGL_DBG_MSG_PERF_WARNING: |
Jon Ashburn | 7d7b3cf | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 89 | break; |
| 90 | default: |
Jon Ashburn | 7d7b3cf | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 100 | break; |
| 101 | } |
| 102 | } |
| 103 | } |
Tobin Ehlis | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 186 | // Increment 'insert' if new node was inserted |
Tobin Ehlis | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 285 | found = 1; |
| 286 | foundCount++; |
Tobin Ehlis | c0418f9 | 2014-11-25 14:47:20 -0700 | [diff] [blame] | 287 | break; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 288 | } |
| 289 | } |
| 290 | if (!found) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 294 | return XGL_FALSE; |
| 295 | } |
| 296 | found = 0; |
| 297 | pMemNode = pMemNode->pNext; |
| 298 | } |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | c0418f9 | 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 | 6663f49 | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 474 | pCBTrav = pCBTrav->pNext; |
| 475 | } |
| 476 | while (pObjTrav) { |
| 477 | refCount++; |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 481 | pObjTrav = pObjTrav->pNext; |
| 482 | } |
| 483 | if (refCount != pMemObjTrav->refCount) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 518 | return XGL_FALSE; |
| 519 | } |
| 520 | if (!pCBTrav->fence) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 524 | return XGL_FALSE; |
| 525 | } |
| 526 | if (XGL_SUCCESS != nextTable.GetFenceStatus(pCBTrav->fence)) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | 6663f49 | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 597 | memset(pTrav, 0, sizeof(GLOBAL_OBJECT_NODE)); |
| 598 | pPrev->pNext = pTrav; |
| 599 | } |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 624 | return XGL_FALSE; |
| 625 | } |
| 626 | if (!pGlobalObjTrav->pMemNode) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 656 | // IF a previous binding existed, clear it |
Tobin Ehlis | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 701 | } |
| 702 | else { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 706 | while (pGlobalObjTrav) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 726 | printObjList(); |
| 727 | } |
| 728 | } |
| 729 | else { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 743 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 746 | } |
| 747 | else { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 750 | while (pTrav) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 764 | MINI_NODE* pObjTrav = pTrav->pObjBindings; |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 769 | else { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 772 | while (pObjTrav) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 775 | pObjTrav = pObjTrav->pNext; |
| 776 | } |
| 777 | } |
| 778 | MINI_NODE* pCBTrav = pTrav->pCmdBufferBindings; |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 783 | else { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 786 | while (pCBTrav) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 799 | char str[1024] = {0}; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 800 | GLOBAL_CB_NODE* pTrav = pGlobalCBHead; |
| 801 | if (!pTrav) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 804 | } |
| 805 | else { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 808 | while (pTrav) { |
Tobin Ehlis | c0418f9 | 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 | cd9223b | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 811 | MINI_NODE* pMemObjTrav = pTrav->pMemObjList; |
| 812 | while (pMemObjTrav) { |
Tobin Ehlis | cd9223b | 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 | 6663f49 | 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 | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 833 | static void initMemTracker() |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 834 | { |
Jon Ashburn | 7d7b3cf | 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 | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 857 | GetProcAddrType fpNextGPA; |
| 858 | fpNextGPA = pCurObj->pGPA; |
| 859 | assert(fpNextGPA); |
| 860 | |
Chia-I Wu | aa4121f | 2015-01-04 23:11:43 +0800 | [diff] [blame] | 861 | layer_initialize_dispatch_table(&nextTable, fpNextGPA, (XGL_PHYSICAL_GPU) pCurObj->nextObject); |
| 862 | |
Tobin Ehlis | 6663f49 | 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; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 865 | } |
| 866 | |
| 867 | |
| 868 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 869 | { |
| 870 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 871 | pCurObj = gpuw; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 872 | pthread_once(&g_initOnce, initMemTracker); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 873 | XGL_RESULT result = nextTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData); |
| 874 | return result; |
| 875 | } |
| 876 | |
| 877 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice) |
| 878 | { |
| 879 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 880 | pCurObj = gpuw; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 881 | pthread_once(&g_initOnce, initMemTracker); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 882 | XGL_RESULT result = nextTable.CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice); |
| 883 | // Save off device in case we need it to create Fences |
| 884 | globalDevice = *pDevice; |
| 885 | return result; |
| 886 | } |
| 887 | |
| 888 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(XGL_DEVICE device) |
| 889 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 890 | char str[1024]; |
| 891 | sprintf(str, "Printing List details prior to xglDestroyDevice()"); |
| 892 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, device, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 893 | printMemList(); |
| 894 | printGlobalCB(); |
| 895 | printObjList(); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 896 | if (XGL_FALSE == deleteGlobalCBList()) { |
| 897 | sprintf(str, "Issue deleting global CB list in xglDestroyDevice()"); |
| 898 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, device, 0, MEMTRACK_INTERNAL_ERROR, "MEM", str); |
| 899 | } |
Tobin Ehlis | b54ef78 | 2014-11-25 18:01:12 -0700 | [diff] [blame] | 900 | // Report any memory leaks |
| 901 | GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; |
| 902 | while (pTrav) { |
| 903 | 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); |
| 904 | layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, pTrav->mem, 0, MEMTRACK_MEMORY_LEAK, "MEM", str); |
| 905 | pTrav = pTrav->pNextGlobalNode; |
| 906 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 907 | XGL_RESULT result = nextTable.DestroyDevice(device); |
| 908 | return result; |
| 909 | } |
| 910 | |
| 911 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pExtName) |
| 912 | { |
| 913 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 914 | pCurObj = gpuw; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 915 | pthread_once(&g_initOnce, initMemTracker); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 916 | XGL_RESULT result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); |
| 917 | return result; |
| 918 | } |
| 919 | |
Jon Ashburn | d586459 | 2014-11-25 12:56:49 -0700 | [diff] [blame] | 920 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, XGL_SIZE maxLayerCount, XGL_SIZE maxStringSize, XGL_CHAR* const* pOutLayers, XGL_SIZE * pOutLayerCount, XGL_VOID* pReserved) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 921 | { |
Jon Ashburn | f7a0874 | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 922 | if (gpu != NULL) |
| 923 | { |
| 924 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 925 | pCurObj = gpuw; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 926 | pthread_once(&g_initOnce, initMemTracker); |
Jon Ashburn | d586459 | 2014-11-25 12:56:49 -0700 | [diff] [blame] | 927 | XGL_RESULT result = nextTable.EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved); |
Jon Ashburn | f7a0874 | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 928 | return result; |
| 929 | } else |
| 930 | { |
| 931 | if (pOutLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL) |
| 932 | return XGL_ERROR_INVALID_POINTER; |
| 933 | // This layer compatible with all GPUs |
| 934 | *pOutLayerCount = 1; |
Chia-I Wu | 1da4b9f | 2014-12-16 10:47:33 +0800 | [diff] [blame] | 935 | strncpy((char *) pOutLayers[0], "MemTracker", maxStringSize); |
Jon Ashburn | f7a0874 | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 936 | return XGL_SUCCESS; |
| 937 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 938 | } |
| 939 | |
| 940 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetDeviceQueue(XGL_DEVICE device, XGL_QUEUE_TYPE queueType, XGL_UINT queueIndex, XGL_QUEUE* pQueue) |
| 941 | { |
| 942 | XGL_RESULT result = nextTable.GetDeviceQueue(device, queueType, queueIndex, pQueue); |
| 943 | return result; |
| 944 | } |
| 945 | |
| 946 | 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) |
| 947 | { |
| 948 | // TODO : Need to track fence and clear mem references when fence clears |
| 949 | XGL_FENCE localFence = fence; |
| 950 | if (XGL_NULL_HANDLE == fence) { // allocate our own fence to track cmd buffer |
| 951 | localFence = createLocalFence(); |
| 952 | } |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 953 | char str[1024]; |
| 954 | sprintf(str, "In xglQueueSubmit(), checking %u cmdBuffers with %u memRefs", cmdBufferCount, memRefCount); |
| 955 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, queue, 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 956 | printMemList(); |
| 957 | printGlobalCB(); |
| 958 | for (uint32_t i = 0; i < cmdBufferCount; i++) { |
| 959 | setCBFence(pCmdBuffers[i], localFence); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 960 | sprintf(str, "Verifying mem refs for CB %p", pCmdBuffers[i]); |
| 961 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pCmdBuffers[i], 0, MEMTRACK_NONE, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 962 | if (XGL_FALSE == validateCBMemRef(pCmdBuffers[i], memRefCount, pMemRefs)) { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 963 | sprintf(str, "Unable to verify memory references for CB %p", (void*)pCmdBuffers[i]); |
| 964 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pCmdBuffers[i], 0, MEMTRACK_CB_MISSING_MEM_REF, "MEM", str); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 965 | } |
| 966 | } |
| 967 | printGlobalCB(); |
| 968 | XGL_RESULT result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, memRefCount, pMemRefs, localFence); |
| 969 | return result; |
| 970 | } |
| 971 | |
| 972 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSetGlobalMemReferences(XGL_QUEUE queue, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs) |
| 973 | { |
| 974 | // TODO : Use global mem references as part of list checked on QueueSubmit above |
| 975 | XGL_RESULT result = nextTable.QueueSetGlobalMemReferences(queue, memRefCount, pMemRefs); |
| 976 | return result; |
| 977 | } |
| 978 | |
| 979 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueWaitIdle(XGL_QUEUE queue) |
| 980 | { |
| 981 | XGL_RESULT result = nextTable.QueueWaitIdle(queue); |
| 982 | return result; |
| 983 | } |
| 984 | |
| 985 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device) |
| 986 | { |
| 987 | XGL_RESULT result = nextTable.DeviceWaitIdle(device); |
| 988 | return result; |
| 989 | } |
| 990 | |
| 991 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount) |
| 992 | { |
| 993 | // TODO : Track memory stats here |
| 994 | XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount); |
| 995 | return result; |
| 996 | } |
| 997 | |
| 998 | 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) |
| 999 | { |
| 1000 | // TODO : Track memory stats here |
| 1001 | XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData); |
| 1002 | return result; |
| 1003 | } |
| 1004 | |
| 1005 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem) |
| 1006 | { |
| 1007 | XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem); |
| 1008 | // TODO : Track allocations and overall size here |
| 1009 | insertGlobalMemObj(*pMem, pAllocInfo); |
| 1010 | printMemList(); |
| 1011 | return result; |
| 1012 | } |
| 1013 | |
| 1014 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglFreeMemory(XGL_GPU_MEMORY mem) |
| 1015 | { |
Tobin Ehlis | c0418f9 | 2014-11-25 14:47:20 -0700 | [diff] [blame] | 1016 | /* From spec : A memory object is freed by calling xglFreeMemory() when it is no longer needed. Before |
| 1017 | * freeing a memory object, an application must ensure the memory object is unbound from |
| 1018 | * all API objects referencing it and that it is not referenced by any queued command buffers |
| 1019 | */ |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1020 | if (XGL_FALSE == freeMemNode(mem)) { |
| 1021 | char str[1024]; |
| 1022 | sprintf(str, "Issue while freeing mem obj %p", (void*)mem); |
| 1023 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_FREE_MEM_ERROR, "MEM", str); |
| 1024 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1025 | printMemList(); |
| 1026 | printObjList(); |
| 1027 | printGlobalCB(); |
| 1028 | XGL_RESULT result = nextTable.FreeMemory(mem); |
| 1029 | return result; |
| 1030 | } |
| 1031 | |
| 1032 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetMemoryPriority(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority) |
| 1033 | { |
| 1034 | // TODO : Update tracking for this alloc |
| 1035 | // Make sure memory is not pinned, which can't have priority set |
| 1036 | XGL_RESULT result = nextTable.SetMemoryPriority(mem, priority); |
| 1037 | return result; |
| 1038 | } |
| 1039 | |
| 1040 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglMapMemory(XGL_GPU_MEMORY mem, XGL_FLAGS flags, XGL_VOID** ppData) |
| 1041 | { |
| 1042 | // TODO : Track when memory is mapped |
| 1043 | XGL_RESULT result = nextTable.MapMemory(mem, flags, ppData); |
| 1044 | return result; |
| 1045 | } |
| 1046 | |
| 1047 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglUnmapMemory(XGL_GPU_MEMORY mem) |
| 1048 | { |
| 1049 | // TODO : Track as memory gets unmapped, do we want to check what changed following map? |
| 1050 | // Make sure that memory was ever mapped to begin with |
| 1051 | XGL_RESULT result = nextTable.UnmapMemory(mem); |
| 1052 | return result; |
| 1053 | } |
| 1054 | |
| 1055 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglPinSystemMemory(XGL_DEVICE device, const XGL_VOID* pSysMem, XGL_SIZE memSize, XGL_GPU_MEMORY* pMem) |
| 1056 | { |
| 1057 | // TODO : Track this |
| 1058 | // Verify that memory is actually pinnable |
| 1059 | XGL_RESULT result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem); |
| 1060 | return result; |
| 1061 | } |
| 1062 | |
| 1063 | 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) |
| 1064 | { |
| 1065 | // TODO : Track this |
| 1066 | XGL_RESULT result = nextTable.RemapVirtualMemoryPages(device, rangeCount, pRanges, preWaitSemaphoreCount, pPreWaitSemaphores, postSignalSemaphoreCount, pPostSignalSemaphores); |
| 1067 | return result; |
| 1068 | } |
| 1069 | |
| 1070 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMultiGpuCompatibility(XGL_PHYSICAL_GPU gpu0, XGL_PHYSICAL_GPU gpu1, XGL_GPU_COMPATIBILITY_INFO* pInfo) |
| 1071 | { |
| 1072 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu0; |
| 1073 | pCurObj = gpuw; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 1074 | pthread_once(&g_initOnce, initMemTracker); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1075 | XGL_RESULT result = nextTable.GetMultiGpuCompatibility((XGL_PHYSICAL_GPU)gpuw->nextObject, gpu1, pInfo); |
| 1076 | return result; |
| 1077 | } |
| 1078 | |
| 1079 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedMemory(XGL_DEVICE device, const XGL_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) |
| 1080 | { |
| 1081 | // TODO : Track this |
| 1082 | XGL_RESULT result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem); |
| 1083 | return result; |
| 1084 | } |
| 1085 | |
| 1086 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) |
| 1087 | { |
| 1088 | XGL_RESULT result = nextTable.OpenSharedQueueSemaphore(device, pOpenInfo, pSemaphore); |
| 1089 | return result; |
| 1090 | } |
| 1091 | |
| 1092 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerMemory(XGL_DEVICE device, const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) |
| 1093 | { |
| 1094 | // TODO : Track this |
| 1095 | XGL_RESULT result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem); |
| 1096 | return result; |
| 1097 | } |
| 1098 | |
| 1099 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerImage(XGL_DEVICE device, const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem) |
| 1100 | { |
| 1101 | // TODO : Track this |
| 1102 | XGL_RESULT result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem); |
| 1103 | return result; |
| 1104 | } |
| 1105 | |
| 1106 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyObject(XGL_OBJECT object) |
| 1107 | { |
Tobin Ehlis | a98df73 | 2014-11-27 07:52:04 -0700 | [diff] [blame] | 1108 | // First check if this is a CmdBuffer |
| 1109 | if (NULL != getGlobalCBNode((XGL_CMD_BUFFER)object)) { |
| 1110 | deleteGlobalCBNode((XGL_CMD_BUFFER)object); |
| 1111 | } |
| 1112 | // Now locate node in global list along with prev node |
Tobin Ehlis | a6c0e3c | 2014-11-25 12:27:38 -0700 | [diff] [blame] | 1113 | GLOBAL_OBJECT_NODE* pTrav = pGlobalObjectHead; |
| 1114 | GLOBAL_OBJECT_NODE* pPrev = pTrav; |
Tobin Ehlis | a6c0e3c | 2014-11-25 12:27:38 -0700 | [diff] [blame] | 1115 | while (pTrav) { |
| 1116 | if (object == pTrav->object) |
| 1117 | break; |
| 1118 | pPrev = pTrav; |
| 1119 | pTrav = pTrav->pNext; |
| 1120 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1121 | if (pTrav) { |
| 1122 | if (pTrav->pMemNode) { |
Tobin Ehlis | a98df73 | 2014-11-27 07:52:04 -0700 | [diff] [blame] | 1123 | // Wsi allocated Memory is tied to image object so clear the binding and free that memory automatically |
| 1124 | if (0 == pTrav->pMemNode->allocInfo.allocationSize) { // Wsi allocated memory has NULL allocInfo w/ 0 size |
| 1125 | XGL_GPU_MEMORY memToFree = pTrav->pMemNode->mem; |
| 1126 | clearObjectBinding(object); |
| 1127 | freeMemNode(memToFree); |
| 1128 | } |
| 1129 | else { |
| 1130 | char str[1024]; |
| 1131 | 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); |
| 1132 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_DESTROY_OBJECT_ERROR, "MEM", str); |
| 1133 | // From the spec : If an object has previous memory binding, it is required to unbind memory from an API object before it is destroyed. |
| 1134 | clearObjectBinding(object); |
| 1135 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1136 | } |
| 1137 | if (pGlobalObjectHead == pTrav) // update HEAD if needed |
| 1138 | pGlobalObjectHead = pTrav->pNext; |
Tobin Ehlis | a6c0e3c | 2014-11-25 12:27:38 -0700 | [diff] [blame] | 1139 | // Delete the obj node from global list |
| 1140 | pPrev->pNext = pTrav->pNext; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1141 | free(pTrav); |
| 1142 | } |
| 1143 | XGL_RESULT result = nextTable.DestroyObject(object); |
| 1144 | return result; |
| 1145 | } |
| 1146 | |
| 1147 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetObjectInfo(XGL_BASE_OBJECT object, XGL_OBJECT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1148 | { |
| 1149 | // TODO : What to track here? |
| 1150 | // Could potentially save returned mem requirements and validate values passed into BindObjectMemory for this object |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1151 | // From spec : The only objects that are guaranteed to have no external memory requirements are devices, queues, command buffers, shaders and memory objects. |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1152 | XGL_RESULT result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); |
| 1153 | return result; |
| 1154 | } |
| 1155 | |
| 1156 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBindObjectMemory(XGL_OBJECT object, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) |
| 1157 | { |
| 1158 | XGL_RESULT result = nextTable.BindObjectMemory(object, mem, offset); |
| 1159 | // Track objects tied to memory |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1160 | if (XGL_FALSE == updateObjectBinding(object, mem)) { |
| 1161 | char str[1024]; |
| 1162 | sprintf(str, "Unable to set object %p binding to mem obj %p", (void*)object, (void*)mem); |
| 1163 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, object, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1164 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1165 | printObjList(); |
| 1166 | printMemList(); |
| 1167 | return result; |
| 1168 | } |
| 1169 | |
| 1170 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateFence(XGL_DEVICE device, const XGL_FENCE_CREATE_INFO* pCreateInfo, XGL_FENCE* pFence) |
| 1171 | { |
| 1172 | XGL_RESULT result = nextTable.CreateFence(device, pCreateInfo, pFence); |
| 1173 | return result; |
| 1174 | } |
| 1175 | |
| 1176 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFenceStatus(XGL_FENCE fence) |
| 1177 | { |
| 1178 | XGL_RESULT result = nextTable.GetFenceStatus(fence); |
| 1179 | return result; |
| 1180 | } |
| 1181 | |
| 1182 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitForFences(XGL_DEVICE device, XGL_UINT fenceCount, const XGL_FENCE* pFences, XGL_BOOL waitAll, XGL_UINT64 timeout) |
| 1183 | { |
| 1184 | XGL_RESULT result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 1185 | return result; |
| 1186 | } |
| 1187 | |
| 1188 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) |
| 1189 | { |
| 1190 | XGL_RESULT result = nextTable.CreateQueueSemaphore(device, pCreateInfo, pSemaphore); |
| 1191 | return result; |
| 1192 | } |
| 1193 | |
| 1194 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSignalQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) |
| 1195 | { |
| 1196 | XGL_RESULT result = nextTable.SignalQueueSemaphore(queue, semaphore); |
| 1197 | return result; |
| 1198 | } |
| 1199 | |
| 1200 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) |
| 1201 | { |
| 1202 | XGL_RESULT result = nextTable.WaitQueueSemaphore(queue, semaphore); |
| 1203 | return result; |
| 1204 | } |
| 1205 | |
| 1206 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateEvent(XGL_DEVICE device, const XGL_EVENT_CREATE_INFO* pCreateInfo, XGL_EVENT* pEvent) |
| 1207 | { |
| 1208 | XGL_RESULT result = nextTable.CreateEvent(device, pCreateInfo, pEvent); |
| 1209 | return result; |
| 1210 | } |
| 1211 | |
| 1212 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetEventStatus(XGL_EVENT event) |
| 1213 | { |
| 1214 | XGL_RESULT result = nextTable.GetEventStatus(event); |
| 1215 | return result; |
| 1216 | } |
| 1217 | |
| 1218 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetEvent(XGL_EVENT event) |
| 1219 | { |
| 1220 | XGL_RESULT result = nextTable.SetEvent(event); |
| 1221 | return result; |
| 1222 | } |
| 1223 | |
| 1224 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetEvent(XGL_EVENT event) |
| 1225 | { |
| 1226 | XGL_RESULT result = nextTable.ResetEvent(event); |
| 1227 | return result; |
| 1228 | } |
| 1229 | |
| 1230 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueryPool(XGL_DEVICE device, const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo, XGL_QUERY_POOL* pQueryPool) |
| 1231 | { |
| 1232 | XGL_RESULT result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool); |
| 1233 | return result; |
| 1234 | } |
| 1235 | |
| 1236 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetQueryPoolResults(XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1237 | { |
| 1238 | XGL_RESULT result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData); |
| 1239 | return result; |
| 1240 | } |
| 1241 | |
| 1242 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1243 | { |
| 1244 | XGL_RESULT result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData); |
| 1245 | return result; |
| 1246 | } |
| 1247 | |
| 1248 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImage(XGL_DEVICE device, const XGL_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage) |
| 1249 | { |
| 1250 | XGL_RESULT result = nextTable.CreateImage(device, pCreateInfo, pImage); |
| 1251 | return result; |
| 1252 | } |
| 1253 | |
| 1254 | 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) |
| 1255 | { |
| 1256 | XGL_RESULT result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData); |
| 1257 | return result; |
| 1258 | } |
| 1259 | |
| 1260 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImageView(XGL_DEVICE device, const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, XGL_IMAGE_VIEW* pView) |
| 1261 | { |
| 1262 | XGL_RESULT result = nextTable.CreateImageView(device, pCreateInfo, pView); |
| 1263 | return result; |
| 1264 | } |
| 1265 | |
| 1266 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorAttachmentView(XGL_DEVICE device, const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, XGL_COLOR_ATTACHMENT_VIEW* pView) |
| 1267 | { |
| 1268 | XGL_RESULT result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView); |
| 1269 | return result; |
| 1270 | } |
| 1271 | |
| 1272 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilView(XGL_DEVICE device, const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_VIEW* pView) |
| 1273 | { |
| 1274 | XGL_RESULT result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView); |
| 1275 | return result; |
| 1276 | } |
| 1277 | |
| 1278 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateShader(XGL_DEVICE device, const XGL_SHADER_CREATE_INFO* pCreateInfo, XGL_SHADER* pShader) |
| 1279 | { |
| 1280 | XGL_RESULT result = nextTable.CreateShader(device, pCreateInfo, pShader); |
| 1281 | return result; |
| 1282 | } |
| 1283 | |
| 1284 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) |
| 1285 | { |
| 1286 | XGL_RESULT result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline); |
| 1287 | return result; |
| 1288 | } |
| 1289 | |
| 1290 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateComputePipeline(XGL_DEVICE device, const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) |
| 1291 | { |
| 1292 | XGL_RESULT result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline); |
| 1293 | return result; |
| 1294 | } |
| 1295 | |
| 1296 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglStorePipeline(XGL_PIPELINE pipeline, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1297 | { |
| 1298 | XGL_RESULT result = nextTable.StorePipeline(pipeline, pDataSize, pData); |
| 1299 | return result; |
| 1300 | } |
| 1301 | |
| 1302 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLoadPipeline(XGL_DEVICE device, XGL_SIZE dataSize, const XGL_VOID* pData, XGL_PIPELINE* pPipeline) |
| 1303 | { |
| 1304 | XGL_RESULT result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline); |
| 1305 | return result; |
| 1306 | } |
| 1307 | |
| 1308 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreatePipelineDelta(XGL_DEVICE device, XGL_PIPELINE p1, XGL_PIPELINE p2, XGL_PIPELINE_DELTA* delta) |
| 1309 | { |
| 1310 | XGL_RESULT result = nextTable.CreatePipelineDelta(device, p1, p2, delta); |
| 1311 | return result; |
| 1312 | } |
| 1313 | |
| 1314 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateSampler(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler) |
| 1315 | { |
| 1316 | XGL_RESULT result = nextTable.CreateSampler(device, pCreateInfo, pSampler); |
| 1317 | return result; |
| 1318 | } |
| 1319 | |
| 1320 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSet(XGL_DEVICE device, const XGL_DESCRIPTOR_SET_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET* pDescriptorSet) |
| 1321 | { |
| 1322 | XGL_RESULT result = nextTable.CreateDescriptorSet(device, pCreateInfo, pDescriptorSet); |
| 1323 | return result; |
| 1324 | } |
| 1325 | |
| 1326 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglBeginDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) |
| 1327 | { |
| 1328 | nextTable.BeginDescriptorSetUpdate(descriptorSet); |
| 1329 | } |
| 1330 | |
| 1331 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglEndDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) |
| 1332 | { |
| 1333 | nextTable.EndDescriptorSetUpdate(descriptorSet); |
| 1334 | } |
| 1335 | |
| 1336 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachSamplerDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers) |
| 1337 | { |
| 1338 | nextTable.AttachSamplerDescriptors(descriptorSet, startSlot, slotCount, pSamplers); |
| 1339 | } |
| 1340 | |
| 1341 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachImageViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews) |
| 1342 | { |
| 1343 | nextTable.AttachImageViewDescriptors(descriptorSet, startSlot, slotCount, pImageViews); |
| 1344 | } |
| 1345 | |
| 1346 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachMemoryViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews) |
| 1347 | { |
| 1348 | nextTable.AttachMemoryViewDescriptors(descriptorSet, startSlot, slotCount, pMemViews); |
| 1349 | } |
| 1350 | |
| 1351 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachNestedDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_DESCRIPTOR_SET_ATTACH_INFO* pNestedDescriptorSets) |
| 1352 | { |
| 1353 | nextTable.AttachNestedDescriptors(descriptorSet, startSlot, slotCount, pNestedDescriptorSets); |
| 1354 | } |
| 1355 | |
| 1356 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglClearDescriptorSetSlots(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount) |
| 1357 | { |
| 1358 | nextTable.ClearDescriptorSetSlots(descriptorSet, startSlot, slotCount); |
| 1359 | } |
| 1360 | |
| 1361 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateViewportState(XGL_DEVICE device, const XGL_VIEWPORT_STATE_CREATE_INFO* pCreateInfo, XGL_VIEWPORT_STATE_OBJECT* pState) |
| 1362 | { |
| 1363 | XGL_RESULT result = nextTable.CreateViewportState(device, pCreateInfo, pState); |
| 1364 | return result; |
| 1365 | } |
| 1366 | |
| 1367 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateRasterState(XGL_DEVICE device, const XGL_RASTER_STATE_CREATE_INFO* pCreateInfo, XGL_RASTER_STATE_OBJECT* pState) |
| 1368 | { |
| 1369 | XGL_RESULT result = nextTable.CreateRasterState(device, pCreateInfo, pState); |
| 1370 | return result; |
| 1371 | } |
| 1372 | |
| 1373 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateMsaaState(XGL_DEVICE device, const XGL_MSAA_STATE_CREATE_INFO* pCreateInfo, XGL_MSAA_STATE_OBJECT* pState) |
| 1374 | { |
| 1375 | XGL_RESULT result = nextTable.CreateMsaaState(device, pCreateInfo, pState); |
| 1376 | return result; |
| 1377 | } |
| 1378 | |
| 1379 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorBlendState(XGL_DEVICE device, const XGL_COLOR_BLEND_STATE_CREATE_INFO* pCreateInfo, XGL_COLOR_BLEND_STATE_OBJECT* pState) |
| 1380 | { |
| 1381 | XGL_RESULT result = nextTable.CreateColorBlendState(device, pCreateInfo, pState); |
| 1382 | return result; |
| 1383 | } |
| 1384 | |
| 1385 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilState(XGL_DEVICE device, const XGL_DEPTH_STENCIL_STATE_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_STATE_OBJECT* pState) |
| 1386 | { |
| 1387 | XGL_RESULT result = nextTable.CreateDepthStencilState(device, pCreateInfo, pState); |
| 1388 | return result; |
| 1389 | } |
| 1390 | |
| 1391 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo, XGL_CMD_BUFFER* pCmdBuffer) |
| 1392 | { |
| 1393 | XGL_RESULT result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); |
| 1394 | // At time of cmd buffer creation, create global cmd buffer node for the returned cmd buffer |
| 1395 | if (*pCmdBuffer) |
| 1396 | insertGlobalCB(*pCmdBuffer); |
| 1397 | printGlobalCB(); |
| 1398 | return result; |
| 1399 | } |
| 1400 | |
| 1401 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBeginCommandBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_FLAGS flags) |
| 1402 | { |
| 1403 | // This implicitly resets the Cmd Buffer so clear memory references |
| 1404 | freeCBBindings(cmdBuffer); |
| 1405 | XGL_RESULT result = nextTable.BeginCommandBuffer(cmdBuffer, flags); |
| 1406 | return result; |
| 1407 | } |
| 1408 | |
| 1409 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEndCommandBuffer(XGL_CMD_BUFFER cmdBuffer) |
| 1410 | { |
| 1411 | // TODO : Anything to do here? |
| 1412 | XGL_RESULT result = nextTable.EndCommandBuffer(cmdBuffer); |
| 1413 | return result; |
| 1414 | } |
| 1415 | |
| 1416 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetCommandBuffer(XGL_CMD_BUFFER cmdBuffer) |
| 1417 | { |
| 1418 | // Clear memory references as this point. Anything else to do here? |
| 1419 | freeCBBindings(cmdBuffer); |
| 1420 | XGL_RESULT result = nextTable.ResetCommandBuffer(cmdBuffer); |
| 1421 | return result; |
| 1422 | } |
| 1423 | // TODO : For any xglCmdBind* calls that include an object which has mem bound to it, |
| 1424 | // need to account for that mem now having binding to given cmdBuffer |
| 1425 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipeline(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline) |
| 1426 | { |
| 1427 | nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline); |
| 1428 | } |
| 1429 | |
| 1430 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipelineDelta(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE_DELTA delta) |
| 1431 | { |
| 1432 | nextTable.CmdBindPipelineDelta(cmdBuffer, pipelineBindPoint, delta); |
| 1433 | } |
| 1434 | |
| 1435 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindStateObject(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_STATE_OBJECT state) |
| 1436 | { |
| 1437 | nextTable.CmdBindStateObject(cmdBuffer, stateBindPoint, state); |
| 1438 | } |
| 1439 | |
| 1440 | 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) |
| 1441 | { |
| 1442 | nextTable.CmdBindDescriptorSet(cmdBuffer, pipelineBindPoint, index, descriptorSet, slotOffset); |
| 1443 | } |
| 1444 | |
| 1445 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDynamicMemoryView(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView) |
| 1446 | { |
| 1447 | nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView); |
| 1448 | } |
| 1449 | |
Chia-I Wu | 1915682 | 2015-01-05 13:42:56 +0800 | [diff] [blame^] | 1450 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindVertexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding) |
| 1451 | { |
| 1452 | // Track this memory. What exactly is this call doing? |
| 1453 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1454 | char str[1024]; |
| 1455 | sprintf(str, "In xglCmdBindVertexData() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1456 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1457 | } |
| 1458 | nextTable.CmdBindVertexData(cmdBuffer, mem, offset, binding); |
| 1459 | } |
| 1460 | |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1461 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType) |
| 1462 | { |
| 1463 | // Track this memory. What exactly is this call doing? |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1464 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1465 | char str[1024]; |
| 1466 | sprintf(str, "In xglCmdBindIndexData() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1467 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1468 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1469 | nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType); |
| 1470 | } |
| 1471 | |
| 1472 | 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) |
| 1473 | { |
| 1474 | nextTable.CmdBindAttachments(cmdBuffer, colorAttachmentCount, pColorAttachments, pDepthStencilAttachment); |
| 1475 | } |
| 1476 | |
| 1477 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareMemoryRegions(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_MEMORY_STATE_TRANSITION* pStateTransitions) |
| 1478 | { |
| 1479 | // TODO : Track memory state transitions |
| 1480 | // Flag incorrect transitions when states don't match |
| 1481 | XGL_GPU_MEMORY mem = pStateTransitions->mem; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1482 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1483 | char str[1024]; |
| 1484 | sprintf(str, "In xglCmdPrepareMemoryRegions() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1485 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1486 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1487 | nextTable.CmdPrepareMemoryRegions(cmdBuffer, transitionCount, pStateTransitions); |
| 1488 | } |
| 1489 | |
| 1490 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareImages(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_IMAGE_STATE_TRANSITION* pStateTransitions) |
| 1491 | { |
| 1492 | // TODO : This will have an image object that's bound to memory in the pStateTransitions struct |
| 1493 | // Need to pull object based on image and then pull mem mapping from that object |
| 1494 | XGL_GPU_MEMORY mem = getMemBindingFromObject((XGL_OBJECT)pStateTransitions->image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1495 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1496 | char str[1024]; |
| 1497 | sprintf(str, "In xglCmdPrepareImages() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1498 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1499 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1500 | nextTable.CmdPrepareImages(cmdBuffer, transitionCount, pStateTransitions); |
| 1501 | } |
| 1502 | |
| 1503 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDraw(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstVertex, XGL_UINT vertexCount, XGL_UINT firstInstance, XGL_UINT instanceCount) |
| 1504 | { |
| 1505 | nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); |
| 1506 | } |
| 1507 | |
| 1508 | 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) |
| 1509 | { |
| 1510 | nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); |
| 1511 | } |
| 1512 | |
| 1513 | 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) |
| 1514 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1515 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1516 | char str[1024]; |
| 1517 | sprintf(str, "In xglCmdDrawIndirect() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1518 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1519 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1520 | nextTable.CmdDrawIndirect(cmdBuffer, mem, offset, count, stride); |
| 1521 | } |
| 1522 | |
| 1523 | 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) |
| 1524 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1525 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1526 | char str[1024]; |
| 1527 | sprintf(str, "In xglCmdDrawIndexedIndirect() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1528 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1529 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1530 | nextTable.CmdDrawIndexedIndirect(cmdBuffer, mem, offset, count, stride); |
| 1531 | } |
| 1532 | |
| 1533 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatch(XGL_CMD_BUFFER cmdBuffer, XGL_UINT x, XGL_UINT y, XGL_UINT z) |
| 1534 | { |
| 1535 | nextTable.CmdDispatch(cmdBuffer, x, y, z); |
| 1536 | } |
| 1537 | |
| 1538 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatchIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) |
| 1539 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1540 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1541 | char str[1024]; |
| 1542 | sprintf(str, "In xglCmdDispatchIndirect() call unable to update binding of mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1543 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1544 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1545 | nextTable.CmdDispatchIndirect(cmdBuffer, mem, offset); |
| 1546 | } |
| 1547 | |
| 1548 | 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) |
| 1549 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1550 | if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) { |
| 1551 | char str[1024]; |
| 1552 | sprintf(str, "In xglCmdCopyMemory() call unable to update binding of srcMem %p to cmdBuffer %p", srcMem, cmdBuffer); |
| 1553 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1554 | } |
| 1555 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1556 | char str[1024]; |
| 1557 | sprintf(str, "In xglCmdCopyMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1558 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1559 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1560 | nextTable.CmdCopyMemory(cmdBuffer, srcMem, destMem, regionCount, pRegions); |
| 1561 | } |
| 1562 | |
| 1563 | 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) |
| 1564 | { |
| 1565 | // TODO : Each image will have mem mapping so track them |
| 1566 | nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions); |
| 1567 | } |
| 1568 | |
| 1569 | 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) |
| 1570 | { |
| 1571 | // TODO : Track this |
| 1572 | XGL_GPU_MEMORY mem = getMemBindingFromObject(destImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1573 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1574 | char str[1024]; |
| 1575 | sprintf(str, "In xglCmdCopyMemoryToImage() call unable to update binding of destImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1576 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1577 | } |
| 1578 | if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) { |
| 1579 | char str[1024]; |
| 1580 | sprintf(str, "In xglCmdCopyMemoryToImage() call unable to update binding of srcMem %p to cmdBuffer %p", srcMem, cmdBuffer); |
| 1581 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1582 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1583 | nextTable.CmdCopyMemoryToImage(cmdBuffer, srcMem, destImage, regionCount, pRegions); |
| 1584 | } |
| 1585 | |
| 1586 | 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) |
| 1587 | { |
| 1588 | // TODO : Track this |
| 1589 | XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1590 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1591 | char str[1024]; |
| 1592 | sprintf(str, "In xglCmdCopyImageToMemory() call unable to update binding of srcImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1593 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1594 | } |
| 1595 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1596 | char str[1024]; |
| 1597 | sprintf(str, "In xglCmdCopyImageToMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1598 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1599 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1600 | nextTable.CmdCopyImageToMemory(cmdBuffer, srcImage, destMem, regionCount, pRegions); |
| 1601 | } |
| 1602 | |
| 1603 | 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) |
| 1604 | { |
| 1605 | // TODO : Each image will have mem mapping so track them |
| 1606 | XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1607 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1608 | char str[1024]; |
| 1609 | sprintf(str, "In xglCmdCloneImageData() call unable to update binding of srcImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1610 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1611 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1612 | mem = getMemBindingFromObject(destImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1613 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1614 | char str[1024]; |
| 1615 | sprintf(str, "In xglCmdCloneImageData() call unable to update binding of destImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1616 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1617 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1618 | nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageState, destImage, destImageState); |
| 1619 | } |
| 1620 | |
| 1621 | 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) |
| 1622 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1623 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1624 | char str[1024]; |
| 1625 | sprintf(str, "In xglCmdUpdateMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1626 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1627 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1628 | nextTable.CmdUpdateMemory(cmdBuffer, destMem, destOffset, dataSize, pData); |
| 1629 | } |
| 1630 | |
| 1631 | 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) |
| 1632 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1633 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1634 | char str[1024]; |
| 1635 | sprintf(str, "In xglCmdFillMemory() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1636 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1637 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1638 | nextTable.CmdFillMemory(cmdBuffer, destMem, destOffset, fillSize, data); |
| 1639 | } |
| 1640 | |
| 1641 | 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) |
| 1642 | { |
| 1643 | XGL_GPU_MEMORY mem = getMemBindingFromObject(image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1644 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1645 | char str[1024]; |
| 1646 | sprintf(str, "In xglCmdClearColorImage() call unable to update binding of image mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1647 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1648 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1649 | nextTable.CmdClearColorImage(cmdBuffer, image, color, rangeCount, pRanges); |
| 1650 | } |
| 1651 | |
| 1652 | 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) |
| 1653 | { |
| 1654 | XGL_GPU_MEMORY mem = getMemBindingFromObject(image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1655 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1656 | char str[1024]; |
| 1657 | sprintf(str, "In xglCmdClearColorImageRaw() call unable to update binding of image mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1658 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1659 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1660 | nextTable.CmdClearColorImageRaw(cmdBuffer, image, color, rangeCount, pRanges); |
| 1661 | } |
| 1662 | |
| 1663 | 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) |
| 1664 | { |
| 1665 | XGL_GPU_MEMORY mem = getMemBindingFromObject(image); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1666 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1667 | char str[1024]; |
| 1668 | sprintf(str, "In xglCmdClearDepthStencil() call unable to update binding of image mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1669 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1670 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1671 | nextTable.CmdClearDepthStencil(cmdBuffer, image, depth, stencil, rangeCount, pRanges); |
| 1672 | } |
| 1673 | |
| 1674 | 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) |
| 1675 | { |
| 1676 | XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1677 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1678 | char str[1024]; |
| 1679 | sprintf(str, "In xglCmdResolveImage() call unable to update binding of srcImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1680 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1681 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1682 | mem = getMemBindingFromObject(destImage); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1683 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1684 | char str[1024]; |
| 1685 | sprintf(str, "In xglCmdResolveImage() call unable to update binding of destImage mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1686 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1687 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1688 | nextTable.CmdResolveImage(cmdBuffer, srcImage, destImage, rectCount, pRects); |
| 1689 | } |
| 1690 | |
| 1691 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) |
| 1692 | { |
| 1693 | nextTable.CmdSetEvent(cmdBuffer, event); |
| 1694 | } |
| 1695 | |
| 1696 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) |
| 1697 | { |
| 1698 | nextTable.CmdResetEvent(cmdBuffer, event); |
| 1699 | } |
| 1700 | |
| 1701 | 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) |
| 1702 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1703 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1704 | char str[1024]; |
| 1705 | sprintf(str, "In xglCmdMemoryAtomic() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1706 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1707 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1708 | nextTable.CmdMemoryAtomic(cmdBuffer, destMem, destOffset, srcData, atomicOp); |
| 1709 | } |
| 1710 | |
| 1711 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBeginQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot, XGL_FLAGS flags) |
| 1712 | { |
| 1713 | XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1714 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1715 | char str[1024]; |
| 1716 | sprintf(str, "In xglCmdBeginQuery() call unable to update binding of queryPool mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1717 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1718 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1719 | nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags); |
| 1720 | } |
| 1721 | |
| 1722 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdEndQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot) |
| 1723 | { |
| 1724 | XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1725 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1726 | char str[1024]; |
| 1727 | sprintf(str, "In xglCmdEndQuery() call unable to update binding of queryPool mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1728 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1729 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1730 | nextTable.CmdEndQuery(cmdBuffer, queryPool, slot); |
| 1731 | } |
| 1732 | |
| 1733 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetQueryPool(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount) |
| 1734 | { |
| 1735 | XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1736 | if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) { |
| 1737 | char str[1024]; |
| 1738 | sprintf(str, "In xglCmdResetQueryPool() call unable to update binding of queryPool mem %p to cmdBuffer %p", mem, cmdBuffer); |
| 1739 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1740 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1741 | nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount); |
| 1742 | } |
| 1743 | |
| 1744 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdWriteTimestamp(XGL_CMD_BUFFER cmdBuffer, XGL_TIMESTAMP_TYPE timestampType, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset) |
| 1745 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1746 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1747 | char str[1024]; |
| 1748 | sprintf(str, "In xglCmdWriteTimestamp() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1749 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1750 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1751 | nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destMem, destOffset); |
| 1752 | } |
| 1753 | |
| 1754 | 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) |
| 1755 | { |
| 1756 | nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData); |
| 1757 | } |
| 1758 | |
| 1759 | 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) |
| 1760 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1761 | if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) { |
| 1762 | char str[1024]; |
| 1763 | sprintf(str, "In xglCmdLoadAtomicCounters() call unable to update binding of srcMem %p to cmdBuffer %p", srcMem, cmdBuffer); |
| 1764 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1765 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1766 | nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcMem, srcOffset); |
| 1767 | } |
| 1768 | |
| 1769 | 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) |
| 1770 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1771 | if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) { |
| 1772 | char str[1024]; |
| 1773 | sprintf(str, "In xglCmdSaveAtomicCounters() call unable to update binding of destMem %p to cmdBuffer %p", destMem, cmdBuffer); |
| 1774 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1775 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1776 | nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destMem, destOffset); |
| 1777 | } |
| 1778 | |
| 1779 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetValidationLevel(XGL_DEVICE device, XGL_VALIDATION_LEVEL validationLevel) |
| 1780 | { |
| 1781 | XGL_RESULT result = nextTable.DbgSetValidationLevel(device, validationLevel); |
| 1782 | return result; |
| 1783 | } |
| 1784 | |
| 1785 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgRegisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, XGL_VOID* pUserData) |
| 1786 | { |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1787 | // This layer intercepts callbacks |
| 1788 | XGL_LAYER_DBG_FUNCTION_NODE *pNewDbgFuncNode = (XGL_LAYER_DBG_FUNCTION_NODE*)malloc(sizeof(XGL_LAYER_DBG_FUNCTION_NODE)); |
| 1789 | if (!pNewDbgFuncNode) |
| 1790 | return XGL_ERROR_OUT_OF_MEMORY; |
| 1791 | pNewDbgFuncNode->pfnMsgCallback = pfnMsgCallback; |
| 1792 | pNewDbgFuncNode->pUserData = pUserData; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 1793 | pNewDbgFuncNode->pNext = g_pDbgFunctionHead; |
| 1794 | g_pDbgFunctionHead = pNewDbgFuncNode; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1795 | XGL_RESULT result = nextTable.DbgRegisterMsgCallback(pfnMsgCallback, pUserData); |
| 1796 | return result; |
| 1797 | } |
| 1798 | |
| 1799 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgUnregisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback) |
| 1800 | { |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 1801 | XGL_LAYER_DBG_FUNCTION_NODE *pTrav = g_pDbgFunctionHead; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1802 | XGL_LAYER_DBG_FUNCTION_NODE *pPrev = pTrav; |
| 1803 | while (pTrav) { |
| 1804 | if (pTrav->pfnMsgCallback == pfnMsgCallback) { |
| 1805 | pPrev->pNext = pTrav->pNext; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 1806 | if (g_pDbgFunctionHead == pTrav) |
| 1807 | g_pDbgFunctionHead = pTrav->pNext; |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1808 | free(pTrav); |
| 1809 | break; |
| 1810 | } |
| 1811 | pPrev = pTrav; |
| 1812 | pTrav = pTrav->pNext; |
| 1813 | } |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1814 | XGL_RESULT result = nextTable.DbgUnregisterMsgCallback(pfnMsgCallback); |
| 1815 | return result; |
| 1816 | } |
| 1817 | |
| 1818 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetMessageFilter(XGL_DEVICE device, XGL_INT msgCode, XGL_DBG_MSG_FILTER filter) |
| 1819 | { |
| 1820 | XGL_RESULT result = nextTable.DbgSetMessageFilter(device, msgCode, filter); |
| 1821 | return result; |
| 1822 | } |
| 1823 | |
| 1824 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetObjectTag(XGL_BASE_OBJECT object, XGL_SIZE tagSize, const XGL_VOID* pTag) |
| 1825 | { |
| 1826 | XGL_RESULT result = nextTable.DbgSetObjectTag(object, tagSize, pTag); |
| 1827 | return result; |
| 1828 | } |
| 1829 | |
| 1830 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(XGL_DBG_GLOBAL_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) |
| 1831 | { |
| 1832 | XGL_RESULT result = nextTable.DbgSetGlobalOption(dbgOption, dataSize, pData); |
| 1833 | return result; |
| 1834 | } |
| 1835 | |
| 1836 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetDeviceOption(XGL_DEVICE device, XGL_DBG_DEVICE_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) |
| 1837 | { |
| 1838 | XGL_RESULT result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData); |
| 1839 | return result; |
| 1840 | } |
| 1841 | |
| 1842 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerBegin(XGL_CMD_BUFFER cmdBuffer, const XGL_CHAR* pMarker) |
| 1843 | { |
| 1844 | nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker); |
| 1845 | } |
| 1846 | |
| 1847 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerEnd(XGL_CMD_BUFFER cmdBuffer) |
| 1848 | { |
| 1849 | nextTable.CmdDbgMarkerEnd(cmdBuffer); |
| 1850 | } |
| 1851 | |
| 1852 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11AssociateConnection(XGL_PHYSICAL_GPU gpu, const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo) |
| 1853 | { |
| 1854 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1855 | pCurObj = gpuw; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 1856 | pthread_once(&g_initOnce, initMemTracker); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1857 | XGL_RESULT result = nextTable.WsiX11AssociateConnection((XGL_PHYSICAL_GPU)gpuw->nextObject, pConnectionInfo); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1858 | return result; |
| 1859 | } |
| 1860 | |
Tobin Ehlis | 61f36c9 | 2014-11-11 08:00:58 -0700 | [diff] [blame] | 1861 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11GetMSC(XGL_DEVICE device, xcb_window_t window, xcb_randr_crtc_t crtc, XGL_UINT64* pMsc) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1862 | { |
Tobin Ehlis | 61f36c9 | 2014-11-11 08:00:58 -0700 | [diff] [blame] | 1863 | XGL_RESULT result = nextTable.WsiX11GetMSC(device, window, crtc, pMsc); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1864 | return result; |
| 1865 | } |
| 1866 | |
| 1867 | 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) |
| 1868 | { |
| 1869 | XGL_RESULT result = nextTable.WsiX11CreatePresentableImage(device, pCreateInfo, pImage, pMem); |
Tobin Ehlis | cd9223b | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1870 | // First insert the new Mem Object and then bind it to created image |
| 1871 | insertGlobalMemObj(*pMem, NULL); |
| 1872 | if (XGL_FALSE == updateObjectBinding(*pImage, *pMem)) { |
| 1873 | char str[1024]; |
| 1874 | sprintf(str, "In xglWsiX11CreatePresentableImage(), unable to set image %p binding to mem obj %p", (void*)*pImage, (void*)*pMem); |
| 1875 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, *pImage, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); |
| 1876 | } |
| 1877 | printObjList(); |
| 1878 | printMemList(); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1879 | return result; |
| 1880 | } |
| 1881 | |
| 1882 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent(XGL_QUEUE queue, const XGL_WSI_X11_PRESENT_INFO* pPresentInfo, XGL_FENCE fence) |
| 1883 | { |
| 1884 | XGL_RESULT result = nextTable.WsiX11QueuePresent(queue, pPresentInfo, fence); |
| 1885 | return result; |
| 1886 | } |
| 1887 | |
| 1888 | XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* funcName) |
| 1889 | { |
| 1890 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 1891 | if (gpu == NULL) |
| 1892 | return NULL; |
| 1893 | pCurObj = gpuw; |
Jon Ashburn | 7d7b3cf | 2014-12-22 13:24:15 -0700 | [diff] [blame] | 1894 | pthread_once(&g_initOnce, initMemTracker); |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1895 | |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1896 | if (!strncmp("xglGetProcAddr", funcName, sizeof("xglGetProcAddr"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1897 | return xglGetProcAddr; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1898 | else if (!strncmp("xglInitAndEnumerateGpus", funcName, sizeof("xglInitAndEnumerateGpus"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1899 | return nextTable.InitAndEnumerateGpus; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1900 | else if (!strncmp("xglGetGpuInfo", funcName, sizeof("xglGetGpuInfo"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1901 | return xglGetGpuInfo; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1902 | else if (!strncmp("xglCreateDevice", funcName, sizeof("xglCreateDevice"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1903 | return xglCreateDevice; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1904 | else if (!strncmp("xglDestroyDevice", funcName, sizeof("xglDestroyDevice"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1905 | return xglDestroyDevice; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1906 | else if (!strncmp("xglGetExtensionSupport", funcName, sizeof("xglGetExtensionSupport"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1907 | return xglGetExtensionSupport; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1908 | else if (!strncmp("xglEnumerateLayers", funcName, sizeof("xglEnumerateLayers"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1909 | return xglEnumerateLayers; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1910 | else if (!strncmp("xglGetDeviceQueue", funcName, sizeof("xglGetDeviceQueue"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1911 | return xglGetDeviceQueue; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1912 | else if (!strncmp("xglQueueSubmit", funcName, sizeof("xglQueueSubmit"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1913 | return xglQueueSubmit; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1914 | else if (!strncmp("xglQueueSetGlobalMemReferences", funcName, sizeof("xglQueueSetGlobalMemReferences"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1915 | return xglQueueSetGlobalMemReferences; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1916 | else if (!strncmp("xglQueueWaitIdle", funcName, sizeof("xglQueueWaitIdle"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1917 | return xglQueueWaitIdle; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1918 | else if (!strncmp("xglDeviceWaitIdle", funcName, sizeof("xglDeviceWaitIdle"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1919 | return xglDeviceWaitIdle; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1920 | else if (!strncmp("xglGetMemoryHeapCount", funcName, sizeof("xglGetMemoryHeapCount"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1921 | return xglGetMemoryHeapCount; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1922 | else if (!strncmp("xglGetMemoryHeapInfo", funcName, sizeof("xglGetMemoryHeapInfo"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1923 | return xglGetMemoryHeapInfo; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1924 | else if (!strncmp("xglAllocMemory", funcName, sizeof("xglAllocMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1925 | return xglAllocMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1926 | else if (!strncmp("xglFreeMemory", funcName, sizeof("xglFreeMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1927 | return xglFreeMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1928 | else if (!strncmp("xglSetMemoryPriority", funcName, sizeof("xglSetMemoryPriority"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1929 | return xglSetMemoryPriority; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1930 | else if (!strncmp("xglMapMemory", funcName, sizeof("xglMapMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1931 | return xglMapMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1932 | else if (!strncmp("xglUnmapMemory", funcName, sizeof("xglUnmapMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1933 | return xglUnmapMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1934 | else if (!strncmp("xglPinSystemMemory", funcName, sizeof("xglPinSystemMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1935 | return xglPinSystemMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1936 | else if (!strncmp("xglRemapVirtualMemoryPages", funcName, sizeof("xglRemapVirtualMemoryPages"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1937 | return xglRemapVirtualMemoryPages; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1938 | else if (!strncmp("xglGetMultiGpuCompatibility", funcName, sizeof("xglGetMultiGpuCompatibility"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1939 | return xglGetMultiGpuCompatibility; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1940 | else if (!strncmp("xglOpenSharedMemory", funcName, sizeof("xglOpenSharedMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1941 | return xglOpenSharedMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1942 | else if (!strncmp("xglOpenSharedQueueSemaphore", funcName, sizeof("xglOpenSharedQueueSemaphore"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1943 | return xglOpenSharedQueueSemaphore; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1944 | else if (!strncmp("xglOpenPeerMemory", funcName, sizeof("xglOpenPeerMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1945 | return xglOpenPeerMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1946 | else if (!strncmp("xglOpenPeerImage", funcName, sizeof("xglOpenPeerImage"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1947 | return xglOpenPeerImage; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1948 | else if (!strncmp("xglDestroyObject", funcName, sizeof("xglDestroyObject"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1949 | return xglDestroyObject; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1950 | else if (!strncmp("xglGetObjectInfo", funcName, sizeof("xglGetObjectInfo"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1951 | return xglGetObjectInfo; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1952 | else if (!strncmp("xglBindObjectMemory", funcName, sizeof("xglBindObjectMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1953 | return xglBindObjectMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1954 | else if (!strncmp("xglCreateFence", funcName, sizeof("xglCreateFence"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1955 | return xglCreateFence; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1956 | else if (!strncmp("xglGetFenceStatus", funcName, sizeof("xglGetFenceStatus"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1957 | return xglGetFenceStatus; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1958 | else if (!strncmp("xglWaitForFences", funcName, sizeof("xglWaitForFences"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1959 | return xglWaitForFences; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1960 | else if (!strncmp("xglCreateQueueSemaphore", funcName, sizeof("xglCreateQueueSemaphore"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1961 | return xglCreateQueueSemaphore; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1962 | else if (!strncmp("xglSignalQueueSemaphore", funcName, sizeof("xglSignalQueueSemaphore"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1963 | return xglSignalQueueSemaphore; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1964 | else if (!strncmp("xglWaitQueueSemaphore", funcName, sizeof("xglWaitQueueSemaphore"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1965 | return xglWaitQueueSemaphore; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1966 | else if (!strncmp("xglCreateEvent", funcName, sizeof("xglCreateEvent"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1967 | return xglCreateEvent; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1968 | else if (!strncmp("xglGetEventStatus", funcName, sizeof("xglGetEventStatus"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1969 | return xglGetEventStatus; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1970 | else if (!strncmp("xglSetEvent", funcName, sizeof("xglSetEvent"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1971 | return xglSetEvent; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1972 | else if (!strncmp("xglResetEvent", funcName, sizeof("xglResetEvent"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1973 | return xglResetEvent; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1974 | else if (!strncmp("xglCreateQueryPool", funcName, sizeof("xglCreateQueryPool"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1975 | return xglCreateQueryPool; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1976 | else if (!strncmp("xglGetQueryPoolResults", funcName, sizeof("xglGetQueryPoolResults"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1977 | return xglGetQueryPoolResults; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1978 | else if (!strncmp("xglGetFormatInfo", funcName, sizeof("xglGetFormatInfo"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1979 | return xglGetFormatInfo; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1980 | else if (!strncmp("xglCreateImage", funcName, sizeof("xglCreateImage"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1981 | return xglCreateImage; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1982 | else if (!strncmp("xglGetImageSubresourceInfo", funcName, sizeof("xglGetImageSubresourceInfo"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1983 | return xglGetImageSubresourceInfo; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1984 | else if (!strncmp("xglCreateImageView", funcName, sizeof("xglCreateImageView"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1985 | return xglCreateImageView; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1986 | else if (!strncmp("xglCreateColorAttachmentView", funcName, sizeof("xglCreateColorAttachmentView"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1987 | return xglCreateColorAttachmentView; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1988 | else if (!strncmp("xglCreateDepthStencilView", funcName, sizeof("xglCreateDepthStencilView"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1989 | return xglCreateDepthStencilView; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1990 | else if (!strncmp("xglCreateShader", funcName, sizeof("xglCreateShader"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1991 | return xglCreateShader; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1992 | else if (!strncmp("xglCreateGraphicsPipeline", funcName, sizeof("xglCreateGraphicsPipeline"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1993 | return xglCreateGraphicsPipeline; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1994 | else if (!strncmp("xglCreateComputePipeline", funcName, sizeof("xglCreateComputePipeline"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1995 | return xglCreateComputePipeline; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1996 | else if (!strncmp("xglStorePipeline", funcName, sizeof("xglStorePipeline"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1997 | return xglStorePipeline; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 1998 | else if (!strncmp("xglLoadPipeline", funcName, sizeof("xglLoadPipeline"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 1999 | return xglLoadPipeline; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2000 | else if (!strncmp("xglCreatePipelineDelta", funcName, sizeof("xglCreatePipelineDelta"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2001 | return xglCreatePipelineDelta; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2002 | else if (!strncmp("xglCreateSampler", funcName, sizeof("xglCreateSampler"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2003 | return xglCreateSampler; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2004 | else if (!strncmp("xglCreateDescriptorSet", funcName, sizeof("xglCreateDescriptorSet"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2005 | return xglCreateDescriptorSet; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2006 | else if (!strncmp("xglBeginDescriptorSetUpdate", funcName, sizeof("xglBeginDescriptorSetUpdate"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2007 | return xglBeginDescriptorSetUpdate; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2008 | else if (!strncmp("xglEndDescriptorSetUpdate", funcName, sizeof("xglEndDescriptorSetUpdate"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2009 | return xglEndDescriptorSetUpdate; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2010 | else if (!strncmp("xglAttachSamplerDescriptors", funcName, sizeof("xglAttachSamplerDescriptors"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2011 | return xglAttachSamplerDescriptors; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2012 | else if (!strncmp("xglAttachImageViewDescriptors", funcName, sizeof("xglAttachImageViewDescriptors"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2013 | return xglAttachImageViewDescriptors; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2014 | else if (!strncmp("xglAttachMemoryViewDescriptors", funcName, sizeof("xglAttachMemoryViewDescriptors"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2015 | return xglAttachMemoryViewDescriptors; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2016 | else if (!strncmp("xglAttachNestedDescriptors", funcName, sizeof("xglAttachNestedDescriptors"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2017 | return xglAttachNestedDescriptors; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2018 | else if (!strncmp("xglClearDescriptorSetSlots", funcName, sizeof("xglClearDescriptorSetSlots"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2019 | return xglClearDescriptorSetSlots; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2020 | else if (!strncmp("xglCreateViewportState", funcName, sizeof("xglCreateViewportState"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2021 | return xglCreateViewportState; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2022 | else if (!strncmp("xglCreateRasterState", funcName, sizeof("xglCreateRasterState"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2023 | return xglCreateRasterState; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2024 | else if (!strncmp("xglCreateMsaaState", funcName, sizeof("xglCreateMsaaState"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2025 | return xglCreateMsaaState; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2026 | else if (!strncmp("xglCreateColorBlendState", funcName, sizeof("xglCreateColorBlendState"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2027 | return xglCreateColorBlendState; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2028 | else if (!strncmp("xglCreateDepthStencilState", funcName, sizeof("xglCreateDepthStencilState"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2029 | return xglCreateDepthStencilState; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2030 | else if (!strncmp("xglCreateCommandBuffer", funcName, sizeof("xglCreateCommandBuffer"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2031 | return xglCreateCommandBuffer; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2032 | else if (!strncmp("xglBeginCommandBuffer", funcName, sizeof("xglBeginCommandBuffer"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2033 | return xglBeginCommandBuffer; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2034 | else if (!strncmp("xglEndCommandBuffer", funcName, sizeof("xglEndCommandBuffer"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2035 | return xglEndCommandBuffer; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2036 | else if (!strncmp("xglResetCommandBuffer", funcName, sizeof("xglResetCommandBuffer"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2037 | return xglResetCommandBuffer; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2038 | else if (!strncmp("xglCmdBindPipeline", funcName, sizeof("xglCmdBindPipeline"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2039 | return xglCmdBindPipeline; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2040 | else if (!strncmp("xglCmdBindPipelineDelta", funcName, sizeof("xglCmdBindPipelineDelta"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2041 | return xglCmdBindPipelineDelta; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2042 | else if (!strncmp("xglCmdBindStateObject", funcName, sizeof("xglCmdBindStateObject"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2043 | return xglCmdBindStateObject; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2044 | else if (!strncmp("xglCmdBindDescriptorSet", funcName, sizeof("xglCmdBindDescriptorSet"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2045 | return xglCmdBindDescriptorSet; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2046 | else if (!strncmp("xglCmdBindDynamicMemoryView", funcName, sizeof("xglCmdBindDynamicMemoryView"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2047 | return xglCmdBindDynamicMemoryView; |
Chia-I Wu | 1915682 | 2015-01-05 13:42:56 +0800 | [diff] [blame^] | 2048 | else if (!strncmp("xglCmdBindVertexData", funcName, sizeof("xglCmdBindVertexData"))) |
| 2049 | return xglCmdBindVertexData; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2050 | else if (!strncmp("xglCmdBindIndexData", funcName, sizeof("xglCmdBindIndexData"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2051 | return xglCmdBindIndexData; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2052 | else if (!strncmp("xglCmdBindAttachments", funcName, sizeof("xglCmdBindAttachments"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2053 | return xglCmdBindAttachments; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2054 | else if (!strncmp("xglCmdPrepareMemoryRegions", funcName, sizeof("xglCmdPrepareMemoryRegions"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2055 | return xglCmdPrepareMemoryRegions; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2056 | else if (!strncmp("xglCmdPrepareImages", funcName, sizeof("xglCmdPrepareImages"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2057 | return xglCmdPrepareImages; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2058 | else if (!strncmp("xglCmdDraw", funcName, sizeof("xglCmdDraw"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2059 | return xglCmdDraw; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2060 | else if (!strncmp("xglCmdDrawIndexed", funcName, sizeof("xglCmdDrawIndexed"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2061 | return xglCmdDrawIndexed; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2062 | else if (!strncmp("xglCmdDrawIndirect", funcName, sizeof("xglCmdDrawIndirect"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2063 | return xglCmdDrawIndirect; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2064 | else if (!strncmp("xglCmdDrawIndexedIndirect", funcName, sizeof("xglCmdDrawIndexedIndirect"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2065 | return xglCmdDrawIndexedIndirect; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2066 | else if (!strncmp("xglCmdDispatch", funcName, sizeof("xglCmdDispatch"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2067 | return xglCmdDispatch; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2068 | else if (!strncmp("xglCmdDispatchIndirect", funcName, sizeof("xglCmdDispatchIndirect"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2069 | return xglCmdDispatchIndirect; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2070 | else if (!strncmp("xglCmdCopyMemory", funcName, sizeof("xglCmdCopyMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2071 | return xglCmdCopyMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2072 | else if (!strncmp("xglCmdCopyImage", funcName, sizeof("xglCmdCopyImage"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2073 | return xglCmdCopyImage; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2074 | else if (!strncmp("xglCmdCopyMemoryToImage", funcName, sizeof("xglCmdCopyMemoryToImage"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2075 | return xglCmdCopyMemoryToImage; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2076 | else if (!strncmp("xglCmdCopyImageToMemory", funcName, sizeof("xglCmdCopyImageToMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2077 | return xglCmdCopyImageToMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2078 | else if (!strncmp("xglCmdCloneImageData", funcName, sizeof("xglCmdCloneImageData"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2079 | return xglCmdCloneImageData; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2080 | else if (!strncmp("xglCmdUpdateMemory", funcName, sizeof("xglCmdUpdateMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2081 | return xglCmdUpdateMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2082 | else if (!strncmp("xglCmdFillMemory", funcName, sizeof("xglCmdFillMemory"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2083 | return xglCmdFillMemory; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2084 | else if (!strncmp("xglCmdClearColorImage", funcName, sizeof("xglCmdClearColorImage"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2085 | return xglCmdClearColorImage; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2086 | else if (!strncmp("xglCmdClearColorImageRaw", funcName, sizeof("xglCmdClearColorImageRaw"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2087 | return xglCmdClearColorImageRaw; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2088 | else if (!strncmp("xglCmdClearDepthStencil", funcName, sizeof("xglCmdClearDepthStencil"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2089 | return xglCmdClearDepthStencil; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2090 | else if (!strncmp("xglCmdResolveImage", funcName, sizeof("xglCmdResolveImage"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2091 | return xglCmdResolveImage; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2092 | else if (!strncmp("xglCmdSetEvent", funcName, sizeof("xglCmdSetEvent"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2093 | return xglCmdSetEvent; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2094 | else if (!strncmp("xglCmdResetEvent", funcName, sizeof("xglCmdResetEvent"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2095 | return xglCmdResetEvent; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2096 | else if (!strncmp("xglCmdMemoryAtomic", funcName, sizeof("xglCmdMemoryAtomic"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2097 | return xglCmdMemoryAtomic; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2098 | else if (!strncmp("xglCmdBeginQuery", funcName, sizeof("xglCmdBeginQuery"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2099 | return xglCmdBeginQuery; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2100 | else if (!strncmp("xglCmdEndQuery", funcName, sizeof("xglCmdEndQuery"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2101 | return xglCmdEndQuery; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2102 | else if (!strncmp("xglCmdResetQueryPool", funcName, sizeof("xglCmdResetQueryPool"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2103 | return xglCmdResetQueryPool; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2104 | else if (!strncmp("xglCmdWriteTimestamp", funcName, sizeof("xglCmdWriteTimestamp"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2105 | return xglCmdWriteTimestamp; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2106 | else if (!strncmp("xglCmdInitAtomicCounters", funcName, sizeof("xglCmdInitAtomicCounters"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2107 | return xglCmdInitAtomicCounters; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2108 | else if (!strncmp("xglCmdLoadAtomicCounters", funcName, sizeof("xglCmdLoadAtomicCounters"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2109 | return xglCmdLoadAtomicCounters; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2110 | else if (!strncmp("xglCmdSaveAtomicCounters", funcName, sizeof("xglCmdSaveAtomicCounters"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2111 | return xglCmdSaveAtomicCounters; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2112 | else if (!strncmp("xglDbgSetValidationLevel", funcName, sizeof("xglDbgSetValidationLevel"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2113 | return xglDbgSetValidationLevel; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2114 | else if (!strncmp("xglDbgRegisterMsgCallback", funcName, sizeof("xglDbgRegisterMsgCallback"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2115 | return xglDbgRegisterMsgCallback; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2116 | else if (!strncmp("xglDbgUnregisterMsgCallback", funcName, sizeof("xglDbgUnregisterMsgCallback"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2117 | return xglDbgUnregisterMsgCallback; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2118 | else if (!strncmp("xglDbgSetMessageFilter", funcName, sizeof("xglDbgSetMessageFilter"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2119 | return xglDbgSetMessageFilter; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2120 | else if (!strncmp("xglDbgSetObjectTag", funcName, sizeof("xglDbgSetObjectTag"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2121 | return xglDbgSetObjectTag; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2122 | else if (!strncmp("xglDbgSetGlobalOption", funcName, sizeof("xglDbgSetGlobalOption"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2123 | return xglDbgSetGlobalOption; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2124 | else if (!strncmp("xglDbgSetDeviceOption", funcName, sizeof("xglDbgSetDeviceOption"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2125 | return xglDbgSetDeviceOption; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2126 | else if (!strncmp("xglCmdDbgMarkerBegin", funcName, sizeof("xglCmdDbgMarkerBegin"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2127 | return xglCmdDbgMarkerBegin; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2128 | else if (!strncmp("xglCmdDbgMarkerEnd", funcName, sizeof("xglCmdDbgMarkerEnd"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2129 | return xglCmdDbgMarkerEnd; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2130 | else if (!strncmp("xglWsiX11AssociateConnection", funcName, sizeof("xglWsiX11AssociateConnection"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2131 | return xglWsiX11AssociateConnection; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2132 | else if (!strncmp("xglWsiX11GetMSC", funcName, sizeof("xglWsiX11GetMSC"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2133 | return xglWsiX11GetMSC; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2134 | else if (!strncmp("xglWsiX11CreatePresentableImage", funcName, sizeof("xglWsiX11CreatePresentableImage"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2135 | return xglWsiX11CreatePresentableImage; |
Chia-I Wu | f1a5a74 | 2014-12-27 15:16:07 +0800 | [diff] [blame] | 2136 | else if (!strncmp("xglWsiX11QueuePresent", funcName, sizeof("xglWsiX11QueuePresent"))) |
Tobin Ehlis | 6663f49 | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 2137 | return xglWsiX11QueuePresent; |
| 2138 | else { |
| 2139 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 2140 | if (gpuw->pGPA == NULL) |
| 2141 | return NULL; |
| 2142 | return gpuw->pGPA(gpuw->nextObject, funcName); |
| 2143 | } |
| 2144 | } |