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