Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [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> |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 30 | #include "xgl_struct_string_helper.h" |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 31 | #include "draw_state.h" |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 32 | |
| 33 | static XGL_LAYER_DISPATCH_TABLE nextTable; |
| 34 | static XGL_BASE_LAYER_OBJECT *pCurObj; |
| 35 | static pthread_once_t tabOnce = PTHREAD_ONCE_INIT; |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 36 | // Could be smarter about locking with unique locks for various tasks, but just using one for now |
| 37 | pthread_mutex_t globalLock = PTHREAD_MUTEX_INITIALIZER; |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 38 | // Ptr to LL of dbg functions |
| 39 | static XGL_LAYER_DBG_FUNCTION_NODE *pDbgFunctionHead = NULL; |
| 40 | // Utility function to handle reporting |
| 41 | // If callbacks are enabled, use them, otherwise use printf |
| 42 | static XGL_VOID layerCbMsg(XGL_DBG_MSG_TYPE msgType, |
| 43 | XGL_VALIDATION_LEVEL validationLevel, |
| 44 | XGL_BASE_OBJECT srcObject, |
| 45 | XGL_SIZE location, |
| 46 | XGL_INT msgCode, |
| 47 | const XGL_CHAR* pLayerPrefix, |
| 48 | const XGL_CHAR* pMsg) |
| 49 | { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 50 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 51 | XGL_LAYER_DBG_FUNCTION_NODE *pTrav = pDbgFunctionHead; |
| 52 | if (pTrav) { |
| 53 | while (pTrav) { |
| 54 | pTrav->pfnMsgCallback(msgType, validationLevel, srcObject, location, msgCode, pMsg, pTrav->pUserData); |
| 55 | pTrav = pTrav->pNext; |
| 56 | } |
| 57 | } |
| 58 | else { |
| 59 | switch (msgType) { |
| 60 | case XGL_DBG_MSG_ERROR: |
| 61 | printf("{%s}ERROR : %s\n", pLayerPrefix, pMsg); |
| 62 | break; |
| 63 | case XGL_DBG_MSG_WARNING: |
| 64 | printf("{%s}WARN : %s\n", pLayerPrefix, pMsg); |
| 65 | break; |
| 66 | case XGL_DBG_MSG_PERF_WARNING: |
| 67 | printf("{%s}PERF_WARN : %s\n", pLayerPrefix, pMsg); |
| 68 | break; |
| 69 | default: |
| 70 | printf("{%s}INFO : %s\n", pLayerPrefix, pMsg); |
| 71 | break; |
| 72 | } |
| 73 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 74 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 75 | } |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 76 | // Return the size of the underlying struct based on struct type |
| 77 | static XGL_SIZE sTypeStructSize(XGL_STRUCTURE_TYPE sType) |
| 78 | { |
| 79 | switch (sType) |
| 80 | { |
| 81 | case XGL_STRUCTURE_TYPE_APPLICATION_INFO: |
| 82 | return sizeof(XGL_APPLICATION_INFO); |
| 83 | case XGL_STRUCTURE_TYPE_DEVICE_CREATE_INFO: |
| 84 | return sizeof(XGL_DEVICE_CREATE_INFO); |
| 85 | case XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO: |
| 86 | return sizeof(XGL_MEMORY_ALLOC_INFO); |
| 87 | case XGL_STRUCTURE_TYPE_MEMORY_OPEN_INFO: |
| 88 | return sizeof(XGL_MEMORY_OPEN_INFO); |
| 89 | case XGL_STRUCTURE_TYPE_PEER_MEMORY_OPEN_INFO: |
| 90 | return sizeof(XGL_PEER_MEMORY_OPEN_INFO); |
| 91 | case XGL_STRUCTURE_TYPE_MEMORY_VIEW_ATTACH_INFO: |
| 92 | return sizeof(XGL_MEMORY_VIEW_ATTACH_INFO); |
| 93 | case XGL_STRUCTURE_TYPE_IMAGE_VIEW_ATTACH_INFO: |
| 94 | return sizeof(XGL_IMAGE_VIEW_ATTACH_INFO); |
| 95 | case XGL_STRUCTURE_TYPE_MEMORY_STATE_TRANSITION: |
| 96 | return sizeof(XGL_MEMORY_STATE_TRANSITION); |
| 97 | case XGL_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO: |
| 98 | return sizeof(XGL_IMAGE_VIEW_CREATE_INFO); |
| 99 | case XGL_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO: |
| 100 | return sizeof(XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO); |
| 101 | case XGL_STRUCTURE_TYPE_DEPTH_STENCIL_VIEW_CREATE_INFO: |
| 102 | return sizeof(XGL_DEPTH_STENCIL_VIEW_CREATE_INFO); |
| 103 | case XGL_STRUCTURE_TYPE_SHADER_CREATE_INFO: |
| 104 | return sizeof(XGL_SHADER_CREATE_INFO); |
| 105 | case XGL_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO: |
| 106 | return sizeof(XGL_COMPUTE_PIPELINE_CREATE_INFO); |
| 107 | case XGL_STRUCTURE_TYPE_SAMPLER_CREATE_INFO: |
| 108 | return sizeof(XGL_SAMPLER_CREATE_INFO); |
| 109 | case XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_CREATE_INFO: |
| 110 | return sizeof(XGL_DESCRIPTOR_SET_CREATE_INFO); |
| 111 | case XGL_STRUCTURE_TYPE_RASTER_STATE_CREATE_INFO: |
| 112 | return sizeof(XGL_RASTER_STATE_CREATE_INFO); |
| 113 | case XGL_STRUCTURE_TYPE_MSAA_STATE_CREATE_INFO: |
| 114 | return sizeof(XGL_MSAA_STATE_CREATE_INFO); |
| 115 | case XGL_STRUCTURE_TYPE_COLOR_BLEND_STATE_CREATE_INFO: |
| 116 | return sizeof(XGL_COLOR_BLEND_STATE_CREATE_INFO); |
| 117 | case XGL_STRUCTURE_TYPE_DEPTH_STENCIL_STATE_CREATE_INFO: |
| 118 | return sizeof(XGL_DEPTH_STENCIL_STATE_CREATE_INFO); |
| 119 | case XGL_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO: |
| 120 | return sizeof(XGL_CMD_BUFFER_CREATE_INFO); |
| 121 | case XGL_STRUCTURE_TYPE_EVENT_CREATE_INFO: |
| 122 | return sizeof(XGL_EVENT_CREATE_INFO); |
| 123 | case XGL_STRUCTURE_TYPE_FENCE_CREATE_INFO: |
| 124 | return sizeof(XGL_FENCE_CREATE_INFO); |
| 125 | case XGL_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO: |
| 126 | return sizeof(XGL_QUEUE_SEMAPHORE_CREATE_INFO); |
| 127 | case XGL_STRUCTURE_TYPE_SEMAPHORE_OPEN_INFO: |
| 128 | return sizeof(XGL_QUEUE_SEMAPHORE_OPEN_INFO); |
| 129 | case XGL_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO: |
| 130 | return sizeof(XGL_QUERY_POOL_CREATE_INFO); |
| 131 | case XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO: |
| 132 | return sizeof(XGL_PIPELINE_SHADER_STAGE_CREATE_INFO); |
| 133 | case XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO: |
| 134 | return sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO); |
| 135 | case XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO: |
| 136 | return sizeof(XGL_PIPELINE_IA_STATE_CREATE_INFO); |
| 137 | case XGL_STRUCTURE_TYPE_PIPELINE_DB_STATE_CREATE_INFO: |
| 138 | return sizeof(XGL_PIPELINE_DB_STATE_CREATE_INFO); |
| 139 | case XGL_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO: |
| 140 | return sizeof(XGL_PIPELINE_CB_STATE); |
| 141 | case XGL_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO: |
| 142 | return sizeof(XGL_PIPELINE_RS_STATE_CREATE_INFO); |
| 143 | case XGL_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO: |
| 144 | return sizeof(XGL_PIPELINE_TESS_STATE_CREATE_INFO); |
| 145 | case XGL_STRUCTURE_TYPE_IMAGE_CREATE_INFO: |
| 146 | return sizeof(XGL_IMAGE_CREATE_INFO); |
| 147 | case XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO: |
| 148 | return sizeof(XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO); |
| 149 | case XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO: |
| 150 | return sizeof(XGL_LAYER_CREATE_INFO); |
| 151 | default: |
| 152 | return 0; |
| 153 | } |
| 154 | } |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 155 | // Return the size of the underlying struct based on Bind Point enum |
| 156 | // Have to do this b/c VIEWPORT doesn't have sType in its createinfo struct |
| 157 | static XGL_SIZE dynStateCreateInfoSize(XGL_STRUCTURE_TYPE sType) |
| 158 | { |
| 159 | switch (sType) |
| 160 | { |
| 161 | case XGL_STATE_BIND_VIEWPORT: |
| 162 | return sizeof(XGL_VIEWPORT_STATE_CREATE_INFO); |
| 163 | case XGL_STATE_BIND_RASTER: |
| 164 | return sizeof(XGL_RASTER_STATE_CREATE_INFO); |
| 165 | case XGL_STATE_BIND_DEPTH_STENCIL: |
| 166 | return sizeof(XGL_DEPTH_STENCIL_STATE_CREATE_INFO); |
| 167 | case XGL_STATE_BIND_COLOR_BLEND: |
| 168 | return sizeof(XGL_COLOR_BLEND_STATE_CREATE_INFO); |
| 169 | case XGL_STATE_BIND_MSAA: |
| 170 | return sizeof(XGL_MSAA_STATE_CREATE_INFO); |
| 171 | default: |
| 172 | return 0; |
| 173 | } |
| 174 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 175 | // Block of code at start here for managing/tracking Pipeline state that this layer cares about |
| 176 | // Just track 2 shaders for now |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 177 | #define XGL_NUM_GRAPHICS_SHADERS XGL_SHADER_STAGE_COMPUTE |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 178 | #define MAX_SLOTS 2048 |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 179 | |
| 180 | static uint64_t drawCount[NUM_DRAW_TYPES] = {0, 0, 0, 0}; |
| 181 | |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 182 | typedef struct _SHADER_DS_MAPPING { |
| 183 | XGL_UINT slotCount; |
| 184 | XGL_DESCRIPTOR_SLOT_INFO* pShaderMappingSlot; |
| 185 | } SHADER_DS_MAPPING; |
| 186 | |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 187 | typedef struct _PIPELINE_LL_HEADER { |
| 188 | XGL_STRUCTURE_TYPE sType; |
| 189 | const XGL_VOID* pNext; |
| 190 | } PIPELINE_LL_HEADER; |
| 191 | |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 192 | typedef struct _PIPELINE_NODE { |
| 193 | XGL_PIPELINE pipeline; |
| 194 | struct _PIPELINE_NODE *pNext; |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 195 | XGL_GRAPHICS_PIPELINE_CREATE_INFO *pCreateTree; // Ptr to shadow of data in create tree |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 196 | // 1st dimension of array is shader type |
| 197 | SHADER_DS_MAPPING dsMapping[XGL_NUM_GRAPHICS_SHADERS][XGL_MAX_DESCRIPTOR_SETS]; |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 198 | // Vtx input info (if any) |
| 199 | XGL_UINT vtxBindingCount; // number of bindings |
| 200 | XGL_VERTEX_INPUT_BINDING_DESCRIPTION* pVertexBindingDescriptions; |
| 201 | XGL_UINT vtxAttributeCount; // number of attributes |
| 202 | XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION* pVertexAttributeDescriptions; |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 203 | } PIPELINE_NODE; |
| 204 | |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 205 | typedef struct _SAMPLER_NODE { |
| 206 | XGL_SAMPLER sampler; |
| 207 | XGL_SAMPLER_CREATE_INFO createInfo; |
| 208 | struct _SAMPLER_NODE *pNext; |
| 209 | } SAMPLER_NODE; |
| 210 | |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 211 | typedef struct _DYNAMIC_STATE_NODE { |
| 212 | XGL_STATE_OBJECT stateObj; |
| 213 | XGL_STATE_BIND_POINT sType; // Extra data as VIEWPORT CreateInfo doesn't have sType |
| 214 | PIPELINE_LL_HEADER *pCreateInfo; |
| 215 | struct _DYNAMIC_STATE_NODE *pNext; |
| 216 | } DYNAMIC_STATE_NODE; |
| 217 | |
| 218 | // TODO : Should be tracking lastBound per cmdBuffer and when draws occur, report based on that cmd buffer lastBound |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 219 | static PIPELINE_NODE *pPipelineHead = NULL; |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 220 | static SAMPLER_NODE *pSamplerHead = NULL; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 221 | static XGL_PIPELINE lastBoundPipeline = NULL; |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 222 | #define MAX_BINDING 0xFFFFFFFF |
| 223 | static XGL_UINT lastVtxBinding = MAX_BINDING; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 224 | |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 225 | static DYNAMIC_STATE_NODE* pDynamicStateHead[XGL_NUM_STATE_BIND_POINT] = {0}; |
| 226 | static DYNAMIC_STATE_NODE* pLastBoundDynamicState[XGL_NUM_STATE_BIND_POINT] = {0}; |
| 227 | |
| 228 | // Viewport state create info doesn't have sType so we have to pass in BIND_POINT |
| 229 | static void insertDynamicState(const XGL_STATE_OBJECT state, const PIPELINE_LL_HEADER* pCreateInfo, const XGL_STATE_BIND_POINT sType) |
| 230 | { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 231 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 232 | // Insert new node at head of appropriate LL |
| 233 | DYNAMIC_STATE_NODE* pStateNode = (DYNAMIC_STATE_NODE*)malloc(sizeof(DYNAMIC_STATE_NODE)); |
| 234 | pStateNode->pNext = pDynamicStateHead[sType]; |
| 235 | pDynamicStateHead[sType] = pStateNode; |
| 236 | pStateNode->stateObj = state; |
| 237 | pStateNode->sType = sType; |
| 238 | pStateNode->pCreateInfo = (PIPELINE_LL_HEADER*)malloc(dynStateCreateInfoSize(sType)); |
| 239 | memcpy(pStateNode->pCreateInfo, pCreateInfo, dynStateCreateInfoSize(sType)); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 240 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 241 | } |
| 242 | // Set the last bound dynamic state of given type |
| 243 | // TODO : Need to track this per cmdBuffer and correlate cmdBuffer for Draw w/ last bound for that cmdBuffer? |
| 244 | static void setLastBoundDynamicState(const XGL_STATE_OBJECT state, const XGL_STATE_BIND_POINT sType) |
| 245 | { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 246 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 247 | DYNAMIC_STATE_NODE* pTrav = pDynamicStateHead[sType]; |
| 248 | while (pTrav && (state != pTrav->stateObj)) { |
| 249 | pTrav = pTrav->pNext; |
| 250 | } |
| 251 | if (!pTrav) { |
| 252 | char str[1024]; |
| 253 | sprintf(str, "Unable to find dynamic state object %p, was it ever created?", (void*)state); |
| 254 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, state, 0, DRAWSTATE_INVALID_DYNAMIC_STATE_OBJECT, "DS", str); |
| 255 | } |
| 256 | pLastBoundDynamicState[sType] = pTrav; |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 257 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 258 | } |
| 259 | // Print the last bound dynamic state |
| 260 | static void printDynamicState() |
| 261 | { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 262 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 263 | char str[1024]; |
| 264 | for (uint32_t i = 0; i < XGL_NUM_STATE_BIND_POINT; i++) { |
| 265 | if (pLastBoundDynamicState[i]) { |
| 266 | sprintf(str, "Reporting CreateInfo for currently bound %s object %p", string_XGL_STATE_BIND_POINT(i), pLastBoundDynamicState[i]->stateObj); |
| 267 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pLastBoundDynamicState[i]->stateObj, 0, DRAWSTATE_NONE, "DS", str); |
| 268 | switch (pLastBoundDynamicState[i]->sType) |
| 269 | { |
| 270 | case XGL_STATE_BIND_VIEWPORT: |
| 271 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pLastBoundDynamicState[i]->stateObj, 0, DRAWSTATE_NONE, "DS", xgl_print_xgl_viewport_state_create_info((XGL_VIEWPORT_STATE_CREATE_INFO*)pLastBoundDynamicState[i]->pCreateInfo, " ")); |
| 272 | break; |
| 273 | default: |
| 274 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pLastBoundDynamicState[i]->stateObj, 0, DRAWSTATE_NONE, "DS", dynamic_display(pLastBoundDynamicState[i]->pCreateInfo, " ")); |
| 275 | break; |
| 276 | } |
| 277 | } |
| 278 | else { |
| 279 | sprintf(str, "No dynamic state of type %s bound", string_XGL_STATE_BIND_POINT(i)); |
| 280 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", str); |
| 281 | } |
| 282 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 283 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 284 | } |
| 285 | // Retrieve pipeline node ptr for given pipeline object |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 286 | static PIPELINE_NODE *getPipeline(XGL_PIPELINE pipeline) |
| 287 | { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 288 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 289 | PIPELINE_NODE *pTrav = pPipelineHead; |
| 290 | while (pTrav) { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 291 | if (pTrav->pipeline == pipeline) { |
| 292 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 293 | return pTrav; |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 294 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 295 | pTrav = pTrav->pNext; |
| 296 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 297 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 298 | return NULL; |
| 299 | } |
| 300 | |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 301 | // For given sampler, return a ptr to its Create Info struct, or NULL if sampler not found |
| 302 | static XGL_SAMPLER_CREATE_INFO* getSamplerCreateInfo(const XGL_SAMPLER sampler) |
| 303 | { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 304 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 305 | SAMPLER_NODE *pTrav = pSamplerHead; |
| 306 | while (pTrav) { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 307 | if (sampler == pTrav->sampler) { |
| 308 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 309 | return &pTrav->createInfo; |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 310 | } |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 311 | pTrav = pTrav->pNext; |
| 312 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 313 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 314 | return NULL; |
| 315 | } |
| 316 | |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 317 | // Init the pipeline mapping info based on pipeline create info LL tree |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 318 | // Threading note : Calls to this function should wrapped in mutex |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 319 | static void initPipeline(PIPELINE_NODE *pPipeline, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo) |
| 320 | { |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 321 | // First init create info, we'll shadow the structs as we go down the tree |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 322 | pPipeline->pCreateTree = (XGL_GRAPHICS_PIPELINE_CREATE_INFO*)malloc(sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO)); |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 323 | memcpy(pPipeline->pCreateTree, pCreateInfo, sizeof(XGL_GRAPHICS_PIPELINE_CREATE_INFO)); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 324 | PIPELINE_LL_HEADER *pShadowTrav = (PIPELINE_LL_HEADER*)pPipeline->pCreateTree; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 325 | PIPELINE_LL_HEADER *pTrav = (PIPELINE_LL_HEADER*)pCreateInfo->pNext; |
| 326 | while (pTrav) { |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 327 | // Shadow the struct |
| 328 | pShadowTrav->pNext = (PIPELINE_LL_HEADER*)malloc(sTypeStructSize(pTrav->sType)); |
| 329 | // Typically pNext is const so have to cast to avoid warning when we modify it here |
| 330 | memcpy((void*)pShadowTrav->pNext, pTrav, sTypeStructSize(pTrav->sType)); |
| 331 | pShadowTrav = (PIPELINE_LL_HEADER*)pShadowTrav->pNext; |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 332 | // TODO : Now that we shadow whole create info, the special copies are just a convenience that can be done away with once shadow is complete and correct |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 333 | // Special copy of DS Mapping info |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 334 | if (XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO == pTrav->sType) { |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 335 | XGL_PIPELINE_SHADER_STAGE_CREATE_INFO *pSSCI = (XGL_PIPELINE_SHADER_STAGE_CREATE_INFO*)pTrav; |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 336 | for (uint32_t i = 0; i < XGL_MAX_DESCRIPTOR_SETS; i++) { |
| 337 | if (pSSCI->shader.descriptorSetMapping[i].descriptorCount > MAX_SLOTS) { |
| 338 | char str[1024]; |
| 339 | sprintf(str, "descriptorCount for %s exceeds 2048 (%u), is this correct? Changing to 0", string_XGL_PIPELINE_SHADER_STAGE(pSSCI->shader.stage), pSSCI->shader.descriptorSetMapping[i].descriptorCount); |
| 340 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pPipeline, 0, DRAWSTATE_DESCRIPTOR_MAX_EXCEEDED, "DS", str); |
| 341 | pSSCI->shader.descriptorSetMapping[i].descriptorCount = 0; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 342 | } |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 343 | pPipeline->dsMapping[pSSCI->shader.stage][i].slotCount = pSSCI->shader.descriptorSetMapping[i].descriptorCount; |
| 344 | // Deep copy DS Slot array |
| 345 | pPipeline->dsMapping[pSSCI->shader.stage][i].pShaderMappingSlot = (XGL_DESCRIPTOR_SLOT_INFO*)malloc(sizeof(XGL_DESCRIPTOR_SLOT_INFO)*pPipeline->dsMapping[pSSCI->shader.stage][i].slotCount); |
| 346 | memcpy(pPipeline->dsMapping[pSSCI->shader.stage][i].pShaderMappingSlot, pSSCI->shader.descriptorSetMapping[i].pDescriptorInfo, sizeof(XGL_DESCRIPTOR_SLOT_INFO)*pPipeline->dsMapping[pSSCI->shader.stage][i].slotCount); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 347 | } |
| 348 | } |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 349 | else if (XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO == pTrav->sType) { |
| 350 | // Special copy of Vtx info |
| 351 | XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO *pVICI = (XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO*)pTrav; |
| 352 | pPipeline->vtxBindingCount = pVICI->bindingCount; |
| 353 | uint32_t allocSize = pPipeline->vtxBindingCount * sizeof(XGL_VERTEX_INPUT_BINDING_DESCRIPTION); |
| 354 | pPipeline->pVertexBindingDescriptions = (XGL_VERTEX_INPUT_BINDING_DESCRIPTION*)malloc(allocSize); |
| 355 | memcpy(pPipeline->pVertexBindingDescriptions, pVICI->pVertexAttributeDescriptions, allocSize); |
| 356 | pPipeline->vtxAttributeCount = pVICI->attributeCount; |
| 357 | allocSize = pPipeline->vtxAttributeCount * sizeof(XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION); |
| 358 | pPipeline->pVertexAttributeDescriptions = (XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION*)malloc(allocSize); |
| 359 | memcpy(pPipeline->pVertexAttributeDescriptions, pVICI->pVertexAttributeDescriptions, allocSize); |
| 360 | } |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 361 | pTrav = (PIPELINE_LL_HEADER*)pTrav->pNext; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 362 | } |
| 363 | } |
| 364 | |
| 365 | // Block of code at start here specifically for managing/tracking DSs |
| 366 | #define MAPPING_MEMORY 0x00000001 |
| 367 | #define MAPPING_IMAGE 0x00000002 |
| 368 | #define MAPPING_SAMPLER 0x00000004 |
| 369 | #define MAPPING_DS 0x00000008 |
| 370 | |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 371 | static char* stringSlotBinding(XGL_UINT binding) |
| 372 | { |
| 373 | switch (binding) |
| 374 | { |
| 375 | case MAPPING_MEMORY: |
| 376 | return "Memory View"; |
| 377 | case MAPPING_IMAGE: |
| 378 | return "Image View"; |
| 379 | case MAPPING_SAMPLER: |
| 380 | return "Sampler"; |
| 381 | default: |
| 382 | return "UNKNOWN DS BINDING"; |
| 383 | } |
| 384 | } |
| 385 | |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 386 | typedef struct _DS_SLOT { |
| 387 | XGL_UINT slot; |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 388 | XGL_DESCRIPTOR_SLOT_INFO shaderSlotInfo[XGL_NUM_GRAPHICS_SHADERS]; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 389 | // Only 1 of 4 possible slot mappings active |
| 390 | XGL_UINT activeMapping; |
| 391 | XGL_UINT mappingMask; // store record of different mappings used |
| 392 | XGL_MEMORY_VIEW_ATTACH_INFO memView; |
| 393 | XGL_IMAGE_VIEW_ATTACH_INFO imageView; |
| 394 | XGL_SAMPLER sampler; |
| 395 | } DS_SLOT; |
| 396 | |
| 397 | // Top-level node that points to start of DS |
| 398 | typedef struct _DS_LL_HEAD { |
| 399 | XGL_DESCRIPTOR_SET dsID; |
| 400 | XGL_UINT numSlots; |
| 401 | struct _DS_LL_HEAD *pNextDS; |
| 402 | DS_SLOT *dsSlot; // Dynamically allocated array of DS_SLOTs |
| 403 | XGL_BOOL updateActive; // Track if DS is in an update block |
| 404 | } DS_LL_HEAD; |
| 405 | |
| 406 | // ptr to HEAD of LL of DSs |
| 407 | static DS_LL_HEAD *pDSHead = NULL; |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 408 | // Last DS that was bound, and slotOffset for the binding |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 409 | static XGL_DESCRIPTOR_SET lastBoundDS[XGL_MAX_DESCRIPTOR_SETS] = {NULL, NULL}; |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 410 | static XGL_UINT lastBoundSlotOffset[XGL_MAX_DESCRIPTOR_SETS] = {0, 0}; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 411 | |
| 412 | // Return DS Head ptr for specified ds or else NULL |
| 413 | static DS_LL_HEAD* getDS(XGL_DESCRIPTOR_SET ds) |
| 414 | { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 415 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 416 | DS_LL_HEAD *pTrav = pDSHead; |
| 417 | while (pTrav) { |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 418 | if (pTrav->dsID == ds) { |
| 419 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 420 | return pTrav; |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 421 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 422 | pTrav = pTrav->pNextDS; |
| 423 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 424 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 425 | return NULL; |
| 426 | } |
| 427 | |
| 428 | // Initialize a DS where all slots are UNUSED for all shaders |
| 429 | static void initDS(DS_LL_HEAD *pDS) |
| 430 | { |
| 431 | for (uint32_t i = 0; i < pDS->numSlots; i++) { |
| 432 | memset((void*)&pDS->dsSlot[i], 0, sizeof(DS_SLOT)); |
| 433 | pDS->dsSlot[i].slot = i; |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | // Return XGL_TRUE if DS Exists and is within an xglBeginDescriptorSetUpdate() call sequence, otherwise XGL_FALSE |
| 438 | static XGL_BOOL dsUpdate(XGL_DESCRIPTOR_SET ds) |
| 439 | { |
| 440 | DS_LL_HEAD *pTrav = getDS(ds); |
| 441 | if (pTrav) |
| 442 | return pTrav->updateActive; |
| 443 | return XGL_FALSE; |
| 444 | } |
| 445 | |
| 446 | // Clear specified slotCount DS Slots starting at startSlot |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 447 | // Return XGL_TRUE if DS exists and is successfully cleared to 0s |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 448 | static XGL_BOOL clearDS(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount) |
| 449 | { |
| 450 | DS_LL_HEAD *pTrav = getDS(descriptorSet); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 451 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 452 | if (!pTrav || ((startSlot + slotCount) > pTrav->numSlots)) { |
| 453 | // TODO : Log more meaningful error here |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 454 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 455 | return XGL_FALSE; |
| 456 | } |
| 457 | for (uint32_t i = startSlot; i < slotCount; i++) { |
| 458 | memset((void*)&pTrav->dsSlot[i], 0, sizeof(DS_SLOT)); |
| 459 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 460 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 461 | return XGL_TRUE; |
| 462 | } |
| 463 | |
| 464 | static void dsSetMapping(DS_SLOT* pSlot, XGL_UINT mapping) |
| 465 | { |
| 466 | pSlot->mappingMask |= mapping; |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 467 | pSlot->activeMapping = mapping; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 468 | } |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 469 | // Populate pStr w/ a string noting all of the slot mappings based on mapping flag |
| 470 | static char* noteSlotMapping(XGL_UINT32 mapping, char *pStr) |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 471 | { |
| 472 | if (MAPPING_MEMORY & mapping) |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 473 | strcat(pStr, "\n\tMemory View previously mapped"); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 474 | if (MAPPING_IMAGE & mapping) |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 475 | strcat(pStr, "\n\tImage View previously mapped"); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 476 | if (MAPPING_SAMPLER & mapping) |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 477 | strcat(pStr, "\n\tSampler previously mapped"); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 478 | if (MAPPING_DS & mapping) |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 479 | strcat(pStr, "\n\tDESCRIPTOR SET ptr previously mapped"); |
| 480 | return pStr; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 481 | } |
| 482 | |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 483 | static void dsSetMemMapping(XGL_DESCRIPTOR_SET descriptorSet, DS_SLOT* pSlot, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView) |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 484 | { |
| 485 | if (pSlot->mappingMask) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 486 | char str[1024]; |
| 487 | char map_str[1024] = {0}; |
| 488 | sprintf(str, "While mapping Memory View to slot %u previous Mapping(s) identified:%s", pSlot->slot, noteSlotMapping(pSlot->mappingMask, map_str)); |
| 489 | layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_SLOT_REMAPPING, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 490 | } |
| 491 | memcpy(&pSlot->memView, pMemView, sizeof(XGL_MEMORY_VIEW_ATTACH_INFO)); |
| 492 | dsSetMapping(pSlot, MAPPING_MEMORY); |
| 493 | } |
| 494 | |
| 495 | static XGL_BOOL dsMemMapping(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews) |
| 496 | { |
| 497 | DS_LL_HEAD *pTrav = getDS(descriptorSet); |
| 498 | if (pTrav) { |
| 499 | if (pTrav->numSlots < (startSlot + slotCount)) { |
| 500 | return XGL_FALSE; |
| 501 | } |
| 502 | for (uint32_t i = 0; i < slotCount; i++) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 503 | dsSetMemMapping(descriptorSet, &pTrav->dsSlot[i+startSlot], &pMemViews[i]); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 504 | } |
| 505 | } |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 506 | else |
| 507 | return XGL_FALSE; |
| 508 | return XGL_TRUE; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 509 | } |
| 510 | |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 511 | static void dsSetImageMapping(XGL_DESCRIPTOR_SET descriptorSet, DS_SLOT* pSlot, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews) |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 512 | { |
| 513 | if (pSlot->mappingMask) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 514 | char str[1024]; |
| 515 | char map_str[1024] = {0}; |
| 516 | sprintf(str, "While mapping Image View to slot %u previous Mapping(s) identified:%s", pSlot->slot, noteSlotMapping(pSlot->mappingMask, map_str)); |
| 517 | layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_SLOT_REMAPPING, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 518 | } |
| 519 | memcpy(&pSlot->imageView, pImageViews, sizeof(XGL_IMAGE_VIEW_ATTACH_INFO)); |
| 520 | dsSetMapping(pSlot, MAPPING_IMAGE); |
| 521 | } |
| 522 | |
| 523 | static XGL_BOOL dsImageMapping(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews) |
| 524 | { |
| 525 | DS_LL_HEAD *pTrav = getDS(descriptorSet); |
| 526 | if (pTrav) { |
| 527 | if (pTrav->numSlots < (startSlot + slotCount)) { |
| 528 | return XGL_FALSE; |
| 529 | } |
| 530 | for (uint32_t i = 0; i < slotCount; i++) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 531 | dsSetImageMapping(descriptorSet, &pTrav->dsSlot[i+startSlot], &pImageViews[i]); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 532 | } |
| 533 | } |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 534 | else |
| 535 | return XGL_FALSE; |
| 536 | return XGL_TRUE; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 537 | } |
| 538 | |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 539 | static void dsSetSamplerMapping(XGL_DESCRIPTOR_SET descriptorSet, DS_SLOT* pSlot, const XGL_SAMPLER sampler) |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 540 | { |
| 541 | if (pSlot->mappingMask) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 542 | char str[1024]; |
| 543 | char map_str[1024] = {0}; |
| 544 | sprintf(str, "While mapping Sampler to slot %u previous Mapping(s) identified:%s", pSlot->slot, noteSlotMapping(pSlot->mappingMask, map_str)); |
| 545 | layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_SLOT_REMAPPING, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 546 | } |
| 547 | pSlot->sampler = sampler; |
| 548 | dsSetMapping(pSlot, MAPPING_SAMPLER); |
| 549 | } |
| 550 | |
| 551 | static XGL_BOOL dsSamplerMapping(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers) |
| 552 | { |
| 553 | DS_LL_HEAD *pTrav = getDS(descriptorSet); |
| 554 | if (pTrav) { |
| 555 | if (pTrav->numSlots < (startSlot + slotCount)) { |
| 556 | return XGL_FALSE; |
| 557 | } |
| 558 | for (uint32_t i = 0; i < slotCount; i++) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 559 | dsSetSamplerMapping(descriptorSet, &pTrav->dsSlot[i+startSlot], pSamplers[i]); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 560 | } |
| 561 | } |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 562 | else |
| 563 | return XGL_FALSE; |
| 564 | return XGL_TRUE; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 565 | } |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 566 | // Print the last bound Gfx Pipeline |
| 567 | static void printPipeline() |
| 568 | { |
| 569 | PIPELINE_NODE *pPipeTrav = getPipeline(lastBoundPipeline); |
| 570 | if (!pPipeTrav) { |
| 571 | // nothing to print |
| 572 | } |
| 573 | else { |
| 574 | char* pipeStr = xgl_print_xgl_graphics_pipeline_create_info(pPipeTrav->pCreateTree, "{DS}"); |
| 575 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", pipeStr); |
| 576 | } |
| 577 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 578 | // Synch up currently bound pipeline settings with DS mappings |
| 579 | static void synchDSMapping() |
| 580 | { |
| 581 | // First verify that we have a bound pipeline |
| 582 | PIPELINE_NODE *pPipeTrav = getPipeline(lastBoundPipeline); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 583 | char str[1024]; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 584 | if (!pPipeTrav) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 585 | sprintf(str, "Can't find last bound Pipeline %p!", (void*)lastBoundPipeline); |
| 586 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_PIPELINE_BOUND, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 587 | } |
| 588 | else { |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 589 | // Synch Descriptor Set Mapping |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 590 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 591 | for (uint32_t i = 0; i < XGL_MAX_DESCRIPTOR_SETS; i++) { |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 592 | DS_LL_HEAD *pDS; |
| 593 | if (lastBoundDS[i]) { |
| 594 | pDS = getDS(lastBoundDS[i]); |
| 595 | if (!pDS) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 596 | sprintf(str, "Can't find last bound DS %p. Did you need to bind DS to index %u?", (void*)lastBoundDS[i], i); |
| 597 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_DS_BOUND, "DS", str); |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 598 | } |
| 599 | else { // We have a good DS & Pipeline, store pipeline mappings in DS |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 600 | XGL_UINT slotOffset = lastBoundSlotOffset[i]; |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 601 | for (uint32_t j = 0; j < XGL_NUM_GRAPHICS_SHADERS; j++) { // j is shader selector |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 602 | if (pPipeTrav->dsMapping[j][i].slotCount > (pDS->numSlots - slotOffset)) { |
| 603 | sprintf(str, "DS Mapping for shader %u has more slots (%u) than DS %p (%u) minus slotOffset (%u) (%u slots available)!", j, pPipeTrav->dsMapping[j][i].slotCount, (void*)pDS->dsID, pDS->numSlots, slotOffset, (pDS->numSlots - slotOffset)); |
Tobin Ehlis | 2104279 | 2014-11-24 16:06:04 -0700 | [diff] [blame] | 604 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_DS_SLOT_NUM_MISMATCH, "DS", str); |
| 605 | } |
| 606 | else { |
| 607 | for (uint32_t r = 0; r < pPipeTrav->dsMapping[j][i].slotCount; r++) { |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 608 | pDS->dsSlot[r+slotOffset].shaderSlotInfo[j] = pPipeTrav->dsMapping[j][i].pShaderMappingSlot[r]; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 609 | } |
| 610 | } |
| 611 | } |
| 612 | } |
| 613 | } |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 614 | else { |
Tobin Ehlis | 2104279 | 2014-11-24 16:06:04 -0700 | [diff] [blame] | 615 | // Verify that no shader is mapping this DS |
| 616 | uint32_t dsUsed = 0; |
| 617 | for (uint32_t j = 0; j < XGL_NUM_GRAPHICS_SHADERS; j++) { // j is shader selector |
| 618 | if (pPipeTrav->dsMapping[j][i].slotCount > 0) { |
| 619 | dsUsed = 1; |
| 620 | sprintf(str, "No DS was bound to index %u, but shader type %s has slots bound to that DS.", i, string_XGL_PIPELINE_SHADER_STAGE(j)); |
| 621 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_DS_BOUND, "DS", str); |
| 622 | } |
| 623 | } |
| 624 | if (0 == dsUsed) { |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 625 | sprintf(str, "No DS was bound to index %u, but no shaders are using that DS so this is not an issue.", i); |
Tobin Ehlis | 2104279 | 2014-11-24 16:06:04 -0700 | [diff] [blame] | 626 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", str); |
| 627 | } |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 628 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 629 | } |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 630 | // Verify Vtx binding |
| 631 | if (MAX_BINDING != lastVtxBinding) { |
| 632 | if (lastVtxBinding >= pPipeTrav->vtxBindingCount) { |
| 633 | sprintf(str, "Vtx binding Index of %u exceeds PSO pVertexBindingDescriptions max array index of %u.", lastVtxBinding, (pPipeTrav->vtxBindingCount - 1)); |
| 634 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS", str); |
| 635 | } |
| 636 | else { |
| 637 | char *tmpStr = xgl_print_xgl_vertex_input_binding_description(&pPipeTrav->pVertexBindingDescriptions[lastVtxBinding], "{DS}INFO : "); |
| 638 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", tmpStr); |
| 639 | free(tmpStr); |
| 640 | } |
| 641 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 642 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 643 | } |
| 644 | } |
| 645 | |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 646 | // Checks to make sure that shader mapping matches slot binding |
| 647 | // Print an ERROR and return XGL_FALSE if they don't line up |
| 648 | static XGL_BOOL verifyShaderSlotMapping(const XGL_UINT slot, const XGL_UINT slotBinding, const XGL_UINT shaderStage, const XGL_DESCRIPTOR_SET_SLOT_TYPE shaderMapping) |
| 649 | { |
| 650 | XGL_BOOL error = XGL_FALSE; |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 651 | char str[1024]; |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 652 | switch (shaderMapping) |
| 653 | { |
| 654 | case XGL_SLOT_SHADER_RESOURCE: |
| 655 | if (MAPPING_MEMORY != slotBinding && MAPPING_IMAGE != slotBinding) |
| 656 | error = XGL_TRUE; |
| 657 | break; |
| 658 | case XGL_SLOT_SHADER_SAMPLER: |
| 659 | if (MAPPING_SAMPLER != slotBinding) |
| 660 | error = XGL_TRUE; |
| 661 | break; |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 662 | case XGL_SLOT_SHADER_UAV: |
| 663 | if (MAPPING_MEMORY != slotBinding) |
| 664 | error = XGL_TRUE; |
| 665 | break; |
| 666 | case XGL_SLOT_NEXT_DESCRIPTOR_SET: |
| 667 | if (MAPPING_DS != slotBinding) |
| 668 | error = XGL_TRUE; |
| 669 | break; |
| 670 | case XGL_SLOT_UNUSED: |
| 671 | break; |
| 672 | default: |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 673 | sprintf(str, "For DS slot %u, unknown shader slot mapping w/ value %u", slot, shaderMapping); |
| 674 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_UNKNOWN_DS_MAPPING, "DS", str); |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 675 | return XGL_FALSE; |
| 676 | } |
| 677 | if (XGL_TRUE == error) { |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 678 | sprintf(str, "DS Slot #%u binding of %s does not match %s shader mapping of %s", slot, stringSlotBinding(slotBinding), string_XGL_PIPELINE_SHADER_STAGE(shaderStage), string_XGL_DESCRIPTOR_SET_SLOT_TYPE(shaderMapping)); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 679 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_DS_MAPPING_MISMATCH, "DS", str); |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 680 | return XGL_FALSE; |
| 681 | } |
| 682 | return XGL_TRUE; |
| 683 | } |
| 684 | |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 685 | // Print details of DS config to stdout |
| 686 | static void printDSConfig() |
| 687 | { |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 688 | uint32_t skipUnusedCount = 0; // track consecutive unused slots for minimal reporting |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 689 | char tmp_str[1024]; |
| 690 | char ds_config_str[1024*256] = {0}; // TODO : Currently making this buffer HUGE w/o overrun protection. Need to be smarter, start smaller, and grow as needed. |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 691 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 692 | for (uint32_t i = 0; i < XGL_MAX_DESCRIPTOR_SETS; i++) { |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 693 | if (lastBoundDS[i]) { |
| 694 | DS_LL_HEAD *pDS = getDS(lastBoundDS[i]); |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 695 | XGL_UINT slotOffset = lastBoundSlotOffset[i]; |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 696 | if (pDS) { |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 697 | sprintf(tmp_str, "DS INFO : Slot bindings for DS[%u] (%p) - %u slots and slotOffset %u:\n", i, (void*)pDS->dsID, pDS->numSlots, slotOffset); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 698 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 699 | for (uint32_t j = 0; j < pDS->numSlots; j++) { |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 700 | switch (pDS->dsSlot[j].activeMapping) |
| 701 | { |
| 702 | case MAPPING_MEMORY: |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 703 | if (0 != skipUnusedCount) {// finish sequence of unused slots |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 704 | sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); |
| 705 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 706 | skipUnusedCount = 0; |
| 707 | } |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 708 | sprintf(tmp_str, "----Slot %u\n Mapped to Memory View %p:\n%s", j, (void*)&pDS->dsSlot[j].memView, xgl_print_xgl_memory_view_attach_info(&pDS->dsSlot[j].memView, " ")); |
| 709 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 710 | break; |
| 711 | case MAPPING_IMAGE: |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 712 | if (0 != skipUnusedCount) {// finish sequence of unused slots |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 713 | sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); |
| 714 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 715 | skipUnusedCount = 0; |
| 716 | } |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 717 | sprintf(tmp_str, "----Slot %u\n Mapped to Image View %p:\n%s", j, (void*)&pDS->dsSlot[j].imageView, xgl_print_xgl_image_view_attach_info(&pDS->dsSlot[j].imageView, " ")); |
| 718 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 719 | break; |
| 720 | case MAPPING_SAMPLER: |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 721 | if (0 != skipUnusedCount) {// finish sequence of unused slots |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 722 | sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); |
| 723 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 724 | skipUnusedCount = 0; |
| 725 | } |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 726 | sprintf(tmp_str, "----Slot %u\n Mapped to Sampler Object %p:\n%s", j, (void*)pDS->dsSlot[j].sampler, xgl_print_xgl_sampler_create_info(getSamplerCreateInfo(pDS->dsSlot[j].sampler), " ")); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 727 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 728 | break; |
| 729 | default: |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 730 | if (!skipUnusedCount) {// only report start of unused sequences |
| 731 | sprintf(tmp_str, "----Skipping slot(s) w/o a view attached...\n"); |
| 732 | strcat(ds_config_str, tmp_str); |
| 733 | } |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 734 | skipUnusedCount++; |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 735 | break; |
| 736 | } |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 737 | // For each shader type, check its mapping |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 738 | for (uint32_t k = 0; k < XGL_NUM_GRAPHICS_SHADERS; k++) { |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 739 | if (XGL_SLOT_UNUSED != pDS->dsSlot[j].shaderSlotInfo[k].slotObjectType) { |
Tobin Ehlis | 2609202 | 2014-11-20 09:49:17 -0700 | [diff] [blame] | 740 | sprintf(tmp_str, " Shader type %s has %s slot type mapping to shaderEntityIndex %u\n", string_XGL_PIPELINE_SHADER_STAGE(k), string_XGL_DESCRIPTOR_SET_SLOT_TYPE(pDS->dsSlot[j].shaderSlotInfo[k].slotObjectType), pDS->dsSlot[j].shaderSlotInfo[k].shaderEntityIndex); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 741 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | 9e3d753 | 2014-10-27 17:12:54 -0600 | [diff] [blame] | 742 | verifyShaderSlotMapping(j, pDS->dsSlot[j].activeMapping, k, pDS->dsSlot[j].shaderSlotInfo[k].slotObjectType); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 743 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 744 | } |
| 745 | } |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 746 | if (0 != skipUnusedCount) {// finish sequence of unused slots |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 747 | sprintf(tmp_str, "----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); |
| 748 | strcat(ds_config_str, tmp_str); |
Tobin Ehlis | 791a49c | 2014-11-10 12:29:12 -0700 | [diff] [blame] | 749 | skipUnusedCount = 0; |
| 750 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 751 | } |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 752 | else { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 753 | char str[1024]; |
| 754 | sprintf(str, "Can't find last bound DS %p. Did you need to bind DS to index %u?", (void*)lastBoundDS[i], i); |
| 755 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NO_DS_BOUND, "DS", str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 756 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 757 | } |
| 758 | } |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 759 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 760 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_NONE, "DS", ds_config_str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | static void synchAndPrintDSConfig() |
| 764 | { |
| 765 | synchDSMapping(); |
| 766 | printDSConfig(); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 767 | printPipeline(); |
| 768 | printDynamicState(); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | static void initLayerTable() |
| 772 | { |
| 773 | GetProcAddrType fpNextGPA; |
| 774 | fpNextGPA = pCurObj->pGPA; |
| 775 | assert(fpNextGPA); |
| 776 | |
| 777 | GetProcAddrType fpGetProcAddr = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetProcAddr"); |
| 778 | nextTable.GetProcAddr = fpGetProcAddr; |
| 779 | InitAndEnumerateGpusType fpInitAndEnumerateGpus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglInitAndEnumerateGpus"); |
| 780 | nextTable.InitAndEnumerateGpus = fpInitAndEnumerateGpus; |
| 781 | GetGpuInfoType fpGetGpuInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetGpuInfo"); |
| 782 | nextTable.GetGpuInfo = fpGetGpuInfo; |
| 783 | CreateDeviceType fpCreateDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDevice"); |
| 784 | nextTable.CreateDevice = fpCreateDevice; |
| 785 | DestroyDeviceType fpDestroyDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyDevice"); |
| 786 | nextTable.DestroyDevice = fpDestroyDevice; |
| 787 | GetExtensionSupportType fpGetExtensionSupport = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetExtensionSupport"); |
| 788 | nextTable.GetExtensionSupport = fpGetExtensionSupport; |
| 789 | EnumerateLayersType fpEnumerateLayers = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEnumerateLayers"); |
| 790 | nextTable.EnumerateLayers = fpEnumerateLayers; |
| 791 | GetDeviceQueueType fpGetDeviceQueue = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetDeviceQueue"); |
| 792 | nextTable.GetDeviceQueue = fpGetDeviceQueue; |
| 793 | QueueSubmitType fpQueueSubmit = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSubmit"); |
| 794 | nextTable.QueueSubmit = fpQueueSubmit; |
| 795 | QueueSetGlobalMemReferencesType fpQueueSetGlobalMemReferences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSetGlobalMemReferences"); |
| 796 | nextTable.QueueSetGlobalMemReferences = fpQueueSetGlobalMemReferences; |
| 797 | QueueWaitIdleType fpQueueWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueWaitIdle"); |
| 798 | nextTable.QueueWaitIdle = fpQueueWaitIdle; |
| 799 | DeviceWaitIdleType fpDeviceWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDeviceWaitIdle"); |
| 800 | nextTable.DeviceWaitIdle = fpDeviceWaitIdle; |
| 801 | GetMemoryHeapCountType fpGetMemoryHeapCount = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapCount"); |
| 802 | nextTable.GetMemoryHeapCount = fpGetMemoryHeapCount; |
| 803 | GetMemoryHeapInfoType fpGetMemoryHeapInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapInfo"); |
| 804 | nextTable.GetMemoryHeapInfo = fpGetMemoryHeapInfo; |
| 805 | AllocMemoryType fpAllocMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAllocMemory"); |
| 806 | nextTable.AllocMemory = fpAllocMemory; |
| 807 | FreeMemoryType fpFreeMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglFreeMemory"); |
| 808 | nextTable.FreeMemory = fpFreeMemory; |
| 809 | SetMemoryPriorityType fpSetMemoryPriority = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetMemoryPriority"); |
| 810 | nextTable.SetMemoryPriority = fpSetMemoryPriority; |
| 811 | MapMemoryType fpMapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglMapMemory"); |
| 812 | nextTable.MapMemory = fpMapMemory; |
| 813 | UnmapMemoryType fpUnmapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglUnmapMemory"); |
| 814 | nextTable.UnmapMemory = fpUnmapMemory; |
| 815 | PinSystemMemoryType fpPinSystemMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglPinSystemMemory"); |
| 816 | nextTable.PinSystemMemory = fpPinSystemMemory; |
| 817 | RemapVirtualMemoryPagesType fpRemapVirtualMemoryPages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglRemapVirtualMemoryPages"); |
| 818 | nextTable.RemapVirtualMemoryPages = fpRemapVirtualMemoryPages; |
| 819 | GetMultiGpuCompatibilityType fpGetMultiGpuCompatibility = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMultiGpuCompatibility"); |
| 820 | nextTable.GetMultiGpuCompatibility = fpGetMultiGpuCompatibility; |
| 821 | OpenSharedMemoryType fpOpenSharedMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedMemory"); |
| 822 | nextTable.OpenSharedMemory = fpOpenSharedMemory; |
| 823 | OpenSharedQueueSemaphoreType fpOpenSharedQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedQueueSemaphore"); |
| 824 | nextTable.OpenSharedQueueSemaphore = fpOpenSharedQueueSemaphore; |
| 825 | OpenPeerMemoryType fpOpenPeerMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerMemory"); |
| 826 | nextTable.OpenPeerMemory = fpOpenPeerMemory; |
| 827 | OpenPeerImageType fpOpenPeerImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerImage"); |
| 828 | nextTable.OpenPeerImage = fpOpenPeerImage; |
| 829 | DestroyObjectType fpDestroyObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyObject"); |
| 830 | nextTable.DestroyObject = fpDestroyObject; |
| 831 | GetObjectInfoType fpGetObjectInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetObjectInfo"); |
| 832 | nextTable.GetObjectInfo = fpGetObjectInfo; |
| 833 | BindObjectMemoryType fpBindObjectMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBindObjectMemory"); |
| 834 | nextTable.BindObjectMemory = fpBindObjectMemory; |
| 835 | CreateFenceType fpCreateFence = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateFence"); |
| 836 | nextTable.CreateFence = fpCreateFence; |
| 837 | GetFenceStatusType fpGetFenceStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFenceStatus"); |
| 838 | nextTable.GetFenceStatus = fpGetFenceStatus; |
| 839 | WaitForFencesType fpWaitForFences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitForFences"); |
| 840 | nextTable.WaitForFences = fpWaitForFences; |
| 841 | CreateQueueSemaphoreType fpCreateQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueueSemaphore"); |
| 842 | nextTable.CreateQueueSemaphore = fpCreateQueueSemaphore; |
| 843 | SignalQueueSemaphoreType fpSignalQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSignalQueueSemaphore"); |
| 844 | nextTable.SignalQueueSemaphore = fpSignalQueueSemaphore; |
| 845 | WaitQueueSemaphoreType fpWaitQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitQueueSemaphore"); |
| 846 | nextTable.WaitQueueSemaphore = fpWaitQueueSemaphore; |
| 847 | CreateEventType fpCreateEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateEvent"); |
| 848 | nextTable.CreateEvent = fpCreateEvent; |
| 849 | GetEventStatusType fpGetEventStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetEventStatus"); |
| 850 | nextTable.GetEventStatus = fpGetEventStatus; |
| 851 | SetEventType fpSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetEvent"); |
| 852 | nextTable.SetEvent = fpSetEvent; |
| 853 | ResetEventType fpResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetEvent"); |
| 854 | nextTable.ResetEvent = fpResetEvent; |
| 855 | CreateQueryPoolType fpCreateQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueryPool"); |
| 856 | nextTable.CreateQueryPool = fpCreateQueryPool; |
| 857 | GetQueryPoolResultsType fpGetQueryPoolResults = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetQueryPoolResults"); |
| 858 | nextTable.GetQueryPoolResults = fpGetQueryPoolResults; |
| 859 | GetFormatInfoType fpGetFormatInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFormatInfo"); |
| 860 | nextTable.GetFormatInfo = fpGetFormatInfo; |
| 861 | CreateImageType fpCreateImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImage"); |
| 862 | nextTable.CreateImage = fpCreateImage; |
| 863 | GetImageSubresourceInfoType fpGetImageSubresourceInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetImageSubresourceInfo"); |
| 864 | nextTable.GetImageSubresourceInfo = fpGetImageSubresourceInfo; |
| 865 | CreateImageViewType fpCreateImageView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImageView"); |
| 866 | nextTable.CreateImageView = fpCreateImageView; |
| 867 | CreateColorAttachmentViewType fpCreateColorAttachmentView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorAttachmentView"); |
| 868 | nextTable.CreateColorAttachmentView = fpCreateColorAttachmentView; |
| 869 | CreateDepthStencilViewType fpCreateDepthStencilView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilView"); |
| 870 | nextTable.CreateDepthStencilView = fpCreateDepthStencilView; |
| 871 | CreateShaderType fpCreateShader = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateShader"); |
| 872 | nextTable.CreateShader = fpCreateShader; |
| 873 | CreateGraphicsPipelineType fpCreateGraphicsPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateGraphicsPipeline"); |
| 874 | nextTable.CreateGraphicsPipeline = fpCreateGraphicsPipeline; |
| 875 | CreateComputePipelineType fpCreateComputePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateComputePipeline"); |
| 876 | nextTable.CreateComputePipeline = fpCreateComputePipeline; |
| 877 | StorePipelineType fpStorePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglStorePipeline"); |
| 878 | nextTable.StorePipeline = fpStorePipeline; |
| 879 | LoadPipelineType fpLoadPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglLoadPipeline"); |
| 880 | nextTable.LoadPipeline = fpLoadPipeline; |
| 881 | CreatePipelineDeltaType fpCreatePipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreatePipelineDelta"); |
| 882 | nextTable.CreatePipelineDelta = fpCreatePipelineDelta; |
| 883 | CreateSamplerType fpCreateSampler = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateSampler"); |
| 884 | nextTable.CreateSampler = fpCreateSampler; |
| 885 | CreateDescriptorSetType fpCreateDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDescriptorSet"); |
| 886 | nextTable.CreateDescriptorSet = fpCreateDescriptorSet; |
| 887 | BeginDescriptorSetUpdateType fpBeginDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginDescriptorSetUpdate"); |
| 888 | nextTable.BeginDescriptorSetUpdate = fpBeginDescriptorSetUpdate; |
| 889 | EndDescriptorSetUpdateType fpEndDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndDescriptorSetUpdate"); |
| 890 | nextTable.EndDescriptorSetUpdate = fpEndDescriptorSetUpdate; |
| 891 | AttachSamplerDescriptorsType fpAttachSamplerDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachSamplerDescriptors"); |
| 892 | nextTable.AttachSamplerDescriptors = fpAttachSamplerDescriptors; |
| 893 | AttachImageViewDescriptorsType fpAttachImageViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachImageViewDescriptors"); |
| 894 | nextTable.AttachImageViewDescriptors = fpAttachImageViewDescriptors; |
| 895 | AttachMemoryViewDescriptorsType fpAttachMemoryViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachMemoryViewDescriptors"); |
| 896 | nextTable.AttachMemoryViewDescriptors = fpAttachMemoryViewDescriptors; |
| 897 | AttachNestedDescriptorsType fpAttachNestedDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachNestedDescriptors"); |
| 898 | nextTable.AttachNestedDescriptors = fpAttachNestedDescriptors; |
| 899 | ClearDescriptorSetSlotsType fpClearDescriptorSetSlots = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglClearDescriptorSetSlots"); |
| 900 | nextTable.ClearDescriptorSetSlots = fpClearDescriptorSetSlots; |
| 901 | CreateViewportStateType fpCreateViewportState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateViewportState"); |
| 902 | nextTable.CreateViewportState = fpCreateViewportState; |
| 903 | CreateRasterStateType fpCreateRasterState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateRasterState"); |
| 904 | nextTable.CreateRasterState = fpCreateRasterState; |
| 905 | CreateMsaaStateType fpCreateMsaaState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateMsaaState"); |
| 906 | nextTable.CreateMsaaState = fpCreateMsaaState; |
| 907 | CreateColorBlendStateType fpCreateColorBlendState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorBlendState"); |
| 908 | nextTable.CreateColorBlendState = fpCreateColorBlendState; |
| 909 | CreateDepthStencilStateType fpCreateDepthStencilState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilState"); |
| 910 | nextTable.CreateDepthStencilState = fpCreateDepthStencilState; |
| 911 | CreateCommandBufferType fpCreateCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateCommandBuffer"); |
| 912 | nextTable.CreateCommandBuffer = fpCreateCommandBuffer; |
| 913 | BeginCommandBufferType fpBeginCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginCommandBuffer"); |
| 914 | nextTable.BeginCommandBuffer = fpBeginCommandBuffer; |
| 915 | EndCommandBufferType fpEndCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndCommandBuffer"); |
| 916 | nextTable.EndCommandBuffer = fpEndCommandBuffer; |
| 917 | ResetCommandBufferType fpResetCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetCommandBuffer"); |
| 918 | nextTable.ResetCommandBuffer = fpResetCommandBuffer; |
| 919 | CmdBindPipelineType fpCmdBindPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipeline"); |
| 920 | nextTable.CmdBindPipeline = fpCmdBindPipeline; |
| 921 | CmdBindPipelineDeltaType fpCmdBindPipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipelineDelta"); |
| 922 | nextTable.CmdBindPipelineDelta = fpCmdBindPipelineDelta; |
| 923 | CmdBindStateObjectType fpCmdBindStateObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindStateObject"); |
| 924 | nextTable.CmdBindStateObject = fpCmdBindStateObject; |
| 925 | CmdBindDescriptorSetType fpCmdBindDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDescriptorSet"); |
| 926 | nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet; |
| 927 | CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView"); |
| 928 | nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView; |
Chia-I Wu | 3b04af5 | 2014-11-08 10:48:20 +0800 | [diff] [blame] | 929 | CmdBindVertexDataType fpCmdBindVertexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindVertexData"); |
| 930 | nextTable.CmdBindVertexData = fpCmdBindVertexData; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 931 | CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData"); |
| 932 | nextTable.CmdBindIndexData = fpCmdBindIndexData; |
| 933 | CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments"); |
| 934 | nextTable.CmdBindAttachments = fpCmdBindAttachments; |
| 935 | CmdPrepareMemoryRegionsType fpCmdPrepareMemoryRegions = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareMemoryRegions"); |
| 936 | nextTable.CmdPrepareMemoryRegions = fpCmdPrepareMemoryRegions; |
| 937 | CmdPrepareImagesType fpCmdPrepareImages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareImages"); |
| 938 | nextTable.CmdPrepareImages = fpCmdPrepareImages; |
| 939 | CmdDrawType fpCmdDraw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDraw"); |
| 940 | nextTable.CmdDraw = fpCmdDraw; |
| 941 | CmdDrawIndexedType fpCmdDrawIndexed = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexed"); |
| 942 | nextTable.CmdDrawIndexed = fpCmdDrawIndexed; |
| 943 | CmdDrawIndirectType fpCmdDrawIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndirect"); |
| 944 | nextTable.CmdDrawIndirect = fpCmdDrawIndirect; |
| 945 | CmdDrawIndexedIndirectType fpCmdDrawIndexedIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexedIndirect"); |
| 946 | nextTable.CmdDrawIndexedIndirect = fpCmdDrawIndexedIndirect; |
| 947 | CmdDispatchType fpCmdDispatch = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatch"); |
| 948 | nextTable.CmdDispatch = fpCmdDispatch; |
| 949 | CmdDispatchIndirectType fpCmdDispatchIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatchIndirect"); |
| 950 | nextTable.CmdDispatchIndirect = fpCmdDispatchIndirect; |
| 951 | CmdCopyMemoryType fpCmdCopyMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemory"); |
| 952 | nextTable.CmdCopyMemory = fpCmdCopyMemory; |
| 953 | CmdCopyImageType fpCmdCopyImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImage"); |
| 954 | nextTable.CmdCopyImage = fpCmdCopyImage; |
| 955 | CmdCopyMemoryToImageType fpCmdCopyMemoryToImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemoryToImage"); |
| 956 | nextTable.CmdCopyMemoryToImage = fpCmdCopyMemoryToImage; |
| 957 | CmdCopyImageToMemoryType fpCmdCopyImageToMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImageToMemory"); |
| 958 | nextTable.CmdCopyImageToMemory = fpCmdCopyImageToMemory; |
| 959 | CmdCloneImageDataType fpCmdCloneImageData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCloneImageData"); |
| 960 | nextTable.CmdCloneImageData = fpCmdCloneImageData; |
| 961 | CmdUpdateMemoryType fpCmdUpdateMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdUpdateMemory"); |
| 962 | nextTable.CmdUpdateMemory = fpCmdUpdateMemory; |
| 963 | CmdFillMemoryType fpCmdFillMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdFillMemory"); |
| 964 | nextTable.CmdFillMemory = fpCmdFillMemory; |
| 965 | CmdClearColorImageType fpCmdClearColorImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImage"); |
| 966 | nextTable.CmdClearColorImage = fpCmdClearColorImage; |
| 967 | CmdClearColorImageRawType fpCmdClearColorImageRaw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImageRaw"); |
| 968 | nextTable.CmdClearColorImageRaw = fpCmdClearColorImageRaw; |
| 969 | CmdClearDepthStencilType fpCmdClearDepthStencil = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearDepthStencil"); |
| 970 | nextTable.CmdClearDepthStencil = fpCmdClearDepthStencil; |
| 971 | CmdResolveImageType fpCmdResolveImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResolveImage"); |
| 972 | nextTable.CmdResolveImage = fpCmdResolveImage; |
| 973 | CmdSetEventType fpCmdSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSetEvent"); |
| 974 | nextTable.CmdSetEvent = fpCmdSetEvent; |
| 975 | CmdResetEventType fpCmdResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetEvent"); |
| 976 | nextTable.CmdResetEvent = fpCmdResetEvent; |
| 977 | CmdMemoryAtomicType fpCmdMemoryAtomic = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdMemoryAtomic"); |
| 978 | nextTable.CmdMemoryAtomic = fpCmdMemoryAtomic; |
| 979 | CmdBeginQueryType fpCmdBeginQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBeginQuery"); |
| 980 | nextTable.CmdBeginQuery = fpCmdBeginQuery; |
| 981 | CmdEndQueryType fpCmdEndQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdEndQuery"); |
| 982 | nextTable.CmdEndQuery = fpCmdEndQuery; |
| 983 | CmdResetQueryPoolType fpCmdResetQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetQueryPool"); |
| 984 | nextTable.CmdResetQueryPool = fpCmdResetQueryPool; |
| 985 | CmdWriteTimestampType fpCmdWriteTimestamp = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdWriteTimestamp"); |
| 986 | nextTable.CmdWriteTimestamp = fpCmdWriteTimestamp; |
| 987 | CmdInitAtomicCountersType fpCmdInitAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdInitAtomicCounters"); |
| 988 | nextTable.CmdInitAtomicCounters = fpCmdInitAtomicCounters; |
| 989 | CmdLoadAtomicCountersType fpCmdLoadAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdLoadAtomicCounters"); |
| 990 | nextTable.CmdLoadAtomicCounters = fpCmdLoadAtomicCounters; |
| 991 | CmdSaveAtomicCountersType fpCmdSaveAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSaveAtomicCounters"); |
| 992 | nextTable.CmdSaveAtomicCounters = fpCmdSaveAtomicCounters; |
| 993 | DbgSetValidationLevelType fpDbgSetValidationLevel = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetValidationLevel"); |
| 994 | nextTable.DbgSetValidationLevel = fpDbgSetValidationLevel; |
| 995 | DbgRegisterMsgCallbackType fpDbgRegisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgRegisterMsgCallback"); |
| 996 | nextTable.DbgRegisterMsgCallback = fpDbgRegisterMsgCallback; |
| 997 | DbgUnregisterMsgCallbackType fpDbgUnregisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgUnregisterMsgCallback"); |
| 998 | nextTable.DbgUnregisterMsgCallback = fpDbgUnregisterMsgCallback; |
| 999 | DbgSetMessageFilterType fpDbgSetMessageFilter = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetMessageFilter"); |
| 1000 | nextTable.DbgSetMessageFilter = fpDbgSetMessageFilter; |
| 1001 | DbgSetObjectTagType fpDbgSetObjectTag = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetObjectTag"); |
| 1002 | nextTable.DbgSetObjectTag = fpDbgSetObjectTag; |
| 1003 | DbgSetGlobalOptionType fpDbgSetGlobalOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetGlobalOption"); |
| 1004 | nextTable.DbgSetGlobalOption = fpDbgSetGlobalOption; |
| 1005 | DbgSetDeviceOptionType fpDbgSetDeviceOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetDeviceOption"); |
| 1006 | nextTable.DbgSetDeviceOption = fpDbgSetDeviceOption; |
| 1007 | CmdDbgMarkerBeginType fpCmdDbgMarkerBegin = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerBegin"); |
| 1008 | nextTable.CmdDbgMarkerBegin = fpCmdDbgMarkerBegin; |
| 1009 | CmdDbgMarkerEndType fpCmdDbgMarkerEnd = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerEnd"); |
| 1010 | nextTable.CmdDbgMarkerEnd = fpCmdDbgMarkerEnd; |
| 1011 | WsiX11AssociateConnectionType fpWsiX11AssociateConnection = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11AssociateConnection"); |
| 1012 | nextTable.WsiX11AssociateConnection = fpWsiX11AssociateConnection; |
| 1013 | WsiX11GetMSCType fpWsiX11GetMSC = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11GetMSC"); |
| 1014 | nextTable.WsiX11GetMSC = fpWsiX11GetMSC; |
| 1015 | WsiX11CreatePresentableImageType fpWsiX11CreatePresentableImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11CreatePresentableImage"); |
| 1016 | nextTable.WsiX11CreatePresentableImage = fpWsiX11CreatePresentableImage; |
| 1017 | WsiX11QueuePresentType fpWsiX11QueuePresent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11QueuePresent"); |
| 1018 | nextTable.WsiX11QueuePresent = fpWsiX11QueuePresent; |
| 1019 | } |
| 1020 | |
| 1021 | |
| 1022 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1023 | { |
| 1024 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1025 | pCurObj = gpuw; |
| 1026 | pthread_once(&tabOnce, initLayerTable); |
| 1027 | XGL_RESULT result = nextTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1028 | return result; |
| 1029 | } |
| 1030 | |
| 1031 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice) |
| 1032 | { |
| 1033 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1034 | pCurObj = gpuw; |
| 1035 | pthread_once(&tabOnce, initLayerTable); |
| 1036 | XGL_RESULT result = nextTable.CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1037 | return result; |
| 1038 | } |
| 1039 | |
| 1040 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(XGL_DEVICE device) |
| 1041 | { |
| 1042 | XGL_RESULT result = nextTable.DestroyDevice(device); |
| 1043 | return result; |
| 1044 | } |
| 1045 | |
| 1046 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pExtName) |
| 1047 | { |
| 1048 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1049 | pCurObj = gpuw; |
| 1050 | pthread_once(&tabOnce, initLayerTable); |
| 1051 | XGL_RESULT result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1052 | return result; |
| 1053 | } |
| 1054 | |
Jon Ashburn | 6847c2b | 2014-11-25 12:56:49 -0700 | [diff] [blame] | 1055 | 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 | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1056 | { |
Jon Ashburn | 451c16f | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 1057 | if (gpu != NULL) |
| 1058 | { |
| 1059 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 1060 | pCurObj = gpuw; |
| 1061 | pthread_once(&tabOnce, initLayerTable); |
Jon Ashburn | 6847c2b | 2014-11-25 12:56:49 -0700 | [diff] [blame] | 1062 | XGL_RESULT result = nextTable.EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount, pReserved); |
Jon Ashburn | 451c16f | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 1063 | return result; |
| 1064 | } else |
| 1065 | { |
| 1066 | if (pOutLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL) |
| 1067 | return XGL_ERROR_INVALID_POINTER; |
| 1068 | // This layer compatible with all GPUs |
| 1069 | *pOutLayerCount = 1; |
Tobin Ehlis | 907a052 | 2014-11-25 16:59:27 -0700 | [diff] [blame] | 1070 | strncpy(pOutLayers[0], "DrawState", maxStringSize); |
Jon Ashburn | 451c16f | 2014-11-25 11:08:42 -0700 | [diff] [blame] | 1071 | return XGL_SUCCESS; |
| 1072 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1073 | } |
| 1074 | |
| 1075 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetDeviceQueue(XGL_DEVICE device, XGL_QUEUE_TYPE queueType, XGL_UINT queueIndex, XGL_QUEUE* pQueue) |
| 1076 | { |
| 1077 | XGL_RESULT result = nextTable.GetDeviceQueue(device, queueType, queueIndex, pQueue); |
| 1078 | return result; |
| 1079 | } |
| 1080 | |
| 1081 | 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) |
| 1082 | { |
| 1083 | XGL_RESULT result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, memRefCount, pMemRefs, fence); |
| 1084 | return result; |
| 1085 | } |
| 1086 | |
| 1087 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSetGlobalMemReferences(XGL_QUEUE queue, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs) |
| 1088 | { |
| 1089 | XGL_RESULT result = nextTable.QueueSetGlobalMemReferences(queue, memRefCount, pMemRefs); |
| 1090 | return result; |
| 1091 | } |
| 1092 | |
| 1093 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueWaitIdle(XGL_QUEUE queue) |
| 1094 | { |
| 1095 | XGL_RESULT result = nextTable.QueueWaitIdle(queue); |
| 1096 | return result; |
| 1097 | } |
| 1098 | |
| 1099 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device) |
| 1100 | { |
| 1101 | XGL_RESULT result = nextTable.DeviceWaitIdle(device); |
| 1102 | return result; |
| 1103 | } |
| 1104 | |
| 1105 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount) |
| 1106 | { |
| 1107 | XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount); |
| 1108 | return result; |
| 1109 | } |
| 1110 | |
| 1111 | 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) |
| 1112 | { |
| 1113 | XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData); |
| 1114 | return result; |
| 1115 | } |
| 1116 | |
| 1117 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem) |
| 1118 | { |
| 1119 | XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem); |
| 1120 | return result; |
| 1121 | } |
| 1122 | |
| 1123 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglFreeMemory(XGL_GPU_MEMORY mem) |
| 1124 | { |
| 1125 | XGL_RESULT result = nextTable.FreeMemory(mem); |
| 1126 | return result; |
| 1127 | } |
| 1128 | |
| 1129 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetMemoryPriority(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority) |
| 1130 | { |
| 1131 | XGL_RESULT result = nextTable.SetMemoryPriority(mem, priority); |
| 1132 | return result; |
| 1133 | } |
| 1134 | |
| 1135 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglMapMemory(XGL_GPU_MEMORY mem, XGL_FLAGS flags, XGL_VOID** ppData) |
| 1136 | { |
| 1137 | XGL_RESULT result = nextTable.MapMemory(mem, flags, ppData); |
| 1138 | return result; |
| 1139 | } |
| 1140 | |
| 1141 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglUnmapMemory(XGL_GPU_MEMORY mem) |
| 1142 | { |
| 1143 | XGL_RESULT result = nextTable.UnmapMemory(mem); |
| 1144 | return result; |
| 1145 | } |
| 1146 | |
| 1147 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglPinSystemMemory(XGL_DEVICE device, const XGL_VOID* pSysMem, XGL_SIZE memSize, XGL_GPU_MEMORY* pMem) |
| 1148 | { |
| 1149 | XGL_RESULT result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem); |
| 1150 | return result; |
| 1151 | } |
| 1152 | |
| 1153 | 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) |
| 1154 | { |
| 1155 | XGL_RESULT result = nextTable.RemapVirtualMemoryPages(device, rangeCount, pRanges, preWaitSemaphoreCount, pPreWaitSemaphores, postSignalSemaphoreCount, pPostSignalSemaphores); |
| 1156 | return result; |
| 1157 | } |
| 1158 | |
| 1159 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMultiGpuCompatibility(XGL_PHYSICAL_GPU gpu0, XGL_PHYSICAL_GPU gpu1, XGL_GPU_COMPATIBILITY_INFO* pInfo) |
| 1160 | { |
| 1161 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu0; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1162 | pCurObj = gpuw; |
| 1163 | pthread_once(&tabOnce, initLayerTable); |
| 1164 | XGL_RESULT result = nextTable.GetMultiGpuCompatibility((XGL_PHYSICAL_GPU)gpuw->nextObject, gpu1, pInfo); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1165 | return result; |
| 1166 | } |
| 1167 | |
| 1168 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedMemory(XGL_DEVICE device, const XGL_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) |
| 1169 | { |
| 1170 | XGL_RESULT result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem); |
| 1171 | return result; |
| 1172 | } |
| 1173 | |
| 1174 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) |
| 1175 | { |
| 1176 | XGL_RESULT result = nextTable.OpenSharedQueueSemaphore(device, pOpenInfo, pSemaphore); |
| 1177 | return result; |
| 1178 | } |
| 1179 | |
| 1180 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerMemory(XGL_DEVICE device, const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) |
| 1181 | { |
| 1182 | XGL_RESULT result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem); |
| 1183 | return result; |
| 1184 | } |
| 1185 | |
| 1186 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerImage(XGL_DEVICE device, const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem) |
| 1187 | { |
| 1188 | XGL_RESULT result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem); |
| 1189 | return result; |
| 1190 | } |
| 1191 | |
| 1192 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyObject(XGL_OBJECT object) |
| 1193 | { |
| 1194 | XGL_RESULT result = nextTable.DestroyObject(object); |
| 1195 | return result; |
| 1196 | } |
| 1197 | |
| 1198 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetObjectInfo(XGL_BASE_OBJECT object, XGL_OBJECT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1199 | { |
| 1200 | XGL_RESULT result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); |
| 1201 | return result; |
| 1202 | } |
| 1203 | |
| 1204 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBindObjectMemory(XGL_OBJECT object, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) |
| 1205 | { |
| 1206 | XGL_RESULT result = nextTable.BindObjectMemory(object, mem, offset); |
| 1207 | return result; |
| 1208 | } |
| 1209 | |
| 1210 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateFence(XGL_DEVICE device, const XGL_FENCE_CREATE_INFO* pCreateInfo, XGL_FENCE* pFence) |
| 1211 | { |
| 1212 | XGL_RESULT result = nextTable.CreateFence(device, pCreateInfo, pFence); |
| 1213 | return result; |
| 1214 | } |
| 1215 | |
| 1216 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFenceStatus(XGL_FENCE fence) |
| 1217 | { |
| 1218 | XGL_RESULT result = nextTable.GetFenceStatus(fence); |
| 1219 | return result; |
| 1220 | } |
| 1221 | |
| 1222 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitForFences(XGL_DEVICE device, XGL_UINT fenceCount, const XGL_FENCE* pFences, XGL_BOOL waitAll, XGL_UINT64 timeout) |
| 1223 | { |
| 1224 | XGL_RESULT result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 1225 | return result; |
| 1226 | } |
| 1227 | |
| 1228 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) |
| 1229 | { |
| 1230 | XGL_RESULT result = nextTable.CreateQueueSemaphore(device, pCreateInfo, pSemaphore); |
| 1231 | return result; |
| 1232 | } |
| 1233 | |
| 1234 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSignalQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) |
| 1235 | { |
| 1236 | XGL_RESULT result = nextTable.SignalQueueSemaphore(queue, semaphore); |
| 1237 | return result; |
| 1238 | } |
| 1239 | |
| 1240 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) |
| 1241 | { |
| 1242 | XGL_RESULT result = nextTable.WaitQueueSemaphore(queue, semaphore); |
| 1243 | return result; |
| 1244 | } |
| 1245 | |
| 1246 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateEvent(XGL_DEVICE device, const XGL_EVENT_CREATE_INFO* pCreateInfo, XGL_EVENT* pEvent) |
| 1247 | { |
| 1248 | XGL_RESULT result = nextTable.CreateEvent(device, pCreateInfo, pEvent); |
| 1249 | return result; |
| 1250 | } |
| 1251 | |
| 1252 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetEventStatus(XGL_EVENT event) |
| 1253 | { |
| 1254 | XGL_RESULT result = nextTable.GetEventStatus(event); |
| 1255 | return result; |
| 1256 | } |
| 1257 | |
| 1258 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetEvent(XGL_EVENT event) |
| 1259 | { |
| 1260 | XGL_RESULT result = nextTable.SetEvent(event); |
| 1261 | return result; |
| 1262 | } |
| 1263 | |
| 1264 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetEvent(XGL_EVENT event) |
| 1265 | { |
| 1266 | XGL_RESULT result = nextTable.ResetEvent(event); |
| 1267 | return result; |
| 1268 | } |
| 1269 | |
| 1270 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueryPool(XGL_DEVICE device, const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo, XGL_QUERY_POOL* pQueryPool) |
| 1271 | { |
| 1272 | XGL_RESULT result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool); |
| 1273 | return result; |
| 1274 | } |
| 1275 | |
| 1276 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetQueryPoolResults(XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1277 | { |
| 1278 | XGL_RESULT result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData); |
| 1279 | return result; |
| 1280 | } |
| 1281 | |
| 1282 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1283 | { |
| 1284 | XGL_RESULT result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData); |
| 1285 | return result; |
| 1286 | } |
| 1287 | |
| 1288 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImage(XGL_DEVICE device, const XGL_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage) |
| 1289 | { |
| 1290 | XGL_RESULT result = nextTable.CreateImage(device, pCreateInfo, pImage); |
| 1291 | return result; |
| 1292 | } |
| 1293 | |
| 1294 | 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) |
| 1295 | { |
| 1296 | XGL_RESULT result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData); |
| 1297 | return result; |
| 1298 | } |
| 1299 | |
| 1300 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImageView(XGL_DEVICE device, const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, XGL_IMAGE_VIEW* pView) |
| 1301 | { |
| 1302 | XGL_RESULT result = nextTable.CreateImageView(device, pCreateInfo, pView); |
| 1303 | return result; |
| 1304 | } |
| 1305 | |
| 1306 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorAttachmentView(XGL_DEVICE device, const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, XGL_COLOR_ATTACHMENT_VIEW* pView) |
| 1307 | { |
| 1308 | XGL_RESULT result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView); |
| 1309 | return result; |
| 1310 | } |
| 1311 | |
| 1312 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilView(XGL_DEVICE device, const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_VIEW* pView) |
| 1313 | { |
| 1314 | XGL_RESULT result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView); |
| 1315 | return result; |
| 1316 | } |
| 1317 | |
| 1318 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateShader(XGL_DEVICE device, const XGL_SHADER_CREATE_INFO* pCreateInfo, XGL_SHADER* pShader) |
| 1319 | { |
| 1320 | XGL_RESULT result = nextTable.CreateShader(device, pCreateInfo, pShader); |
| 1321 | return result; |
| 1322 | } |
| 1323 | |
| 1324 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) |
| 1325 | { |
| 1326 | XGL_RESULT result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline); |
| 1327 | // Create LL HEAD for this Pipeline |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1328 | char str[1024]; |
| 1329 | sprintf(str, "Created Gfx Pipeline %p", (void*)*pPipeline); |
| 1330 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pPipeline, 0, DRAWSTATE_NONE, "DS", str); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1331 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1332 | PIPELINE_NODE *pTrav = pPipelineHead; |
| 1333 | if (pTrav) { |
| 1334 | while (pTrav->pNext) |
| 1335 | pTrav = pTrav->pNext; |
| 1336 | pTrav->pNext = (PIPELINE_NODE*)malloc(sizeof(PIPELINE_NODE)); |
| 1337 | pTrav = pTrav->pNext; |
| 1338 | } |
| 1339 | else { |
| 1340 | pTrav = (PIPELINE_NODE*)malloc(sizeof(PIPELINE_NODE)); |
| 1341 | pPipelineHead = pTrav; |
| 1342 | } |
| 1343 | memset((void*)pTrav, 0, sizeof(PIPELINE_NODE)); |
| 1344 | pTrav->pipeline = *pPipeline; |
| 1345 | initPipeline(pTrav, pCreateInfo); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1346 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1347 | return result; |
| 1348 | } |
| 1349 | |
| 1350 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateComputePipeline(XGL_DEVICE device, const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) |
| 1351 | { |
| 1352 | XGL_RESULT result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline); |
| 1353 | return result; |
| 1354 | } |
| 1355 | |
| 1356 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglStorePipeline(XGL_PIPELINE pipeline, XGL_SIZE* pDataSize, XGL_VOID* pData) |
| 1357 | { |
| 1358 | XGL_RESULT result = nextTable.StorePipeline(pipeline, pDataSize, pData); |
| 1359 | return result; |
| 1360 | } |
| 1361 | |
| 1362 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLoadPipeline(XGL_DEVICE device, XGL_SIZE dataSize, const XGL_VOID* pData, XGL_PIPELINE* pPipeline) |
| 1363 | { |
| 1364 | XGL_RESULT result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline); |
| 1365 | return result; |
| 1366 | } |
| 1367 | |
| 1368 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreatePipelineDelta(XGL_DEVICE device, XGL_PIPELINE p1, XGL_PIPELINE p2, XGL_PIPELINE_DELTA* delta) |
| 1369 | { |
| 1370 | XGL_RESULT result = nextTable.CreatePipelineDelta(device, p1, p2, delta); |
| 1371 | return result; |
| 1372 | } |
| 1373 | |
| 1374 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateSampler(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler) |
| 1375 | { |
| 1376 | XGL_RESULT result = nextTable.CreateSampler(device, pCreateInfo, pSampler); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1377 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 5a1d9f3 | 2014-11-20 10:48:56 -0700 | [diff] [blame] | 1378 | SAMPLER_NODE *pNewNode = (SAMPLER_NODE*)malloc(sizeof(SAMPLER_NODE)); |
| 1379 | pNewNode->sampler = *pSampler; |
| 1380 | memcpy(&pNewNode->createInfo, pCreateInfo, sizeof(XGL_SAMPLER_CREATE_INFO)); |
| 1381 | pNewNode->pNext = pSamplerHead; |
| 1382 | pSamplerHead = pNewNode; |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1383 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1384 | return result; |
| 1385 | } |
| 1386 | |
| 1387 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSet(XGL_DEVICE device, const XGL_DESCRIPTOR_SET_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET* pDescriptorSet) |
| 1388 | { |
| 1389 | XGL_RESULT result = nextTable.CreateDescriptorSet(device, pCreateInfo, pDescriptorSet); |
| 1390 | // Create LL chain |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1391 | char str[1024]; |
| 1392 | sprintf(str, "Created Descriptor Set (DS) %p", (void*)*pDescriptorSet); |
| 1393 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pDescriptorSet, 0, DRAWSTATE_NONE, "DS", str); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1394 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1395 | DS_LL_HEAD *pTrav = pDSHead; |
| 1396 | if (pTrav) { |
| 1397 | // Grow existing list |
| 1398 | while (pTrav->pNextDS) |
| 1399 | pTrav = pTrav->pNextDS; |
| 1400 | pTrav->pNextDS = (DS_LL_HEAD*)malloc(sizeof(DS_LL_HEAD)); |
| 1401 | pTrav = pTrav->pNextDS; |
| 1402 | } |
| 1403 | else { // Create new list |
| 1404 | pTrav = (DS_LL_HEAD*)malloc(sizeof(DS_LL_HEAD)); |
| 1405 | pDSHead = pTrav; |
| 1406 | } |
| 1407 | pTrav->dsSlot = (DS_SLOT*)malloc(sizeof(DS_SLOT) * pCreateInfo->slots); |
| 1408 | pTrav->dsID = *pDescriptorSet; |
| 1409 | pTrav->numSlots = pCreateInfo->slots; |
| 1410 | pTrav->pNextDS = NULL; |
| 1411 | pTrav->updateActive = XGL_FALSE; |
| 1412 | initDS(pTrav); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1413 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1414 | return result; |
| 1415 | } |
| 1416 | |
| 1417 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglBeginDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) |
| 1418 | { |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 1419 | DS_LL_HEAD* pDS = getDS(descriptorSet); |
| 1420 | if (!pDS) { |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1421 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1422 | char str[1024]; |
| 1423 | sprintf(str, "Specified Descriptor Set %p does not exist!", (void*)descriptorSet); |
| 1424 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_INVALID_DS, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1425 | } |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 1426 | else { |
| 1427 | pDS->updateActive = XGL_TRUE; |
| 1428 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1429 | nextTable.BeginDescriptorSetUpdate(descriptorSet); |
| 1430 | } |
| 1431 | |
| 1432 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglEndDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) |
| 1433 | { |
| 1434 | if (!dsUpdate(descriptorSet)) { |
| 1435 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1436 | char str[1024]; |
| 1437 | sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglEndDescriptorSetUpdate()!", (void*)descriptorSet); |
| 1438 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_END_WITHOUT_BEGIN, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1439 | } |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 1440 | else { |
| 1441 | DS_LL_HEAD* pDS = getDS(descriptorSet); |
| 1442 | if (!pDS) { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1443 | char str[1024]; |
| 1444 | sprintf(str, "Specified Descriptor Set %p does not exist!", (void*)descriptorSet); |
| 1445 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_INVALID_DS, "DS", str); |
Tobin Ehlis | 0f051a5 | 2014-10-24 13:03:56 -0600 | [diff] [blame] | 1446 | } |
| 1447 | else { |
| 1448 | pDS->updateActive = XGL_FALSE; |
| 1449 | } |
| 1450 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1451 | nextTable.EndDescriptorSetUpdate(descriptorSet); |
| 1452 | } |
| 1453 | |
| 1454 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachSamplerDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers) |
| 1455 | { |
| 1456 | if (!dsUpdate(descriptorSet)) { |
| 1457 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1458 | char str[1024]; |
| 1459 | sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet); |
| 1460 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1461 | } |
| 1462 | else { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1463 | if (!dsSamplerMapping(descriptorSet, startSlot, slotCount, pSamplers)) { |
| 1464 | char str[1024]; |
| 1465 | sprintf(str, "Unable to attach sampler descriptors to DS %p!", (void*)descriptorSet); |
| 1466 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_SAMPLE_ATTACH_FAILED, "DS", str); |
| 1467 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1468 | } |
| 1469 | nextTable.AttachSamplerDescriptors(descriptorSet, startSlot, slotCount, pSamplers); |
| 1470 | } |
| 1471 | |
| 1472 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachImageViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews) |
| 1473 | { |
| 1474 | if (!dsUpdate(descriptorSet)) { |
| 1475 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1476 | char str[1024]; |
| 1477 | sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet); |
| 1478 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1479 | } |
| 1480 | else { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1481 | if (!dsImageMapping(descriptorSet, startSlot, slotCount, pImageViews)) { |
| 1482 | char str[1024]; |
| 1483 | sprintf(str, "Unable to attach image view descriptors to DS %p!", (void*)descriptorSet); |
| 1484 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_IMAGE_ATTACH_FAILED, "DS", str); |
| 1485 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1486 | } |
| 1487 | nextTable.AttachImageViewDescriptors(descriptorSet, startSlot, slotCount, pImageViews); |
| 1488 | } |
| 1489 | |
| 1490 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachMemoryViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews) |
| 1491 | { |
| 1492 | if (!dsUpdate(descriptorSet)) { |
| 1493 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1494 | char str[1024]; |
| 1495 | sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet); |
| 1496 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1497 | } |
| 1498 | else { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1499 | if (!dsMemMapping(descriptorSet, startSlot, slotCount, pMemViews)) { |
| 1500 | char str[1024]; |
| 1501 | sprintf(str, "Unable to attach memory view descriptors to DS %p!", (void*)descriptorSet); |
| 1502 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_MEMORY_ATTACH_FAILED, "DS", str); |
| 1503 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1504 | } |
| 1505 | nextTable.AttachMemoryViewDescriptors(descriptorSet, startSlot, slotCount, pMemViews); |
| 1506 | } |
| 1507 | |
| 1508 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachNestedDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_DESCRIPTOR_SET_ATTACH_INFO* pNestedDescriptorSets) |
| 1509 | { |
| 1510 | if (!dsUpdate(descriptorSet)) { |
| 1511 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1512 | char str[1024]; |
| 1513 | sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglAttachSamplerDescriptors()!", (void*)descriptorSet); |
| 1514 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1515 | } |
| 1516 | nextTable.AttachNestedDescriptors(descriptorSet, startSlot, slotCount, pNestedDescriptorSets); |
| 1517 | } |
| 1518 | |
| 1519 | // TODO : Does xglBeginDescriptorSetUpdate() have to be called before this function? |
| 1520 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglClearDescriptorSetSlots(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount) |
| 1521 | { |
| 1522 | if (!dsUpdate(descriptorSet)) { |
| 1523 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1524 | char str[1024]; |
| 1525 | sprintf(str, "You must call xglBeginDescriptorSetUpdate(%p) before this call to xglClearDescriptorSetSlots()!", (void*)descriptorSet); |
| 1526 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_DS_ATTACH_WITHOUT_BEGIN, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1527 | } |
| 1528 | if (!clearDS(descriptorSet, startSlot, slotCount)) { |
| 1529 | // TODO : This is where we should flag a REAL error |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1530 | char str[1024]; |
| 1531 | sprintf(str, "Unable to perform xglClearDescriptorSetSlots(%p, %u, %u) call!", descriptorSet, startSlot, slotCount); |
| 1532 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_CLEAR_DS_FAILED, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1533 | } |
| 1534 | nextTable.ClearDescriptorSetSlots(descriptorSet, startSlot, slotCount); |
| 1535 | } |
| 1536 | |
| 1537 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateViewportState(XGL_DEVICE device, const XGL_VIEWPORT_STATE_CREATE_INFO* pCreateInfo, XGL_VIEWPORT_STATE_OBJECT* pState) |
| 1538 | { |
| 1539 | XGL_RESULT result = nextTable.CreateViewportState(device, pCreateInfo, pState); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 1540 | insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_VIEWPORT); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1541 | return result; |
| 1542 | } |
| 1543 | |
| 1544 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateRasterState(XGL_DEVICE device, const XGL_RASTER_STATE_CREATE_INFO* pCreateInfo, XGL_RASTER_STATE_OBJECT* pState) |
| 1545 | { |
| 1546 | XGL_RESULT result = nextTable.CreateRasterState(device, pCreateInfo, pState); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 1547 | insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_RASTER); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1548 | return result; |
| 1549 | } |
| 1550 | |
| 1551 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateMsaaState(XGL_DEVICE device, const XGL_MSAA_STATE_CREATE_INFO* pCreateInfo, XGL_MSAA_STATE_OBJECT* pState) |
| 1552 | { |
| 1553 | XGL_RESULT result = nextTable.CreateMsaaState(device, pCreateInfo, pState); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 1554 | insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_MSAA); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1555 | return result; |
| 1556 | } |
| 1557 | |
| 1558 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorBlendState(XGL_DEVICE device, const XGL_COLOR_BLEND_STATE_CREATE_INFO* pCreateInfo, XGL_COLOR_BLEND_STATE_OBJECT* pState) |
| 1559 | { |
| 1560 | XGL_RESULT result = nextTable.CreateColorBlendState(device, pCreateInfo, pState); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 1561 | insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_COLOR_BLEND); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1562 | return result; |
| 1563 | } |
| 1564 | |
| 1565 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilState(XGL_DEVICE device, const XGL_DEPTH_STENCIL_STATE_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_STATE_OBJECT* pState) |
| 1566 | { |
| 1567 | XGL_RESULT result = nextTable.CreateDepthStencilState(device, pCreateInfo, pState); |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 1568 | insertDynamicState(*pState, (PIPELINE_LL_HEADER*)pCreateInfo, XGL_STATE_BIND_DEPTH_STENCIL); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1569 | return result; |
| 1570 | } |
| 1571 | |
| 1572 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo, XGL_CMD_BUFFER* pCmdBuffer) |
| 1573 | { |
| 1574 | XGL_RESULT result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); |
| 1575 | return result; |
| 1576 | } |
| 1577 | |
| 1578 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBeginCommandBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_FLAGS flags) |
| 1579 | { |
| 1580 | XGL_RESULT result = nextTable.BeginCommandBuffer(cmdBuffer, flags); |
| 1581 | return result; |
| 1582 | } |
| 1583 | |
| 1584 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEndCommandBuffer(XGL_CMD_BUFFER cmdBuffer) |
| 1585 | { |
| 1586 | XGL_RESULT result = nextTable.EndCommandBuffer(cmdBuffer); |
| 1587 | return result; |
| 1588 | } |
| 1589 | |
| 1590 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetCommandBuffer(XGL_CMD_BUFFER cmdBuffer) |
| 1591 | { |
| 1592 | XGL_RESULT result = nextTable.ResetCommandBuffer(cmdBuffer); |
| 1593 | return result; |
| 1594 | } |
| 1595 | |
| 1596 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipeline(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline) |
| 1597 | { |
| 1598 | if (getPipeline(pipeline)) { |
| 1599 | lastBoundPipeline = pipeline; |
| 1600 | } |
| 1601 | else { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1602 | char str[1024]; |
| 1603 | sprintf(str, "Attempt to bind Pipeline %p that doesn't exist!", (void*)pipeline); |
| 1604 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pipeline, 0, DRAWSTATE_INVALID_PIPELINE, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1605 | } |
| 1606 | nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline); |
| 1607 | } |
| 1608 | |
| 1609 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipelineDelta(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE_DELTA delta) |
| 1610 | { |
| 1611 | nextTable.CmdBindPipelineDelta(cmdBuffer, pipelineBindPoint, delta); |
| 1612 | } |
| 1613 | |
| 1614 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindStateObject(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_STATE_OBJECT state) |
| 1615 | { |
Tobin Ehlis | 56a6107 | 2014-11-21 08:58:46 -0700 | [diff] [blame] | 1616 | setLastBoundDynamicState(state, stateBindPoint); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1617 | nextTable.CmdBindStateObject(cmdBuffer, stateBindPoint, state); |
| 1618 | } |
| 1619 | |
| 1620 | 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) |
| 1621 | { |
| 1622 | if (getDS(descriptorSet)) { |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 1623 | assert(index < XGL_MAX_DESCRIPTOR_SETS); |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1624 | pthread_mutex_lock(&globalLock); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1625 | lastBoundDS[index] = descriptorSet; |
Tobin Ehlis | eacc64f | 2014-11-24 17:09:09 -0700 | [diff] [blame] | 1626 | lastBoundSlotOffset[index] = slotOffset; |
Tobin Ehlis | 9e142a3 | 2014-11-21 12:04:39 -0700 | [diff] [blame^] | 1627 | pthread_mutex_unlock(&globalLock); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1628 | char str[1024]; |
| 1629 | sprintf(str, "DS %p bound to DS index %u on pipeline %s", (void*)descriptorSet, index, string_XGL_PIPELINE_BIND_POINT(pipelineBindPoint)); |
| 1630 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_NONE, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1631 | } |
| 1632 | else { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1633 | char str[1024]; |
| 1634 | sprintf(str, "Attempt to bind DS %p that doesn't exist!", (void*)descriptorSet); |
| 1635 | layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, descriptorSet, 0, DRAWSTATE_INVALID_DS, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1636 | } |
| 1637 | nextTable.CmdBindDescriptorSet(cmdBuffer, pipelineBindPoint, index, descriptorSet, slotOffset); |
| 1638 | } |
| 1639 | |
| 1640 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDynamicMemoryView(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView) |
| 1641 | { |
| 1642 | nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView); |
| 1643 | } |
| 1644 | |
Chia-I Wu | 3b04af5 | 2014-11-08 10:48:20 +0800 | [diff] [blame] | 1645 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindVertexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding) |
| 1646 | { |
Tobin Ehlis | 1affd3c | 2014-11-25 10:24:15 -0700 | [diff] [blame] | 1647 | lastVtxBinding = binding; |
Chia-I Wu | 3b04af5 | 2014-11-08 10:48:20 +0800 | [diff] [blame] | 1648 | nextTable.CmdBindVertexData(cmdBuffer, mem, offset, binding); |
| 1649 | } |
| 1650 | |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1651 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType) |
| 1652 | { |
| 1653 | nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType); |
| 1654 | } |
| 1655 | |
| 1656 | 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) |
| 1657 | { |
| 1658 | nextTable.CmdBindAttachments(cmdBuffer, colorAttachmentCount, pColorAttachments, pDepthStencilAttachment); |
| 1659 | } |
| 1660 | |
| 1661 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareMemoryRegions(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_MEMORY_STATE_TRANSITION* pStateTransitions) |
| 1662 | { |
| 1663 | nextTable.CmdPrepareMemoryRegions(cmdBuffer, transitionCount, pStateTransitions); |
| 1664 | } |
| 1665 | |
| 1666 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareImages(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_IMAGE_STATE_TRANSITION* pStateTransitions) |
| 1667 | { |
| 1668 | nextTable.CmdPrepareImages(cmdBuffer, transitionCount, pStateTransitions); |
| 1669 | } |
| 1670 | |
| 1671 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDraw(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstVertex, XGL_UINT vertexCount, XGL_UINT firstInstance, XGL_UINT instanceCount) |
| 1672 | { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1673 | char str[1024]; |
| 1674 | sprintf(str, "xglCmdDraw() call #%lu, reporting DS state:", drawCount[DRAW]++); |
| 1675 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1676 | synchAndPrintDSConfig(); |
| 1677 | nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); |
| 1678 | } |
| 1679 | |
| 1680 | 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) |
| 1681 | { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1682 | char str[1024]; |
Tobin Ehlis | 6208641 | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1683 | sprintf(str, "xglCmdDrawIndexed() call #%lu, reporting DS state:", drawCount[DRAW_INDEXED]++); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1684 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 1685 | synchAndPrintDSConfig(); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1686 | nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); |
| 1687 | } |
| 1688 | |
| 1689 | 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) |
| 1690 | { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1691 | char str[1024]; |
Tobin Ehlis | 6208641 | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1692 | sprintf(str, "xglCmdDrawIndirect() call #%lu, reporting DS state:", drawCount[DRAW_INDIRECT]++); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1693 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 1694 | synchAndPrintDSConfig(); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1695 | nextTable.CmdDrawIndirect(cmdBuffer, mem, offset, count, stride); |
| 1696 | } |
| 1697 | |
| 1698 | 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) |
| 1699 | { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1700 | char str[1024]; |
Tobin Ehlis | 6208641 | 2014-11-19 16:19:28 -0700 | [diff] [blame] | 1701 | sprintf(str, "xglCmdDrawIndexedIndirect() call #%lu, reporting DS state:", drawCount[DRAW_INDEXED_INDIRECT]++); |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1702 | layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_NONE, "DS", str); |
Tobin Ehlis | b815498 | 2014-10-27 14:53:17 -0600 | [diff] [blame] | 1703 | synchAndPrintDSConfig(); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1704 | nextTable.CmdDrawIndexedIndirect(cmdBuffer, mem, offset, count, stride); |
| 1705 | } |
| 1706 | |
| 1707 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatch(XGL_CMD_BUFFER cmdBuffer, XGL_UINT x, XGL_UINT y, XGL_UINT z) |
| 1708 | { |
| 1709 | nextTable.CmdDispatch(cmdBuffer, x, y, z); |
| 1710 | } |
| 1711 | |
| 1712 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatchIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) |
| 1713 | { |
| 1714 | nextTable.CmdDispatchIndirect(cmdBuffer, mem, offset); |
| 1715 | } |
| 1716 | |
| 1717 | 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) |
| 1718 | { |
| 1719 | nextTable.CmdCopyMemory(cmdBuffer, srcMem, destMem, regionCount, pRegions); |
| 1720 | } |
| 1721 | |
| 1722 | 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) |
| 1723 | { |
| 1724 | nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions); |
| 1725 | } |
| 1726 | |
| 1727 | 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) |
| 1728 | { |
| 1729 | nextTable.CmdCopyMemoryToImage(cmdBuffer, srcMem, destImage, regionCount, pRegions); |
| 1730 | } |
| 1731 | |
| 1732 | 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) |
| 1733 | { |
| 1734 | nextTable.CmdCopyImageToMemory(cmdBuffer, srcImage, destMem, regionCount, pRegions); |
| 1735 | } |
| 1736 | |
| 1737 | 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) |
| 1738 | { |
| 1739 | nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageState, destImage, destImageState); |
| 1740 | } |
| 1741 | |
| 1742 | 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) |
| 1743 | { |
| 1744 | nextTable.CmdUpdateMemory(cmdBuffer, destMem, destOffset, dataSize, pData); |
| 1745 | } |
| 1746 | |
| 1747 | 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) |
| 1748 | { |
| 1749 | nextTable.CmdFillMemory(cmdBuffer, destMem, destOffset, fillSize, data); |
| 1750 | } |
| 1751 | |
| 1752 | 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) |
| 1753 | { |
| 1754 | nextTable.CmdClearColorImage(cmdBuffer, image, color, rangeCount, pRanges); |
| 1755 | } |
| 1756 | |
| 1757 | 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) |
| 1758 | { |
| 1759 | nextTable.CmdClearColorImageRaw(cmdBuffer, image, color, rangeCount, pRanges); |
| 1760 | } |
| 1761 | |
| 1762 | 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) |
| 1763 | { |
| 1764 | nextTable.CmdClearDepthStencil(cmdBuffer, image, depth, stencil, rangeCount, pRanges); |
| 1765 | } |
| 1766 | |
| 1767 | 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) |
| 1768 | { |
| 1769 | nextTable.CmdResolveImage(cmdBuffer, srcImage, destImage, rectCount, pRects); |
| 1770 | } |
| 1771 | |
| 1772 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) |
| 1773 | { |
| 1774 | nextTable.CmdSetEvent(cmdBuffer, event); |
| 1775 | } |
| 1776 | |
| 1777 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) |
| 1778 | { |
| 1779 | nextTable.CmdResetEvent(cmdBuffer, event); |
| 1780 | } |
| 1781 | |
| 1782 | 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) |
| 1783 | { |
| 1784 | nextTable.CmdMemoryAtomic(cmdBuffer, destMem, destOffset, srcData, atomicOp); |
| 1785 | } |
| 1786 | |
| 1787 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBeginQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot, XGL_FLAGS flags) |
| 1788 | { |
| 1789 | nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags); |
| 1790 | } |
| 1791 | |
| 1792 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdEndQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot) |
| 1793 | { |
| 1794 | nextTable.CmdEndQuery(cmdBuffer, queryPool, slot); |
| 1795 | } |
| 1796 | |
| 1797 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetQueryPool(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount) |
| 1798 | { |
| 1799 | nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount); |
| 1800 | } |
| 1801 | |
| 1802 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdWriteTimestamp(XGL_CMD_BUFFER cmdBuffer, XGL_TIMESTAMP_TYPE timestampType, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset) |
| 1803 | { |
| 1804 | nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destMem, destOffset); |
| 1805 | } |
| 1806 | |
| 1807 | 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) |
| 1808 | { |
| 1809 | nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData); |
| 1810 | } |
| 1811 | |
| 1812 | 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) |
| 1813 | { |
| 1814 | nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcMem, srcOffset); |
| 1815 | } |
| 1816 | |
| 1817 | 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) |
| 1818 | { |
| 1819 | nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destMem, destOffset); |
| 1820 | } |
| 1821 | |
| 1822 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetValidationLevel(XGL_DEVICE device, XGL_VALIDATION_LEVEL validationLevel) |
| 1823 | { |
| 1824 | XGL_RESULT result = nextTable.DbgSetValidationLevel(device, validationLevel); |
| 1825 | return result; |
| 1826 | } |
| 1827 | |
| 1828 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgRegisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, XGL_VOID* pUserData) |
| 1829 | { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1830 | // This layer intercepts callbacks |
| 1831 | XGL_LAYER_DBG_FUNCTION_NODE *pNewDbgFuncNode = (XGL_LAYER_DBG_FUNCTION_NODE*)malloc(sizeof(XGL_LAYER_DBG_FUNCTION_NODE)); |
| 1832 | if (!pNewDbgFuncNode) |
| 1833 | return XGL_ERROR_OUT_OF_MEMORY; |
| 1834 | pNewDbgFuncNode->pfnMsgCallback = pfnMsgCallback; |
| 1835 | pNewDbgFuncNode->pUserData = pUserData; |
| 1836 | pNewDbgFuncNode->pNext = pDbgFunctionHead; |
| 1837 | pDbgFunctionHead = pNewDbgFuncNode; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1838 | XGL_RESULT result = nextTable.DbgRegisterMsgCallback(pfnMsgCallback, pUserData); |
| 1839 | return result; |
| 1840 | } |
| 1841 | |
| 1842 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgUnregisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback) |
| 1843 | { |
Tobin Ehlis | e79df94 | 2014-11-18 16:38:08 -0700 | [diff] [blame] | 1844 | XGL_LAYER_DBG_FUNCTION_NODE *pTrav = pDbgFunctionHead; |
| 1845 | XGL_LAYER_DBG_FUNCTION_NODE *pPrev = pTrav; |
| 1846 | while (pTrav) { |
| 1847 | if (pTrav->pfnMsgCallback == pfnMsgCallback) { |
| 1848 | pPrev->pNext = pTrav->pNext; |
| 1849 | if (pDbgFunctionHead == pTrav) |
| 1850 | pDbgFunctionHead = pTrav->pNext; |
| 1851 | free(pTrav); |
| 1852 | break; |
| 1853 | } |
| 1854 | pPrev = pTrav; |
| 1855 | pTrav = pTrav->pNext; |
| 1856 | } |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1857 | XGL_RESULT result = nextTable.DbgUnregisterMsgCallback(pfnMsgCallback); |
| 1858 | return result; |
| 1859 | } |
| 1860 | |
| 1861 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetMessageFilter(XGL_DEVICE device, XGL_INT msgCode, XGL_DBG_MSG_FILTER filter) |
| 1862 | { |
| 1863 | XGL_RESULT result = nextTable.DbgSetMessageFilter(device, msgCode, filter); |
| 1864 | return result; |
| 1865 | } |
| 1866 | |
| 1867 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetObjectTag(XGL_BASE_OBJECT object, XGL_SIZE tagSize, const XGL_VOID* pTag) |
| 1868 | { |
| 1869 | XGL_RESULT result = nextTable.DbgSetObjectTag(object, tagSize, pTag); |
| 1870 | return result; |
| 1871 | } |
| 1872 | |
| 1873 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(XGL_DBG_GLOBAL_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) |
| 1874 | { |
| 1875 | XGL_RESULT result = nextTable.DbgSetGlobalOption(dbgOption, dataSize, pData); |
| 1876 | return result; |
| 1877 | } |
| 1878 | |
| 1879 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetDeviceOption(XGL_DEVICE device, XGL_DBG_DEVICE_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) |
| 1880 | { |
| 1881 | XGL_RESULT result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData); |
| 1882 | return result; |
| 1883 | } |
| 1884 | |
| 1885 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerBegin(XGL_CMD_BUFFER cmdBuffer, const XGL_CHAR* pMarker) |
| 1886 | { |
| 1887 | nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker); |
| 1888 | } |
| 1889 | |
| 1890 | XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerEnd(XGL_CMD_BUFFER cmdBuffer) |
| 1891 | { |
| 1892 | nextTable.CmdDbgMarkerEnd(cmdBuffer); |
| 1893 | } |
| 1894 | |
| 1895 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11AssociateConnection(XGL_PHYSICAL_GPU gpu, const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo) |
| 1896 | { |
| 1897 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1898 | pCurObj = gpuw; |
| 1899 | pthread_once(&tabOnce, initLayerTable); |
| 1900 | XGL_RESULT result = nextTable.WsiX11AssociateConnection((XGL_PHYSICAL_GPU)gpuw->nextObject, pConnectionInfo); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1901 | return result; |
| 1902 | } |
| 1903 | |
Chia-I Wu | 6204f34 | 2014-11-07 13:33:45 +0800 | [diff] [blame] | 1904 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11GetMSC(XGL_DEVICE device, xcb_window_t window, xcb_randr_crtc_t crtc, XGL_UINT64* pMsc) |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1905 | { |
Chia-I Wu | 6204f34 | 2014-11-07 13:33:45 +0800 | [diff] [blame] | 1906 | XGL_RESULT result = nextTable.WsiX11GetMSC(device, window, crtc, pMsc); |
Tobin Ehlis | 8726b9f | 2014-10-24 12:01:45 -0600 | [diff] [blame] | 1907 | return result; |
| 1908 | } |
| 1909 | |
| 1910 | 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) |
| 1911 | { |
| 1912 | XGL_RESULT result = nextTable.WsiX11CreatePresentableImage(device, pCreateInfo, pImage, pMem); |
| 1913 | return result; |
| 1914 | } |
| 1915 | |
| 1916 | XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent(XGL_QUEUE queue, const XGL_WSI_X11_PRESENT_INFO* pPresentInfo, XGL_FENCE fence) |
| 1917 | { |
| 1918 | XGL_RESULT result = nextTable.WsiX11QueuePresent(queue, pPresentInfo, fence); |
| 1919 | return result; |
| 1920 | } |
| 1921 | |
| 1922 | XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* funcName) |
| 1923 | { |
| 1924 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 1925 | if (gpu == NULL) |
| 1926 | return NULL; |
| 1927 | pCurObj = gpuw; |
| 1928 | pthread_once(&tabOnce, initLayerTable); |
| 1929 | |
| 1930 | if (!strncmp("xglGetProcAddr", (const char *) funcName, sizeof("xglGetProcAddr"))) |
| 1931 | return xglGetProcAddr; |
| 1932 | else if (!strncmp("xglInitAndEnumerateGpus", (const char *) funcName, sizeof("xglInitAndEnumerateGpus"))) |
| 1933 | return nextTable.InitAndEnumerateGpus; |
| 1934 | else if (!strncmp("xglGetGpuInfo", (const char *) funcName, sizeof("xglGetGpuInfo"))) |
| 1935 | return xglGetGpuInfo; |
| 1936 | else if (!strncmp("xglCreateDevice", (const char *) funcName, sizeof("xglCreateDevice"))) |
| 1937 | return xglCreateDevice; |
| 1938 | else if (!strncmp("xglDestroyDevice", (const char *) funcName, sizeof("xglDestroyDevice"))) |
| 1939 | return xglDestroyDevice; |
| 1940 | else if (!strncmp("xglGetExtensionSupport", (const char *) funcName, sizeof("xglGetExtensionSupport"))) |
| 1941 | return xglGetExtensionSupport; |
| 1942 | else if (!strncmp("xglEnumerateLayers", (const char *) funcName, sizeof("xglEnumerateLayers"))) |
| 1943 | return xglEnumerateLayers; |
| 1944 | else if (!strncmp("xglGetDeviceQueue", (const char *) funcName, sizeof("xglGetDeviceQueue"))) |
| 1945 | return xglGetDeviceQueue; |
| 1946 | else if (!strncmp("xglQueueSubmit", (const char *) funcName, sizeof("xglQueueSubmit"))) |
| 1947 | return xglQueueSubmit; |
| 1948 | else if (!strncmp("xglQueueSetGlobalMemReferences", (const char *) funcName, sizeof("xglQueueSetGlobalMemReferences"))) |
| 1949 | return xglQueueSetGlobalMemReferences; |
| 1950 | else if (!strncmp("xglQueueWaitIdle", (const char *) funcName, sizeof("xglQueueWaitIdle"))) |
| 1951 | return xglQueueWaitIdle; |
| 1952 | else if (!strncmp("xglDeviceWaitIdle", (const char *) funcName, sizeof("xglDeviceWaitIdle"))) |
| 1953 | return xglDeviceWaitIdle; |
| 1954 | else if (!strncmp("xglGetMemoryHeapCount", (const char *) funcName, sizeof("xglGetMemoryHeapCount"))) |
| 1955 | return xglGetMemoryHeapCount; |
| 1956 | else if (!strncmp("xglGetMemoryHeapInfo", (const char *) funcName, sizeof("xglGetMemoryHeapInfo"))) |
| 1957 | return xglGetMemoryHeapInfo; |
| 1958 | else if (!strncmp("xglAllocMemory", (const char *) funcName, sizeof("xglAllocMemory"))) |
| 1959 | return xglAllocMemory; |
| 1960 | else if (!strncmp("xglFreeMemory", (const char *) funcName, sizeof("xglFreeMemory"))) |
| 1961 | return xglFreeMemory; |
| 1962 | else if (!strncmp("xglSetMemoryPriority", (const char *) funcName, sizeof("xglSetMemoryPriority"))) |
| 1963 | return xglSetMemoryPriority; |
| 1964 | else if (!strncmp("xglMapMemory", (const char *) funcName, sizeof("xglMapMemory"))) |
| 1965 | return xglMapMemory; |
| 1966 | else if (!strncmp("xglUnmapMemory", (const char *) funcName, sizeof("xglUnmapMemory"))) |
| 1967 | return xglUnmapMemory; |
| 1968 | else if (!strncmp("xglPinSystemMemory", (const char *) funcName, sizeof("xglPinSystemMemory"))) |
| 1969 | return xglPinSystemMemory; |
| 1970 | else if (!strncmp("xglRemapVirtualMemoryPages", (const char *) funcName, sizeof("xglRemapVirtualMemoryPages"))) |
| 1971 | return xglRemapVirtualMemoryPages; |
| 1972 | else if (!strncmp("xglGetMultiGpuCompatibility", (const char *) funcName, sizeof("xglGetMultiGpuCompatibility"))) |
| 1973 | return xglGetMultiGpuCompatibility; |
| 1974 | else if (!strncmp("xglOpenSharedMemory", (const char *) funcName, sizeof("xglOpenSharedMemory"))) |
| 1975 | return xglOpenSharedMemory; |
| 1976 | else if (!strncmp("xglOpenSharedQueueSemaphore", (const char *) funcName, sizeof("xglOpenSharedQueueSemaphore"))) |
| 1977 | return xglOpenSharedQueueSemaphore; |
| 1978 | else if (!strncmp("xglOpenPeerMemory", (const char *) funcName, sizeof("xglOpenPeerMemory"))) |
| 1979 | return xglOpenPeerMemory; |
| 1980 | else if (!strncmp("xglOpenPeerImage", (const char *) funcName, sizeof("xglOpenPeerImage"))) |
| 1981 | return xglOpenPeerImage; |
| 1982 | else if (!strncmp("xglDestroyObject", (const char *) funcName, sizeof("xglDestroyObject"))) |
| 1983 | return xglDestroyObject; |
| 1984 | else if (!strncmp("xglGetObjectInfo", (const char *) funcName, sizeof("xglGetObjectInfo"))) |
| 1985 | return xglGetObjectInfo; |
| 1986 | else if (!strncmp("xglBindObjectMemory", (const char *) funcName, sizeof("xglBindObjectMemory"))) |
| 1987 | return xglBindObjectMemory; |
| 1988 | else if (!strncmp("xglCreateFence", (const char *) funcName, sizeof("xglCreateFence"))) |
| 1989 | return xglCreateFence; |
| 1990 | else if (!strncmp("xglGetFenceStatus", (const char *) funcName, sizeof("xglGetFenceStatus"))) |
| 1991 | return xglGetFenceStatus; |
| 1992 | else if (!strncmp("xglWaitForFences", (const char *) funcName, sizeof("xglWaitForFences"))) |
| 1993 | return xglWaitForFences; |
| 1994 | else if (!strncmp("xglCreateQueueSemaphore", (const char *) funcName, sizeof("xglCreateQueueSemaphore"))) |
| 1995 | return xglCreateQueueSemaphore; |
| 1996 | else if (!strncmp("xglSignalQueueSemaphore", (const char *) funcName, sizeof("xglSignalQueueSemaphore"))) |
| 1997 | return xglSignalQueueSemaphore; |
| 1998 | else if (!strncmp("xglWaitQueueSemaphore", (const char *) funcName, sizeof("xglWaitQueueSemaphore"))) |
| 1999 | return xglWaitQueueSemaphore; |
| 2000 | else if (!strncmp("xglCreateEvent", (const char *) funcName, sizeof("xglCreateEvent"))) |
| 2001 | return xglCreateEvent; |
| 2002 | else if (!strncmp("xglGetEventStatus", (const char *) funcName, sizeof("xglGetEventStatus"))) |
| 2003 | return xglGetEventStatus; |
| 2004 | else if (!strncmp("xglSetEvent", (const char *) funcName, sizeof("xglSetEvent"))) |
| 2005 | return xglSetEvent; |
| 2006 | else if (!strncmp("xglResetEvent", (const char *) funcName, sizeof("xglResetEvent"))) |
| 2007 | return xglResetEvent; |
| 2008 | else if (!strncmp("xglCreateQueryPool", (const char *) funcName, sizeof("xglCreateQueryPool"))) |
| 2009 | return xglCreateQueryPool; |
| 2010 | else if (!strncmp("xglGetQueryPoolResults", (const char *) funcName, sizeof("xglGetQueryPoolResults"))) |
| 2011 | return xglGetQueryPoolResults; |
| 2012 | else if (!strncmp("xglGetFormatInfo", (const char *) funcName, sizeof("xglGetFormatInfo"))) |
| 2013 | return xglGetFormatInfo; |
| 2014 | else if (!strncmp("xglCreateImage", (const char *) funcName, sizeof("xglCreateImage"))) |
| 2015 | return xglCreateImage; |
| 2016 | else if (!strncmp("xglGetImageSubresourceInfo", (const char *) funcName, sizeof("xglGetImageSubresourceInfo"))) |
| 2017 | return xglGetImageSubresourceInfo; |
| 2018 | else if (!strncmp("xglCreateImageView", (const char *) funcName, sizeof("xglCreateImageView"))) |
| 2019 | return xglCreateImageView; |
| 2020 | else if (!strncmp("xglCreateColorAttachmentView", (const char *) funcName, sizeof("xglCreateColorAttachmentView"))) |
| 2021 | return xglCreateColorAttachmentView; |
| 2022 | else if (!strncmp("xglCreateDepthStencilView", (const char *) funcName, sizeof("xglCreateDepthStencilView"))) |
| 2023 | return xglCreateDepthStencilView; |
| 2024 | else if (!strncmp("xglCreateShader", (const char *) funcName, sizeof("xglCreateShader"))) |
| 2025 | return xglCreateShader; |
| 2026 | else if (!strncmp("xglCreateGraphicsPipeline", (const char *) funcName, sizeof("xglCreateGraphicsPipeline"))) |
| 2027 | return xglCreateGraphicsPipeline; |
| 2028 | else if (!strncmp("xglCreateComputePipeline", (const char *) funcName, sizeof("xglCreateComputePipeline"))) |
| 2029 | return xglCreateComputePipeline; |
| 2030 | else if (!strncmp("xglStorePipeline", (const char *) funcName, sizeof("xglStorePipeline"))) |
| 2031 | return xglStorePipeline; |
| 2032 | else if (!strncmp("xglLoadPipeline", (const char *) funcName, sizeof("xglLoadPipeline"))) |
| 2033 | return xglLoadPipeline; |
| 2034 | else if (!strncmp("xglCreatePipelineDelta", (const char *) funcName, sizeof("xglCreatePipelineDelta"))) |
| 2035 | return xglCreatePipelineDelta; |
| 2036 | else if (!strncmp("xglCreateSampler", (const char *) funcName, sizeof("xglCreateSampler"))) |
| 2037 | return xglCreateSampler; |
| 2038 | else if (!strncmp("xglCreateDescriptorSet", (const char *) funcName, sizeof("xglCreateDescriptorSet"))) |
| 2039 | return xglCreateDescriptorSet; |
| 2040 | else if (!strncmp("xglBeginDescriptorSetUpdate", (const char *) funcName, sizeof("xglBeginDescriptorSetUpdate"))) |
| 2041 | return xglBeginDescriptorSetUpdate; |
| 2042 | else if (!strncmp("xglEndDescriptorSetUpdate", (const char *) funcName, sizeof("xglEndDescriptorSetUpdate"))) |
| 2043 | return xglEndDescriptorSetUpdate; |
| 2044 | else if (!strncmp("xglAttachSamplerDescriptors", (const char *) funcName, sizeof("xglAttachSamplerDescriptors"))) |
| 2045 | return xglAttachSamplerDescriptors; |
| 2046 | else if (!strncmp("xglAttachImageViewDescriptors", (const char *) funcName, sizeof("xglAttachImageViewDescriptors"))) |
| 2047 | return xglAttachImageViewDescriptors; |
| 2048 | else if (!strncmp("xglAttachMemoryViewDescriptors", (const char *) funcName, sizeof("xglAttachMemoryViewDescriptors"))) |
| 2049 | return xglAttachMemoryViewDescriptors; |
| 2050 | else if (!strncmp("xglAttachNestedDescriptors", (const char *) funcName, sizeof("xglAttachNestedDescriptors"))) |
| 2051 | return xglAttachNestedDescriptors; |
| 2052 | else if (!strncmp("xglClearDescriptorSetSlots", (const char *) funcName, sizeof("xglClearDescriptorSetSlots"))) |
| 2053 | return xglClearDescriptorSetSlots; |
| 2054 | else if (!strncmp("xglCreateViewportState", (const char *) funcName, sizeof("xglCreateViewportState"))) |
| 2055 | return xglCreateViewportState; |
| 2056 | else if (!strncmp("xglCreateRasterState", (const char *) funcName, sizeof("xglCreateRasterState"))) |
| 2057 | return xglCreateRasterState; |
| 2058 | else if (!strncmp("xglCreateMsaaState", (const char *) funcName, sizeof("xglCreateMsaaState"))) |
| 2059 | return xglCreateMsaaState; |
| 2060 | else if (!strncmp("xglCreateColorBlendState", (const char *) funcName, sizeof("xglCreateColorBlendState"))) |
| 2061 | return xglCreateColorBlendState; |
| 2062 | else if (!strncmp("xglCreateDepthStencilState", (const char *) funcName, sizeof("xglCreateDepthStencilState"))) |
| 2063 | return xglCreateDepthStencilState; |
| 2064 | else if (!strncmp("xglCreateCommandBuffer", (const char *) funcName, sizeof("xglCreateCommandBuffer"))) |
| 2065 | return xglCreateCommandBuffer; |
| 2066 | else if (!strncmp("xglBeginCommandBuffer", (const char *) funcName, sizeof("xglBeginCommandBuffer"))) |
| 2067 | return xglBeginCommandBuffer; |
| 2068 | else if (!strncmp("xglEndCommandBuffer", (const char *) funcName, sizeof("xglEndCommandBuffer"))) |
| 2069 | return xglEndCommandBuffer; |
| 2070 | else if (!strncmp("xglResetCommandBuffer", (const char *) funcName, sizeof("xglResetCommandBuffer"))) |
| 2071 | return xglResetCommandBuffer; |
| 2072 | else if (!strncmp("xglCmdBindPipeline", (const char *) funcName, sizeof("xglCmdBindPipeline"))) |
| 2073 | return xglCmdBindPipeline; |
| 2074 | else if (!strncmp("xglCmdBindPipelineDelta", (const char *) funcName, sizeof("xglCmdBindPipelineDelta"))) |
| 2075 | return xglCmdBindPipelineDelta; |
| 2076 | else if (!strncmp("xglCmdBindStateObject", (const char *) funcName, sizeof("xglCmdBindStateObject"))) |
| 2077 | return xglCmdBindStateObject; |
| 2078 | else if (!strncmp("xglCmdBindDescriptorSet", (const char *) funcName, sizeof("xglCmdBindDescriptorSet"))) |
| 2079 | return xglCmdBindDescriptorSet; |
| 2080 | else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) funcName, sizeof("xglCmdBindDynamicMemoryView"))) |
| 2081 | return xglCmdBindDynamicMemoryView; |
| 2082 | else if (!strncmp("xglCmdBindIndexData", (const char *) funcName, sizeof("xglCmdBindIndexData"))) |
| 2083 | return xglCmdBindIndexData; |
| 2084 | else if (!strncmp("xglCmdBindAttachments", (const char *) funcName, sizeof("xglCmdBindAttachments"))) |
| 2085 | return xglCmdBindAttachments; |
| 2086 | else if (!strncmp("xglCmdPrepareMemoryRegions", (const char *) funcName, sizeof("xglCmdPrepareMemoryRegions"))) |
| 2087 | return xglCmdPrepareMemoryRegions; |
| 2088 | else if (!strncmp("xglCmdPrepareImages", (const char *) funcName, sizeof("xglCmdPrepareImages"))) |
| 2089 | return xglCmdPrepareImages; |
| 2090 | else if (!strncmp("xglCmdDraw", (const char *) funcName, sizeof("xglCmdDraw"))) |
| 2091 | return xglCmdDraw; |
| 2092 | else if (!strncmp("xglCmdDrawIndexed", (const char *) funcName, sizeof("xglCmdDrawIndexed"))) |
| 2093 | return xglCmdDrawIndexed; |
| 2094 | else if (!strncmp("xglCmdDrawIndirect", (const char *) funcName, sizeof("xglCmdDrawIndirect"))) |
| 2095 | return xglCmdDrawIndirect; |
| 2096 | else if (!strncmp("xglCmdDrawIndexedIndirect", (const char *) funcName, sizeof("xglCmdDrawIndexedIndirect"))) |
| 2097 | return xglCmdDrawIndexedIndirect; |
| 2098 | else if (!strncmp("xglCmdDispatch", (const char *) funcName, sizeof("xglCmdDispatch"))) |
| 2099 | return xglCmdDispatch; |
| 2100 | else if (!strncmp("xglCmdDispatchIndirect", (const char *) funcName, sizeof("xglCmdDispatchIndirect"))) |
| 2101 | return xglCmdDispatchIndirect; |
| 2102 | else if (!strncmp("xglCmdCopyMemory", (const char *) funcName, sizeof("xglCmdCopyMemory"))) |
| 2103 | return xglCmdCopyMemory; |
| 2104 | else if (!strncmp("xglCmdCopyImage", (const char *) funcName, sizeof("xglCmdCopyImage"))) |
| 2105 | return xglCmdCopyImage; |
| 2106 | else if (!strncmp("xglCmdCopyMemoryToImage", (const char *) funcName, sizeof("xglCmdCopyMemoryToImage"))) |
| 2107 | return xglCmdCopyMemoryToImage; |
| 2108 | else if (!strncmp("xglCmdCopyImageToMemory", (const char *) funcName, sizeof("xglCmdCopyImageToMemory"))) |
| 2109 | return xglCmdCopyImageToMemory; |
| 2110 | else if (!strncmp("xglCmdCloneImageData", (const char *) funcName, sizeof("xglCmdCloneImageData"))) |
| 2111 | return xglCmdCloneImageData; |
| 2112 | else if (!strncmp("xglCmdUpdateMemory", (const char *) funcName, sizeof("xglCmdUpdateMemory"))) |
| 2113 | return xglCmdUpdateMemory; |
| 2114 | else if (!strncmp("xglCmdFillMemory", (const char *) funcName, sizeof("xglCmdFillMemory"))) |
| 2115 | return xglCmdFillMemory; |
| 2116 | else if (!strncmp("xglCmdClearColorImage", (const char *) funcName, sizeof("xglCmdClearColorImage"))) |
| 2117 | return xglCmdClearColorImage; |
| 2118 | else if (!strncmp("xglCmdClearColorImageRaw", (const char *) funcName, sizeof("xglCmdClearColorImageRaw"))) |
| 2119 | return xglCmdClearColorImageRaw; |
| 2120 | else if (!strncmp("xglCmdClearDepthStencil", (const char *) funcName, sizeof("xglCmdClearDepthStencil"))) |
| 2121 | return xglCmdClearDepthStencil; |
| 2122 | else if (!strncmp("xglCmdResolveImage", (const char *) funcName, sizeof("xglCmdResolveImage"))) |
| 2123 | return xglCmdResolveImage; |
| 2124 | else if (!strncmp("xglCmdSetEvent", (const char *) funcName, sizeof("xglCmdSetEvent"))) |
| 2125 | return xglCmdSetEvent; |
| 2126 | else if (!strncmp("xglCmdResetEvent", (const char *) funcName, sizeof("xglCmdResetEvent"))) |
| 2127 | return xglCmdResetEvent; |
| 2128 | else if (!strncmp("xglCmdMemoryAtomic", (const char *) funcName, sizeof("xglCmdMemoryAtomic"))) |
| 2129 | return xglCmdMemoryAtomic; |
| 2130 | else if (!strncmp("xglCmdBeginQuery", (const char *) funcName, sizeof("xglCmdBeginQuery"))) |
| 2131 | return xglCmdBeginQuery; |
| 2132 | else if (!strncmp("xglCmdEndQuery", (const char *) funcName, sizeof("xglCmdEndQuery"))) |
| 2133 | return xglCmdEndQuery; |
| 2134 | else if (!strncmp("xglCmdResetQueryPool", (const char *) funcName, sizeof("xglCmdResetQueryPool"))) |
| 2135 | return xglCmdResetQueryPool; |
| 2136 | else if (!strncmp("xglCmdWriteTimestamp", (const char *) funcName, sizeof("xglCmdWriteTimestamp"))) |
| 2137 | return xglCmdWriteTimestamp; |
| 2138 | else if (!strncmp("xglCmdInitAtomicCounters", (const char *) funcName, sizeof("xglCmdInitAtomicCounters"))) |
| 2139 | return xglCmdInitAtomicCounters; |
| 2140 | else if (!strncmp("xglCmdLoadAtomicCounters", (const char *) funcName, sizeof("xglCmdLoadAtomicCounters"))) |
| 2141 | return xglCmdLoadAtomicCounters; |
| 2142 | else if (!strncmp("xglCmdSaveAtomicCounters", (const char *) funcName, sizeof("xglCmdSaveAtomicCounters"))) |
| 2143 | return xglCmdSaveAtomicCounters; |
| 2144 | else if (!strncmp("xglDbgSetValidationLevel", (const char *) funcName, sizeof("xglDbgSetValidationLevel"))) |
| 2145 | return xglDbgSetValidationLevel; |
| 2146 | else if (!strncmp("xglDbgRegisterMsgCallback", (const char *) funcName, sizeof("xglDbgRegisterMsgCallback"))) |
| 2147 | return xglDbgRegisterMsgCallback; |
| 2148 | else if (!strncmp("xglDbgUnregisterMsgCallback", (const char *) funcName, sizeof("xglDbgUnregisterMsgCallback"))) |
| 2149 | return xglDbgUnregisterMsgCallback; |
| 2150 | else if (!strncmp("xglDbgSetMessageFilter", (const char *) funcName, sizeof("xglDbgSetMessageFilter"))) |
| 2151 | return xglDbgSetMessageFilter; |
| 2152 | else if (!strncmp("xglDbgSetObjectTag", (const char *) funcName, sizeof("xglDbgSetObjectTag"))) |
| 2153 | return xglDbgSetObjectTag; |
| 2154 | else if (!strncmp("xglDbgSetGlobalOption", (const char *) funcName, sizeof("xglDbgSetGlobalOption"))) |
| 2155 | return xglDbgSetGlobalOption; |
| 2156 | else if (!strncmp("xglDbgSetDeviceOption", (const char *) funcName, sizeof("xglDbgSetDeviceOption"))) |
| 2157 | return xglDbgSetDeviceOption; |
| 2158 | else if (!strncmp("xglCmdDbgMarkerBegin", (const char *) funcName, sizeof("xglCmdDbgMarkerBegin"))) |
| 2159 | return xglCmdDbgMarkerBegin; |
| 2160 | else if (!strncmp("xglCmdDbgMarkerEnd", (const char *) funcName, sizeof("xglCmdDbgMarkerEnd"))) |
| 2161 | return xglCmdDbgMarkerEnd; |
| 2162 | else if (!strncmp("xglWsiX11AssociateConnection", (const char *) funcName, sizeof("xglWsiX11AssociateConnection"))) |
| 2163 | return xglWsiX11AssociateConnection; |
| 2164 | else if (!strncmp("xglWsiX11GetMSC", (const char *) funcName, sizeof("xglWsiX11GetMSC"))) |
| 2165 | return xglWsiX11GetMSC; |
| 2166 | else if (!strncmp("xglWsiX11CreatePresentableImage", (const char *) funcName, sizeof("xglWsiX11CreatePresentableImage"))) |
| 2167 | return xglWsiX11CreatePresentableImage; |
| 2168 | else if (!strncmp("xglWsiX11QueuePresent", (const char *) funcName, sizeof("xglWsiX11QueuePresent"))) |
| 2169 | return xglWsiX11QueuePresent; |
| 2170 | else { |
| 2171 | XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; |
| 2172 | if (gpuw->pGPA == NULL) |
| 2173 | return NULL; |
| 2174 | return gpuw->pGPA(gpuw->nextObject, funcName); |
| 2175 | } |
| 2176 | } |
| 2177 | |