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