Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * GLAVE & vulkan |
| 3 | * |
| 4 | * Copyright (C) 2015 LunarG, Inc. and Valve Corporation |
| 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 "loader_platform.h" |
Peter Lohrmann | 333d68f | 2015-03-24 16:30:17 -0700 | [diff] [blame] | 29 | #include "glave_snapshot.h" |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 30 | #include "vk_struct_string_helper.h" |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 31 | |
| 32 | #define LAYER_NAME_STR "GlaveSnapshot" |
| 33 | #define LAYER_ABBREV_STR "GLVSnap" |
| 34 | |
Jon Ashburn | bacb0f5 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 35 | static VkLayerDispatchTable nextTable; |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 36 | static VkBaseLayerObject *pCurObj; |
Peter Lohrmann | 506bbda | 2015-03-25 20:37:02 -0700 | [diff] [blame] | 37 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 38 | // The following is #included again to catch certain OS-specific functions being used: |
| 39 | #include "loader_platform.h" |
| 40 | #include "layers_config.h" |
| 41 | #include "layers_msg.h" |
Peter Lohrmann | 506bbda | 2015-03-25 20:37:02 -0700 | [diff] [blame] | 42 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 43 | static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(tabOnce); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 44 | static int objLockInitialized = 0; |
| 45 | static loader_platform_thread_mutex objLock; |
| 46 | |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 47 | // The 'masterSnapshot' which gets the delta merged into it when 'GetSnapshot()' is called. |
| 48 | static GLV_VK_SNAPSHOT s_snapshot = {0}; |
| 49 | |
| 50 | // The 'deltaSnapshot' which tracks all object creation and deletion. |
| 51 | static GLV_VK_SNAPSHOT s_delta = {0}; |
| 52 | |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 53 | |
| 54 | //============================================================================= |
| 55 | // Helper structure for a GLAVE vulkan snapshot. |
| 56 | // These can probably be auto-generated at some point. |
| 57 | //============================================================================= |
| 58 | |
| 59 | void glv_vk_malloc_and_copy(void** ppDest, size_t size, const void* pSrc) |
| 60 | { |
| 61 | *ppDest = malloc(size); |
| 62 | memcpy(*ppDest, pSrc, size); |
| 63 | } |
| 64 | |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 65 | VkDeviceCreateInfo* glv_deepcopy_VkDeviceCreateInfo(const VkDeviceCreateInfo* pSrcCreateInfo) |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 66 | { |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 67 | VkDeviceCreateInfo* pDestCreateInfo; |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 68 | |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 69 | // NOTE: partially duplicated code from add_VkDeviceCreateInfo_to_packet(...) |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 70 | { |
| 71 | uint32_t i; |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 72 | glv_vk_malloc_and_copy((void**)&pDestCreateInfo, sizeof(VkDeviceCreateInfo), pSrcCreateInfo); |
| 73 | glv_vk_malloc_and_copy((void**)&pDestCreateInfo->pRequestedQueues, pSrcCreateInfo->queueRecordCount*sizeof(VkDeviceQueueCreateInfo), pSrcCreateInfo->pRequestedQueues); |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 74 | |
| 75 | if (pSrcCreateInfo->extensionCount > 0) |
| 76 | { |
| 77 | glv_vk_malloc_and_copy((void**)&pDestCreateInfo->ppEnabledExtensionNames, pSrcCreateInfo->extensionCount * sizeof(char *), pSrcCreateInfo->ppEnabledExtensionNames); |
| 78 | for (i = 0; i < pSrcCreateInfo->extensionCount; i++) |
| 79 | { |
| 80 | glv_vk_malloc_and_copy((void**)&pDestCreateInfo->ppEnabledExtensionNames[i], strlen(pSrcCreateInfo->ppEnabledExtensionNames[i]) + 1, pSrcCreateInfo->ppEnabledExtensionNames[i]); |
| 81 | } |
| 82 | } |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 83 | VkLayerCreateInfo *pSrcNext = ( VkLayerCreateInfo *) pSrcCreateInfo->pNext; |
| 84 | VkLayerCreateInfo **ppDstNext = ( VkLayerCreateInfo **) &pDestCreateInfo->pNext; |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 85 | while (pSrcNext != NULL) |
| 86 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 87 | if ((pSrcNext->sType == VK_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pSrcNext->layerCount > 0) |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 88 | { |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 89 | glv_vk_malloc_and_copy((void**)ppDstNext, sizeof(VkLayerCreateInfo), pSrcNext); |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 90 | glv_vk_malloc_and_copy((void**)&(*ppDstNext)->ppActiveLayerNames, pSrcNext->layerCount * sizeof(char*), pSrcNext->ppActiveLayerNames); |
| 91 | for (i = 0; i < pSrcNext->layerCount; i++) |
| 92 | { |
| 93 | glv_vk_malloc_and_copy((void**)&(*ppDstNext)->ppActiveLayerNames[i], strlen(pSrcNext->ppActiveLayerNames[i]) + 1, pSrcNext->ppActiveLayerNames[i]); |
| 94 | } |
| 95 | |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 96 | ppDstNext = (VkLayerCreateInfo**) &(*ppDstNext)->pNext; |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 97 | } |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 98 | pSrcNext = (VkLayerCreateInfo*) pSrcNext->pNext; |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 99 | } |
| 100 | } |
| 101 | |
| 102 | return pDestCreateInfo; |
| 103 | } |
| 104 | |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 105 | void glv_deepfree_VkDeviceCreateInfo(VkDeviceCreateInfo* pCreateInfo) |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 106 | { |
| 107 | uint32_t i; |
| 108 | if (pCreateInfo->pRequestedQueues != NULL) |
| 109 | { |
| 110 | free((void*)pCreateInfo->pRequestedQueues); |
| 111 | } |
| 112 | |
| 113 | if (pCreateInfo->ppEnabledExtensionNames != NULL) |
| 114 | { |
| 115 | for (i = 0; i < pCreateInfo->extensionCount; i++) |
| 116 | { |
| 117 | free((void*)pCreateInfo->ppEnabledExtensionNames[i]); |
| 118 | } |
| 119 | free((void*)pCreateInfo->ppEnabledExtensionNames); |
| 120 | } |
| 121 | |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 122 | VkLayerCreateInfo *pSrcNext = (VkLayerCreateInfo*)pCreateInfo->pNext; |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 123 | while (pSrcNext != NULL) |
| 124 | { |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 125 | VkLayerCreateInfo* pTmp = (VkLayerCreateInfo*)pSrcNext->pNext; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 126 | if ((pSrcNext->sType == VK_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pSrcNext->layerCount > 0) |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 127 | { |
| 128 | for (i = 0; i < pSrcNext->layerCount; i++) |
| 129 | { |
| 130 | free((void*)pSrcNext->ppActiveLayerNames[i]); |
| 131 | } |
| 132 | |
| 133 | free((void*)pSrcNext->ppActiveLayerNames); |
| 134 | free(pSrcNext); |
| 135 | } |
| 136 | pSrcNext = pTmp; |
| 137 | } |
| 138 | |
| 139 | free(pCreateInfo); |
| 140 | } |
| 141 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 142 | void glv_vk_snapshot_copy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pDest, VkPhysicalGpu gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice) |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 143 | { |
| 144 | pDest->gpu = gpu; |
| 145 | |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 146 | pDest->pCreateInfo = glv_deepcopy_VkDeviceCreateInfo(pCreateInfo); |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 147 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 148 | pDest->pDevice = (VkDevice*)malloc(sizeof(VkDevice)); |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 149 | *pDest->pDevice = *pDevice; |
| 150 | } |
| 151 | |
| 152 | void glv_vk_snapshot_destroy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pSrc) |
| 153 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 154 | memset(&pSrc->gpu, 0, sizeof(VkPhysicalGpu)); |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 155 | |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 156 | glv_deepfree_VkDeviceCreateInfo(pSrc->pCreateInfo); |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 157 | pSrc->pCreateInfo = NULL; |
| 158 | |
| 159 | free(pSrc->pDevice); |
| 160 | pSrc->pDevice = NULL; |
| 161 | } |
| 162 | |
| 163 | |
| 164 | |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 165 | // add a new node to the global and object lists, then return it so the caller can populate the object information. |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 166 | static GLV_VK_SNAPSHOT_LL_NODE* snapshot_insert_object(GLV_VK_SNAPSHOT* pSnapshot, void* pObject, VK_OBJECT_TYPE type) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 167 | { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 168 | // Create a new node |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 169 | GLV_VK_SNAPSHOT_LL_NODE* pNewObjNode = (GLV_VK_SNAPSHOT_LL_NODE*)malloc(sizeof(GLV_VK_SNAPSHOT_LL_NODE)); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 170 | memset(pNewObjNode, 0, sizeof(GLV_VK_SNAPSHOT_LL_NODE)); |
| 171 | pNewObjNode->obj.pVkObject = pObject; |
| 172 | pNewObjNode->obj.objType = type; |
| 173 | pNewObjNode->obj.status = OBJSTATUS_NONE; |
| 174 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 175 | // insert at front of global list |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 176 | pNewObjNode->pNextGlobal = pSnapshot->pGlobalObjs; |
| 177 | pSnapshot->pGlobalObjs = pNewObjNode; |
| 178 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 179 | // insert at front of object list |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 180 | pNewObjNode->pNextObj = pSnapshot->pObjectHead[type]; |
| 181 | pSnapshot->pObjectHead[type] = pNewObjNode; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 182 | |
| 183 | // increment count |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 184 | pSnapshot->globalObjCount++; |
| 185 | pSnapshot->numObjs[type]++; |
| 186 | |
| 187 | return pNewObjNode; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 188 | } |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 189 | |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 190 | // This is just a helper function to snapshot_remove_object(..). It is not intended for this to be called directly. |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 191 | static void snapshot_remove_obj_type(GLV_VK_SNAPSHOT* pSnapshot, void* pObj, VK_OBJECT_TYPE objType) { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 192 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = pSnapshot->pObjectHead[objType]; |
| 193 | GLV_VK_SNAPSHOT_LL_NODE *pPrev = pSnapshot->pObjectHead[objType]; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 194 | while (pTrav) { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 195 | if (pTrav->obj.pVkObject == pObj) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 196 | pPrev->pNextObj = pTrav->pNextObj; |
| 197 | // update HEAD of Obj list as needed |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 198 | if (pSnapshot->pObjectHead[objType] == pTrav) |
| 199 | { |
| 200 | pSnapshot->pObjectHead[objType] = pTrav->pNextObj; |
| 201 | } |
| 202 | assert(pSnapshot->numObjs[objType] > 0); |
| 203 | pSnapshot->numObjs[objType]--; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 204 | return; |
| 205 | } |
| 206 | pPrev = pTrav; |
| 207 | pTrav = pTrav->pNextObj; |
| 208 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 209 | char str[1024]; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 210 | sprintf(str, "OBJ INTERNAL ERROR : Obj %p was in global list but not in %s list", pObj, string_VK_OBJECT_TYPE(objType)); |
| 211 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, pObj, 0, GLVSNAPSHOT_INTERNAL_ERROR, LAYER_ABBREV_STR, str); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 212 | } |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 213 | |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 214 | // Search global list to find object, |
| 215 | // if found: |
| 216 | // remove object from obj_type list using snapshot_remove_obj_type() |
| 217 | // remove object from global list, |
| 218 | // return object. |
| 219 | // else: |
| 220 | // Report message that we didn't see it get created, |
| 221 | // return NULL. |
| 222 | static GLV_VK_SNAPSHOT_LL_NODE* snapshot_remove_object(GLV_VK_SNAPSHOT* pSnapshot, void* pObject) |
| 223 | { |
| 224 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = pSnapshot->pGlobalObjs; |
| 225 | GLV_VK_SNAPSHOT_LL_NODE *pPrev = pSnapshot->pGlobalObjs; |
| 226 | while (pTrav) |
| 227 | { |
| 228 | if (pTrav->obj.pVkObject == pObject) |
| 229 | { |
| 230 | snapshot_remove_obj_type(pSnapshot, pObject, pTrav->obj.objType); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 231 | pPrev->pNextGlobal = pTrav->pNextGlobal; |
| 232 | // update HEAD of global list if needed |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 233 | if (pSnapshot->pGlobalObjs == pTrav) |
| 234 | { |
| 235 | pSnapshot->pGlobalObjs = pTrav->pNextGlobal; |
| 236 | } |
| 237 | assert(pSnapshot->globalObjCount > 0); |
| 238 | pSnapshot->globalObjCount--; |
| 239 | return pTrav; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 240 | } |
| 241 | pPrev = pTrav; |
| 242 | pTrav = pTrav->pNextGlobal; |
| 243 | } |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 244 | |
| 245 | // Object not found. |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 246 | char str[1024]; |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 247 | sprintf(str, "Object %p was not found in the created object list. It should be added as a deleted object.", pObject); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 248 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, pObject, 0, GLVSNAPSHOT_UNKNOWN_OBJECT, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 249 | return NULL; |
| 250 | } |
| 251 | |
| 252 | // Add a new deleted object node to the list |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 253 | static void snapshot_insert_deleted_object(GLV_VK_SNAPSHOT* pSnapshot, void* pObject, VK_OBJECT_TYPE type) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 254 | { |
| 255 | // Create a new node |
| 256 | GLV_VK_SNAPSHOT_DELETED_OBJ_NODE* pNewObjNode = (GLV_VK_SNAPSHOT_DELETED_OBJ_NODE*)malloc(sizeof(GLV_VK_SNAPSHOT_DELETED_OBJ_NODE)); |
| 257 | memset(pNewObjNode, 0, sizeof(GLV_VK_SNAPSHOT_DELETED_OBJ_NODE)); |
| 258 | pNewObjNode->objType = type; |
| 259 | pNewObjNode->pVkObject = pObject; |
| 260 | |
| 261 | // insert at front of list |
| 262 | pNewObjNode->pNextObj = pSnapshot->pDeltaDeletedObjects; |
| 263 | pSnapshot->pDeltaDeletedObjects = pNewObjNode; |
| 264 | |
| 265 | // increment count |
| 266 | pSnapshot->deltaDeletedObjectCount++; |
| 267 | } |
| 268 | |
| 269 | // Note: the parameters after pSnapshot match the order of vkCreateDevice(..) |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 270 | static void snapshot_insert_device(GLV_VK_SNAPSHOT* pSnapshot, VkPhysicalGpu gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 271 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 272 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(pSnapshot, *pDevice, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 273 | pNode->obj.pStruct = malloc(sizeof(GLV_VK_SNAPSHOT_DEVICE_NODE)); |
| 274 | |
| 275 | GLV_VK_SNAPSHOT_DEVICE_NODE* pDevNode = (GLV_VK_SNAPSHOT_DEVICE_NODE*)pNode->obj.pStruct; |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 276 | glv_vk_snapshot_copy_createdevice_params(&pDevNode->params, gpu, pCreateInfo, pDevice); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 277 | |
| 278 | // insert at front of device list |
| 279 | pNode->pNextObj = pSnapshot->pDevices; |
| 280 | pSnapshot->pDevices = pNode; |
| 281 | |
| 282 | // increment count |
| 283 | pSnapshot->deviceCount++; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 284 | } |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 285 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 286 | static void snapshot_remove_device(GLV_VK_SNAPSHOT* pSnapshot, VkDevice device) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 287 | { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 288 | GLV_VK_SNAPSHOT_LL_NODE* pFoundObject = snapshot_remove_object(pSnapshot, device); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 289 | |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 290 | if (pFoundObject != NULL) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 291 | { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 292 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = pSnapshot->pDevices; |
| 293 | GLV_VK_SNAPSHOT_LL_NODE *pPrev = pSnapshot->pDevices; |
| 294 | while (pTrav != NULL) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 295 | { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 296 | if (pTrav->obj.pVkObject == device) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 297 | { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 298 | pPrev->pNextObj = pTrav->pNextObj; |
| 299 | // update HEAD of Obj list as needed |
| 300 | if (pSnapshot->pDevices == pTrav) |
| 301 | pSnapshot->pDevices = pTrav->pNextObj; |
| 302 | |
| 303 | // delete the object |
| 304 | if (pTrav->obj.pStruct != NULL) |
| 305 | { |
| 306 | GLV_VK_SNAPSHOT_DEVICE_NODE* pDevNode = (GLV_VK_SNAPSHOT_DEVICE_NODE*)pTrav->obj.pStruct; |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 307 | glv_vk_snapshot_destroy_createdevice_params(&pDevNode->params); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 308 | free(pDevNode); |
| 309 | } |
| 310 | free(pTrav); |
| 311 | |
| 312 | if (pSnapshot->deviceCount > 0) |
| 313 | { |
| 314 | pSnapshot->deviceCount--; |
| 315 | } |
| 316 | else |
| 317 | { |
| 318 | // TODO: Callback WARNING that too many devices were deleted |
| 319 | assert(!"DeviceCount <= 0 means that too many devices were deleted."); |
| 320 | } |
| 321 | return; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 322 | } |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 323 | pPrev = pTrav; |
| 324 | pTrav = pTrav->pNextObj; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 325 | } |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | // If the code got here, then the device wasn't in the devices list. |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 329 | // That means we should add this device to the deleted items list. |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 330 | snapshot_insert_deleted_object(&s_delta, device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | // Traverse global list and return type for given object |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 334 | static VK_OBJECT_TYPE ll_get_obj_type(VkObject object) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 335 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = s_delta.pGlobalObjs; |
| 336 | while (pTrav) { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 337 | if (pTrav->obj.pVkObject == object) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 338 | return pTrav->obj.objType; |
| 339 | pTrav = pTrav->pNextGlobal; |
| 340 | } |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 341 | char str[1024]; |
| 342 | sprintf(str, "Attempting look-up on obj %p but it is NOT in the global list!", (void*)object); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 343 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, object, 0, GLVSNAPSHOT_MISSING_OBJECT, LAYER_ABBREV_STR, str); |
| 344 | return VK_OBJECT_TYPE_UNKNOWN; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 345 | } |
| 346 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 347 | static void ll_increment_use_count(void* pObj, VK_OBJECT_TYPE objType) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 348 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = s_delta.pObjectHead[objType]; |
| 349 | while (pTrav) { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 350 | if (pTrav->obj.pVkObject == pObj) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 351 | pTrav->obj.numUses++; |
| 352 | return; |
| 353 | } |
| 354 | pTrav = pTrav->pNextObj; |
| 355 | } |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 356 | |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 357 | // If we do not find obj, insert it and then increment count |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 358 | // TODO: we can't just create the object, because we don't know what it was created with. |
| 359 | // Instead, we need to make a list of referenced objects. When the delta is merged with a snapshot, we'll need |
| 360 | // to confirm that the referenced objects actually exist in the snapshot; otherwise I guess the merge should fail. |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 361 | char str[1024]; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 362 | sprintf(str, "Unable to increment count for obj %p, will add to list as %s type and increment count", pObj, string_VK_OBJECT_TYPE(objType)); |
| 363 | layerCbMsg(VK_DBG_MSG_WARNING, VK_VALIDATION_LEVEL_0, pObj, 0, GLVSNAPSHOT_UNKNOWN_OBJECT, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 364 | |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 365 | // ll_insert_obj(pObj, objType); |
| 366 | // ll_increment_use_count(pObj, objType); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 367 | } |
| 368 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 369 | // Set selected flag state for an object node |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 370 | static void set_status(void* pObj, VK_OBJECT_TYPE objType, OBJECT_STATUS status_flag) { |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 371 | if (pObj != NULL) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 372 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = s_delta.pObjectHead[objType]; |
| 373 | while (pTrav) { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 374 | if (pTrav->obj.pVkObject == pObj) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 375 | pTrav->obj.status |= status_flag; |
| 376 | return; |
| 377 | } |
| 378 | pTrav = pTrav->pNextObj; |
| 379 | } |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 380 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 381 | // If we do not find it print an error |
| 382 | char str[1024]; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 383 | sprintf(str, "Unable to set status for non-existent object %p of %s type", pObj, string_VK_OBJECT_TYPE(objType)); |
| 384 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, pObj, 0, GLVSNAPSHOT_UNKNOWN_OBJECT, LAYER_ABBREV_STR, str); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 385 | } |
| 386 | } |
| 387 | |
| 388 | // Track selected state for an object node |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 389 | static void track_object_status(void* pObj, VkStateBindPoint stateBindPoint) { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 390 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = s_delta.pObjectHead[VK_OBJECT_TYPE_CMD_BUFFER]; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 391 | |
| 392 | while (pTrav) { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 393 | if (pTrav->obj.pVkObject == pObj) { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 394 | if (stateBindPoint == VK_STATE_BIND_VIEWPORT) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 395 | pTrav->obj.status |= OBJSTATUS_VIEWPORT_BOUND; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 396 | } else if (stateBindPoint == VK_STATE_BIND_RASTER) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 397 | pTrav->obj.status |= OBJSTATUS_RASTER_BOUND; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 398 | } else if (stateBindPoint == VK_STATE_BIND_COLOR_BLEND) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 399 | pTrav->obj.status |= OBJSTATUS_COLOR_BLEND_BOUND; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 400 | } else if (stateBindPoint == VK_STATE_BIND_DEPTH_STENCIL) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 401 | pTrav->obj.status |= OBJSTATUS_DEPTH_STENCIL_BOUND; |
| 402 | } |
| 403 | return; |
| 404 | } |
| 405 | pTrav = pTrav->pNextObj; |
| 406 | } |
Peter Lohrmann | 4522141 | 2015-03-27 17:31:17 -0700 | [diff] [blame] | 407 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 408 | // If we do not find it print an error |
| 409 | char str[1024]; |
| 410 | sprintf(str, "Unable to track status for non-existent Command Buffer object %p", pObj); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 411 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, pObj, 0, GLVSNAPSHOT_UNKNOWN_OBJECT, LAYER_ABBREV_STR, str); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | // Reset selected flag state for an object node |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 415 | static void reset_status(void* pObj, VK_OBJECT_TYPE objType, OBJECT_STATUS status_flag) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 416 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = s_delta.pObjectHead[objType]; |
| 417 | while (pTrav) { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 418 | if (pTrav->obj.pVkObject == pObj) { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 419 | pTrav->obj.status &= ~status_flag; |
| 420 | return; |
| 421 | } |
| 422 | pTrav = pTrav->pNextObj; |
| 423 | } |
Peter Lohrmann | 4522141 | 2015-03-27 17:31:17 -0700 | [diff] [blame] | 424 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 425 | // If we do not find it print an error |
| 426 | char str[1024]; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 427 | sprintf(str, "Unable to reset status for non-existent object %p of %s type", pObj, string_VK_OBJECT_TYPE(objType)); |
| 428 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, pObj, 0, GLVSNAPSHOT_UNKNOWN_OBJECT, LAYER_ABBREV_STR, str); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 429 | } |
| 430 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 431 | #include "vk_dispatch_table_helper.h" |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 432 | static void initGlaveSnapshot(void) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 433 | { |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 434 | const char *strOpt; |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 435 | // initialize GlaveSnapshot options |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 436 | getLayerOptionEnum(LAYER_NAME_STR "ReportLevel", (uint32_t *) &g_reportingLevel); |
| 437 | g_actionIsDefault = getLayerOptionEnum(LAYER_NAME_STR "DebugAction", (uint32_t *) &g_debugAction); |
| 438 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 439 | if (g_debugAction & VK_DBG_LAYER_ACTION_LOG_MSG) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 440 | { |
| 441 | strOpt = getLayerOption(LAYER_NAME_STR "LogFilename"); |
| 442 | if (strOpt) |
| 443 | { |
| 444 | g_logFile = fopen(strOpt, "w"); |
| 445 | } |
| 446 | if (g_logFile == NULL) |
| 447 | g_logFile = stdout; |
| 448 | } |
| 449 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 450 | PFN_vkGetProcAddr fpNextGPA; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 451 | fpNextGPA = pCurObj->pGPA; |
| 452 | assert(fpNextGPA); |
| 453 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 454 | layer_initialize_dispatch_table(&nextTable, fpNextGPA, (VkPhysicalGpu) pCurObj->nextObject); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 455 | if (!objLockInitialized) |
| 456 | { |
| 457 | // TODO/TBD: Need to delete this mutex sometime. How??? |
| 458 | loader_platform_thread_create_mutex(&objLock); |
| 459 | objLockInitialized = 1; |
| 460 | } |
| 461 | } |
| 462 | |
Peter Lohrmann | 506bbda | 2015-03-25 20:37:02 -0700 | [diff] [blame] | 463 | //============================================================================= |
| 464 | // vulkan entrypoints |
| 465 | //============================================================================= |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 466 | VK_LAYER_EXPORT VkResult VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VkInstance* pInstance) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 467 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 468 | VkResult result = nextTable.CreateInstance(pCreateInfo, pInstance); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 469 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 470 | snapshot_insert_object(&s_delta, *pInstance, VK_OBJECT_TYPE_INSTANCE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 471 | loader_platform_thread_unlock_mutex(&objLock); |
| 472 | return result; |
| 473 | } |
| 474 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 475 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyInstance(VkInstance instance) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 476 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 477 | VkResult result = nextTable.DestroyInstance(instance); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 478 | loader_platform_thread_lock_mutex(&objLock); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 479 | snapshot_remove_object(&s_delta, (void*)instance); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 480 | loader_platform_thread_unlock_mutex(&objLock); |
| 481 | return result; |
| 482 | } |
| 483 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 484 | VK_LAYER_EXPORT VkResult VKAPI vkEnumerateGpus(VkInstance instance, uint32_t maxGpus, uint32_t* pGpuCount, VkPhysicalGpu* pGpus) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 485 | { |
| 486 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 487 | ll_increment_use_count((void*)instance, VK_OBJECT_TYPE_INSTANCE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 488 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 489 | VkResult result = nextTable.EnumerateGpus(instance, maxGpus, pGpuCount, pGpus); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 490 | return result; |
| 491 | } |
| 492 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 493 | VK_LAYER_EXPORT VkResult VKAPI vkGetGpuInfo(VkPhysicalGpu gpu, VkPhysicalGpuInfoType infoType, size_t* pDataSize, void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 494 | { |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 495 | VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 496 | pCurObj = gpuw; |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 497 | loader_platform_thread_once(&tabOnce, initGlaveSnapshot); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 498 | VkResult result = nextTable.GetGpuInfo((VkPhysicalGpu)gpuw->nextObject, infoType, pDataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 499 | return result; |
| 500 | } |
| 501 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 502 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalGpu gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 503 | { |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 504 | VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 505 | pCurObj = gpuw; |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 506 | loader_platform_thread_once(&tabOnce, initGlaveSnapshot); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 507 | VkResult result = nextTable.CreateDevice((VkPhysicalGpu)gpuw->nextObject, pCreateInfo, pDevice); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 508 | if (result == VK_SUCCESS) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 509 | { |
| 510 | loader_platform_thread_lock_mutex(&objLock); |
| 511 | snapshot_insert_device(&s_delta, gpu, pCreateInfo, pDevice); |
| 512 | loader_platform_thread_unlock_mutex(&objLock); |
| 513 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 514 | return result; |
| 515 | } |
| 516 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 517 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyDevice(VkDevice device) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 518 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 519 | VkResult result = nextTable.DestroyDevice(device); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 520 | loader_platform_thread_lock_mutex(&objLock); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 521 | snapshot_remove_device(&s_delta, device); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 522 | loader_platform_thread_unlock_mutex(&objLock); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 523 | |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 524 | // Report any remaining objects in LL |
| 525 | GLV_VK_SNAPSHOT_LL_NODE *pTrav = s_delta.pGlobalObjs; |
| 526 | while (pTrav != NULL) |
| 527 | { |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 528 | if (pTrav->obj.objType == VK_OBJECT_TYPE_SWAP_CHAIN_IMAGE_WSI || |
| 529 | pTrav->obj.objType == VK_OBJECT_TYPE_SWAP_CHAIN_MEMORY_WSI) |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 530 | { |
| 531 | GLV_VK_SNAPSHOT_LL_NODE *pDel = pTrav; |
| 532 | pTrav = pTrav->pNextGlobal; |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 533 | snapshot_remove_object(&s_delta, (void*)(pDel->obj.pVkObject)); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 534 | } else { |
| 535 | char str[1024]; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 536 | sprintf(str, "OBJ ERROR : %s object %p has not been destroyed (was used %lu times).", string_VK_OBJECT_TYPE(pTrav->obj.objType), pTrav->obj.pVkObject, pTrav->obj.numUses); |
| 537 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, device, 0, GLVSNAPSHOT_OBJECT_LEAK, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 538 | pTrav = pTrav->pNextGlobal; |
| 539 | } |
| 540 | } |
Peter Lohrmann | 4522141 | 2015-03-27 17:31:17 -0700 | [diff] [blame] | 541 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 542 | return result; |
| 543 | } |
| 544 | |
Courtney Goeltzenleuchter | d9dc0c7 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 545 | VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalGpu gpu, size_t maxStringSize, size_t* pLayerCount, char* const* pOutLayers, void* pReserved) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 546 | { |
| 547 | if (gpu != NULL) { |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 548 | VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 549 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d9dc0c7 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 550 | ll_increment_use_count((void*)gpu, VK_OBJECT_TYPE_PHYSICAL_GPU); |
| 551 | loader_platform_thread_unlock_mutex(&objLock); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 552 | pCurObj = gpuw; |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 553 | loader_platform_thread_once(&tabOnce, initGlaveSnapshot); |
Courtney Goeltzenleuchter | d9dc0c7 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 554 | VkResult result = nextTable.EnumerateLayers((VkPhysicalGpu)gpuw->nextObject, maxStringSize, pLayerCount, pOutLayers, pReserved); |
| 555 | return result; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 556 | } else { |
Courtney Goeltzenleuchter | d9dc0c7 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 557 | if (pLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 558 | return VK_ERROR_INVALID_POINTER; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 559 | // This layer compatible with all GPUs |
Courtney Goeltzenleuchter | d9dc0c7 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 560 | *pLayerCount = 1; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 561 | strncpy((char *) pOutLayers[0], LAYER_NAME_STR, maxStringSize); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 562 | return VK_SUCCESS; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 563 | } |
| 564 | } |
| 565 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 566 | VK_LAYER_EXPORT VkResult VKAPI vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 567 | { |
| 568 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 569 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 570 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 571 | VkResult result = nextTable.GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 572 | return result; |
| 573 | } |
| 574 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 575 | VK_LAYER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 576 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 577 | set_status((void*)fence, VK_OBJECT_TYPE_FENCE, OBJSTATUS_FENCE_IS_SUBMITTED); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 578 | VkResult result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, fence); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 579 | return result; |
| 580 | } |
| 581 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 582 | VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitIdle(VkQueue queue) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 583 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 584 | VkResult result = nextTable.QueueWaitIdle(queue); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 585 | return result; |
| 586 | } |
| 587 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 588 | VK_LAYER_EXPORT VkResult VKAPI vkDeviceWaitIdle(VkDevice device) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 589 | { |
| 590 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 591 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 592 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 593 | VkResult result = nextTable.DeviceWaitIdle(device); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 594 | return result; |
| 595 | } |
| 596 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 597 | VK_LAYER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllocInfo* pAllocInfo, VkGpuMemory* pMem) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 598 | { |
| 599 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 600 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 601 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 602 | VkResult result = nextTable.AllocMemory(device, pAllocInfo, pMem); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 603 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 604 | { |
| 605 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 606 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pMem, VK_OBJECT_TYPE_GPU_MEMORY); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 607 | pNode->obj.pStruct = NULL; |
| 608 | loader_platform_thread_unlock_mutex(&objLock); |
| 609 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 610 | return result; |
| 611 | } |
| 612 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 613 | VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkGpuMemory mem) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 614 | { |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 615 | VkResult result = nextTable.FreeMemory(device, mem); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 616 | loader_platform_thread_lock_mutex(&objLock); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 617 | snapshot_remove_object(&s_delta, (void*)mem); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 618 | loader_platform_thread_unlock_mutex(&objLock); |
| 619 | return result; |
| 620 | } |
| 621 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 622 | VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDevice device, VkGpuMemory mem, VkMemoryPriority priority) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 623 | { |
| 624 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 625 | ll_increment_use_count((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 626 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 627 | VkResult result = nextTable.SetMemoryPriority(device, mem, priority); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 628 | return result; |
| 629 | } |
| 630 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 631 | VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkGpuMemory mem, VkFlags flags, void** ppData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 632 | { |
| 633 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 634 | ll_increment_use_count((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 635 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 636 | set_status((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY, OBJSTATUS_GPU_MEM_MAPPED); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 637 | VkResult result = nextTable.MapMemory(device, mem, flags, ppData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 638 | return result; |
| 639 | } |
| 640 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 641 | VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkGpuMemory mem) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 642 | { |
| 643 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 644 | ll_increment_use_count((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 645 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 646 | reset_status((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY, OBJSTATUS_GPU_MEM_MAPPED); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 647 | VkResult result = nextTable.UnmapMemory(device, mem); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 648 | return result; |
| 649 | } |
| 650 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 651 | VK_LAYER_EXPORT VkResult VKAPI vkPinSystemMemory(VkDevice device, const void* pSysMem, size_t memSize, VkGpuMemory* pMem) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 652 | { |
| 653 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 654 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 655 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 656 | VkResult result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 657 | return result; |
| 658 | } |
| 659 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 660 | VK_LAYER_EXPORT VkResult VKAPI vkGetMultiGpuCompatibility(VkPhysicalGpu gpu0, VkPhysicalGpu gpu1, VkGpuCompatibilityInfo* pInfo) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 661 | { |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 662 | VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu0; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 663 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 664 | ll_increment_use_count((void*)gpu0, VK_OBJECT_TYPE_PHYSICAL_GPU); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 665 | loader_platform_thread_unlock_mutex(&objLock); |
| 666 | pCurObj = gpuw; |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 667 | loader_platform_thread_once(&tabOnce, initGlaveSnapshot); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 668 | VkResult result = nextTable.GetMultiGpuCompatibility((VkPhysicalGpu)gpuw->nextObject, gpu1, pInfo); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 669 | return result; |
| 670 | } |
| 671 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 672 | VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedMemory(VkDevice device, const VkMemoryOpenInfo* pOpenInfo, VkGpuMemory* pMem) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 673 | { |
| 674 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 675 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 676 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 677 | VkResult result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 678 | return result; |
| 679 | } |
| 680 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 681 | VK_LAYER_EXPORT VkResult VKAPI vkOpenSharedSemaphore(VkDevice device, const VkSemaphoreOpenInfo* pOpenInfo, VkSemaphore* pSemaphore) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 682 | { |
| 683 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 684 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 685 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 686 | VkResult result = nextTable.OpenSharedSemaphore(device, pOpenInfo, pSemaphore); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 687 | return result; |
| 688 | } |
| 689 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 690 | VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerMemory(VkDevice device, const VkPeerMemoryOpenInfo* pOpenInfo, VkGpuMemory* pMem) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 691 | { |
| 692 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 693 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 694 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 695 | VkResult result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 696 | return result; |
| 697 | } |
| 698 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 699 | VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImageOpenInfo* pOpenInfo, VkImage* pImage, VkGpuMemory* pMem) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 700 | { |
| 701 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 702 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 703 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 704 | VkResult result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 705 | return result; |
| 706 | } |
| 707 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 708 | VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 709 | { |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 710 | VkResult result = nextTable.DestroyObject(device, objType, object); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 711 | loader_platform_thread_lock_mutex(&objLock); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 712 | snapshot_remove_object(&s_delta, (void*)object); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 713 | loader_platform_thread_unlock_mutex(&objLock); |
| 714 | return result; |
| 715 | } |
| 716 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 717 | VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 718 | { |
| 719 | loader_platform_thread_lock_mutex(&objLock); |
| 720 | ll_increment_use_count((void*)object, ll_get_obj_type(object)); |
| 721 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 722 | VkResult result = nextTable.GetObjectInfo(device, objType, object, infoType, pDataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 723 | return result; |
| 724 | } |
| 725 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 726 | VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemory(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkGpuMemory mem, VkGpuSize offset) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 727 | { |
| 728 | loader_platform_thread_lock_mutex(&objLock); |
| 729 | ll_increment_use_count((void*)object, ll_get_obj_type(object)); |
| 730 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 731 | VkResult result = nextTable.BindObjectMemory(queue, objType, object, allocationIdx, mem, offset); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 732 | return result; |
| 733 | } |
| 734 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 735 | VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemoryRange(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkGpuSize rangeOffset, VkGpuSize rangeSize, VkGpuMemory mem, VkGpuSize memOffset) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 736 | { |
| 737 | loader_platform_thread_lock_mutex(&objLock); |
| 738 | ll_increment_use_count((void*)object, ll_get_obj_type(object)); |
| 739 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 740 | VkResult result = nextTable.BindObjectMemoryRange(queue, objType, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 741 | return result; |
| 742 | } |
| 743 | |
Jeremy Hayes | af0d72c | 2015-04-15 15:20:03 -0600 | [diff] [blame] | 744 | VK_LAYER_EXPORT VkResult VKAPI vkBindImageMemoryRange(VkImage image, uint32_t allocationIdx, const VkImageMemoryBindInfo* pBindInfo, VkGpuMemory mem, VkGpuSize memOffset) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 745 | { |
| 746 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 747 | ll_increment_use_count((void*)image, VK_OBJECT_TYPE_IMAGE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 748 | loader_platform_thread_unlock_mutex(&objLock); |
Jeremy Hayes | af0d72c | 2015-04-15 15:20:03 -0600 | [diff] [blame] | 749 | VkResult result = nextTable.BindImageMemoryRange(image, allocationIdx, pBindInfo, mem, memOffset); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 750 | return result; |
| 751 | } |
| 752 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 753 | VK_LAYER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, VkFence* pFence) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 754 | { |
| 755 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 756 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 757 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 758 | VkResult result = nextTable.CreateFence(device, pCreateInfo, pFence); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 759 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 760 | { |
| 761 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 762 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pFence, VK_OBJECT_TYPE_FENCE); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 763 | pNode->obj.pStruct = NULL; |
| 764 | loader_platform_thread_unlock_mutex(&objLock); |
| 765 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 766 | return result; |
| 767 | } |
| 768 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 769 | VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 770 | { |
| 771 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 772 | ll_increment_use_count((void*)fence, VK_OBJECT_TYPE_FENCE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 773 | loader_platform_thread_unlock_mutex(&objLock); |
| 774 | // Warn if submitted_flag is not set |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 775 | VkResult result = nextTable.GetFenceStatus(device, fence); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 776 | return result; |
| 777 | } |
| 778 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 779 | VK_LAYER_EXPORT VkResult VKAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, bool32_t waitAll, uint64_t timeout) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 780 | { |
| 781 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 782 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 783 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 784 | VkResult result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 785 | return result; |
| 786 | } |
| 787 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 788 | VK_LAYER_EXPORT VkResult VKAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, VkSemaphore* pSemaphore) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 789 | { |
| 790 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 791 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 792 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 793 | VkResult result = nextTable.CreateSemaphore(device, pCreateInfo, pSemaphore); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 794 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 795 | { |
| 796 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 797 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pSemaphore, VK_OBJECT_TYPE_QUEUE_SEMAPHORE); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 798 | pNode->obj.pStruct = NULL; |
| 799 | loader_platform_thread_unlock_mutex(&objLock); |
| 800 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 801 | return result; |
| 802 | } |
| 803 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 804 | VK_LAYER_EXPORT VkResult VKAPI vkQueueSignalSemaphore(VkQueue queue, VkSemaphore semaphore) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 805 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 806 | VkResult result = nextTable.QueueSignalSemaphore(queue, semaphore); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 807 | return result; |
| 808 | } |
| 809 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 810 | VK_LAYER_EXPORT VkResult VKAPI vkQueueWaitSemaphore(VkQueue queue, VkSemaphore semaphore) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 811 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 812 | VkResult result = nextTable.QueueWaitSemaphore(queue, semaphore); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 813 | return result; |
| 814 | } |
| 815 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 816 | VK_LAYER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, VkEvent* pEvent) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 817 | { |
| 818 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 819 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 820 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 821 | VkResult result = nextTable.CreateEvent(device, pCreateInfo, pEvent); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 822 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 823 | { |
| 824 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 825 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pEvent, VK_OBJECT_TYPE_EVENT); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 826 | pNode->obj.pStruct = NULL; |
| 827 | loader_platform_thread_unlock_mutex(&objLock); |
| 828 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 829 | return result; |
| 830 | } |
| 831 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 832 | VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 833 | { |
| 834 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 835 | ll_increment_use_count((void*)event, VK_OBJECT_TYPE_EVENT); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 836 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 837 | VkResult result = nextTable.GetEventStatus(device, event); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 838 | return result; |
| 839 | } |
| 840 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 841 | VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 842 | { |
| 843 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 844 | ll_increment_use_count((void*)event, VK_OBJECT_TYPE_EVENT); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 845 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 846 | VkResult result = nextTable.SetEvent(device, event); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 847 | return result; |
| 848 | } |
| 849 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 850 | VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 851 | { |
| 852 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 853 | ll_increment_use_count((void*)event, VK_OBJECT_TYPE_EVENT); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 854 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 855 | VkResult result = nextTable.ResetEvent(device, event); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 856 | return result; |
| 857 | } |
| 858 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 859 | VK_LAYER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, VkQueryPool* pQueryPool) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 860 | { |
| 861 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 862 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 863 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 864 | VkResult result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 865 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 866 | { |
| 867 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 868 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pQueryPool, VK_OBJECT_TYPE_QUERY_POOL); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 869 | pNode->obj.pStruct = NULL; |
| 870 | loader_platform_thread_unlock_mutex(&objLock); |
| 871 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 872 | return result; |
| 873 | } |
| 874 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 875 | VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 876 | { |
| 877 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 878 | ll_increment_use_count((void*)queryPool, VK_OBJECT_TYPE_QUERY_POOL); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 879 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 880 | VkResult result = nextTable.GetQueryPoolResults(device, queryPool, startQuery, queryCount, pDataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 881 | return result; |
| 882 | } |
| 883 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 884 | VK_LAYER_EXPORT VkResult VKAPI vkGetFormatInfo(VkDevice device, VkFormat format, VkFormatInfoType infoType, size_t* pDataSize, void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 885 | { |
| 886 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 887 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 888 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 889 | VkResult result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 890 | return result; |
| 891 | } |
| 892 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 893 | VK_LAYER_EXPORT VkResult VKAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, VkBuffer* pBuffer) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 894 | { |
| 895 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 896 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 897 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 898 | VkResult result = nextTable.CreateBuffer(device, pCreateInfo, pBuffer); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 899 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 900 | { |
| 901 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 902 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pBuffer, VK_OBJECT_TYPE_BUFFER); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 903 | pNode->obj.pStruct = NULL; |
| 904 | loader_platform_thread_unlock_mutex(&objLock); |
| 905 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 906 | return result; |
| 907 | } |
| 908 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 909 | VK_LAYER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, VkBufferView* pView) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 910 | { |
| 911 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 912 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 913 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 914 | VkResult result = nextTable.CreateBufferView(device, pCreateInfo, pView); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 915 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 916 | { |
| 917 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 918 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pView, VK_OBJECT_TYPE_BUFFER_VIEW); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 919 | pNode->obj.pStruct = NULL; |
| 920 | loader_platform_thread_unlock_mutex(&objLock); |
| 921 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 922 | return result; |
| 923 | } |
| 924 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 925 | VK_LAYER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, VkImage* pImage) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 926 | { |
| 927 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 928 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 929 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 930 | VkResult result = nextTable.CreateImage(device, pCreateInfo, pImage); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 931 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 932 | { |
| 933 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 934 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pImage, VK_OBJECT_TYPE_IMAGE); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 935 | pNode->obj.pStruct = NULL; |
| 936 | loader_platform_thread_unlock_mutex(&objLock); |
| 937 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 938 | return result; |
| 939 | } |
| 940 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 941 | VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 942 | { |
| 943 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 944 | ll_increment_use_count((void*)image, VK_OBJECT_TYPE_IMAGE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 945 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 946 | VkResult result = nextTable.GetImageSubresourceInfo(device, image, pSubresource, infoType, pDataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 947 | return result; |
| 948 | } |
| 949 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 950 | VK_LAYER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, VkImageView* pView) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 951 | { |
| 952 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 953 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 954 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 955 | VkResult result = nextTable.CreateImageView(device, pCreateInfo, pView); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 956 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 957 | { |
| 958 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 959 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pView, VK_OBJECT_TYPE_IMAGE_VIEW); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 960 | pNode->obj.pStruct = NULL; |
| 961 | loader_platform_thread_unlock_mutex(&objLock); |
| 962 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 963 | return result; |
| 964 | } |
| 965 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 966 | VK_LAYER_EXPORT VkResult VKAPI vkCreateColorAttachmentView(VkDevice device, const VkColorAttachmentViewCreateInfo* pCreateInfo, VkColorAttachmentView* pView) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 967 | { |
| 968 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 969 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 970 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 971 | VkResult result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 972 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 973 | { |
| 974 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 975 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pView, VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 976 | pNode->obj.pStruct = NULL; |
| 977 | loader_platform_thread_unlock_mutex(&objLock); |
| 978 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 979 | return result; |
| 980 | } |
| 981 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 982 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDepthStencilView(VkDevice device, const VkDepthStencilViewCreateInfo* pCreateInfo, VkDepthStencilView* pView) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 983 | { |
| 984 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 985 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 986 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 987 | VkResult result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 988 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 989 | { |
| 990 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 991 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pView, VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 992 | pNode->obj.pStruct = NULL; |
| 993 | loader_platform_thread_unlock_mutex(&objLock); |
| 994 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 995 | return result; |
| 996 | } |
| 997 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 998 | VK_LAYER_EXPORT VkResult VKAPI vkCreateShader(VkDevice device, const VkShaderCreateInfo* pCreateInfo, VkShader* pShader) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 999 | { |
| 1000 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1001 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1002 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1003 | VkResult result = nextTable.CreateShader(device, pCreateInfo, pShader); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1004 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1005 | { |
| 1006 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1007 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pShader, VK_OBJECT_TYPE_SHADER); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1008 | pNode->obj.pStruct = NULL; |
| 1009 | loader_platform_thread_unlock_mutex(&objLock); |
| 1010 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1011 | return result; |
| 1012 | } |
| 1013 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1014 | VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1015 | { |
| 1016 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1017 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1018 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1019 | VkResult result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1020 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1021 | { |
| 1022 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1023 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pPipeline, VK_OBJECT_TYPE_PIPELINE); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1024 | pNode->obj.pStruct = NULL; |
| 1025 | loader_platform_thread_unlock_mutex(&objLock); |
| 1026 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1027 | return result; |
| 1028 | } |
| 1029 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1030 | VK_LAYER_EXPORT VkResult VKAPI vkCreateComputePipeline(VkDevice device, const VkComputePipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1031 | { |
| 1032 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1033 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1034 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1035 | VkResult result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1036 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1037 | { |
| 1038 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1039 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pPipeline, VK_OBJECT_TYPE_PIPELINE); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1040 | pNode->obj.pStruct = NULL; |
| 1041 | loader_platform_thread_unlock_mutex(&objLock); |
| 1042 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1043 | return result; |
| 1044 | } |
| 1045 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1046 | VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1047 | { |
| 1048 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1049 | ll_increment_use_count((void*)pipeline, VK_OBJECT_TYPE_PIPELINE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1050 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1051 | VkResult result = nextTable.StorePipeline(device, pipeline, pDataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1052 | return result; |
| 1053 | } |
| 1054 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1055 | VK_LAYER_EXPORT VkResult VKAPI vkLoadPipeline(VkDevice device, size_t dataSize, const void* pData, VkPipeline* pPipeline) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1056 | { |
| 1057 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1058 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1059 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1060 | VkResult result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1061 | return result; |
| 1062 | } |
| 1063 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1064 | VK_LAYER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1065 | { |
| 1066 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1067 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1068 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1069 | VkResult result = nextTable.CreateSampler(device, pCreateInfo, pSampler); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1070 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1071 | { |
| 1072 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1073 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pSampler, VK_OBJECT_TYPE_SAMPLER); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1074 | pNode->obj.pStruct = NULL; |
| 1075 | loader_platform_thread_unlock_mutex(&objLock); |
| 1076 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1077 | return result; |
| 1078 | } |
| 1079 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1080 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout( VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayout* pSetLayout) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1081 | { |
| 1082 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1083 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1084 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1085 | VkResult result = nextTable.CreateDescriptorSetLayout(device, pCreateInfo, pSetLayout); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1086 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1087 | { |
| 1088 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1089 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pSetLayout, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1090 | pNode->obj.pStruct = NULL; |
| 1091 | loader_platform_thread_unlock_mutex(&objLock); |
| 1092 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1093 | return result; |
| 1094 | } |
| 1095 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1096 | VK_LAYER_EXPORT VkResult VKAPI vkBeginDescriptorPoolUpdate(VkDevice device, VkDescriptorUpdateMode updateMode) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1097 | { |
| 1098 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1099 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1100 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1101 | VkResult result = nextTable.BeginDescriptorPoolUpdate(device, updateMode); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1102 | return result; |
| 1103 | } |
| 1104 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1105 | VK_LAYER_EXPORT VkResult VKAPI vkEndDescriptorPoolUpdate(VkDevice device, VkCmdBuffer cmd) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1106 | { |
| 1107 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1108 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1109 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1110 | VkResult result = nextTable.EndDescriptorPoolUpdate(device, cmd); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1111 | return result; |
| 1112 | } |
| 1113 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1114 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescriptorPoolUsage poolUsage, uint32_t maxSets, const VkDescriptorPoolCreateInfo* pCreateInfo, VkDescriptorPool* pDescriptorPool) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1115 | { |
| 1116 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1117 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1118 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1119 | VkResult result = nextTable.CreateDescriptorPool(device, poolUsage, maxSets, pCreateInfo, pDescriptorPool); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1120 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1121 | { |
| 1122 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1123 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pDescriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1124 | pNode->obj.pStruct = NULL; |
| 1125 | loader_platform_thread_unlock_mutex(&objLock); |
| 1126 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1127 | return result; |
| 1128 | } |
| 1129 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1130 | VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1131 | { |
| 1132 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1133 | ll_increment_use_count((void*)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1134 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1135 | VkResult result = nextTable.ResetDescriptorPool(device, descriptorPool); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1136 | return result; |
| 1137 | } |
| 1138 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1139 | VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1140 | { |
| 1141 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1142 | ll_increment_use_count((void*)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1143 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1144 | VkResult result = nextTable.AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1145 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1146 | { |
| 1147 | for (uint32_t i = 0; i < *pCount; i++) { |
| 1148 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1149 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, pDescriptorSets[i], VK_OBJECT_TYPE_DESCRIPTOR_SET); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1150 | pNode->obj.pStruct = NULL; |
| 1151 | loader_platform_thread_unlock_mutex(&objLock); |
| 1152 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1153 | } |
| 1154 | return result; |
| 1155 | } |
| 1156 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1157 | VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1158 | { |
| 1159 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1160 | ll_increment_use_count((void*)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1161 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1162 | nextTable.ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1163 | } |
| 1164 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1165 | VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDevice device, VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1166 | { |
| 1167 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1168 | ll_increment_use_count((void*)descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1169 | loader_platform_thread_unlock_mutex(&objLock); |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1170 | nextTable.UpdateDescriptors(device, descriptorSet, updateCount, ppUpdateArray); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1171 | } |
| 1172 | |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 1173 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1174 | { |
| 1175 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1176 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1177 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1178 | VkResult result = nextTable.CreateDynamicViewportState(device, pCreateInfo, pState); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1179 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1180 | { |
| 1181 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1182 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pState, VK_OBJECT_TYPE_DYNAMIC_VP_STATE_OBJECT); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1183 | pNode->obj.pStruct = NULL; |
| 1184 | loader_platform_thread_unlock_mutex(&objLock); |
| 1185 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1186 | return result; |
| 1187 | } |
| 1188 | |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 1189 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicRasterState(VkDevice device, const VkDynamicRsStateCreateInfo* pCreateInfo, VkDynamicRsState* pState) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1190 | { |
| 1191 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1192 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1193 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1194 | VkResult result = nextTable.CreateDynamicRasterState(device, pCreateInfo, pState); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1195 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1196 | { |
| 1197 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1198 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pState, VK_OBJECT_TYPE_DYNAMIC_RS_STATE_OBJECT); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1199 | pNode->obj.pStruct = NULL; |
| 1200 | loader_platform_thread_unlock_mutex(&objLock); |
| 1201 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1202 | return result; |
| 1203 | } |
| 1204 | |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 1205 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(VkDevice device, const VkDynamicCbStateCreateInfo* pCreateInfo, VkDynamicCbState* pState) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1206 | { |
| 1207 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1208 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1209 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1210 | VkResult result = nextTable.CreateDynamicColorBlendState(device, pCreateInfo, pState); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1211 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1212 | { |
| 1213 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1214 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pState, VK_OBJECT_TYPE_DYNAMIC_CB_STATE_OBJECT); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1215 | pNode->obj.pStruct = NULL; |
| 1216 | loader_platform_thread_unlock_mutex(&objLock); |
| 1217 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1218 | return result; |
| 1219 | } |
| 1220 | |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 1221 | VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDsStateCreateInfo* pCreateInfo, VkDynamicDsState* pState) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1222 | { |
| 1223 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1224 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1225 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1226 | VkResult result = nextTable.CreateDynamicDepthStencilState(device, pCreateInfo, pState); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1227 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1228 | { |
| 1229 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1230 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pState, VK_OBJECT_TYPE_DYNAMIC_DS_STATE_OBJECT); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1231 | pNode->obj.pStruct = NULL; |
| 1232 | loader_platform_thread_unlock_mutex(&objLock); |
| 1233 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1234 | return result; |
| 1235 | } |
| 1236 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1237 | VK_LAYER_EXPORT VkResult VKAPI vkCreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1238 | { |
| 1239 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1240 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1241 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1242 | VkResult result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1243 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1244 | { |
| 1245 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1246 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pCmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1247 | pNode->obj.pStruct = NULL; |
| 1248 | loader_platform_thread_unlock_mutex(&objLock); |
| 1249 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1250 | return result; |
| 1251 | } |
| 1252 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1253 | VK_LAYER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1254 | { |
| 1255 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1256 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1257 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1258 | VkResult result = nextTable.BeginCommandBuffer(cmdBuffer, pBeginInfo); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1259 | return result; |
| 1260 | } |
| 1261 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1262 | VK_LAYER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCmdBuffer cmdBuffer) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1263 | { |
| 1264 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1265 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1266 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1267 | reset_status((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER, (OBJSTATUS_VIEWPORT_BOUND | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1268 | OBJSTATUS_RASTER_BOUND | |
| 1269 | OBJSTATUS_COLOR_BLEND_BOUND | |
| 1270 | OBJSTATUS_DEPTH_STENCIL_BOUND)); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1271 | VkResult result = nextTable.EndCommandBuffer(cmdBuffer); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1272 | return result; |
| 1273 | } |
| 1274 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1275 | VK_LAYER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCmdBuffer cmdBuffer) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1276 | { |
| 1277 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1278 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1279 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1280 | VkResult result = nextTable.ResetCommandBuffer(cmdBuffer); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1281 | return result; |
| 1282 | } |
| 1283 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1284 | VK_LAYER_EXPORT void VKAPI vkCmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1285 | { |
| 1286 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1287 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1288 | loader_platform_thread_unlock_mutex(&objLock); |
| 1289 | nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline); |
| 1290 | } |
| 1291 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1292 | VK_LAYER_EXPORT void VKAPI vkCmdBindDynamicStateObject(VkCmdBuffer cmdBuffer, VkStateBindPoint stateBindPoint, VkDynamicStateObject state) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1293 | { |
| 1294 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1295 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1296 | loader_platform_thread_unlock_mutex(&objLock); |
| 1297 | track_object_status((void*)cmdBuffer, stateBindPoint); |
| 1298 | nextTable.CmdBindDynamicStateObject(cmdBuffer, stateBindPoint, state); |
| 1299 | } |
| 1300 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1301 | VK_LAYER_EXPORT void VKAPI vkCmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkDescriptorSetLayoutChain layoutChain, uint32_t layoutChainSlot, uint32_t count, const VkDescriptorSet* pDescriptorSets, const uint32_t* pUserData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1302 | { |
| 1303 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1304 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1305 | loader_platform_thread_unlock_mutex(&objLock); |
Jon Ashburn | 2112d6b | 2015-04-01 13:30:06 -0600 | [diff] [blame] | 1306 | nextTable.CmdBindDescriptorSets(cmdBuffer, pipelineBindPoint, layoutChain, layoutChainSlot, count, pDescriptorSets, pUserData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1307 | } |
| 1308 | |
Courtney Goeltzenleuchter | f68ad72 | 2015-04-16 13:38:46 -0600 | [diff] [blame] | 1309 | VK_LAYER_EXPORT void VKAPI vkCmdBindVertexBuffers( |
| 1310 | VkCmdBuffer cmdBuffer, |
| 1311 | uint32_t startBinding, |
| 1312 | uint32_t bindingCount, |
| 1313 | const VkBuffer* pBuffers |
| 1314 | const VkGpuSize* pOffsets) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1315 | { |
| 1316 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1317 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1318 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | f68ad72 | 2015-04-16 13:38:46 -0600 | [diff] [blame] | 1319 | nextTable.CmdBindVertexBuffers(cmdBuffer, startBinding, bindingCount, pBuffers, pOffsets); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1320 | } |
| 1321 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1322 | VK_LAYER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkGpuSize offset, VkIndexType indexType) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1323 | { |
| 1324 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1325 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1326 | loader_platform_thread_unlock_mutex(&objLock); |
| 1327 | nextTable.CmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType); |
| 1328 | } |
| 1329 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1330 | VK_LAYER_EXPORT void VKAPI vkCmdDraw(VkCmdBuffer cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1331 | { |
| 1332 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1333 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1334 | loader_platform_thread_unlock_mutex(&objLock); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1335 | nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); |
| 1336 | } |
| 1337 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1338 | VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexed(VkCmdBuffer cmdBuffer, uint32_t firstIndex, uint32_t indexCount, int32_t vertexOffset, uint32_t firstInstance, uint32_t instanceCount) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1339 | { |
| 1340 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1341 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1342 | loader_platform_thread_unlock_mutex(&objLock); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1343 | nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); |
| 1344 | } |
| 1345 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1346 | VK_LAYER_EXPORT void VKAPI vkCmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkGpuSize offset, uint32_t count, uint32_t stride) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1347 | { |
| 1348 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1349 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1350 | loader_platform_thread_unlock_mutex(&objLock); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1351 | nextTable.CmdDrawIndirect(cmdBuffer, buffer, offset, count, stride); |
| 1352 | } |
| 1353 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1354 | VK_LAYER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkGpuSize offset, uint32_t count, uint32_t stride) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1355 | { |
| 1356 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1357 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1358 | loader_platform_thread_unlock_mutex(&objLock); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1359 | nextTable.CmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride); |
| 1360 | } |
| 1361 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1362 | VK_LAYER_EXPORT void VKAPI vkCmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1363 | { |
| 1364 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1365 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1366 | loader_platform_thread_unlock_mutex(&objLock); |
| 1367 | nextTable.CmdDispatch(cmdBuffer, x, y, z); |
| 1368 | } |
| 1369 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1370 | VK_LAYER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkGpuSize offset) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1371 | { |
| 1372 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1373 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1374 | loader_platform_thread_unlock_mutex(&objLock); |
| 1375 | nextTable.CmdDispatchIndirect(cmdBuffer, buffer, offset); |
| 1376 | } |
| 1377 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1378 | VK_LAYER_EXPORT void VKAPI vkCmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1379 | { |
| 1380 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1381 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1382 | loader_platform_thread_unlock_mutex(&objLock); |
| 1383 | nextTable.CmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions); |
| 1384 | } |
| 1385 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1386 | VK_LAYER_EXPORT void VKAPI vkCmdCopyImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1387 | { |
| 1388 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1389 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1390 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | 9e433bb | 2015-03-25 11:25:10 -0600 | [diff] [blame] | 1391 | nextTable.CmdCopyImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1392 | } |
| 1393 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1394 | VK_LAYER_EXPORT void VKAPI vkCmdCopyBufferToImage(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1395 | { |
| 1396 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1397 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1398 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | 9e433bb | 2015-03-25 11:25:10 -0600 | [diff] [blame] | 1399 | nextTable.CmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, destImageLayout, regionCount, pRegions); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1400 | } |
| 1401 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1402 | VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1403 | { |
| 1404 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1405 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1406 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | 9e433bb | 2015-03-25 11:25:10 -0600 | [diff] [blame] | 1407 | nextTable.CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1408 | } |
| 1409 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1410 | VK_LAYER_EXPORT void VKAPI vkCmdCloneImageData(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1411 | { |
| 1412 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1413 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1414 | loader_platform_thread_unlock_mutex(&objLock); |
| 1415 | nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout); |
| 1416 | } |
| 1417 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1418 | VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkGpuSize destOffset, VkGpuSize dataSize, const uint32_t* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1419 | { |
| 1420 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1421 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1422 | loader_platform_thread_unlock_mutex(&objLock); |
| 1423 | nextTable.CmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData); |
| 1424 | } |
| 1425 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1426 | VK_LAYER_EXPORT void VKAPI vkCmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkGpuSize destOffset, VkGpuSize fillSize, uint32_t data) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1427 | { |
| 1428 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1429 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1430 | loader_platform_thread_unlock_mutex(&objLock); |
| 1431 | nextTable.CmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data); |
| 1432 | } |
| 1433 | |
Courtney Goeltzenleuchter | d7a5cff | 2015-04-23 17:49:22 -0600 | [diff] [blame^] | 1434 | VK_LAYER_EXPORT void VKAPI vkCmdClearColorImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1435 | { |
| 1436 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1437 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1438 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | d7a5cff | 2015-04-23 17:49:22 -0600 | [diff] [blame^] | 1439 | nextTable.CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1440 | } |
| 1441 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1442 | VK_LAYER_EXPORT void VKAPI vkCmdClearDepthStencil(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1443 | { |
| 1444 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1445 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1446 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | 9e433bb | 2015-03-25 11:25:10 -0600 | [diff] [blame] | 1447 | nextTable.CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1448 | } |
| 1449 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1450 | VK_LAYER_EXPORT void VKAPI vkCmdResolveImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t rectCount, const VkImageResolve* pRects) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1451 | { |
| 1452 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1453 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1454 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | 9e433bb | 2015-03-25 11:25:10 -0600 | [diff] [blame] | 1455 | nextTable.CmdResolveImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, rectCount, pRects); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1456 | } |
| 1457 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1458 | VK_LAYER_EXPORT void VKAPI vkCmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1459 | { |
| 1460 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1461 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1462 | loader_platform_thread_unlock_mutex(&objLock); |
| 1463 | nextTable.CmdSetEvent(cmdBuffer, event, pipeEvent); |
| 1464 | } |
| 1465 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1466 | VK_LAYER_EXPORT void VKAPI vkCmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1467 | { |
| 1468 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1469 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1470 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | 1e8f3be | 2015-03-24 18:02:34 -0600 | [diff] [blame] | 1471 | nextTable.CmdResetEvent(cmdBuffer, event, pipeEvent); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1472 | } |
| 1473 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1474 | VK_LAYER_EXPORT void VKAPI vkCmdWaitEvents(VkCmdBuffer cmdBuffer, const VkEventWaitInfo* pWaitInfo) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1475 | { |
| 1476 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1477 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1478 | loader_platform_thread_unlock_mutex(&objLock); |
| 1479 | nextTable.CmdWaitEvents(cmdBuffer, pWaitInfo); |
| 1480 | } |
| 1481 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1482 | VK_LAYER_EXPORT void VKAPI vkCmdPipelineBarrier(VkCmdBuffer cmdBuffer, const VkPipelineBarrier* pBarrier) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1483 | { |
| 1484 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1485 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1486 | loader_platform_thread_unlock_mutex(&objLock); |
| 1487 | nextTable.CmdPipelineBarrier(cmdBuffer, pBarrier); |
| 1488 | } |
| 1489 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1490 | VK_LAYER_EXPORT void VKAPI vkCmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1491 | { |
| 1492 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1493 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1494 | loader_platform_thread_unlock_mutex(&objLock); |
| 1495 | nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags); |
| 1496 | } |
| 1497 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1498 | VK_LAYER_EXPORT void VKAPI vkCmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1499 | { |
| 1500 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1501 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1502 | loader_platform_thread_unlock_mutex(&objLock); |
| 1503 | nextTable.CmdEndQuery(cmdBuffer, queryPool, slot); |
| 1504 | } |
| 1505 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1506 | VK_LAYER_EXPORT void VKAPI vkCmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1507 | { |
| 1508 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1509 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1510 | loader_platform_thread_unlock_mutex(&objLock); |
| 1511 | nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount); |
| 1512 | } |
| 1513 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1514 | VK_LAYER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkGpuSize destOffset) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1515 | { |
| 1516 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1517 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1518 | loader_platform_thread_unlock_mutex(&objLock); |
| 1519 | nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset); |
| 1520 | } |
| 1521 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1522 | VK_LAYER_EXPORT void VKAPI vkCmdInitAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, const uint32_t* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1523 | { |
| 1524 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1525 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1526 | loader_platform_thread_unlock_mutex(&objLock); |
| 1527 | nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData); |
| 1528 | } |
| 1529 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1530 | VK_LAYER_EXPORT void VKAPI vkCmdLoadAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer srcBuffer, VkGpuSize srcOffset) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1531 | { |
| 1532 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1533 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1534 | loader_platform_thread_unlock_mutex(&objLock); |
| 1535 | nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcBuffer, srcOffset); |
| 1536 | } |
| 1537 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1538 | VK_LAYER_EXPORT void VKAPI vkCmdSaveAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer destBuffer, VkGpuSize destOffset) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1539 | { |
| 1540 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1541 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1542 | loader_platform_thread_unlock_mutex(&objLock); |
| 1543 | nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset); |
| 1544 | } |
| 1545 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1546 | VK_LAYER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1547 | { |
| 1548 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1549 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1550 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1551 | VkResult result = nextTable.CreateFramebuffer(device, pCreateInfo, pFramebuffer); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1552 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1553 | { |
| 1554 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1555 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pFramebuffer, VK_OBJECT_TYPE_FRAMEBUFFER); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1556 | pNode->obj.pStruct = NULL; |
| 1557 | loader_platform_thread_unlock_mutex(&objLock); |
| 1558 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1559 | return result; |
| 1560 | } |
| 1561 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1562 | VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1563 | { |
| 1564 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1565 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1566 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1567 | VkResult result = nextTable.CreateRenderPass(device, pCreateInfo, pRenderPass); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1568 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1569 | { |
| 1570 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1571 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pRenderPass, VK_OBJECT_TYPE_RENDER_PASS); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1572 | pNode->obj.pStruct = NULL; |
| 1573 | loader_platform_thread_unlock_mutex(&objLock); |
| 1574 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1575 | return result; |
| 1576 | } |
| 1577 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1578 | VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBegin *pRenderPassBegin) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1579 | { |
| 1580 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1581 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1582 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | 69894b7 | 2015-04-03 15:25:24 -0600 | [diff] [blame] | 1583 | nextTable.CmdBeginRenderPass(cmdBuffer, pRenderPassBegin); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1584 | } |
| 1585 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1586 | VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer, VkRenderPass renderPass) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1587 | { |
| 1588 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1589 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1590 | loader_platform_thread_unlock_mutex(&objLock); |
| 1591 | nextTable.CmdEndRenderPass(cmdBuffer, renderPass); |
| 1592 | } |
| 1593 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1594 | VK_LAYER_EXPORT VkResult VKAPI vkDbgSetValidationLevel(VkDevice device, VkValidationLevel validationLevel) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1595 | { |
| 1596 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1597 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1598 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1599 | VkResult result = nextTable.DbgSetValidationLevel(device, validationLevel); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1600 | return result; |
| 1601 | } |
| 1602 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1603 | VK_LAYER_EXPORT VkResult VKAPI vkDbgRegisterMsgCallback(VkInstance instance, VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, void* pUserData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1604 | { |
| 1605 | // This layer intercepts callbacks |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1606 | VK_LAYER_DBG_FUNCTION_NODE *pNewDbgFuncNode = (VK_LAYER_DBG_FUNCTION_NODE*)malloc(sizeof(VK_LAYER_DBG_FUNCTION_NODE)); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1607 | if (!pNewDbgFuncNode) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1608 | return VK_ERROR_OUT_OF_MEMORY; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1609 | pNewDbgFuncNode->pfnMsgCallback = pfnMsgCallback; |
| 1610 | pNewDbgFuncNode->pUserData = pUserData; |
| 1611 | pNewDbgFuncNode->pNext = g_pDbgFunctionHead; |
| 1612 | g_pDbgFunctionHead = pNewDbgFuncNode; |
| 1613 | // force callbacks if DebugAction hasn't been set already other than initial value |
| 1614 | if (g_actionIsDefault) { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1615 | g_debugAction = VK_DBG_LAYER_ACTION_CALLBACK; |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1616 | } VkResult result = nextTable.DbgRegisterMsgCallback(instance, pfnMsgCallback, pUserData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1617 | return result; |
| 1618 | } |
| 1619 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1620 | VK_LAYER_EXPORT VkResult VKAPI vkDbgUnregisterMsgCallback(VkInstance instance, VK_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1621 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1622 | VK_LAYER_DBG_FUNCTION_NODE *pTrav = g_pDbgFunctionHead; |
| 1623 | VK_LAYER_DBG_FUNCTION_NODE *pPrev = pTrav; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1624 | while (pTrav) { |
| 1625 | if (pTrav->pfnMsgCallback == pfnMsgCallback) { |
| 1626 | pPrev->pNext = pTrav->pNext; |
| 1627 | if (g_pDbgFunctionHead == pTrav) |
| 1628 | g_pDbgFunctionHead = pTrav->pNext; |
| 1629 | free(pTrav); |
| 1630 | break; |
| 1631 | } |
| 1632 | pPrev = pTrav; |
| 1633 | pTrav = pTrav->pNext; |
| 1634 | } |
| 1635 | if (g_pDbgFunctionHead == NULL) |
| 1636 | { |
| 1637 | if (g_actionIsDefault) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1638 | g_debugAction = VK_DBG_LAYER_ACTION_LOG_MSG; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1639 | else |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1640 | g_debugAction &= ~VK_DBG_LAYER_ACTION_CALLBACK; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1641 | } |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1642 | VkResult result = nextTable.DbgUnregisterMsgCallback(instance, pfnMsgCallback); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1643 | return result; |
| 1644 | } |
| 1645 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1646 | VK_LAYER_EXPORT VkResult VKAPI vkDbgSetMessageFilter(VkDevice device, int32_t msgCode, VK_DBG_MSG_FILTER filter) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1647 | { |
| 1648 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1649 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1650 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1651 | VkResult result = nextTable.DbgSetMessageFilter(device, msgCode, filter); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1652 | return result; |
| 1653 | } |
| 1654 | |
Mike Stroyan | b050c68 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 1655 | VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkObject object, size_t tagSize, const void* pTag) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1656 | { |
| 1657 | loader_platform_thread_lock_mutex(&objLock); |
| 1658 | ll_increment_use_count((void*)object, ll_get_obj_type(object)); |
| 1659 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1660 | VkResult result = nextTable.DbgSetObjectTag(object, tagSize, pTag); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1661 | return result; |
| 1662 | } |
| 1663 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1664 | VK_LAYER_EXPORT VkResult VKAPI vkDbgSetGlobalOption(VkInstance instance, VK_DBG_GLOBAL_OPTION dbgOption, size_t dataSize, const void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1665 | { |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1666 | VkResult result = nextTable.DbgSetGlobalOption(instance, dbgOption, dataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1667 | return result; |
| 1668 | } |
| 1669 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1670 | VK_LAYER_EXPORT VkResult VKAPI vkDbgSetDeviceOption(VkDevice device, VK_DBG_DEVICE_OPTION dbgOption, size_t dataSize, const void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1671 | { |
| 1672 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1673 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1674 | loader_platform_thread_unlock_mutex(&objLock); |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1675 | VkResult result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1676 | return result; |
| 1677 | } |
| 1678 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1679 | VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerBegin(VkCmdBuffer cmdBuffer, const char* pMarker) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1680 | { |
| 1681 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1682 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1683 | loader_platform_thread_unlock_mutex(&objLock); |
| 1684 | nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker); |
| 1685 | } |
| 1686 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1687 | VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1688 | { |
| 1689 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1690 | ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1691 | loader_platform_thread_unlock_mutex(&objLock); |
| 1692 | nextTable.CmdDbgMarkerEnd(cmdBuffer); |
| 1693 | } |
| 1694 | |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1695 | VK_LAYER_EXPORT VkResult VKAPI xglGetDisplayInfoWSI(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1696 | { |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1697 | loader_platform_thread_lock_mutex(&objLock); |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1698 | ll_increment_use_count((void*)display, VK_OBJECT_TYPE_DISPLAY_WSI); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1699 | loader_platform_thread_unlock_mutex(&objLock); |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1700 | VkResult result = nextTable.GetDisplayInfoWSI(display, infoType, pDataSize, pData); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1701 | return result; |
| 1702 | } |
| 1703 | |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1704 | VK_LAYER_EXPORT VkResult VKAPI xglCreateSwapChainWSI(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1705 | { |
| 1706 | loader_platform_thread_lock_mutex(&objLock); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1707 | ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1708 | loader_platform_thread_unlock_mutex(&objLock); |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1709 | VkResult result = nextTable.CreateSwapChainWSI(device, pCreateInfo, pSwapChain); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1710 | if (result == VK_SUCCESS) |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1711 | { |
| 1712 | loader_platform_thread_lock_mutex(&objLock); |
| 1713 | |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1714 | #if 0 |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1715 | GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(&s_delta, *pImage, VK_OBJECT_TYPE_IMAGE); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1716 | pNode->obj.pStruct = NULL; |
| 1717 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1718 | GLV_VK_SNAPSHOT_LL_NODE* pMemNode = snapshot_insert_object(&s_delta, *pMem, VK_OBJECT_TYPE_PRESENTABLE_IMAGE_MEMORY); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1719 | pMemNode->obj.pStruct = NULL; |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1720 | #else |
| 1721 | snapshot_insert_object(&s_delta, (void*)*pSwapChain, VK_OBJECT_TYPE_SWAP_CHAIN_WSI); |
| 1722 | #endif |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1723 | |
| 1724 | loader_platform_thread_unlock_mutex(&objLock); |
| 1725 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1726 | return result; |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1727 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1728 | } |
| 1729 | |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1730 | VK_LAYER_EXPORT VkResult VKAPI xglDestroySwapChainWSI(VkSwapChainWSI swapChain) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1731 | { |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1732 | VkResult result = nextTable.DestroySwapChainWSI(swapChain); |
| 1733 | loader_platform_thread_lock_mutex(&objLock); |
| 1734 | snapshot_remove_object(&s_delta, (void*)swapChain); |
| 1735 | loader_platform_thread_unlock_mutex(&objLock); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1736 | return result; |
| 1737 | } |
| 1738 | |
Chia-I Wu | f869338 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 1739 | VK_LAYER_EXPORT VkResult VKAPI xglGetSwapChainInfoWSI(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData) |
| 1740 | { |
| 1741 | loader_platform_thread_lock_mutex(&objLock); |
| 1742 | ll_increment_use_count((void*)swapChain, VK_OBJECT_TYPE_SWAP_CHAIN_WSI); |
| 1743 | loader_platform_thread_unlock_mutex(&objLock); |
| 1744 | VkResult result = nextTable.GetSwapChainInfoWSI(swapChain, infoType, pDataSize, pData); |
| 1745 | return result; |
| 1746 | } |
| 1747 | |
| 1748 | VK_LAYER_EXPORT VkResult VKAPI xglQueuePresentWSI(VkQueue queue, const VkPresentInfoWSI* pPresentInfo) |
| 1749 | { |
| 1750 | loader_platform_thread_lock_mutex(&objLock); |
| 1751 | ll_increment_use_count((void*)queue, VK_OBJECT_TYPE_QUEUE); |
| 1752 | loader_platform_thread_unlock_mutex(&objLock); |
| 1753 | VkResult result = nextTable.QueuePresentWSI(queue, pPresentInfo); |
| 1754 | return result; |
| 1755 | } |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1756 | |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1757 | //================================================================================================= |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 1758 | // Exported methods |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1759 | //================================================================================================= |
| 1760 | void glvSnapshotStartTracking(void) |
| 1761 | { |
| 1762 | assert(!"Not Implemented"); |
| 1763 | } |
| 1764 | |
| 1765 | //================================================================================================= |
| 1766 | GLV_VK_SNAPSHOT glvSnapshotGetDelta(void) |
| 1767 | { |
| 1768 | // copy the delta by merging it into an empty snapshot |
| 1769 | GLV_VK_SNAPSHOT empty; |
| 1770 | memset(&empty, 0, sizeof(GLV_VK_SNAPSHOT)); |
| 1771 | |
| 1772 | return glvSnapshotMerge(&s_delta, &empty); |
| 1773 | } |
| 1774 | |
| 1775 | //================================================================================================= |
| 1776 | GLV_VK_SNAPSHOT glvSnapshotGetSnapshot(void) |
| 1777 | { |
| 1778 | // copy the master snapshot by merging it into an empty snapshot |
| 1779 | GLV_VK_SNAPSHOT empty; |
| 1780 | memset(&empty, 0, sizeof(GLV_VK_SNAPSHOT)); |
| 1781 | |
| 1782 | return glvSnapshotMerge(&s_snapshot, &empty); |
| 1783 | } |
| 1784 | |
| 1785 | //================================================================================================= |
| 1786 | void glvSnapshotPrintDelta() |
| 1787 | { |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 1788 | char str[2048]; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1789 | GLV_VK_SNAPSHOT_LL_NODE* pTrav = s_delta.pGlobalObjs; |
| 1790 | sprintf(str, "==== DELTA SNAPSHOT contains %lu objects, %lu devices, and %lu deleted objects", s_delta.globalObjCount, s_delta.deviceCount, s_delta.deltaDeletedObjectCount); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1791 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1792 | |
| 1793 | // print all objects |
| 1794 | if (s_delta.globalObjCount > 0) |
| 1795 | { |
| 1796 | sprintf(str, "======== DELTA SNAPSHOT Created Objects:"); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1797 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, pTrav->obj.pVkObject, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1798 | while (pTrav != NULL) |
| 1799 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1800 | sprintf(str, "\t%s obj %p", string_VK_OBJECT_TYPE(pTrav->obj.objType), pTrav->obj.pVkObject); |
| 1801 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, pTrav->obj.pVkObject, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1802 | pTrav = pTrav->pNextGlobal; |
| 1803 | } |
| 1804 | } |
| 1805 | |
| 1806 | // print devices |
| 1807 | if (s_delta.deviceCount > 0) |
| 1808 | { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1809 | GLV_VK_SNAPSHOT_LL_NODE* pDeviceNode = s_delta.pDevices; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1810 | sprintf(str, "======== DELTA SNAPSHOT Devices:"); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1811 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1812 | while (pDeviceNode != NULL) |
| 1813 | { |
Peter Lohrmann | 6d84923 | 2015-04-01 13:54:18 -0700 | [diff] [blame] | 1814 | GLV_VK_SNAPSHOT_DEVICE_NODE* pDev = (GLV_VK_SNAPSHOT_DEVICE_NODE*)pDeviceNode->obj.pStruct; |
Courtney Goeltzenleuchter | 95487bc | 2015-04-14 18:48:46 -0600 | [diff] [blame] | 1815 | char * createInfoStr = vk_print_vkdevicecreateinfo(pDev->params.pCreateInfo, "\t\t"); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1816 | sprintf(str, "\t%s obj %p:\n%s", string_VK_OBJECT_TYPE(VK_OBJECT_TYPE_DEVICE), pDeviceNode->obj.pVkObject, createInfoStr); |
| 1817 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, pDeviceNode->obj.pVkObject, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1818 | pDeviceNode = pDeviceNode->pNextObj; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1819 | } |
| 1820 | } |
| 1821 | |
| 1822 | // print deleted objects |
| 1823 | if (s_delta.deltaDeletedObjectCount > 0) |
| 1824 | { |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1825 | GLV_VK_SNAPSHOT_DELETED_OBJ_NODE* pDelObjNode = s_delta.pDeltaDeletedObjects; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1826 | sprintf(str, "======== DELTA SNAPSHOT Deleted Objects:"); |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1827 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1828 | while (pDelObjNode != NULL) |
| 1829 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1830 | sprintf(str, " %s obj %p", string_VK_OBJECT_TYPE(pDelObjNode->objType), pDelObjNode->pVkObject); |
| 1831 | layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, pDelObjNode->pVkObject, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); |
Peter Lohrmann | 0506950 | 2015-03-30 12:58:50 -0700 | [diff] [blame] | 1832 | pDelObjNode = pDelObjNode->pNextObj; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1833 | } |
| 1834 | } |
| 1835 | } |
| 1836 | |
| 1837 | void glvSnapshotStopTracking(void) |
| 1838 | { |
| 1839 | assert(!"Not Implemented"); |
| 1840 | } |
| 1841 | |
| 1842 | void glvSnapshotClear(void) |
| 1843 | { |
| 1844 | assert(!"Not Implemented"); |
| 1845 | } |
| 1846 | |
| 1847 | GLV_VK_SNAPSHOT glvSnapshotMerge(const GLV_VK_SNAPSHOT* const pDelta, const GLV_VK_SNAPSHOT* const pSnapshot) |
| 1848 | { |
| 1849 | assert(!"Not Implemented"); |
| 1850 | } |
| 1851 | |
| 1852 | |
| 1853 | |
| 1854 | |
| 1855 | //============================================================================= |
| 1856 | // Old Exported methods |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 1857 | //============================================================================= |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1858 | uint64_t glvSnapshotGetObjectCount(VK_OBJECT_TYPE type) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1859 | { |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1860 | uint64_t retVal = (type == VK_OBJECT_TYPE_ANY) ? s_delta.globalObjCount : s_delta.numObjs[type]; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1861 | return retVal; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1862 | } |
| 1863 | |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1864 | VkResult glvSnapshotGetObjects(VK_OBJECT_TYPE type, uint64_t objCount, GLV_VK_SNAPSHOT_OBJECT_NODE *pObjNodeArray) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1865 | { |
| 1866 | // This bool flags if we're pulling all objs or just a single class of objs |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1867 | bool32_t bAllObjs = (type == VK_OBJECT_TYPE_ANY); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1868 | // Check the count first thing |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1869 | uint64_t maxObjCount = (bAllObjs) ? s_delta.globalObjCount : s_delta.numObjs[type]; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1870 | if (objCount > maxObjCount) { |
| 1871 | char str[1024]; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1872 | sprintf(str, "OBJ ERROR : Received objTrackGetObjects() request for %lu objs, but there are only %lu objs of type %s", objCount, maxObjCount, string_VK_OBJECT_TYPE(type)); |
| 1873 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, 0, 0, GLVSNAPSHOT_OBJCOUNT_MAX_EXCEEDED, LAYER_ABBREV_STR, str); |
| 1874 | return VK_ERROR_INVALID_VALUE; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1875 | } |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1876 | |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1877 | GLV_VK_SNAPSHOT_LL_NODE* pTrav = (bAllObjs) ? s_delta.pGlobalObjs : s_delta.pObjectHead[type]; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1878 | |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1879 | for (uint64_t i = 0; i < objCount; i++) { |
| 1880 | if (!pTrav) { |
| 1881 | char str[1024]; |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1882 | sprintf(str, "OBJ INTERNAL ERROR : Ran out of %s objs! Should have %lu, but only copied %lu and not the requested %lu.", string_VK_OBJECT_TYPE(type), maxObjCount, i, objCount); |
| 1883 | layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, 0, 0, GLVSNAPSHOT_INTERNAL_ERROR, LAYER_ABBREV_STR, str); |
| 1884 | return VK_ERROR_UNKNOWN; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1885 | } |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1886 | memcpy(&pObjNodeArray[i], pTrav, sizeof(GLV_VK_SNAPSHOT_OBJECT_NODE)); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1887 | pTrav = (bAllObjs) ? pTrav->pNextGlobal : pTrav->pNextObj; |
| 1888 | } |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1889 | return VK_SUCCESS; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1890 | } |
| 1891 | |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 1892 | void glvSnapshotPrintObjects(void) |
| 1893 | { |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1894 | glvSnapshotPrintDelta(); |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 1895 | } |
| 1896 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 1897 | #include "vk_generic_intercept_proc_helper.h" |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1898 | VK_LAYER_EXPORT void* VKAPI vkGetProcAddr(VkPhysicalGpu gpu, const char* funcName) |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1899 | { |
Tobin Ehlis | b870cbb | 2015-04-15 07:46:12 -0600 | [diff] [blame] | 1900 | VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1901 | void* addr; |
| 1902 | if (gpu == NULL) |
| 1903 | return NULL; |
| 1904 | pCurObj = gpuw; |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 1905 | loader_platform_thread_once(&tabOnce, initGlaveSnapshot); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1906 | |
| 1907 | addr = layer_intercept_proc(funcName); |
| 1908 | if (addr) |
| 1909 | return addr; |
Peter Lohrmann | 0582ed3 | 2015-03-24 17:15:03 -0700 | [diff] [blame] | 1910 | else if (!strncmp("glvSnapshotGetObjectCount", funcName, sizeof("glvSnapshotGetObjectCount"))) |
| 1911 | return glvSnapshotGetObjectCount; |
| 1912 | else if (!strncmp("glvSnapshotGetObjects", funcName, sizeof("glvSnapshotGetObjects"))) |
| 1913 | return glvSnapshotGetObjects; |
| 1914 | else if (!strncmp("glvSnapshotPrintObjects", funcName, sizeof("glvSnapshotPrintObjects"))) |
| 1915 | return glvSnapshotPrintObjects; |
Peter Lohrmann | 623be4e | 2015-03-26 20:38:12 -0700 | [diff] [blame] | 1916 | else if (!strncmp("glvSnapshotStartTracking", funcName, sizeof("glvSnapshotStartTracking"))) |
| 1917 | return glvSnapshotStartTracking; |
| 1918 | else if (!strncmp("glvSnapshotGetDelta", funcName, sizeof("glvSnapshotGetDelta"))) |
| 1919 | return glvSnapshotGetDelta; |
| 1920 | else if (!strncmp("glvSnapshotGetSnapshot", funcName, sizeof("glvSnapshotGetSnapshot"))) |
| 1921 | return glvSnapshotGetSnapshot; |
| 1922 | else if (!strncmp("glvSnapshotPrintDelta", funcName, sizeof("glvSnapshotPrintDelta"))) |
| 1923 | return glvSnapshotPrintDelta; |
| 1924 | else if (!strncmp("glvSnapshotStopTracking", funcName, sizeof("glvSnapshotStopTracking"))) |
| 1925 | return glvSnapshotStopTracking; |
| 1926 | else if (!strncmp("glvSnapshotClear", funcName, sizeof("glvSnapshotClear"))) |
| 1927 | return glvSnapshotClear; |
| 1928 | else if (!strncmp("glvSnapshotMerge", funcName, sizeof("glvSnapshotMerge"))) |
| 1929 | return glvSnapshotMerge; |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1930 | else { |
| 1931 | if (gpuw->pGPA == NULL) |
| 1932 | return NULL; |
Courtney Goeltzenleuchter | fb4efc6 | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 1933 | return gpuw->pGPA((VkPhysicalGpu)gpuw->nextObject, funcName); |
Peter Lohrmann | d67314b | 2015-03-24 16:14:01 -0700 | [diff] [blame] | 1934 | } |
| 1935 | } |
| 1936 | |