| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1 | |
| 2 | // This file is ***GENERATED***. Do Not Edit. |
| 3 | // See layer_chassis_dispatch_generator.py for modifications. |
| 4 | |
| 5 | /* Copyright (c) 2015-2019 The Khronos Group Inc. |
| 6 | * Copyright (c) 2015-2019 Valve Corporation |
| 7 | * Copyright (c) 2015-2019 LunarG, Inc. |
| 8 | * Copyright (c) 2015-2019 Google Inc. |
| 9 | * |
| 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | * you may not use this file except in compliance with the License. |
| 12 | * You may obtain a copy of the License at |
| 13 | * |
| 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | * |
| 16 | * Unless required by applicable law or agreed to in writing, software |
| 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | * See the License for the specific language governing permissions and |
| 20 | * limitations under the License. |
| 21 | * |
| 22 | * Author: Mark Lobodzinski <mark@lunarg.com> |
| 23 | */ |
| 24 | |
| 25 | #include <mutex> |
| 26 | #include "chassis.h" |
| 27 | #include "layer_chassis_dispatch.h" |
| 28 | #include "vk_layer_utils.h" |
| 29 | |
| 30 | // This intentionally includes a cpp file |
| 31 | #include "vk_safe_struct.cpp" |
| 32 | |
| 33 | std::mutex dispatch_lock; |
| 34 | |
| 35 | // Unique Objects pNext extension handling function |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 36 | void WrapPnextChainHandles(ValidationObject *layer_data, const void *pNext) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 37 | void *cur_pnext = const_cast<void *>(pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 38 | while (cur_pnext != NULL) { |
| 39 | VkBaseOutStructure *header = reinterpret_cast<VkBaseOutStructure *>(cur_pnext); |
| 40 | |
| 41 | switch (header->sType) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 42 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 43 | case VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 44 | safe_VkWin32KeyedMutexAcquireReleaseInfoKHR *safe_struct = reinterpret_cast<safe_VkWin32KeyedMutexAcquireReleaseInfoKHR *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 45 | if (safe_struct->pAcquireSyncs) { |
| 46 | for (uint32_t index0 = 0; index0 < safe_struct->acquireCount; ++index0) { |
| 47 | safe_struct->pAcquireSyncs[index0] = layer_data->Unwrap(safe_struct->pAcquireSyncs[index0]); |
| 48 | } |
| 49 | } |
| 50 | if (safe_struct->pReleaseSyncs) { |
| 51 | for (uint32_t index0 = 0; index0 < safe_struct->releaseCount; ++index0) { |
| 52 | safe_struct->pReleaseSyncs[index0] = layer_data->Unwrap(safe_struct->pReleaseSyncs[index0]); |
| 53 | } |
| 54 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 55 | } break; |
| 56 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 57 | |
| 58 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 59 | case VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 60 | safe_VkWin32KeyedMutexAcquireReleaseInfoNV *safe_struct = reinterpret_cast<safe_VkWin32KeyedMutexAcquireReleaseInfoNV *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 61 | if (safe_struct->pAcquireSyncs) { |
| 62 | for (uint32_t index0 = 0; index0 < safe_struct->acquireCount; ++index0) { |
| 63 | safe_struct->pAcquireSyncs[index0] = layer_data->Unwrap(safe_struct->pAcquireSyncs[index0]); |
| 64 | } |
| 65 | } |
| 66 | if (safe_struct->pReleaseSyncs) { |
| 67 | for (uint32_t index0 = 0; index0 < safe_struct->releaseCount; ++index0) { |
| 68 | safe_struct->pReleaseSyncs[index0] = layer_data->Unwrap(safe_struct->pReleaseSyncs[index0]); |
| 69 | } |
| 70 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 71 | } break; |
| 72 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 73 | |
| 74 | case VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 75 | safe_VkDedicatedAllocationMemoryAllocateInfoNV *safe_struct = reinterpret_cast<safe_VkDedicatedAllocationMemoryAllocateInfoNV *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 76 | if (safe_struct->image) { |
| 77 | safe_struct->image = layer_data->Unwrap(safe_struct->image); |
| 78 | } |
| 79 | if (safe_struct->buffer) { |
| 80 | safe_struct->buffer = layer_data->Unwrap(safe_struct->buffer); |
| 81 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 82 | } break; |
| 83 | |
| 84 | case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 85 | safe_VkMemoryDedicatedAllocateInfo *safe_struct = reinterpret_cast<safe_VkMemoryDedicatedAllocateInfo *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 86 | if (safe_struct->image) { |
| 87 | safe_struct->image = layer_data->Unwrap(safe_struct->image); |
| 88 | } |
| 89 | if (safe_struct->buffer) { |
| 90 | safe_struct->buffer = layer_data->Unwrap(safe_struct->buffer); |
| 91 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 92 | } break; |
| 93 | |
| 94 | case VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 95 | safe_VkImageSwapchainCreateInfoKHR *safe_struct = reinterpret_cast<safe_VkImageSwapchainCreateInfoKHR *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 96 | if (safe_struct->swapchain) { |
| 97 | safe_struct->swapchain = layer_data->Unwrap(safe_struct->swapchain); |
| 98 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 99 | } break; |
| 100 | |
| 101 | case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 102 | safe_VkSamplerYcbcrConversionInfo *safe_struct = reinterpret_cast<safe_VkSamplerYcbcrConversionInfo *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 103 | if (safe_struct->conversion) { |
| 104 | safe_struct->conversion = layer_data->Unwrap(safe_struct->conversion); |
| 105 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 106 | } break; |
| 107 | |
| 108 | case VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 109 | safe_VkShaderModuleValidationCacheCreateInfoEXT *safe_struct = reinterpret_cast<safe_VkShaderModuleValidationCacheCreateInfoEXT *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 110 | if (safe_struct->validationCache) { |
| 111 | safe_struct->validationCache = layer_data->Unwrap(safe_struct->validationCache); |
| 112 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 113 | } break; |
| 114 | |
| 115 | case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 116 | safe_VkWriteDescriptorSetAccelerationStructureNV *safe_struct = reinterpret_cast<safe_VkWriteDescriptorSetAccelerationStructureNV *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 117 | if (safe_struct->pAccelerationStructures) { |
| 118 | for (uint32_t index0 = 0; index0 < safe_struct->accelerationStructureCount; ++index0) { |
| 119 | safe_struct->pAccelerationStructures[index0] = layer_data->Unwrap(safe_struct->pAccelerationStructures[index0]); |
| 120 | } |
| 121 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 122 | } break; |
| 123 | |
| Shannon McPherson | 0e65e19 | 2019-07-17 16:52:21 -0600 | [diff] [blame] | 124 | case VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 125 | safe_VkRenderPassAttachmentBeginInfoKHR *safe_struct = reinterpret_cast<safe_VkRenderPassAttachmentBeginInfoKHR *>(cur_pnext); |
| Shannon McPherson | 0e65e19 | 2019-07-17 16:52:21 -0600 | [diff] [blame] | 126 | if (safe_struct->pAttachments) { |
| 127 | for (uint32_t index0 = 0; index0 < safe_struct->attachmentCount; ++index0) { |
| 128 | safe_struct->pAttachments[index0] = layer_data->Unwrap(safe_struct->pAttachments[index0]); |
| 129 | } |
| 130 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 131 | } break; |
| 132 | |
| 133 | case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR: { |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 134 | safe_VkBindImageMemorySwapchainInfoKHR *safe_struct = reinterpret_cast<safe_VkBindImageMemorySwapchainInfoKHR *>(cur_pnext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 135 | if (safe_struct->swapchain) { |
| 136 | safe_struct->swapchain = layer_data->Unwrap(safe_struct->swapchain); |
| 137 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 138 | } break; |
| 139 | |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 140 | default: |
| 141 | break; |
| 142 | } |
| 143 | |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 144 | // Process the next structure in the chain |
| 145 | cur_pnext = header->pNext; |
| 146 | } |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 147 | } |
| 148 | |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 149 | |
| 150 | // Manually written Dispatch routines |
| 151 | |
| 152 | VkResult DispatchCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 153 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 154 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
| 155 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 156 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateComputePipelines(device, pipelineCache, createInfoCount, |
| 157 | pCreateInfos, pAllocator, pPipelines); |
| 158 | safe_VkComputePipelineCreateInfo *local_pCreateInfos = NULL; |
| 159 | if (pCreateInfos) { |
| 160 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 161 | local_pCreateInfos = new safe_VkComputePipelineCreateInfo[createInfoCount]; |
| 162 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
| 163 | local_pCreateInfos[idx0].initialize(&pCreateInfos[idx0]); |
| 164 | if (pCreateInfos[idx0].basePipelineHandle) { |
| 165 | local_pCreateInfos[idx0].basePipelineHandle = layer_data->Unwrap(pCreateInfos[idx0].basePipelineHandle); |
| 166 | } |
| 167 | if (pCreateInfos[idx0].layout) { |
| 168 | local_pCreateInfos[idx0].layout = layer_data->Unwrap(pCreateInfos[idx0].layout); |
| 169 | } |
| 170 | if (pCreateInfos[idx0].stage.module) { |
| 171 | local_pCreateInfos[idx0].stage.module = layer_data->Unwrap(pCreateInfos[idx0].stage.module); |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | if (pipelineCache) { |
| 176 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 177 | pipelineCache = layer_data->Unwrap(pipelineCache); |
| 178 | } |
| 179 | |
| 180 | VkResult result = layer_data->device_dispatch_table.CreateComputePipelines(device, pipelineCache, createInfoCount, |
| 181 | local_pCreateInfos->ptr(), pAllocator, pPipelines); |
| 182 | delete[] local_pCreateInfos; |
| 183 | { |
| 184 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 185 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
| 186 | if (pPipelines[i] != VK_NULL_HANDLE) { |
| 187 | pPipelines[i] = layer_data->WrapNew(pPipelines[i]); |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | return result; |
| 192 | } |
| 193 | |
| 194 | VkResult DispatchCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 195 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 196 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
| 197 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 198 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateGraphicsPipelines(device, pipelineCache, createInfoCount, |
| 199 | pCreateInfos, pAllocator, pPipelines); |
| 200 | safe_VkGraphicsPipelineCreateInfo *local_pCreateInfos = nullptr; |
| 201 | if (pCreateInfos) { |
| 202 | local_pCreateInfos = new safe_VkGraphicsPipelineCreateInfo[createInfoCount]; |
| 203 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 204 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
| 205 | bool uses_color_attachment = false; |
| 206 | bool uses_depthstencil_attachment = false; |
| 207 | { |
| 208 | const auto subpasses_uses_it = layer_data->renderpasses_states.find(layer_data->Unwrap(pCreateInfos[idx0].renderPass)); |
| 209 | if (subpasses_uses_it != layer_data->renderpasses_states.end()) { |
| 210 | const auto &subpasses_uses = subpasses_uses_it->second; |
| 211 | if (subpasses_uses.subpasses_using_color_attachment.count(pCreateInfos[idx0].subpass)) |
| 212 | uses_color_attachment = true; |
| 213 | if (subpasses_uses.subpasses_using_depthstencil_attachment.count(pCreateInfos[idx0].subpass)) |
| 214 | uses_depthstencil_attachment = true; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | local_pCreateInfos[idx0].initialize(&pCreateInfos[idx0], uses_color_attachment, uses_depthstencil_attachment); |
| 219 | |
| 220 | if (pCreateInfos[idx0].basePipelineHandle) { |
| 221 | local_pCreateInfos[idx0].basePipelineHandle = layer_data->Unwrap(pCreateInfos[idx0].basePipelineHandle); |
| 222 | } |
| 223 | if (pCreateInfos[idx0].layout) { |
| 224 | local_pCreateInfos[idx0].layout = layer_data->Unwrap(pCreateInfos[idx0].layout); |
| 225 | } |
| 226 | if (pCreateInfos[idx0].pStages) { |
| 227 | for (uint32_t idx1 = 0; idx1 < pCreateInfos[idx0].stageCount; ++idx1) { |
| 228 | if (pCreateInfos[idx0].pStages[idx1].module) { |
| 229 | local_pCreateInfos[idx0].pStages[idx1].module = layer_data->Unwrap(pCreateInfos[idx0].pStages[idx1].module); |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | if (pCreateInfos[idx0].renderPass) { |
| 234 | local_pCreateInfos[idx0].renderPass = layer_data->Unwrap(pCreateInfos[idx0].renderPass); |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | if (pipelineCache) { |
| 239 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 240 | pipelineCache = layer_data->Unwrap(pipelineCache); |
| 241 | } |
| 242 | |
| 243 | VkResult result = layer_data->device_dispatch_table.CreateGraphicsPipelines(device, pipelineCache, createInfoCount, |
| 244 | local_pCreateInfos->ptr(), pAllocator, pPipelines); |
| 245 | delete[] local_pCreateInfos; |
| 246 | { |
| 247 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 248 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
| 249 | if (pPipelines[i] != VK_NULL_HANDLE) { |
| 250 | pPipelines[i] = layer_data->WrapNew(pPipelines[i]); |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | return result; |
| 255 | } |
| 256 | |
| 257 | template <typename T> |
| 258 | static void UpdateCreateRenderPassState(ValidationObject *layer_data, const T *pCreateInfo, VkRenderPass renderPass) { |
| 259 | auto &renderpass_state = layer_data->renderpasses_states[renderPass]; |
| 260 | |
| 261 | for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) { |
| 262 | bool uses_color = false; |
| 263 | for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i) |
| 264 | if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true; |
| 265 | |
| 266 | bool uses_depthstencil = false; |
| 267 | if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment) |
| 268 | if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) |
| 269 | uses_depthstencil = true; |
| 270 | |
| 271 | if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass); |
| 272 | if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | VkResult DispatchCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
| 277 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
| 278 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 279 | VkResult result = layer_data->device_dispatch_table.CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
| 280 | if (!wrap_handles) return result; |
| 281 | if (VK_SUCCESS == result) { |
| 282 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 283 | UpdateCreateRenderPassState(layer_data, pCreateInfo, *pRenderPass); |
| 284 | *pRenderPass = layer_data->WrapNew(*pRenderPass); |
| 285 | } |
| 286 | return result; |
| 287 | } |
| 288 | |
| 289 | VkResult DispatchCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, |
| 290 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
| 291 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 292 | VkResult result = layer_data->device_dispatch_table.CreateRenderPass2KHR(device, pCreateInfo, pAllocator, pRenderPass); |
| 293 | if (!wrap_handles) return result; |
| 294 | if (VK_SUCCESS == result) { |
| 295 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 296 | UpdateCreateRenderPassState(layer_data, pCreateInfo, *pRenderPass); |
| 297 | *pRenderPass = layer_data->WrapNew(*pRenderPass); |
| 298 | } |
| 299 | return result; |
| 300 | } |
| 301 | |
| 302 | void DispatchDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { |
| 303 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 304 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyRenderPass(device, renderPass, pAllocator); |
| 305 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 306 | uint64_t renderPass_id = reinterpret_cast<uint64_t &>(renderPass); |
| 307 | renderPass = (VkRenderPass)unique_id_mapping[renderPass_id]; |
| 308 | unique_id_mapping.erase(renderPass_id); |
| 309 | lock.unlock(); |
| 310 | layer_data->device_dispatch_table.DestroyRenderPass(device, renderPass, pAllocator); |
| 311 | |
| 312 | lock.lock(); |
| 313 | layer_data->renderpasses_states.erase(renderPass); |
| 314 | } |
| 315 | |
| 316 | VkResult DispatchCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
| 317 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
| 318 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 319 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
| 320 | safe_VkSwapchainCreateInfoKHR *local_pCreateInfo = NULL; |
| 321 | if (pCreateInfo) { |
| 322 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 323 | local_pCreateInfo = new safe_VkSwapchainCreateInfoKHR(pCreateInfo); |
| 324 | local_pCreateInfo->oldSwapchain = layer_data->Unwrap(pCreateInfo->oldSwapchain); |
| 325 | // Surface is instance-level object |
| 326 | local_pCreateInfo->surface = layer_data->Unwrap(pCreateInfo->surface); |
| 327 | } |
| 328 | |
| 329 | VkResult result = layer_data->device_dispatch_table.CreateSwapchainKHR(device, local_pCreateInfo->ptr(), pAllocator, pSwapchain); |
| 330 | delete local_pCreateInfo; |
| 331 | |
| 332 | if (VK_SUCCESS == result) { |
| 333 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 334 | *pSwapchain = layer_data->WrapNew(*pSwapchain); |
| 335 | } |
| 336 | return result; |
| 337 | } |
| 338 | |
| 339 | VkResult DispatchCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 340 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { |
| 341 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 342 | if (!wrap_handles) |
| 343 | return layer_data->device_dispatch_table.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, |
| 344 | pSwapchains); |
| 345 | safe_VkSwapchainCreateInfoKHR *local_pCreateInfos = NULL; |
| 346 | { |
| 347 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 348 | if (pCreateInfos) { |
| 349 | local_pCreateInfos = new safe_VkSwapchainCreateInfoKHR[swapchainCount]; |
| 350 | for (uint32_t i = 0; i < swapchainCount; ++i) { |
| 351 | local_pCreateInfos[i].initialize(&pCreateInfos[i]); |
| 352 | if (pCreateInfos[i].surface) { |
| 353 | // Surface is instance-level object |
| 354 | local_pCreateInfos[i].surface = layer_data->Unwrap(pCreateInfos[i].surface); |
| 355 | } |
| 356 | if (pCreateInfos[i].oldSwapchain) { |
| 357 | local_pCreateInfos[i].oldSwapchain = layer_data->Unwrap(pCreateInfos[i].oldSwapchain); |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | VkResult result = layer_data->device_dispatch_table.CreateSharedSwapchainsKHR(device, swapchainCount, local_pCreateInfos->ptr(), |
| 363 | pAllocator, pSwapchains); |
| 364 | delete[] local_pCreateInfos; |
| 365 | if (VK_SUCCESS == result) { |
| 366 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 367 | for (uint32_t i = 0; i < swapchainCount; i++) { |
| 368 | pSwapchains[i] = layer_data->WrapNew(pSwapchains[i]); |
| 369 | } |
| 370 | } |
| 371 | return result; |
| 372 | } |
| 373 | |
| 374 | VkResult DispatchGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, |
| 375 | VkImage *pSwapchainImages) { |
| 376 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 377 | if (!wrap_handles) |
| 378 | return layer_data->device_dispatch_table.GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 379 | VkSwapchainKHR wrapped_swapchain_handle = swapchain; |
| 380 | if (VK_NULL_HANDLE != swapchain) { |
| 381 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 382 | swapchain = layer_data->Unwrap(swapchain); |
| 383 | } |
| 384 | VkResult result = |
| 385 | layer_data->device_dispatch_table.GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 386 | if ((VK_SUCCESS == result) || (VK_INCOMPLETE == result)) { |
| 387 | if ((*pSwapchainImageCount > 0) && pSwapchainImages) { |
| 388 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 389 | auto &wrapped_swapchain_image_handles = layer_data->swapchain_wrapped_image_handle_map[wrapped_swapchain_handle]; |
| 390 | for (uint32_t i = static_cast<uint32_t>(wrapped_swapchain_image_handles.size()); i < *pSwapchainImageCount; i++) { |
| 391 | wrapped_swapchain_image_handles.emplace_back(layer_data->WrapNew(pSwapchainImages[i])); |
| 392 | } |
| 393 | for (uint32_t i = 0; i < *pSwapchainImageCount; i++) { |
| 394 | pSwapchainImages[i] = wrapped_swapchain_image_handles[i]; |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | return result; |
| 399 | } |
| 400 | |
| 401 | void DispatchDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { |
| 402 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 403 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroySwapchainKHR(device, swapchain, pAllocator); |
| 404 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 405 | |
| 406 | auto &image_array = layer_data->swapchain_wrapped_image_handle_map[swapchain]; |
| 407 | for (auto &image_handle : image_array) { |
| 408 | unique_id_mapping.erase(HandleToUint64(image_handle)); |
| 409 | } |
| 410 | layer_data->swapchain_wrapped_image_handle_map.erase(swapchain); |
| 411 | |
| 412 | uint64_t swapchain_id = HandleToUint64(swapchain); |
| 413 | swapchain = (VkSwapchainKHR)unique_id_mapping[swapchain_id]; |
| 414 | unique_id_mapping.erase(swapchain_id); |
| 415 | lock.unlock(); |
| 416 | layer_data->device_dispatch_table.DestroySwapchainKHR(device, swapchain, pAllocator); |
| 417 | } |
| 418 | |
| 419 | VkResult DispatchQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
| 420 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 421 | if (!wrap_handles) return layer_data->device_dispatch_table.QueuePresentKHR(queue, pPresentInfo); |
| 422 | safe_VkPresentInfoKHR *local_pPresentInfo = NULL; |
| 423 | { |
| 424 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 425 | if (pPresentInfo) { |
| 426 | local_pPresentInfo = new safe_VkPresentInfoKHR(pPresentInfo); |
| 427 | if (local_pPresentInfo->pWaitSemaphores) { |
| 428 | for (uint32_t index1 = 0; index1 < local_pPresentInfo->waitSemaphoreCount; ++index1) { |
| 429 | local_pPresentInfo->pWaitSemaphores[index1] = layer_data->Unwrap(pPresentInfo->pWaitSemaphores[index1]); |
| 430 | } |
| 431 | } |
| 432 | if (local_pPresentInfo->pSwapchains) { |
| 433 | for (uint32_t index1 = 0; index1 < local_pPresentInfo->swapchainCount; ++index1) { |
| 434 | local_pPresentInfo->pSwapchains[index1] = layer_data->Unwrap(pPresentInfo->pSwapchains[index1]); |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | VkResult result = layer_data->device_dispatch_table.QueuePresentKHR(queue, local_pPresentInfo->ptr()); |
| 440 | |
| 441 | // pResults is an output array embedded in a structure. The code generator neglects to copy back from the safe_* version, |
| 442 | // so handle it as a special case here: |
| 443 | if (pPresentInfo && pPresentInfo->pResults) { |
| 444 | for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) { |
| 445 | pPresentInfo->pResults[i] = local_pPresentInfo->pResults[i]; |
| 446 | } |
| 447 | } |
| 448 | delete local_pPresentInfo; |
| 449 | return result; |
| 450 | } |
| 451 | |
| 452 | void DispatchDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) { |
| 453 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 454 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyDescriptorPool(device, descriptorPool, pAllocator); |
| 455 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 456 | |
| 457 | // remove references to implicitly freed descriptor sets |
| 458 | for(auto descriptor_set : layer_data->pool_descriptor_sets_map[descriptorPool]) { |
| 459 | unique_id_mapping.erase(reinterpret_cast<uint64_t &>(descriptor_set)); |
| 460 | } |
| 461 | layer_data->pool_descriptor_sets_map.erase(descriptorPool); |
| 462 | |
| 463 | uint64_t descriptorPool_id = reinterpret_cast<uint64_t &>(descriptorPool); |
| 464 | descriptorPool = (VkDescriptorPool)unique_id_mapping[descriptorPool_id]; |
| 465 | unique_id_mapping.erase(descriptorPool_id); |
| 466 | lock.unlock(); |
| 467 | layer_data->device_dispatch_table.DestroyDescriptorPool(device, descriptorPool, pAllocator); |
| 468 | } |
| 469 | |
| 470 | VkResult DispatchResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) { |
| 471 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 472 | if (!wrap_handles) return layer_data->device_dispatch_table.ResetDescriptorPool(device, descriptorPool, flags); |
| 473 | VkDescriptorPool local_descriptor_pool = VK_NULL_HANDLE; |
| 474 | { |
| 475 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 476 | local_descriptor_pool = layer_data->Unwrap(descriptorPool); |
| 477 | } |
| 478 | VkResult result = layer_data->device_dispatch_table.ResetDescriptorPool(device, local_descriptor_pool, flags); |
| 479 | if (VK_SUCCESS == result) { |
| 480 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 481 | // remove references to implicitly freed descriptor sets |
| 482 | for(auto descriptor_set : layer_data->pool_descriptor_sets_map[descriptorPool]) { |
| 483 | unique_id_mapping.erase(reinterpret_cast<uint64_t &>(descriptor_set)); |
| 484 | } |
| 485 | layer_data->pool_descriptor_sets_map[descriptorPool].clear(); |
| 486 | } |
| 487 | |
| 488 | return result; |
| 489 | } |
| 490 | |
| 491 | VkResult DispatchAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
| 492 | VkDescriptorSet *pDescriptorSets) { |
| 493 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 494 | if (!wrap_handles) return layer_data->device_dispatch_table.AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); |
| 495 | safe_VkDescriptorSetAllocateInfo *local_pAllocateInfo = NULL; |
| 496 | { |
| 497 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 498 | if (pAllocateInfo) { |
| 499 | local_pAllocateInfo = new safe_VkDescriptorSetAllocateInfo(pAllocateInfo); |
| 500 | if (pAllocateInfo->descriptorPool) { |
| 501 | local_pAllocateInfo->descriptorPool = layer_data->Unwrap(pAllocateInfo->descriptorPool); |
| 502 | } |
| 503 | if (local_pAllocateInfo->pSetLayouts) { |
| 504 | for (uint32_t index1 = 0; index1 < local_pAllocateInfo->descriptorSetCount; ++index1) { |
| 505 | local_pAllocateInfo->pSetLayouts[index1] = layer_data->Unwrap(local_pAllocateInfo->pSetLayouts[index1]); |
| 506 | } |
| 507 | } |
| 508 | } |
| 509 | } |
| 510 | VkResult result = layer_data->device_dispatch_table.AllocateDescriptorSets( |
| 511 | device, (const VkDescriptorSetAllocateInfo *)local_pAllocateInfo, pDescriptorSets); |
| 512 | if (local_pAllocateInfo) { |
| 513 | delete local_pAllocateInfo; |
| 514 | } |
| 515 | if (VK_SUCCESS == result) { |
| 516 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 517 | auto &pool_descriptor_sets = layer_data->pool_descriptor_sets_map[pAllocateInfo->descriptorPool]; |
| 518 | for (uint32_t index0 = 0; index0 < pAllocateInfo->descriptorSetCount; index0++) { |
| 519 | pDescriptorSets[index0] = layer_data->WrapNew(pDescriptorSets[index0]); |
| 520 | pool_descriptor_sets.insert(pDescriptorSets[index0]); |
| 521 | } |
| 522 | } |
| 523 | return result; |
| 524 | } |
| 525 | |
| 526 | VkResult DispatchFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
| 527 | const VkDescriptorSet *pDescriptorSets) { |
| 528 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 529 | if (!wrap_handles) |
| 530 | return layer_data->device_dispatch_table.FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); |
| 531 | VkDescriptorSet *local_pDescriptorSets = NULL; |
| 532 | VkDescriptorPool local_descriptor_pool = VK_NULL_HANDLE; |
| 533 | { |
| 534 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 535 | local_descriptor_pool = layer_data->Unwrap(descriptorPool); |
| 536 | if (pDescriptorSets) { |
| 537 | local_pDescriptorSets = new VkDescriptorSet[descriptorSetCount]; |
| 538 | for (uint32_t index0 = 0; index0 < descriptorSetCount; ++index0) { |
| 539 | local_pDescriptorSets[index0] = layer_data->Unwrap(pDescriptorSets[index0]); |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | VkResult result = layer_data->device_dispatch_table.FreeDescriptorSets(device, local_descriptor_pool, descriptorSetCount, |
| 544 | (const VkDescriptorSet *)local_pDescriptorSets); |
| 545 | if (local_pDescriptorSets) delete[] local_pDescriptorSets; |
| 546 | if ((VK_SUCCESS == result) && (pDescriptorSets)) { |
| 547 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 548 | auto &pool_descriptor_sets = layer_data->pool_descriptor_sets_map[descriptorPool]; |
| 549 | for (uint32_t index0 = 0; index0 < descriptorSetCount; index0++) { |
| 550 | VkDescriptorSet handle = pDescriptorSets[index0]; |
| 551 | pool_descriptor_sets.erase(handle); |
| 552 | uint64_t unique_id = reinterpret_cast<uint64_t &>(handle); |
| 553 | unique_id_mapping.erase(unique_id); |
| 554 | } |
| 555 | } |
| 556 | return result; |
| 557 | } |
| 558 | |
| 559 | // This is the core version of this routine. The extension version is below. |
| 560 | VkResult DispatchCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfoKHR *pCreateInfo, |
| 561 | const VkAllocationCallbacks *pAllocator, |
| 562 | VkDescriptorUpdateTemplateKHR *pDescriptorUpdateTemplate) { |
| 563 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 564 | if (!wrap_handles) |
| 565 | return layer_data->device_dispatch_table.CreateDescriptorUpdateTemplate(device, pCreateInfo, pAllocator, |
| 566 | pDescriptorUpdateTemplate); |
| 567 | safe_VkDescriptorUpdateTemplateCreateInfo *local_create_info = NULL; |
| 568 | { |
| 569 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 570 | if (pCreateInfo) { |
| 571 | local_create_info = new safe_VkDescriptorUpdateTemplateCreateInfo(pCreateInfo); |
| 572 | if (pCreateInfo->descriptorSetLayout) { |
| 573 | local_create_info->descriptorSetLayout = layer_data->Unwrap(pCreateInfo->descriptorSetLayout); |
| 574 | } |
| 575 | if (pCreateInfo->pipelineLayout) { |
| 576 | local_create_info->pipelineLayout = layer_data->Unwrap(pCreateInfo->pipelineLayout); |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | VkResult result = layer_data->device_dispatch_table.CreateDescriptorUpdateTemplate(device, local_create_info->ptr(), pAllocator, |
| 581 | pDescriptorUpdateTemplate); |
| 582 | if (VK_SUCCESS == result) { |
| 583 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 584 | *pDescriptorUpdateTemplate = layer_data->WrapNew(*pDescriptorUpdateTemplate); |
| 585 | |
| 586 | // Shadow template createInfo for later updates |
| 587 | std::unique_ptr<TEMPLATE_STATE> template_state(new TEMPLATE_STATE(*pDescriptorUpdateTemplate, local_create_info)); |
| 588 | layer_data->desc_template_createinfo_map[(uint64_t)*pDescriptorUpdateTemplate] = std::move(template_state); |
| 589 | } |
| 590 | return result; |
| 591 | } |
| 592 | |
| 593 | // This is the extension version of this routine. The core version is above. |
| 594 | VkResult DispatchCreateDescriptorUpdateTemplateKHR(VkDevice device, const VkDescriptorUpdateTemplateCreateInfoKHR *pCreateInfo, |
| 595 | const VkAllocationCallbacks *pAllocator, |
| 596 | VkDescriptorUpdateTemplateKHR *pDescriptorUpdateTemplate) { |
| 597 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 598 | if (!wrap_handles) |
| 599 | return layer_data->device_dispatch_table.CreateDescriptorUpdateTemplateKHR(device, pCreateInfo, pAllocator, |
| 600 | pDescriptorUpdateTemplate); |
| 601 | safe_VkDescriptorUpdateTemplateCreateInfo *local_create_info = NULL; |
| 602 | { |
| 603 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 604 | if (pCreateInfo) { |
| 605 | local_create_info = new safe_VkDescriptorUpdateTemplateCreateInfo(pCreateInfo); |
| 606 | if (pCreateInfo->descriptorSetLayout) { |
| 607 | local_create_info->descriptorSetLayout = layer_data->Unwrap(pCreateInfo->descriptorSetLayout); |
| 608 | } |
| 609 | if (pCreateInfo->pipelineLayout) { |
| 610 | local_create_info->pipelineLayout = layer_data->Unwrap(pCreateInfo->pipelineLayout); |
| 611 | } |
| 612 | } |
| 613 | } |
| 614 | VkResult result = layer_data->device_dispatch_table.CreateDescriptorUpdateTemplateKHR(device, local_create_info->ptr(), pAllocator, |
| 615 | pDescriptorUpdateTemplate); |
| 616 | if (VK_SUCCESS == result) { |
| 617 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 618 | *pDescriptorUpdateTemplate = layer_data->WrapNew(*pDescriptorUpdateTemplate); |
| 619 | |
| 620 | // Shadow template createInfo for later updates |
| 621 | std::unique_ptr<TEMPLATE_STATE> template_state(new TEMPLATE_STATE(*pDescriptorUpdateTemplate, local_create_info)); |
| 622 | layer_data->desc_template_createinfo_map[(uint64_t)*pDescriptorUpdateTemplate] = std::move(template_state); |
| 623 | } |
| 624 | return result; |
| 625 | } |
| 626 | |
| 627 | // This is the core version of this routine. The extension version is below. |
| 628 | void DispatchDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 629 | const VkAllocationCallbacks *pAllocator) { |
| 630 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 631 | if (!wrap_handles) |
| 632 | return layer_data->device_dispatch_table.DestroyDescriptorUpdateTemplate(device, descriptorUpdateTemplate, pAllocator); |
| 633 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 634 | uint64_t descriptor_update_template_id = reinterpret_cast<uint64_t &>(descriptorUpdateTemplate); |
| 635 | layer_data->desc_template_createinfo_map.erase(descriptor_update_template_id); |
| 636 | descriptorUpdateTemplate = (VkDescriptorUpdateTemplate)unique_id_mapping[descriptor_update_template_id]; |
| 637 | unique_id_mapping.erase(descriptor_update_template_id); |
| 638 | lock.unlock(); |
| 639 | layer_data->device_dispatch_table.DestroyDescriptorUpdateTemplate(device, descriptorUpdateTemplate, pAllocator); |
| 640 | } |
| 641 | |
| 642 | // This is the extension version of this routine. The core version is above. |
| 643 | void DispatchDestroyDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, |
| 644 | const VkAllocationCallbacks *pAllocator) { |
| 645 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 646 | if (!wrap_handles) |
| 647 | return layer_data->device_dispatch_table.DestroyDescriptorUpdateTemplateKHR(device, descriptorUpdateTemplate, pAllocator); |
| 648 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 649 | uint64_t descriptor_update_template_id = reinterpret_cast<uint64_t &>(descriptorUpdateTemplate); |
| 650 | layer_data->desc_template_createinfo_map.erase(descriptor_update_template_id); |
| 651 | descriptorUpdateTemplate = (VkDescriptorUpdateTemplate)unique_id_mapping[descriptor_update_template_id]; |
| 652 | unique_id_mapping.erase(descriptor_update_template_id); |
| 653 | lock.unlock(); |
| 654 | layer_data->device_dispatch_table.DestroyDescriptorUpdateTemplateKHR(device, descriptorUpdateTemplate, pAllocator); |
| 655 | } |
| 656 | |
| 657 | void *BuildUnwrappedUpdateTemplateBuffer(ValidationObject *layer_data, uint64_t descriptorUpdateTemplate, const void *pData) { |
| 658 | auto const template_map_entry = layer_data->desc_template_createinfo_map.find(descriptorUpdateTemplate); |
| 659 | if (template_map_entry == layer_data->desc_template_createinfo_map.end()) { |
| 660 | assert(0); |
| 661 | } |
| 662 | auto const &create_info = template_map_entry->second->create_info; |
| 663 | size_t allocation_size = 0; |
| 664 | std::vector<std::tuple<size_t, VulkanObjectType, uint64_t, size_t>> template_entries; |
| 665 | |
| 666 | for (uint32_t i = 0; i < create_info.descriptorUpdateEntryCount; i++) { |
| 667 | for (uint32_t j = 0; j < create_info.pDescriptorUpdateEntries[i].descriptorCount; j++) { |
| 668 | size_t offset = create_info.pDescriptorUpdateEntries[i].offset + j * create_info.pDescriptorUpdateEntries[i].stride; |
| 669 | char *update_entry = (char *)(pData) + offset; |
| 670 | |
| 671 | switch (create_info.pDescriptorUpdateEntries[i].descriptorType) { |
| 672 | case VK_DESCRIPTOR_TYPE_SAMPLER: |
| 673 | case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: |
| 674 | case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: |
| 675 | case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: |
| 676 | case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: { |
| 677 | auto image_entry = reinterpret_cast<VkDescriptorImageInfo *>(update_entry); |
| 678 | allocation_size = std::max(allocation_size, offset + sizeof(VkDescriptorImageInfo)); |
| 679 | |
| 680 | VkDescriptorImageInfo *wrapped_entry = new VkDescriptorImageInfo(*image_entry); |
| 681 | wrapped_entry->sampler = layer_data->Unwrap(image_entry->sampler); |
| 682 | wrapped_entry->imageView = layer_data->Unwrap(image_entry->imageView); |
| 683 | template_entries.emplace_back(offset, kVulkanObjectTypeImage, CastToUint64(wrapped_entry), 0); |
| 684 | } break; |
| 685 | |
| 686 | case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: |
| 687 | case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: |
| 688 | case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: |
| 689 | case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: { |
| 690 | auto buffer_entry = reinterpret_cast<VkDescriptorBufferInfo *>(update_entry); |
| 691 | allocation_size = std::max(allocation_size, offset + sizeof(VkDescriptorBufferInfo)); |
| 692 | |
| 693 | VkDescriptorBufferInfo *wrapped_entry = new VkDescriptorBufferInfo(*buffer_entry); |
| 694 | wrapped_entry->buffer = layer_data->Unwrap(buffer_entry->buffer); |
| 695 | template_entries.emplace_back(offset, kVulkanObjectTypeBuffer, CastToUint64(wrapped_entry), 0); |
| 696 | } break; |
| 697 | |
| 698 | case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: |
| 699 | case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: { |
| 700 | auto buffer_view_handle = reinterpret_cast<VkBufferView *>(update_entry); |
| 701 | allocation_size = std::max(allocation_size, offset + sizeof(VkBufferView)); |
| 702 | |
| 703 | VkBufferView wrapped_entry = layer_data->Unwrap(*buffer_view_handle); |
| 704 | template_entries.emplace_back(offset, kVulkanObjectTypeBufferView, CastToUint64(wrapped_entry), 0); |
| 705 | } break; |
| 706 | case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT: { |
| 707 | size_t numBytes = create_info.pDescriptorUpdateEntries[i].descriptorCount; |
| 708 | allocation_size = std::max(allocation_size, offset + numBytes); |
| 709 | // nothing to unwrap, just plain data |
| 710 | template_entries.emplace_back(offset, kVulkanObjectTypeUnknown, CastToUint64(update_entry), |
| 711 | numBytes); |
| 712 | // to break out of the loop |
| 713 | j = create_info.pDescriptorUpdateEntries[i].descriptorCount; |
| 714 | } break; |
| 715 | default: |
| 716 | assert(0); |
| 717 | break; |
| 718 | } |
| 719 | } |
| 720 | } |
| 721 | // Allocate required buffer size and populate with source/unwrapped data |
| 722 | void *unwrapped_data = malloc(allocation_size); |
| 723 | for (auto &this_entry : template_entries) { |
| 724 | VulkanObjectType type = std::get<1>(this_entry); |
| 725 | void *destination = (char *)unwrapped_data + std::get<0>(this_entry); |
| 726 | uint64_t source = std::get<2>(this_entry); |
| 727 | size_t size = std::get<3>(this_entry); |
| 728 | |
| 729 | if (size != 0) { |
| 730 | assert(type == kVulkanObjectTypeUnknown); |
| 731 | memcpy(destination, CastFromUint64<void *>(source), size); |
| 732 | } else { |
| 733 | switch (type) { |
| 734 | case kVulkanObjectTypeImage: |
| 735 | *(reinterpret_cast<VkDescriptorImageInfo *>(destination)) = |
| 736 | *(reinterpret_cast<VkDescriptorImageInfo *>(source)); |
| 737 | delete CastFromUint64<VkDescriptorImageInfo *>(source); |
| 738 | break; |
| 739 | case kVulkanObjectTypeBuffer: |
| 740 | *(reinterpret_cast<VkDescriptorBufferInfo *>(destination)) = |
| 741 | *(CastFromUint64<VkDescriptorBufferInfo *>(source)); |
| 742 | delete CastFromUint64<VkDescriptorBufferInfo *>(source); |
| 743 | break; |
| 744 | case kVulkanObjectTypeBufferView: |
| 745 | *(reinterpret_cast<VkBufferView *>(destination)) = CastFromUint64<VkBufferView>(source); |
| 746 | break; |
| 747 | default: |
| 748 | assert(0); |
| 749 | break; |
| 750 | } |
| 751 | } |
| 752 | } |
| 753 | return (void *)unwrapped_data; |
| 754 | } |
| 755 | |
| 756 | void DispatchUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, |
| 757 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const void *pData) { |
| 758 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 759 | if (!wrap_handles) |
| 760 | return layer_data->device_dispatch_table.UpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, |
| 761 | pData); |
| 762 | uint64_t template_handle = reinterpret_cast<uint64_t &>(descriptorUpdateTemplate); |
| 763 | { |
| 764 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 765 | descriptorSet = layer_data->Unwrap(descriptorSet); |
| 766 | descriptorUpdateTemplate = (VkDescriptorUpdateTemplate)unique_id_mapping[template_handle]; |
| 767 | } |
| 768 | void *unwrapped_buffer = BuildUnwrappedUpdateTemplateBuffer(layer_data, template_handle, pData); |
| 769 | layer_data->device_dispatch_table.UpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, unwrapped_buffer); |
| 770 | free(unwrapped_buffer); |
| 771 | } |
| 772 | |
| 773 | void DispatchUpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, |
| 774 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const void *pData) { |
| 775 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 776 | if (!wrap_handles) |
| 777 | return layer_data->device_dispatch_table.UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, |
| 778 | pData); |
| 779 | uint64_t template_handle = reinterpret_cast<uint64_t &>(descriptorUpdateTemplate); |
| 780 | void *unwrapped_buffer = nullptr; |
| 781 | { |
| 782 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 783 | descriptorSet = layer_data->Unwrap(descriptorSet); |
| 784 | descriptorUpdateTemplate = (VkDescriptorUpdateTemplate)unique_id_mapping[template_handle]; |
| 785 | unwrapped_buffer = BuildUnwrappedUpdateTemplateBuffer(layer_data, template_handle, pData); |
| 786 | } |
| 787 | layer_data->device_dispatch_table.UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, unwrapped_buffer); |
| 788 | free(unwrapped_buffer); |
| 789 | } |
| 790 | |
| 791 | void DispatchCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, |
| 792 | VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, VkPipelineLayout layout, |
| 793 | uint32_t set, const void *pData) { |
| 794 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 795 | if (!wrap_handles) |
| 796 | return layer_data->device_dispatch_table.CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, |
| 797 | layout, set, pData); |
| 798 | uint64_t template_handle = reinterpret_cast<uint64_t &>(descriptorUpdateTemplate); |
| 799 | void *unwrapped_buffer = nullptr; |
| 800 | { |
| 801 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 802 | descriptorUpdateTemplate = layer_data->Unwrap(descriptorUpdateTemplate); |
| 803 | layout = layer_data->Unwrap(layout); |
| 804 | unwrapped_buffer = BuildUnwrappedUpdateTemplateBuffer(layer_data, template_handle, pData); |
| 805 | } |
| 806 | layer_data->device_dispatch_table.CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, layout, set, |
| 807 | unwrapped_buffer); |
| 808 | free(unwrapped_buffer); |
| 809 | } |
| 810 | |
| 811 | VkResult DispatchGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 812 | VkDisplayPropertiesKHR *pProperties) { |
| 813 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 814 | VkResult result = |
| 815 | layer_data->instance_dispatch_table.GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
| 816 | if (!wrap_handles) return result; |
| 817 | if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pProperties) { |
| 818 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 819 | for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { |
| 820 | pProperties[idx0].display = layer_data->MaybeWrapDisplay(pProperties[idx0].display, layer_data); |
| 821 | } |
| 822 | } |
| 823 | return result; |
| 824 | } |
| 825 | |
| 826 | VkResult DispatchGetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 827 | VkDisplayProperties2KHR *pProperties) { |
| 828 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 829 | VkResult result = |
| 830 | layer_data->instance_dispatch_table.GetPhysicalDeviceDisplayProperties2KHR(physicalDevice, pPropertyCount, pProperties); |
| 831 | if (!wrap_handles) return result; |
| 832 | if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pProperties) { |
| 833 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 834 | for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { |
| 835 | pProperties[idx0].displayProperties.display = |
| 836 | layer_data->MaybeWrapDisplay(pProperties[idx0].displayProperties.display, layer_data); |
| 837 | } |
| 838 | } |
| 839 | return result; |
| 840 | } |
| 841 | |
| 842 | VkResult DispatchGetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 843 | VkDisplayPlanePropertiesKHR *pProperties) { |
| 844 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 845 | VkResult result = |
| 846 | layer_data->instance_dispatch_table.GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, pProperties); |
| 847 | if (!wrap_handles) return result; |
| 848 | if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pProperties) { |
| 849 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 850 | for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { |
| 851 | VkDisplayKHR &opt_display = pProperties[idx0].currentDisplay; |
| 852 | if (opt_display) opt_display = layer_data->MaybeWrapDisplay(opt_display, layer_data); |
| 853 | } |
| 854 | } |
| 855 | return result; |
| 856 | } |
| 857 | |
| 858 | VkResult DispatchGetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 859 | VkDisplayPlaneProperties2KHR *pProperties) { |
| 860 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 861 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice, |
| 862 | pPropertyCount, pProperties); |
| 863 | if (!wrap_handles) return result; |
| 864 | if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pProperties) { |
| 865 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 866 | for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { |
| 867 | VkDisplayKHR &opt_display = pProperties[idx0].displayPlaneProperties.currentDisplay; |
| 868 | if (opt_display) opt_display = layer_data->MaybeWrapDisplay(opt_display, layer_data); |
| 869 | } |
| 870 | } |
| 871 | return result; |
| 872 | } |
| 873 | |
| 874 | VkResult DispatchGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t *pDisplayCount, |
| 875 | VkDisplayKHR *pDisplays) { |
| 876 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 877 | VkResult result = layer_data->instance_dispatch_table.GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, |
| 878 | pDisplayCount, pDisplays); |
| 879 | if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pDisplays) { |
| 880 | if (!wrap_handles) return result; |
| 881 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 882 | for (uint32_t i = 0; i < *pDisplayCount; ++i) { |
| 883 | if (pDisplays[i]) pDisplays[i] = layer_data->MaybeWrapDisplay(pDisplays[i], layer_data); |
| 884 | } |
| 885 | } |
| 886 | return result; |
| 887 | } |
| 888 | |
| 889 | VkResult DispatchGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t *pPropertyCount, |
| 890 | VkDisplayModePropertiesKHR *pProperties) { |
| 891 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 892 | if (!wrap_handles) |
| 893 | return layer_data->instance_dispatch_table.GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, |
| 894 | pProperties); |
| 895 | { |
| 896 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 897 | display = layer_data->Unwrap(display); |
| 898 | } |
| 899 | |
| 900 | VkResult result = layer_data->instance_dispatch_table.GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); |
| 901 | if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pProperties) { |
| 902 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 903 | for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { |
| 904 | pProperties[idx0].displayMode = layer_data->WrapNew(pProperties[idx0].displayMode); |
| 905 | } |
| 906 | } |
| 907 | return result; |
| 908 | } |
| 909 | |
| 910 | VkResult DispatchGetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t *pPropertyCount, |
| 911 | VkDisplayModeProperties2KHR *pProperties) { |
| 912 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 913 | if (!wrap_handles) |
| 914 | return layer_data->instance_dispatch_table.GetDisplayModeProperties2KHR(physicalDevice, display, pPropertyCount, |
| 915 | pProperties); |
| 916 | { |
| 917 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 918 | display = layer_data->Unwrap(display); |
| 919 | } |
| 920 | |
| 921 | VkResult result = |
| 922 | layer_data->instance_dispatch_table.GetDisplayModeProperties2KHR(physicalDevice, display, pPropertyCount, pProperties); |
| 923 | if ((result == VK_SUCCESS || result == VK_INCOMPLETE) && pProperties) { |
| 924 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 925 | for (uint32_t idx0 = 0; idx0 < *pPropertyCount; ++idx0) { |
| 926 | pProperties[idx0].displayModeProperties.displayMode = layer_data->WrapNew(pProperties[idx0].displayModeProperties.displayMode); |
| 927 | } |
| 928 | } |
| 929 | return result; |
| 930 | } |
| 931 | |
| 932 | VkResult DispatchDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) { |
| 933 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 934 | if (!wrap_handles) return layer_data->device_dispatch_table.DebugMarkerSetObjectTagEXT(device, pTagInfo); |
| 935 | safe_VkDebugMarkerObjectTagInfoEXT local_tag_info(pTagInfo); |
| 936 | { |
| 937 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 938 | auto it = unique_id_mapping.find(reinterpret_cast<uint64_t &>(local_tag_info.object)); |
| 939 | if (it != unique_id_mapping.end()) { |
| 940 | local_tag_info.object = it->second; |
| 941 | } |
| 942 | } |
| 943 | VkResult result = layer_data->device_dispatch_table.DebugMarkerSetObjectTagEXT(device, |
| 944 | reinterpret_cast<VkDebugMarkerObjectTagInfoEXT *>(&local_tag_info)); |
| 945 | return result; |
| 946 | } |
| 947 | |
| 948 | VkResult DispatchDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo) { |
| 949 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 950 | if (!wrap_handles) return layer_data->device_dispatch_table.DebugMarkerSetObjectNameEXT(device, pNameInfo); |
| 951 | safe_VkDebugMarkerObjectNameInfoEXT local_name_info(pNameInfo); |
| 952 | { |
| 953 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 954 | auto it = unique_id_mapping.find(reinterpret_cast<uint64_t &>(local_name_info.object)); |
| 955 | if (it != unique_id_mapping.end()) { |
| 956 | local_name_info.object = it->second; |
| 957 | } |
| 958 | } |
| 959 | VkResult result = layer_data->device_dispatch_table.DebugMarkerSetObjectNameEXT( |
| 960 | device, reinterpret_cast<VkDebugMarkerObjectNameInfoEXT *>(&local_name_info)); |
| 961 | return result; |
| 962 | } |
| 963 | |
| 964 | // VK_EXT_debug_utils |
| 965 | VkResult DispatchSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) { |
| 966 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 967 | if (!wrap_handles) return layer_data->device_dispatch_table.SetDebugUtilsObjectTagEXT(device, pTagInfo); |
| 968 | safe_VkDebugUtilsObjectTagInfoEXT local_tag_info(pTagInfo); |
| 969 | { |
| 970 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 971 | auto it = unique_id_mapping.find(reinterpret_cast<uint64_t &>(local_tag_info.objectHandle)); |
| 972 | if (it != unique_id_mapping.end()) { |
| 973 | local_tag_info.objectHandle = it->second; |
| 974 | } |
| 975 | } |
| 976 | VkResult result = layer_data->device_dispatch_table.SetDebugUtilsObjectTagEXT( |
| 977 | device, reinterpret_cast<const VkDebugUtilsObjectTagInfoEXT *>(&local_tag_info)); |
| 978 | return result; |
| 979 | } |
| 980 | |
| 981 | VkResult DispatchSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) { |
| 982 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 983 | if (!wrap_handles) return layer_data->device_dispatch_table.SetDebugUtilsObjectNameEXT(device, pNameInfo); |
| 984 | safe_VkDebugUtilsObjectNameInfoEXT local_name_info(pNameInfo); |
| 985 | { |
| 986 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 987 | auto it = unique_id_mapping.find(reinterpret_cast<uint64_t &>(local_name_info.objectHandle)); |
| 988 | if (it != unique_id_mapping.end()) { |
| 989 | local_name_info.objectHandle = it->second; |
| 990 | } |
| 991 | } |
| 992 | VkResult result = layer_data->device_dispatch_table.SetDebugUtilsObjectNameEXT( |
| 993 | device, reinterpret_cast<const VkDebugUtilsObjectNameInfoEXT *>(&local_name_info)); |
| 994 | return result; |
| 995 | } |
| 996 | |
| 997 | |
| 998 | |
| 999 | |
| 1000 | // Skip vkCreateInstance dispatch, manually generated |
| 1001 | |
| 1002 | // Skip vkDestroyInstance dispatch, manually generated |
| 1003 | |
| 1004 | VkResult DispatchEnumeratePhysicalDevices( |
| 1005 | VkInstance instance, |
| 1006 | uint32_t* pPhysicalDeviceCount, |
| 1007 | VkPhysicalDevice* pPhysicalDevices) |
| 1008 | { |
| 1009 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 1010 | VkResult result = layer_data->instance_dispatch_table.EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
| 1011 | |
| 1012 | return result; |
| 1013 | } |
| 1014 | |
| 1015 | void DispatchGetPhysicalDeviceFeatures( |
| 1016 | VkPhysicalDevice physicalDevice, |
| 1017 | VkPhysicalDeviceFeatures* pFeatures) |
| 1018 | { |
| 1019 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1020 | layer_data->instance_dispatch_table.GetPhysicalDeviceFeatures(physicalDevice, pFeatures); |
| 1021 | |
| 1022 | } |
| 1023 | |
| 1024 | void DispatchGetPhysicalDeviceFormatProperties( |
| 1025 | VkPhysicalDevice physicalDevice, |
| 1026 | VkFormat format, |
| 1027 | VkFormatProperties* pFormatProperties) |
| 1028 | { |
| 1029 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1030 | layer_data->instance_dispatch_table.GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); |
| 1031 | |
| 1032 | } |
| 1033 | |
| 1034 | VkResult DispatchGetPhysicalDeviceImageFormatProperties( |
| 1035 | VkPhysicalDevice physicalDevice, |
| 1036 | VkFormat format, |
| 1037 | VkImageType type, |
| 1038 | VkImageTiling tiling, |
| 1039 | VkImageUsageFlags usage, |
| 1040 | VkImageCreateFlags flags, |
| 1041 | VkImageFormatProperties* pImageFormatProperties) |
| 1042 | { |
| 1043 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1044 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties); |
| 1045 | |
| 1046 | return result; |
| 1047 | } |
| 1048 | |
| 1049 | void DispatchGetPhysicalDeviceProperties( |
| 1050 | VkPhysicalDevice physicalDevice, |
| 1051 | VkPhysicalDeviceProperties* pProperties) |
| 1052 | { |
| 1053 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1054 | layer_data->instance_dispatch_table.GetPhysicalDeviceProperties(physicalDevice, pProperties); |
| 1055 | |
| 1056 | } |
| 1057 | |
| 1058 | void DispatchGetPhysicalDeviceQueueFamilyProperties( |
| 1059 | VkPhysicalDevice physicalDevice, |
| 1060 | uint32_t* pQueueFamilyPropertyCount, |
| 1061 | VkQueueFamilyProperties* pQueueFamilyProperties) |
| 1062 | { |
| 1063 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1064 | layer_data->instance_dispatch_table.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 1065 | |
| 1066 | } |
| 1067 | |
| 1068 | void DispatchGetPhysicalDeviceMemoryProperties( |
| 1069 | VkPhysicalDevice physicalDevice, |
| 1070 | VkPhysicalDeviceMemoryProperties* pMemoryProperties) |
| 1071 | { |
| 1072 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1073 | layer_data->instance_dispatch_table.GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); |
| 1074 | |
| 1075 | } |
| 1076 | |
| 1077 | PFN_vkVoidFunction DispatchGetInstanceProcAddr( |
| 1078 | VkInstance instance, |
| 1079 | const char* pName) |
| 1080 | { |
| 1081 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 1082 | PFN_vkVoidFunction result = layer_data->instance_dispatch_table.GetInstanceProcAddr(instance, pName); |
| 1083 | |
| 1084 | return result; |
| 1085 | } |
| 1086 | |
| 1087 | PFN_vkVoidFunction DispatchGetDeviceProcAddr( |
| 1088 | VkDevice device, |
| 1089 | const char* pName) |
| 1090 | { |
| 1091 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1092 | PFN_vkVoidFunction result = layer_data->device_dispatch_table.GetDeviceProcAddr(device, pName); |
| 1093 | |
| 1094 | return result; |
| 1095 | } |
| 1096 | |
| 1097 | // Skip vkCreateDevice dispatch, manually generated |
| 1098 | |
| 1099 | // Skip vkDestroyDevice dispatch, manually generated |
| 1100 | |
| 1101 | // Skip vkEnumerateInstanceExtensionProperties dispatch, manually generated |
| 1102 | |
| 1103 | // Skip vkEnumerateDeviceExtensionProperties dispatch, manually generated |
| 1104 | |
| 1105 | // Skip vkEnumerateInstanceLayerProperties dispatch, manually generated |
| 1106 | |
| 1107 | // Skip vkEnumerateDeviceLayerProperties dispatch, manually generated |
| 1108 | |
| 1109 | void DispatchGetDeviceQueue( |
| 1110 | VkDevice device, |
| 1111 | uint32_t queueFamilyIndex, |
| 1112 | uint32_t queueIndex, |
| 1113 | VkQueue* pQueue) |
| 1114 | { |
| 1115 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1116 | layer_data->device_dispatch_table.GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue); |
| 1117 | |
| 1118 | } |
| 1119 | |
| 1120 | VkResult DispatchQueueSubmit( |
| 1121 | VkQueue queue, |
| 1122 | uint32_t submitCount, |
| 1123 | const VkSubmitInfo* pSubmits, |
| 1124 | VkFence fence) |
| 1125 | { |
| 1126 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 1127 | if (!wrap_handles) return layer_data->device_dispatch_table.QueueSubmit(queue, submitCount, pSubmits, fence); |
| 1128 | safe_VkSubmitInfo *local_pSubmits = NULL; |
| 1129 | { |
| 1130 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1131 | if (pSubmits) { |
| 1132 | local_pSubmits = new safe_VkSubmitInfo[submitCount]; |
| 1133 | for (uint32_t index0 = 0; index0 < submitCount; ++index0) { |
| 1134 | local_pSubmits[index0].initialize(&pSubmits[index0]); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 1135 | WrapPnextChainHandles(layer_data, local_pSubmits[index0].pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1136 | if (local_pSubmits[index0].pWaitSemaphores) { |
| 1137 | for (uint32_t index1 = 0; index1 < local_pSubmits[index0].waitSemaphoreCount; ++index1) { |
| 1138 | local_pSubmits[index0].pWaitSemaphores[index1] = layer_data->Unwrap(local_pSubmits[index0].pWaitSemaphores[index1]); |
| 1139 | } |
| 1140 | } |
| 1141 | if (local_pSubmits[index0].pSignalSemaphores) { |
| 1142 | for (uint32_t index1 = 0; index1 < local_pSubmits[index0].signalSemaphoreCount; ++index1) { |
| 1143 | local_pSubmits[index0].pSignalSemaphores[index1] = layer_data->Unwrap(local_pSubmits[index0].pSignalSemaphores[index1]); |
| 1144 | } |
| 1145 | } |
| 1146 | } |
| 1147 | } |
| 1148 | fence = layer_data->Unwrap(fence); |
| 1149 | } |
| 1150 | VkResult result = layer_data->device_dispatch_table.QueueSubmit(queue, submitCount, (const VkSubmitInfo*)local_pSubmits, fence); |
| 1151 | if (local_pSubmits) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1152 | delete[] local_pSubmits; |
| 1153 | } |
| 1154 | return result; |
| 1155 | } |
| 1156 | |
| 1157 | VkResult DispatchQueueWaitIdle( |
| 1158 | VkQueue queue) |
| 1159 | { |
| 1160 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 1161 | VkResult result = layer_data->device_dispatch_table.QueueWaitIdle(queue); |
| 1162 | |
| 1163 | return result; |
| 1164 | } |
| 1165 | |
| 1166 | VkResult DispatchDeviceWaitIdle( |
| 1167 | VkDevice device) |
| 1168 | { |
| 1169 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1170 | VkResult result = layer_data->device_dispatch_table.DeviceWaitIdle(device); |
| 1171 | |
| 1172 | return result; |
| 1173 | } |
| 1174 | |
| 1175 | VkResult DispatchAllocateMemory( |
| 1176 | VkDevice device, |
| 1177 | const VkMemoryAllocateInfo* pAllocateInfo, |
| 1178 | const VkAllocationCallbacks* pAllocator, |
| 1179 | VkDeviceMemory* pMemory) |
| 1180 | { |
| 1181 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1182 | if (!wrap_handles) return layer_data->device_dispatch_table.AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); |
| 1183 | safe_VkMemoryAllocateInfo *local_pAllocateInfo = NULL; |
| 1184 | { |
| 1185 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1186 | if (pAllocateInfo) { |
| 1187 | local_pAllocateInfo = new safe_VkMemoryAllocateInfo(pAllocateInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 1188 | WrapPnextChainHandles(layer_data, local_pAllocateInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1189 | } |
| 1190 | } |
| 1191 | VkResult result = layer_data->device_dispatch_table.AllocateMemory(device, (const VkMemoryAllocateInfo*)local_pAllocateInfo, pAllocator, pMemory); |
| 1192 | if (local_pAllocateInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1193 | delete local_pAllocateInfo; |
| 1194 | } |
| 1195 | if (VK_SUCCESS == result) { |
| 1196 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1197 | *pMemory = layer_data->WrapNew(*pMemory); |
| 1198 | } |
| 1199 | return result; |
| 1200 | } |
| 1201 | |
| 1202 | void DispatchFreeMemory( |
| 1203 | VkDevice device, |
| 1204 | VkDeviceMemory memory, |
| 1205 | const VkAllocationCallbacks* pAllocator) |
| 1206 | { |
| 1207 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1208 | if (!wrap_handles) return layer_data->device_dispatch_table.FreeMemory(device, memory, pAllocator); |
| 1209 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1210 | uint64_t memory_id = reinterpret_cast<uint64_t &>(memory); |
| 1211 | memory = (VkDeviceMemory)unique_id_mapping[memory_id]; |
| 1212 | unique_id_mapping.erase(memory_id); |
| 1213 | lock.unlock(); |
| 1214 | layer_data->device_dispatch_table.FreeMemory(device, memory, pAllocator); |
| 1215 | |
| 1216 | } |
| 1217 | |
| 1218 | VkResult DispatchMapMemory( |
| 1219 | VkDevice device, |
| 1220 | VkDeviceMemory memory, |
| 1221 | VkDeviceSize offset, |
| 1222 | VkDeviceSize size, |
| 1223 | VkMemoryMapFlags flags, |
| 1224 | void** ppData) |
| 1225 | { |
| 1226 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1227 | if (!wrap_handles) return layer_data->device_dispatch_table.MapMemory(device, memory, offset, size, flags, ppData); |
| 1228 | { |
| 1229 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1230 | memory = layer_data->Unwrap(memory); |
| 1231 | } |
| 1232 | VkResult result = layer_data->device_dispatch_table.MapMemory(device, memory, offset, size, flags, ppData); |
| 1233 | |
| 1234 | return result; |
| 1235 | } |
| 1236 | |
| 1237 | void DispatchUnmapMemory( |
| 1238 | VkDevice device, |
| 1239 | VkDeviceMemory memory) |
| 1240 | { |
| 1241 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1242 | if (!wrap_handles) return layer_data->device_dispatch_table.UnmapMemory(device, memory); |
| 1243 | { |
| 1244 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1245 | memory = layer_data->Unwrap(memory); |
| 1246 | } |
| 1247 | layer_data->device_dispatch_table.UnmapMemory(device, memory); |
| 1248 | |
| 1249 | } |
| 1250 | |
| 1251 | VkResult DispatchFlushMappedMemoryRanges( |
| 1252 | VkDevice device, |
| 1253 | uint32_t memoryRangeCount, |
| 1254 | const VkMappedMemoryRange* pMemoryRanges) |
| 1255 | { |
| 1256 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1257 | if (!wrap_handles) return layer_data->device_dispatch_table.FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 1258 | safe_VkMappedMemoryRange *local_pMemoryRanges = NULL; |
| 1259 | { |
| 1260 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1261 | if (pMemoryRanges) { |
| 1262 | local_pMemoryRanges = new safe_VkMappedMemoryRange[memoryRangeCount]; |
| 1263 | for (uint32_t index0 = 0; index0 < memoryRangeCount; ++index0) { |
| 1264 | local_pMemoryRanges[index0].initialize(&pMemoryRanges[index0]); |
| 1265 | if (pMemoryRanges[index0].memory) { |
| 1266 | local_pMemoryRanges[index0].memory = layer_data->Unwrap(pMemoryRanges[index0].memory); |
| 1267 | } |
| 1268 | } |
| 1269 | } |
| 1270 | } |
| 1271 | VkResult result = layer_data->device_dispatch_table.FlushMappedMemoryRanges(device, memoryRangeCount, (const VkMappedMemoryRange*)local_pMemoryRanges); |
| 1272 | if (local_pMemoryRanges) { |
| 1273 | delete[] local_pMemoryRanges; |
| 1274 | } |
| 1275 | return result; |
| 1276 | } |
| 1277 | |
| 1278 | VkResult DispatchInvalidateMappedMemoryRanges( |
| 1279 | VkDevice device, |
| 1280 | uint32_t memoryRangeCount, |
| 1281 | const VkMappedMemoryRange* pMemoryRanges) |
| 1282 | { |
| 1283 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1284 | if (!wrap_handles) return layer_data->device_dispatch_table.InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 1285 | safe_VkMappedMemoryRange *local_pMemoryRanges = NULL; |
| 1286 | { |
| 1287 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1288 | if (pMemoryRanges) { |
| 1289 | local_pMemoryRanges = new safe_VkMappedMemoryRange[memoryRangeCount]; |
| 1290 | for (uint32_t index0 = 0; index0 < memoryRangeCount; ++index0) { |
| 1291 | local_pMemoryRanges[index0].initialize(&pMemoryRanges[index0]); |
| 1292 | if (pMemoryRanges[index0].memory) { |
| 1293 | local_pMemoryRanges[index0].memory = layer_data->Unwrap(pMemoryRanges[index0].memory); |
| 1294 | } |
| 1295 | } |
| 1296 | } |
| 1297 | } |
| 1298 | VkResult result = layer_data->device_dispatch_table.InvalidateMappedMemoryRanges(device, memoryRangeCount, (const VkMappedMemoryRange*)local_pMemoryRanges); |
| 1299 | if (local_pMemoryRanges) { |
| 1300 | delete[] local_pMemoryRanges; |
| 1301 | } |
| 1302 | return result; |
| 1303 | } |
| 1304 | |
| 1305 | void DispatchGetDeviceMemoryCommitment( |
| 1306 | VkDevice device, |
| 1307 | VkDeviceMemory memory, |
| 1308 | VkDeviceSize* pCommittedMemoryInBytes) |
| 1309 | { |
| 1310 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1311 | if (!wrap_handles) return layer_data->device_dispatch_table.GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
| 1312 | { |
| 1313 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1314 | memory = layer_data->Unwrap(memory); |
| 1315 | } |
| 1316 | layer_data->device_dispatch_table.GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
| 1317 | |
| 1318 | } |
| 1319 | |
| 1320 | VkResult DispatchBindBufferMemory( |
| 1321 | VkDevice device, |
| 1322 | VkBuffer buffer, |
| 1323 | VkDeviceMemory memory, |
| 1324 | VkDeviceSize memoryOffset) |
| 1325 | { |
| 1326 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1327 | if (!wrap_handles) return layer_data->device_dispatch_table.BindBufferMemory(device, buffer, memory, memoryOffset); |
| 1328 | { |
| 1329 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1330 | buffer = layer_data->Unwrap(buffer); |
| 1331 | memory = layer_data->Unwrap(memory); |
| 1332 | } |
| 1333 | VkResult result = layer_data->device_dispatch_table.BindBufferMemory(device, buffer, memory, memoryOffset); |
| 1334 | |
| 1335 | return result; |
| 1336 | } |
| 1337 | |
| 1338 | VkResult DispatchBindImageMemory( |
| 1339 | VkDevice device, |
| 1340 | VkImage image, |
| 1341 | VkDeviceMemory memory, |
| 1342 | VkDeviceSize memoryOffset) |
| 1343 | { |
| 1344 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1345 | if (!wrap_handles) return layer_data->device_dispatch_table.BindImageMemory(device, image, memory, memoryOffset); |
| 1346 | { |
| 1347 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1348 | image = layer_data->Unwrap(image); |
| 1349 | memory = layer_data->Unwrap(memory); |
| 1350 | } |
| 1351 | VkResult result = layer_data->device_dispatch_table.BindImageMemory(device, image, memory, memoryOffset); |
| 1352 | |
| 1353 | return result; |
| 1354 | } |
| 1355 | |
| 1356 | void DispatchGetBufferMemoryRequirements( |
| 1357 | VkDevice device, |
| 1358 | VkBuffer buffer, |
| 1359 | VkMemoryRequirements* pMemoryRequirements) |
| 1360 | { |
| 1361 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1362 | if (!wrap_handles) return layer_data->device_dispatch_table.GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
| 1363 | { |
| 1364 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1365 | buffer = layer_data->Unwrap(buffer); |
| 1366 | } |
| 1367 | layer_data->device_dispatch_table.GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
| 1368 | |
| 1369 | } |
| 1370 | |
| 1371 | void DispatchGetImageMemoryRequirements( |
| 1372 | VkDevice device, |
| 1373 | VkImage image, |
| 1374 | VkMemoryRequirements* pMemoryRequirements) |
| 1375 | { |
| 1376 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1377 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageMemoryRequirements(device, image, pMemoryRequirements); |
| 1378 | { |
| 1379 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1380 | image = layer_data->Unwrap(image); |
| 1381 | } |
| 1382 | layer_data->device_dispatch_table.GetImageMemoryRequirements(device, image, pMemoryRequirements); |
| 1383 | |
| 1384 | } |
| 1385 | |
| 1386 | void DispatchGetImageSparseMemoryRequirements( |
| 1387 | VkDevice device, |
| 1388 | VkImage image, |
| 1389 | uint32_t* pSparseMemoryRequirementCount, |
| 1390 | VkSparseImageMemoryRequirements* pSparseMemoryRequirements) |
| 1391 | { |
| 1392 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1393 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 1394 | { |
| 1395 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1396 | image = layer_data->Unwrap(image); |
| 1397 | } |
| 1398 | layer_data->device_dispatch_table.GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 1399 | |
| 1400 | } |
| 1401 | |
| 1402 | void DispatchGetPhysicalDeviceSparseImageFormatProperties( |
| 1403 | VkPhysicalDevice physicalDevice, |
| 1404 | VkFormat format, |
| 1405 | VkImageType type, |
| 1406 | VkSampleCountFlagBits samples, |
| 1407 | VkImageUsageFlags usage, |
| 1408 | VkImageTiling tiling, |
| 1409 | uint32_t* pPropertyCount, |
| 1410 | VkSparseImageFormatProperties* pProperties) |
| 1411 | { |
| 1412 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 1413 | layer_data->instance_dispatch_table.GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties); |
| 1414 | |
| 1415 | } |
| 1416 | |
| 1417 | VkResult DispatchQueueBindSparse( |
| 1418 | VkQueue queue, |
| 1419 | uint32_t bindInfoCount, |
| 1420 | const VkBindSparseInfo* pBindInfo, |
| 1421 | VkFence fence) |
| 1422 | { |
| 1423 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 1424 | if (!wrap_handles) return layer_data->device_dispatch_table.QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
| 1425 | safe_VkBindSparseInfo *local_pBindInfo = NULL; |
| 1426 | { |
| 1427 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1428 | if (pBindInfo) { |
| 1429 | local_pBindInfo = new safe_VkBindSparseInfo[bindInfoCount]; |
| 1430 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
| 1431 | local_pBindInfo[index0].initialize(&pBindInfo[index0]); |
| 1432 | if (local_pBindInfo[index0].pWaitSemaphores) { |
| 1433 | for (uint32_t index1 = 0; index1 < local_pBindInfo[index0].waitSemaphoreCount; ++index1) { |
| 1434 | local_pBindInfo[index0].pWaitSemaphores[index1] = layer_data->Unwrap(local_pBindInfo[index0].pWaitSemaphores[index1]); |
| 1435 | } |
| 1436 | } |
| 1437 | if (local_pBindInfo[index0].pBufferBinds) { |
| 1438 | for (uint32_t index1 = 0; index1 < local_pBindInfo[index0].bufferBindCount; ++index1) { |
| 1439 | if (pBindInfo[index0].pBufferBinds[index1].buffer) { |
| 1440 | local_pBindInfo[index0].pBufferBinds[index1].buffer = layer_data->Unwrap(pBindInfo[index0].pBufferBinds[index1].buffer); |
| 1441 | } |
| 1442 | if (local_pBindInfo[index0].pBufferBinds[index1].pBinds) { |
| 1443 | for (uint32_t index2 = 0; index2 < local_pBindInfo[index0].pBufferBinds[index1].bindCount; ++index2) { |
| 1444 | if (pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory) { |
| 1445 | local_pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory = layer_data->Unwrap(pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory); |
| 1446 | } |
| 1447 | } |
| 1448 | } |
| 1449 | } |
| 1450 | } |
| 1451 | if (local_pBindInfo[index0].pImageOpaqueBinds) { |
| 1452 | for (uint32_t index1 = 0; index1 < local_pBindInfo[index0].imageOpaqueBindCount; ++index1) { |
| 1453 | if (pBindInfo[index0].pImageOpaqueBinds[index1].image) { |
| 1454 | local_pBindInfo[index0].pImageOpaqueBinds[index1].image = layer_data->Unwrap(pBindInfo[index0].pImageOpaqueBinds[index1].image); |
| 1455 | } |
| 1456 | if (local_pBindInfo[index0].pImageOpaqueBinds[index1].pBinds) { |
| 1457 | for (uint32_t index2 = 0; index2 < local_pBindInfo[index0].pImageOpaqueBinds[index1].bindCount; ++index2) { |
| 1458 | if (pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory) { |
| 1459 | local_pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory = layer_data->Unwrap(pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory); |
| 1460 | } |
| 1461 | } |
| 1462 | } |
| 1463 | } |
| 1464 | } |
| 1465 | if (local_pBindInfo[index0].pImageBinds) { |
| 1466 | for (uint32_t index1 = 0; index1 < local_pBindInfo[index0].imageBindCount; ++index1) { |
| 1467 | if (pBindInfo[index0].pImageBinds[index1].image) { |
| 1468 | local_pBindInfo[index0].pImageBinds[index1].image = layer_data->Unwrap(pBindInfo[index0].pImageBinds[index1].image); |
| 1469 | } |
| 1470 | if (local_pBindInfo[index0].pImageBinds[index1].pBinds) { |
| 1471 | for (uint32_t index2 = 0; index2 < local_pBindInfo[index0].pImageBinds[index1].bindCount; ++index2) { |
| 1472 | if (pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory) { |
| 1473 | local_pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory = layer_data->Unwrap(pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory); |
| 1474 | } |
| 1475 | } |
| 1476 | } |
| 1477 | } |
| 1478 | } |
| 1479 | if (local_pBindInfo[index0].pSignalSemaphores) { |
| 1480 | for (uint32_t index1 = 0; index1 < local_pBindInfo[index0].signalSemaphoreCount; ++index1) { |
| 1481 | local_pBindInfo[index0].pSignalSemaphores[index1] = layer_data->Unwrap(local_pBindInfo[index0].pSignalSemaphores[index1]); |
| 1482 | } |
| 1483 | } |
| 1484 | } |
| 1485 | } |
| 1486 | fence = layer_data->Unwrap(fence); |
| 1487 | } |
| 1488 | VkResult result = layer_data->device_dispatch_table.QueueBindSparse(queue, bindInfoCount, (const VkBindSparseInfo*)local_pBindInfo, fence); |
| 1489 | if (local_pBindInfo) { |
| 1490 | delete[] local_pBindInfo; |
| 1491 | } |
| 1492 | return result; |
| 1493 | } |
| 1494 | |
| 1495 | VkResult DispatchCreateFence( |
| 1496 | VkDevice device, |
| 1497 | const VkFenceCreateInfo* pCreateInfo, |
| 1498 | const VkAllocationCallbacks* pAllocator, |
| 1499 | VkFence* pFence) |
| 1500 | { |
| 1501 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1502 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateFence(device, pCreateInfo, pAllocator, pFence); |
| 1503 | VkResult result = layer_data->device_dispatch_table.CreateFence(device, pCreateInfo, pAllocator, pFence); |
| 1504 | if (VK_SUCCESS == result) { |
| 1505 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1506 | *pFence = layer_data->WrapNew(*pFence); |
| 1507 | } |
| 1508 | return result; |
| 1509 | } |
| 1510 | |
| 1511 | void DispatchDestroyFence( |
| 1512 | VkDevice device, |
| 1513 | VkFence fence, |
| 1514 | const VkAllocationCallbacks* pAllocator) |
| 1515 | { |
| 1516 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1517 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyFence(device, fence, pAllocator); |
| 1518 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1519 | uint64_t fence_id = reinterpret_cast<uint64_t &>(fence); |
| 1520 | fence = (VkFence)unique_id_mapping[fence_id]; |
| 1521 | unique_id_mapping.erase(fence_id); |
| 1522 | lock.unlock(); |
| 1523 | layer_data->device_dispatch_table.DestroyFence(device, fence, pAllocator); |
| 1524 | |
| 1525 | } |
| 1526 | |
| 1527 | VkResult DispatchResetFences( |
| 1528 | VkDevice device, |
| 1529 | uint32_t fenceCount, |
| 1530 | const VkFence* pFences) |
| 1531 | { |
| 1532 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1533 | if (!wrap_handles) return layer_data->device_dispatch_table.ResetFences(device, fenceCount, pFences); |
| 1534 | VkFence *local_pFences = NULL; |
| 1535 | { |
| 1536 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1537 | if (pFences) { |
| 1538 | local_pFences = new VkFence[fenceCount]; |
| 1539 | for (uint32_t index0 = 0; index0 < fenceCount; ++index0) { |
| 1540 | local_pFences[index0] = layer_data->Unwrap(pFences[index0]); |
| 1541 | } |
| 1542 | } |
| 1543 | } |
| 1544 | VkResult result = layer_data->device_dispatch_table.ResetFences(device, fenceCount, (const VkFence*)local_pFences); |
| 1545 | if (local_pFences) |
| 1546 | delete[] local_pFences; |
| 1547 | return result; |
| 1548 | } |
| 1549 | |
| 1550 | VkResult DispatchGetFenceStatus( |
| 1551 | VkDevice device, |
| 1552 | VkFence fence) |
| 1553 | { |
| 1554 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1555 | if (!wrap_handles) return layer_data->device_dispatch_table.GetFenceStatus(device, fence); |
| 1556 | { |
| 1557 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1558 | fence = layer_data->Unwrap(fence); |
| 1559 | } |
| 1560 | VkResult result = layer_data->device_dispatch_table.GetFenceStatus(device, fence); |
| 1561 | |
| 1562 | return result; |
| 1563 | } |
| 1564 | |
| 1565 | VkResult DispatchWaitForFences( |
| 1566 | VkDevice device, |
| 1567 | uint32_t fenceCount, |
| 1568 | const VkFence* pFences, |
| 1569 | VkBool32 waitAll, |
| 1570 | uint64_t timeout) |
| 1571 | { |
| 1572 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1573 | if (!wrap_handles) return layer_data->device_dispatch_table.WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 1574 | VkFence *local_pFences = NULL; |
| 1575 | { |
| 1576 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1577 | if (pFences) { |
| 1578 | local_pFences = new VkFence[fenceCount]; |
| 1579 | for (uint32_t index0 = 0; index0 < fenceCount; ++index0) { |
| 1580 | local_pFences[index0] = layer_data->Unwrap(pFences[index0]); |
| 1581 | } |
| 1582 | } |
| 1583 | } |
| 1584 | VkResult result = layer_data->device_dispatch_table.WaitForFences(device, fenceCount, (const VkFence*)local_pFences, waitAll, timeout); |
| 1585 | if (local_pFences) |
| 1586 | delete[] local_pFences; |
| 1587 | return result; |
| 1588 | } |
| 1589 | |
| 1590 | VkResult DispatchCreateSemaphore( |
| 1591 | VkDevice device, |
| 1592 | const VkSemaphoreCreateInfo* pCreateInfo, |
| 1593 | const VkAllocationCallbacks* pAllocator, |
| 1594 | VkSemaphore* pSemaphore) |
| 1595 | { |
| 1596 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1597 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
| 1598 | VkResult result = layer_data->device_dispatch_table.CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
| 1599 | if (VK_SUCCESS == result) { |
| 1600 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1601 | *pSemaphore = layer_data->WrapNew(*pSemaphore); |
| 1602 | } |
| 1603 | return result; |
| 1604 | } |
| 1605 | |
| 1606 | void DispatchDestroySemaphore( |
| 1607 | VkDevice device, |
| 1608 | VkSemaphore semaphore, |
| 1609 | const VkAllocationCallbacks* pAllocator) |
| 1610 | { |
| 1611 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1612 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroySemaphore(device, semaphore, pAllocator); |
| 1613 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1614 | uint64_t semaphore_id = reinterpret_cast<uint64_t &>(semaphore); |
| 1615 | semaphore = (VkSemaphore)unique_id_mapping[semaphore_id]; |
| 1616 | unique_id_mapping.erase(semaphore_id); |
| 1617 | lock.unlock(); |
| 1618 | layer_data->device_dispatch_table.DestroySemaphore(device, semaphore, pAllocator); |
| 1619 | |
| 1620 | } |
| 1621 | |
| 1622 | VkResult DispatchCreateEvent( |
| 1623 | VkDevice device, |
| 1624 | const VkEventCreateInfo* pCreateInfo, |
| 1625 | const VkAllocationCallbacks* pAllocator, |
| 1626 | VkEvent* pEvent) |
| 1627 | { |
| 1628 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1629 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
| 1630 | VkResult result = layer_data->device_dispatch_table.CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
| 1631 | if (VK_SUCCESS == result) { |
| 1632 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1633 | *pEvent = layer_data->WrapNew(*pEvent); |
| 1634 | } |
| 1635 | return result; |
| 1636 | } |
| 1637 | |
| 1638 | void DispatchDestroyEvent( |
| 1639 | VkDevice device, |
| 1640 | VkEvent event, |
| 1641 | const VkAllocationCallbacks* pAllocator) |
| 1642 | { |
| 1643 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1644 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyEvent(device, event, pAllocator); |
| 1645 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1646 | uint64_t event_id = reinterpret_cast<uint64_t &>(event); |
| 1647 | event = (VkEvent)unique_id_mapping[event_id]; |
| 1648 | unique_id_mapping.erase(event_id); |
| 1649 | lock.unlock(); |
| 1650 | layer_data->device_dispatch_table.DestroyEvent(device, event, pAllocator); |
| 1651 | |
| 1652 | } |
| 1653 | |
| 1654 | VkResult DispatchGetEventStatus( |
| 1655 | VkDevice device, |
| 1656 | VkEvent event) |
| 1657 | { |
| 1658 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1659 | if (!wrap_handles) return layer_data->device_dispatch_table.GetEventStatus(device, event); |
| 1660 | { |
| 1661 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1662 | event = layer_data->Unwrap(event); |
| 1663 | } |
| 1664 | VkResult result = layer_data->device_dispatch_table.GetEventStatus(device, event); |
| 1665 | |
| 1666 | return result; |
| 1667 | } |
| 1668 | |
| 1669 | VkResult DispatchSetEvent( |
| 1670 | VkDevice device, |
| 1671 | VkEvent event) |
| 1672 | { |
| 1673 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1674 | if (!wrap_handles) return layer_data->device_dispatch_table.SetEvent(device, event); |
| 1675 | { |
| 1676 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1677 | event = layer_data->Unwrap(event); |
| 1678 | } |
| 1679 | VkResult result = layer_data->device_dispatch_table.SetEvent(device, event); |
| 1680 | |
| 1681 | return result; |
| 1682 | } |
| 1683 | |
| 1684 | VkResult DispatchResetEvent( |
| 1685 | VkDevice device, |
| 1686 | VkEvent event) |
| 1687 | { |
| 1688 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1689 | if (!wrap_handles) return layer_data->device_dispatch_table.ResetEvent(device, event); |
| 1690 | { |
| 1691 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1692 | event = layer_data->Unwrap(event); |
| 1693 | } |
| 1694 | VkResult result = layer_data->device_dispatch_table.ResetEvent(device, event); |
| 1695 | |
| 1696 | return result; |
| 1697 | } |
| 1698 | |
| 1699 | VkResult DispatchCreateQueryPool( |
| 1700 | VkDevice device, |
| 1701 | const VkQueryPoolCreateInfo* pCreateInfo, |
| 1702 | const VkAllocationCallbacks* pAllocator, |
| 1703 | VkQueryPool* pQueryPool) |
| 1704 | { |
| 1705 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1706 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
| 1707 | VkResult result = layer_data->device_dispatch_table.CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
| 1708 | if (VK_SUCCESS == result) { |
| 1709 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1710 | *pQueryPool = layer_data->WrapNew(*pQueryPool); |
| 1711 | } |
| 1712 | return result; |
| 1713 | } |
| 1714 | |
| 1715 | void DispatchDestroyQueryPool( |
| 1716 | VkDevice device, |
| 1717 | VkQueryPool queryPool, |
| 1718 | const VkAllocationCallbacks* pAllocator) |
| 1719 | { |
| 1720 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1721 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyQueryPool(device, queryPool, pAllocator); |
| 1722 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1723 | uint64_t queryPool_id = reinterpret_cast<uint64_t &>(queryPool); |
| 1724 | queryPool = (VkQueryPool)unique_id_mapping[queryPool_id]; |
| 1725 | unique_id_mapping.erase(queryPool_id); |
| 1726 | lock.unlock(); |
| 1727 | layer_data->device_dispatch_table.DestroyQueryPool(device, queryPool, pAllocator); |
| 1728 | |
| 1729 | } |
| 1730 | |
| 1731 | VkResult DispatchGetQueryPoolResults( |
| 1732 | VkDevice device, |
| 1733 | VkQueryPool queryPool, |
| 1734 | uint32_t firstQuery, |
| 1735 | uint32_t queryCount, |
| 1736 | size_t dataSize, |
| 1737 | void* pData, |
| 1738 | VkDeviceSize stride, |
| 1739 | VkQueryResultFlags flags) |
| 1740 | { |
| 1741 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1742 | if (!wrap_handles) return layer_data->device_dispatch_table.GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
| 1743 | { |
| 1744 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1745 | queryPool = layer_data->Unwrap(queryPool); |
| 1746 | } |
| 1747 | VkResult result = layer_data->device_dispatch_table.GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
| 1748 | |
| 1749 | return result; |
| 1750 | } |
| 1751 | |
| 1752 | VkResult DispatchCreateBuffer( |
| 1753 | VkDevice device, |
| 1754 | const VkBufferCreateInfo* pCreateInfo, |
| 1755 | const VkAllocationCallbacks* pAllocator, |
| 1756 | VkBuffer* pBuffer) |
| 1757 | { |
| 1758 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1759 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
| 1760 | VkResult result = layer_data->device_dispatch_table.CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
| 1761 | if (VK_SUCCESS == result) { |
| 1762 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1763 | *pBuffer = layer_data->WrapNew(*pBuffer); |
| 1764 | } |
| 1765 | return result; |
| 1766 | } |
| 1767 | |
| 1768 | void DispatchDestroyBuffer( |
| 1769 | VkDevice device, |
| 1770 | VkBuffer buffer, |
| 1771 | const VkAllocationCallbacks* pAllocator) |
| 1772 | { |
| 1773 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1774 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyBuffer(device, buffer, pAllocator); |
| 1775 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1776 | uint64_t buffer_id = reinterpret_cast<uint64_t &>(buffer); |
| 1777 | buffer = (VkBuffer)unique_id_mapping[buffer_id]; |
| 1778 | unique_id_mapping.erase(buffer_id); |
| 1779 | lock.unlock(); |
| 1780 | layer_data->device_dispatch_table.DestroyBuffer(device, buffer, pAllocator); |
| 1781 | |
| 1782 | } |
| 1783 | |
| 1784 | VkResult DispatchCreateBufferView( |
| 1785 | VkDevice device, |
| 1786 | const VkBufferViewCreateInfo* pCreateInfo, |
| 1787 | const VkAllocationCallbacks* pAllocator, |
| 1788 | VkBufferView* pView) |
| 1789 | { |
| 1790 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1791 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateBufferView(device, pCreateInfo, pAllocator, pView); |
| 1792 | safe_VkBufferViewCreateInfo *local_pCreateInfo = NULL; |
| 1793 | { |
| 1794 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1795 | if (pCreateInfo) { |
| 1796 | local_pCreateInfo = new safe_VkBufferViewCreateInfo(pCreateInfo); |
| 1797 | if (pCreateInfo->buffer) { |
| 1798 | local_pCreateInfo->buffer = layer_data->Unwrap(pCreateInfo->buffer); |
| 1799 | } |
| 1800 | } |
| 1801 | } |
| 1802 | VkResult result = layer_data->device_dispatch_table.CreateBufferView(device, (const VkBufferViewCreateInfo*)local_pCreateInfo, pAllocator, pView); |
| 1803 | if (local_pCreateInfo) { |
| 1804 | delete local_pCreateInfo; |
| 1805 | } |
| 1806 | if (VK_SUCCESS == result) { |
| 1807 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1808 | *pView = layer_data->WrapNew(*pView); |
| 1809 | } |
| 1810 | return result; |
| 1811 | } |
| 1812 | |
| 1813 | void DispatchDestroyBufferView( |
| 1814 | VkDevice device, |
| 1815 | VkBufferView bufferView, |
| 1816 | const VkAllocationCallbacks* pAllocator) |
| 1817 | { |
| 1818 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1819 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyBufferView(device, bufferView, pAllocator); |
| 1820 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1821 | uint64_t bufferView_id = reinterpret_cast<uint64_t &>(bufferView); |
| 1822 | bufferView = (VkBufferView)unique_id_mapping[bufferView_id]; |
| 1823 | unique_id_mapping.erase(bufferView_id); |
| 1824 | lock.unlock(); |
| 1825 | layer_data->device_dispatch_table.DestroyBufferView(device, bufferView, pAllocator); |
| 1826 | |
| 1827 | } |
| 1828 | |
| 1829 | VkResult DispatchCreateImage( |
| 1830 | VkDevice device, |
| 1831 | const VkImageCreateInfo* pCreateInfo, |
| 1832 | const VkAllocationCallbacks* pAllocator, |
| 1833 | VkImage* pImage) |
| 1834 | { |
| 1835 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1836 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateImage(device, pCreateInfo, pAllocator, pImage); |
| 1837 | safe_VkImageCreateInfo *local_pCreateInfo = NULL; |
| 1838 | { |
| 1839 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1840 | if (pCreateInfo) { |
| 1841 | local_pCreateInfo = new safe_VkImageCreateInfo(pCreateInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 1842 | WrapPnextChainHandles(layer_data, local_pCreateInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1843 | } |
| 1844 | } |
| 1845 | VkResult result = layer_data->device_dispatch_table.CreateImage(device, (const VkImageCreateInfo*)local_pCreateInfo, pAllocator, pImage); |
| 1846 | if (local_pCreateInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1847 | delete local_pCreateInfo; |
| 1848 | } |
| 1849 | if (VK_SUCCESS == result) { |
| 1850 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1851 | *pImage = layer_data->WrapNew(*pImage); |
| 1852 | } |
| 1853 | return result; |
| 1854 | } |
| 1855 | |
| 1856 | void DispatchDestroyImage( |
| 1857 | VkDevice device, |
| 1858 | VkImage image, |
| 1859 | const VkAllocationCallbacks* pAllocator) |
| 1860 | { |
| 1861 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1862 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyImage(device, image, pAllocator); |
| 1863 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1864 | uint64_t image_id = reinterpret_cast<uint64_t &>(image); |
| 1865 | image = (VkImage)unique_id_mapping[image_id]; |
| 1866 | unique_id_mapping.erase(image_id); |
| 1867 | lock.unlock(); |
| 1868 | layer_data->device_dispatch_table.DestroyImage(device, image, pAllocator); |
| 1869 | |
| 1870 | } |
| 1871 | |
| 1872 | void DispatchGetImageSubresourceLayout( |
| 1873 | VkDevice device, |
| 1874 | VkImage image, |
| 1875 | const VkImageSubresource* pSubresource, |
| 1876 | VkSubresourceLayout* pLayout) |
| 1877 | { |
| 1878 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1879 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageSubresourceLayout(device, image, pSubresource, pLayout); |
| 1880 | { |
| 1881 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1882 | image = layer_data->Unwrap(image); |
| 1883 | } |
| 1884 | layer_data->device_dispatch_table.GetImageSubresourceLayout(device, image, pSubresource, pLayout); |
| 1885 | |
| 1886 | } |
| 1887 | |
| 1888 | VkResult DispatchCreateImageView( |
| 1889 | VkDevice device, |
| 1890 | const VkImageViewCreateInfo* pCreateInfo, |
| 1891 | const VkAllocationCallbacks* pAllocator, |
| 1892 | VkImageView* pView) |
| 1893 | { |
| 1894 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1895 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateImageView(device, pCreateInfo, pAllocator, pView); |
| 1896 | safe_VkImageViewCreateInfo *local_pCreateInfo = NULL; |
| 1897 | { |
| 1898 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1899 | if (pCreateInfo) { |
| 1900 | local_pCreateInfo = new safe_VkImageViewCreateInfo(pCreateInfo); |
| 1901 | if (pCreateInfo->image) { |
| 1902 | local_pCreateInfo->image = layer_data->Unwrap(pCreateInfo->image); |
| 1903 | } |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 1904 | WrapPnextChainHandles(layer_data, local_pCreateInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1905 | } |
| 1906 | } |
| 1907 | VkResult result = layer_data->device_dispatch_table.CreateImageView(device, (const VkImageViewCreateInfo*)local_pCreateInfo, pAllocator, pView); |
| 1908 | if (local_pCreateInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1909 | delete local_pCreateInfo; |
| 1910 | } |
| 1911 | if (VK_SUCCESS == result) { |
| 1912 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1913 | *pView = layer_data->WrapNew(*pView); |
| 1914 | } |
| 1915 | return result; |
| 1916 | } |
| 1917 | |
| 1918 | void DispatchDestroyImageView( |
| 1919 | VkDevice device, |
| 1920 | VkImageView imageView, |
| 1921 | const VkAllocationCallbacks* pAllocator) |
| 1922 | { |
| 1923 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1924 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyImageView(device, imageView, pAllocator); |
| 1925 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1926 | uint64_t imageView_id = reinterpret_cast<uint64_t &>(imageView); |
| 1927 | imageView = (VkImageView)unique_id_mapping[imageView_id]; |
| 1928 | unique_id_mapping.erase(imageView_id); |
| 1929 | lock.unlock(); |
| 1930 | layer_data->device_dispatch_table.DestroyImageView(device, imageView, pAllocator); |
| 1931 | |
| 1932 | } |
| 1933 | |
| 1934 | VkResult DispatchCreateShaderModule( |
| 1935 | VkDevice device, |
| 1936 | const VkShaderModuleCreateInfo* pCreateInfo, |
| 1937 | const VkAllocationCallbacks* pAllocator, |
| 1938 | VkShaderModule* pShaderModule) |
| 1939 | { |
| 1940 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1941 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); |
| 1942 | safe_VkShaderModuleCreateInfo *local_pCreateInfo = NULL; |
| 1943 | { |
| 1944 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1945 | if (pCreateInfo) { |
| 1946 | local_pCreateInfo = new safe_VkShaderModuleCreateInfo(pCreateInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 1947 | WrapPnextChainHandles(layer_data, local_pCreateInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1948 | } |
| 1949 | } |
| 1950 | VkResult result = layer_data->device_dispatch_table.CreateShaderModule(device, (const VkShaderModuleCreateInfo*)local_pCreateInfo, pAllocator, pShaderModule); |
| 1951 | if (local_pCreateInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 1952 | delete local_pCreateInfo; |
| 1953 | } |
| 1954 | if (VK_SUCCESS == result) { |
| 1955 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1956 | *pShaderModule = layer_data->WrapNew(*pShaderModule); |
| 1957 | } |
| 1958 | return result; |
| 1959 | } |
| 1960 | |
| 1961 | void DispatchDestroyShaderModule( |
| 1962 | VkDevice device, |
| 1963 | VkShaderModule shaderModule, |
| 1964 | const VkAllocationCallbacks* pAllocator) |
| 1965 | { |
| 1966 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1967 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyShaderModule(device, shaderModule, pAllocator); |
| 1968 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 1969 | uint64_t shaderModule_id = reinterpret_cast<uint64_t &>(shaderModule); |
| 1970 | shaderModule = (VkShaderModule)unique_id_mapping[shaderModule_id]; |
| 1971 | unique_id_mapping.erase(shaderModule_id); |
| 1972 | lock.unlock(); |
| 1973 | layer_data->device_dispatch_table.DestroyShaderModule(device, shaderModule, pAllocator); |
| 1974 | |
| 1975 | } |
| 1976 | |
| 1977 | VkResult DispatchCreatePipelineCache( |
| 1978 | VkDevice device, |
| 1979 | const VkPipelineCacheCreateInfo* pCreateInfo, |
| 1980 | const VkAllocationCallbacks* pAllocator, |
| 1981 | VkPipelineCache* pPipelineCache) |
| 1982 | { |
| 1983 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1984 | if (!wrap_handles) return layer_data->device_dispatch_table.CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); |
| 1985 | VkResult result = layer_data->device_dispatch_table.CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); |
| 1986 | if (VK_SUCCESS == result) { |
| 1987 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 1988 | *pPipelineCache = layer_data->WrapNew(*pPipelineCache); |
| 1989 | } |
| 1990 | return result; |
| 1991 | } |
| 1992 | |
| 1993 | void DispatchDestroyPipelineCache( |
| 1994 | VkDevice device, |
| 1995 | VkPipelineCache pipelineCache, |
| 1996 | const VkAllocationCallbacks* pAllocator) |
| 1997 | { |
| 1998 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 1999 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyPipelineCache(device, pipelineCache, pAllocator); |
| 2000 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 2001 | uint64_t pipelineCache_id = reinterpret_cast<uint64_t &>(pipelineCache); |
| 2002 | pipelineCache = (VkPipelineCache)unique_id_mapping[pipelineCache_id]; |
| 2003 | unique_id_mapping.erase(pipelineCache_id); |
| 2004 | lock.unlock(); |
| 2005 | layer_data->device_dispatch_table.DestroyPipelineCache(device, pipelineCache, pAllocator); |
| 2006 | |
| 2007 | } |
| 2008 | |
| 2009 | VkResult DispatchGetPipelineCacheData( |
| 2010 | VkDevice device, |
| 2011 | VkPipelineCache pipelineCache, |
| 2012 | size_t* pDataSize, |
| 2013 | void* pData) |
| 2014 | { |
| 2015 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2016 | if (!wrap_handles) return layer_data->device_dispatch_table.GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
| 2017 | { |
| 2018 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2019 | pipelineCache = layer_data->Unwrap(pipelineCache); |
| 2020 | } |
| 2021 | VkResult result = layer_data->device_dispatch_table.GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
| 2022 | |
| 2023 | return result; |
| 2024 | } |
| 2025 | |
| 2026 | VkResult DispatchMergePipelineCaches( |
| 2027 | VkDevice device, |
| 2028 | VkPipelineCache dstCache, |
| 2029 | uint32_t srcCacheCount, |
| 2030 | const VkPipelineCache* pSrcCaches) |
| 2031 | { |
| 2032 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2033 | if (!wrap_handles) return layer_data->device_dispatch_table.MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); |
| 2034 | VkPipelineCache *local_pSrcCaches = NULL; |
| 2035 | { |
| 2036 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2037 | dstCache = layer_data->Unwrap(dstCache); |
| 2038 | if (pSrcCaches) { |
| 2039 | local_pSrcCaches = new VkPipelineCache[srcCacheCount]; |
| 2040 | for (uint32_t index0 = 0; index0 < srcCacheCount; ++index0) { |
| 2041 | local_pSrcCaches[index0] = layer_data->Unwrap(pSrcCaches[index0]); |
| 2042 | } |
| 2043 | } |
| 2044 | } |
| 2045 | VkResult result = layer_data->device_dispatch_table.MergePipelineCaches(device, dstCache, srcCacheCount, (const VkPipelineCache*)local_pSrcCaches); |
| 2046 | if (local_pSrcCaches) |
| 2047 | delete[] local_pSrcCaches; |
| 2048 | return result; |
| 2049 | } |
| 2050 | |
| 2051 | // Skip vkCreateGraphicsPipelines dispatch, manually generated |
| 2052 | |
| 2053 | // Skip vkCreateComputePipelines dispatch, manually generated |
| 2054 | |
| 2055 | void DispatchDestroyPipeline( |
| 2056 | VkDevice device, |
| 2057 | VkPipeline pipeline, |
| 2058 | const VkAllocationCallbacks* pAllocator) |
| 2059 | { |
| 2060 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2061 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyPipeline(device, pipeline, pAllocator); |
| 2062 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 2063 | uint64_t pipeline_id = reinterpret_cast<uint64_t &>(pipeline); |
| 2064 | pipeline = (VkPipeline)unique_id_mapping[pipeline_id]; |
| 2065 | unique_id_mapping.erase(pipeline_id); |
| 2066 | lock.unlock(); |
| 2067 | layer_data->device_dispatch_table.DestroyPipeline(device, pipeline, pAllocator); |
| 2068 | |
| 2069 | } |
| 2070 | |
| 2071 | VkResult DispatchCreatePipelineLayout( |
| 2072 | VkDevice device, |
| 2073 | const VkPipelineLayoutCreateInfo* pCreateInfo, |
| 2074 | const VkAllocationCallbacks* pAllocator, |
| 2075 | VkPipelineLayout* pPipelineLayout) |
| 2076 | { |
| 2077 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2078 | if (!wrap_handles) return layer_data->device_dispatch_table.CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); |
| 2079 | safe_VkPipelineLayoutCreateInfo *local_pCreateInfo = NULL; |
| 2080 | { |
| 2081 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2082 | if (pCreateInfo) { |
| 2083 | local_pCreateInfo = new safe_VkPipelineLayoutCreateInfo(pCreateInfo); |
| 2084 | if (local_pCreateInfo->pSetLayouts) { |
| 2085 | for (uint32_t index1 = 0; index1 < local_pCreateInfo->setLayoutCount; ++index1) { |
| 2086 | local_pCreateInfo->pSetLayouts[index1] = layer_data->Unwrap(local_pCreateInfo->pSetLayouts[index1]); |
| 2087 | } |
| 2088 | } |
| 2089 | } |
| 2090 | } |
| 2091 | VkResult result = layer_data->device_dispatch_table.CreatePipelineLayout(device, (const VkPipelineLayoutCreateInfo*)local_pCreateInfo, pAllocator, pPipelineLayout); |
| 2092 | if (local_pCreateInfo) { |
| 2093 | delete local_pCreateInfo; |
| 2094 | } |
| 2095 | if (VK_SUCCESS == result) { |
| 2096 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2097 | *pPipelineLayout = layer_data->WrapNew(*pPipelineLayout); |
| 2098 | } |
| 2099 | return result; |
| 2100 | } |
| 2101 | |
| 2102 | void DispatchDestroyPipelineLayout( |
| 2103 | VkDevice device, |
| 2104 | VkPipelineLayout pipelineLayout, |
| 2105 | const VkAllocationCallbacks* pAllocator) |
| 2106 | { |
| 2107 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2108 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
| 2109 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 2110 | uint64_t pipelineLayout_id = reinterpret_cast<uint64_t &>(pipelineLayout); |
| 2111 | pipelineLayout = (VkPipelineLayout)unique_id_mapping[pipelineLayout_id]; |
| 2112 | unique_id_mapping.erase(pipelineLayout_id); |
| 2113 | lock.unlock(); |
| 2114 | layer_data->device_dispatch_table.DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
| 2115 | |
| 2116 | } |
| 2117 | |
| 2118 | VkResult DispatchCreateSampler( |
| 2119 | VkDevice device, |
| 2120 | const VkSamplerCreateInfo* pCreateInfo, |
| 2121 | const VkAllocationCallbacks* pAllocator, |
| 2122 | VkSampler* pSampler) |
| 2123 | { |
| 2124 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2125 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateSampler(device, pCreateInfo, pAllocator, pSampler); |
| 2126 | safe_VkSamplerCreateInfo *local_pCreateInfo = NULL; |
| 2127 | { |
| 2128 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2129 | if (pCreateInfo) { |
| 2130 | local_pCreateInfo = new safe_VkSamplerCreateInfo(pCreateInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 2131 | WrapPnextChainHandles(layer_data, local_pCreateInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 2132 | } |
| 2133 | } |
| 2134 | VkResult result = layer_data->device_dispatch_table.CreateSampler(device, (const VkSamplerCreateInfo*)local_pCreateInfo, pAllocator, pSampler); |
| 2135 | if (local_pCreateInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 2136 | delete local_pCreateInfo; |
| 2137 | } |
| 2138 | if (VK_SUCCESS == result) { |
| 2139 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2140 | *pSampler = layer_data->WrapNew(*pSampler); |
| 2141 | } |
| 2142 | return result; |
| 2143 | } |
| 2144 | |
| 2145 | void DispatchDestroySampler( |
| 2146 | VkDevice device, |
| 2147 | VkSampler sampler, |
| 2148 | const VkAllocationCallbacks* pAllocator) |
| 2149 | { |
| 2150 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2151 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroySampler(device, sampler, pAllocator); |
| 2152 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 2153 | uint64_t sampler_id = reinterpret_cast<uint64_t &>(sampler); |
| 2154 | sampler = (VkSampler)unique_id_mapping[sampler_id]; |
| 2155 | unique_id_mapping.erase(sampler_id); |
| 2156 | lock.unlock(); |
| 2157 | layer_data->device_dispatch_table.DestroySampler(device, sampler, pAllocator); |
| 2158 | |
| 2159 | } |
| 2160 | |
| 2161 | VkResult DispatchCreateDescriptorSetLayout( |
| 2162 | VkDevice device, |
| 2163 | const VkDescriptorSetLayoutCreateInfo* pCreateInfo, |
| 2164 | const VkAllocationCallbacks* pAllocator, |
| 2165 | VkDescriptorSetLayout* pSetLayout) |
| 2166 | { |
| 2167 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2168 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); |
| 2169 | safe_VkDescriptorSetLayoutCreateInfo *local_pCreateInfo = NULL; |
| 2170 | { |
| 2171 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2172 | if (pCreateInfo) { |
| 2173 | local_pCreateInfo = new safe_VkDescriptorSetLayoutCreateInfo(pCreateInfo); |
| 2174 | if (local_pCreateInfo->pBindings) { |
| 2175 | for (uint32_t index1 = 0; index1 < local_pCreateInfo->bindingCount; ++index1) { |
| 2176 | if (local_pCreateInfo->pBindings[index1].pImmutableSamplers) { |
| 2177 | for (uint32_t index2 = 0; index2 < local_pCreateInfo->pBindings[index1].descriptorCount; ++index2) { |
| 2178 | local_pCreateInfo->pBindings[index1].pImmutableSamplers[index2] = layer_data->Unwrap(local_pCreateInfo->pBindings[index1].pImmutableSamplers[index2]); |
| 2179 | } |
| 2180 | } |
| 2181 | } |
| 2182 | } |
| 2183 | } |
| 2184 | } |
| 2185 | VkResult result = layer_data->device_dispatch_table.CreateDescriptorSetLayout(device, (const VkDescriptorSetLayoutCreateInfo*)local_pCreateInfo, pAllocator, pSetLayout); |
| 2186 | if (local_pCreateInfo) { |
| 2187 | delete local_pCreateInfo; |
| 2188 | } |
| 2189 | if (VK_SUCCESS == result) { |
| 2190 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2191 | *pSetLayout = layer_data->WrapNew(*pSetLayout); |
| 2192 | } |
| 2193 | return result; |
| 2194 | } |
| 2195 | |
| 2196 | void DispatchDestroyDescriptorSetLayout( |
| 2197 | VkDevice device, |
| 2198 | VkDescriptorSetLayout descriptorSetLayout, |
| 2199 | const VkAllocationCallbacks* pAllocator) |
| 2200 | { |
| 2201 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2202 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
| 2203 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 2204 | uint64_t descriptorSetLayout_id = reinterpret_cast<uint64_t &>(descriptorSetLayout); |
| 2205 | descriptorSetLayout = (VkDescriptorSetLayout)unique_id_mapping[descriptorSetLayout_id]; |
| 2206 | unique_id_mapping.erase(descriptorSetLayout_id); |
| 2207 | lock.unlock(); |
| 2208 | layer_data->device_dispatch_table.DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
| 2209 | |
| 2210 | } |
| 2211 | |
| 2212 | VkResult DispatchCreateDescriptorPool( |
| 2213 | VkDevice device, |
| 2214 | const VkDescriptorPoolCreateInfo* pCreateInfo, |
| 2215 | const VkAllocationCallbacks* pAllocator, |
| 2216 | VkDescriptorPool* pDescriptorPool) |
| 2217 | { |
| 2218 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2219 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); |
| 2220 | VkResult result = layer_data->device_dispatch_table.CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); |
| 2221 | if (VK_SUCCESS == result) { |
| 2222 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2223 | *pDescriptorPool = layer_data->WrapNew(*pDescriptorPool); |
| 2224 | } |
| 2225 | return result; |
| 2226 | } |
| 2227 | |
| 2228 | // Skip vkDestroyDescriptorPool dispatch, manually generated |
| 2229 | |
| 2230 | // Skip vkResetDescriptorPool dispatch, manually generated |
| 2231 | |
| 2232 | // Skip vkAllocateDescriptorSets dispatch, manually generated |
| 2233 | |
| 2234 | // Skip vkFreeDescriptorSets dispatch, manually generated |
| 2235 | |
| 2236 | void DispatchUpdateDescriptorSets( |
| 2237 | VkDevice device, |
| 2238 | uint32_t descriptorWriteCount, |
| 2239 | const VkWriteDescriptorSet* pDescriptorWrites, |
| 2240 | uint32_t descriptorCopyCount, |
| 2241 | const VkCopyDescriptorSet* pDescriptorCopies) |
| 2242 | { |
| 2243 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2244 | if (!wrap_handles) return layer_data->device_dispatch_table.UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
| 2245 | safe_VkWriteDescriptorSet *local_pDescriptorWrites = NULL; |
| 2246 | safe_VkCopyDescriptorSet *local_pDescriptorCopies = NULL; |
| 2247 | { |
| 2248 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2249 | if (pDescriptorWrites) { |
| 2250 | local_pDescriptorWrites = new safe_VkWriteDescriptorSet[descriptorWriteCount]; |
| 2251 | for (uint32_t index0 = 0; index0 < descriptorWriteCount; ++index0) { |
| 2252 | local_pDescriptorWrites[index0].initialize(&pDescriptorWrites[index0]); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 2253 | WrapPnextChainHandles(layer_data, local_pDescriptorWrites[index0].pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 2254 | if (pDescriptorWrites[index0].dstSet) { |
| 2255 | local_pDescriptorWrites[index0].dstSet = layer_data->Unwrap(pDescriptorWrites[index0].dstSet); |
| 2256 | } |
| 2257 | if (local_pDescriptorWrites[index0].pImageInfo) { |
| 2258 | for (uint32_t index1 = 0; index1 < local_pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 2259 | if (pDescriptorWrites[index0].pImageInfo[index1].sampler) { |
| 2260 | local_pDescriptorWrites[index0].pImageInfo[index1].sampler = layer_data->Unwrap(pDescriptorWrites[index0].pImageInfo[index1].sampler); |
| 2261 | } |
| 2262 | if (pDescriptorWrites[index0].pImageInfo[index1].imageView) { |
| 2263 | local_pDescriptorWrites[index0].pImageInfo[index1].imageView = layer_data->Unwrap(pDescriptorWrites[index0].pImageInfo[index1].imageView); |
| 2264 | } |
| 2265 | } |
| 2266 | } |
| 2267 | if (local_pDescriptorWrites[index0].pBufferInfo) { |
| 2268 | for (uint32_t index1 = 0; index1 < local_pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 2269 | if (pDescriptorWrites[index0].pBufferInfo[index1].buffer) { |
| 2270 | local_pDescriptorWrites[index0].pBufferInfo[index1].buffer = layer_data->Unwrap(pDescriptorWrites[index0].pBufferInfo[index1].buffer); |
| 2271 | } |
| 2272 | } |
| 2273 | } |
| 2274 | if (local_pDescriptorWrites[index0].pTexelBufferView) { |
| 2275 | for (uint32_t index1 = 0; index1 < local_pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 2276 | local_pDescriptorWrites[index0].pTexelBufferView[index1] = layer_data->Unwrap(local_pDescriptorWrites[index0].pTexelBufferView[index1]); |
| 2277 | } |
| 2278 | } |
| 2279 | } |
| 2280 | } |
| 2281 | if (pDescriptorCopies) { |
| 2282 | local_pDescriptorCopies = new safe_VkCopyDescriptorSet[descriptorCopyCount]; |
| 2283 | for (uint32_t index0 = 0; index0 < descriptorCopyCount; ++index0) { |
| 2284 | local_pDescriptorCopies[index0].initialize(&pDescriptorCopies[index0]); |
| 2285 | if (pDescriptorCopies[index0].srcSet) { |
| 2286 | local_pDescriptorCopies[index0].srcSet = layer_data->Unwrap(pDescriptorCopies[index0].srcSet); |
| 2287 | } |
| 2288 | if (pDescriptorCopies[index0].dstSet) { |
| 2289 | local_pDescriptorCopies[index0].dstSet = layer_data->Unwrap(pDescriptorCopies[index0].dstSet); |
| 2290 | } |
| 2291 | } |
| 2292 | } |
| 2293 | } |
| 2294 | layer_data->device_dispatch_table.UpdateDescriptorSets(device, descriptorWriteCount, (const VkWriteDescriptorSet*)local_pDescriptorWrites, descriptorCopyCount, (const VkCopyDescriptorSet*)local_pDescriptorCopies); |
| 2295 | if (local_pDescriptorWrites) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 2296 | delete[] local_pDescriptorWrites; |
| 2297 | } |
| 2298 | if (local_pDescriptorCopies) { |
| 2299 | delete[] local_pDescriptorCopies; |
| 2300 | } |
| 2301 | } |
| 2302 | |
| 2303 | VkResult DispatchCreateFramebuffer( |
| 2304 | VkDevice device, |
| 2305 | const VkFramebufferCreateInfo* pCreateInfo, |
| 2306 | const VkAllocationCallbacks* pAllocator, |
| 2307 | VkFramebuffer* pFramebuffer) |
| 2308 | { |
| 2309 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2310 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
| 2311 | safe_VkFramebufferCreateInfo *local_pCreateInfo = NULL; |
| 2312 | { |
| 2313 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2314 | if (pCreateInfo) { |
| 2315 | local_pCreateInfo = new safe_VkFramebufferCreateInfo(pCreateInfo); |
| 2316 | if (pCreateInfo->renderPass) { |
| 2317 | local_pCreateInfo->renderPass = layer_data->Unwrap(pCreateInfo->renderPass); |
| 2318 | } |
| 2319 | if (local_pCreateInfo->pAttachments) { |
| 2320 | for (uint32_t index1 = 0; index1 < local_pCreateInfo->attachmentCount; ++index1) { |
| 2321 | local_pCreateInfo->pAttachments[index1] = layer_data->Unwrap(local_pCreateInfo->pAttachments[index1]); |
| 2322 | } |
| 2323 | } |
| 2324 | } |
| 2325 | } |
| 2326 | VkResult result = layer_data->device_dispatch_table.CreateFramebuffer(device, (const VkFramebufferCreateInfo*)local_pCreateInfo, pAllocator, pFramebuffer); |
| 2327 | if (local_pCreateInfo) { |
| 2328 | delete local_pCreateInfo; |
| 2329 | } |
| 2330 | if (VK_SUCCESS == result) { |
| 2331 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2332 | *pFramebuffer = layer_data->WrapNew(*pFramebuffer); |
| 2333 | } |
| 2334 | return result; |
| 2335 | } |
| 2336 | |
| 2337 | void DispatchDestroyFramebuffer( |
| 2338 | VkDevice device, |
| 2339 | VkFramebuffer framebuffer, |
| 2340 | const VkAllocationCallbacks* pAllocator) |
| 2341 | { |
| 2342 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2343 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyFramebuffer(device, framebuffer, pAllocator); |
| 2344 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 2345 | uint64_t framebuffer_id = reinterpret_cast<uint64_t &>(framebuffer); |
| 2346 | framebuffer = (VkFramebuffer)unique_id_mapping[framebuffer_id]; |
| 2347 | unique_id_mapping.erase(framebuffer_id); |
| 2348 | lock.unlock(); |
| 2349 | layer_data->device_dispatch_table.DestroyFramebuffer(device, framebuffer, pAllocator); |
| 2350 | |
| 2351 | } |
| 2352 | |
| 2353 | // Skip vkCreateRenderPass dispatch, manually generated |
| 2354 | |
| 2355 | // Skip vkDestroyRenderPass dispatch, manually generated |
| 2356 | |
| 2357 | void DispatchGetRenderAreaGranularity( |
| 2358 | VkDevice device, |
| 2359 | VkRenderPass renderPass, |
| 2360 | VkExtent2D* pGranularity) |
| 2361 | { |
| 2362 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2363 | if (!wrap_handles) return layer_data->device_dispatch_table.GetRenderAreaGranularity(device, renderPass, pGranularity); |
| 2364 | { |
| 2365 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2366 | renderPass = layer_data->Unwrap(renderPass); |
| 2367 | } |
| 2368 | layer_data->device_dispatch_table.GetRenderAreaGranularity(device, renderPass, pGranularity); |
| 2369 | |
| 2370 | } |
| 2371 | |
| 2372 | VkResult DispatchCreateCommandPool( |
| 2373 | VkDevice device, |
| 2374 | const VkCommandPoolCreateInfo* pCreateInfo, |
| 2375 | const VkAllocationCallbacks* pAllocator, |
| 2376 | VkCommandPool* pCommandPool) |
| 2377 | { |
| 2378 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2379 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
| 2380 | VkResult result = layer_data->device_dispatch_table.CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
| 2381 | if (VK_SUCCESS == result) { |
| 2382 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2383 | *pCommandPool = layer_data->WrapNew(*pCommandPool); |
| 2384 | } |
| 2385 | return result; |
| 2386 | } |
| 2387 | |
| 2388 | void DispatchDestroyCommandPool( |
| 2389 | VkDevice device, |
| 2390 | VkCommandPool commandPool, |
| 2391 | const VkAllocationCallbacks* pAllocator) |
| 2392 | { |
| 2393 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2394 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyCommandPool(device, commandPool, pAllocator); |
| 2395 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 2396 | uint64_t commandPool_id = reinterpret_cast<uint64_t &>(commandPool); |
| 2397 | commandPool = (VkCommandPool)unique_id_mapping[commandPool_id]; |
| 2398 | unique_id_mapping.erase(commandPool_id); |
| 2399 | lock.unlock(); |
| 2400 | layer_data->device_dispatch_table.DestroyCommandPool(device, commandPool, pAllocator); |
| 2401 | |
| 2402 | } |
| 2403 | |
| 2404 | VkResult DispatchResetCommandPool( |
| 2405 | VkDevice device, |
| 2406 | VkCommandPool commandPool, |
| 2407 | VkCommandPoolResetFlags flags) |
| 2408 | { |
| 2409 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2410 | if (!wrap_handles) return layer_data->device_dispatch_table.ResetCommandPool(device, commandPool, flags); |
| 2411 | { |
| 2412 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2413 | commandPool = layer_data->Unwrap(commandPool); |
| 2414 | } |
| 2415 | VkResult result = layer_data->device_dispatch_table.ResetCommandPool(device, commandPool, flags); |
| 2416 | |
| 2417 | return result; |
| 2418 | } |
| 2419 | |
| 2420 | VkResult DispatchAllocateCommandBuffers( |
| 2421 | VkDevice device, |
| 2422 | const VkCommandBufferAllocateInfo* pAllocateInfo, |
| 2423 | VkCommandBuffer* pCommandBuffers) |
| 2424 | { |
| 2425 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2426 | if (!wrap_handles) return layer_data->device_dispatch_table.AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
| 2427 | safe_VkCommandBufferAllocateInfo *local_pAllocateInfo = NULL; |
| 2428 | { |
| 2429 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2430 | if (pAllocateInfo) { |
| 2431 | local_pAllocateInfo = new safe_VkCommandBufferAllocateInfo(pAllocateInfo); |
| 2432 | if (pAllocateInfo->commandPool) { |
| 2433 | local_pAllocateInfo->commandPool = layer_data->Unwrap(pAllocateInfo->commandPool); |
| 2434 | } |
| 2435 | } |
| 2436 | } |
| 2437 | VkResult result = layer_data->device_dispatch_table.AllocateCommandBuffers(device, (const VkCommandBufferAllocateInfo*)local_pAllocateInfo, pCommandBuffers); |
| 2438 | if (local_pAllocateInfo) { |
| 2439 | delete local_pAllocateInfo; |
| 2440 | } |
| 2441 | return result; |
| 2442 | } |
| 2443 | |
| 2444 | void DispatchFreeCommandBuffers( |
| 2445 | VkDevice device, |
| 2446 | VkCommandPool commandPool, |
| 2447 | uint32_t commandBufferCount, |
| 2448 | const VkCommandBuffer* pCommandBuffers) |
| 2449 | { |
| 2450 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 2451 | if (!wrap_handles) return layer_data->device_dispatch_table.FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
| 2452 | { |
| 2453 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2454 | commandPool = layer_data->Unwrap(commandPool); |
| 2455 | } |
| 2456 | layer_data->device_dispatch_table.FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
| 2457 | |
| 2458 | } |
| 2459 | |
| 2460 | VkResult DispatchBeginCommandBuffer( |
| 2461 | VkCommandBuffer commandBuffer, |
| 2462 | const VkCommandBufferBeginInfo* pBeginInfo) |
| 2463 | { |
| 2464 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2465 | if (!wrap_handles) return layer_data->device_dispatch_table.BeginCommandBuffer(commandBuffer, pBeginInfo); |
| 2466 | safe_VkCommandBufferBeginInfo *local_pBeginInfo = NULL; |
| 2467 | { |
| 2468 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2469 | if (pBeginInfo) { |
| 2470 | local_pBeginInfo = new safe_VkCommandBufferBeginInfo(pBeginInfo); |
| 2471 | if (local_pBeginInfo->pInheritanceInfo) { |
| 2472 | if (pBeginInfo->pInheritanceInfo->renderPass) { |
| 2473 | local_pBeginInfo->pInheritanceInfo->renderPass = layer_data->Unwrap(pBeginInfo->pInheritanceInfo->renderPass); |
| 2474 | } |
| 2475 | if (pBeginInfo->pInheritanceInfo->framebuffer) { |
| 2476 | local_pBeginInfo->pInheritanceInfo->framebuffer = layer_data->Unwrap(pBeginInfo->pInheritanceInfo->framebuffer); |
| 2477 | } |
| 2478 | } |
| 2479 | } |
| 2480 | } |
| 2481 | VkResult result = layer_data->device_dispatch_table.BeginCommandBuffer(commandBuffer, (const VkCommandBufferBeginInfo*)local_pBeginInfo); |
| 2482 | if (local_pBeginInfo) { |
| 2483 | delete local_pBeginInfo; |
| 2484 | } |
| 2485 | return result; |
| 2486 | } |
| 2487 | |
| 2488 | VkResult DispatchEndCommandBuffer( |
| 2489 | VkCommandBuffer commandBuffer) |
| 2490 | { |
| 2491 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2492 | VkResult result = layer_data->device_dispatch_table.EndCommandBuffer(commandBuffer); |
| 2493 | |
| 2494 | return result; |
| 2495 | } |
| 2496 | |
| 2497 | VkResult DispatchResetCommandBuffer( |
| 2498 | VkCommandBuffer commandBuffer, |
| 2499 | VkCommandBufferResetFlags flags) |
| 2500 | { |
| 2501 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2502 | VkResult result = layer_data->device_dispatch_table.ResetCommandBuffer(commandBuffer, flags); |
| 2503 | |
| 2504 | return result; |
| 2505 | } |
| 2506 | |
| 2507 | void DispatchCmdBindPipeline( |
| 2508 | VkCommandBuffer commandBuffer, |
| 2509 | VkPipelineBindPoint pipelineBindPoint, |
| 2510 | VkPipeline pipeline) |
| 2511 | { |
| 2512 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2513 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
| 2514 | { |
| 2515 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2516 | pipeline = layer_data->Unwrap(pipeline); |
| 2517 | } |
| 2518 | layer_data->device_dispatch_table.CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
| 2519 | |
| 2520 | } |
| 2521 | |
| 2522 | void DispatchCmdSetViewport( |
| 2523 | VkCommandBuffer commandBuffer, |
| 2524 | uint32_t firstViewport, |
| 2525 | uint32_t viewportCount, |
| 2526 | const VkViewport* pViewports) |
| 2527 | { |
| 2528 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2529 | layer_data->device_dispatch_table.CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
| 2530 | |
| 2531 | } |
| 2532 | |
| 2533 | void DispatchCmdSetScissor( |
| 2534 | VkCommandBuffer commandBuffer, |
| 2535 | uint32_t firstScissor, |
| 2536 | uint32_t scissorCount, |
| 2537 | const VkRect2D* pScissors) |
| 2538 | { |
| 2539 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2540 | layer_data->device_dispatch_table.CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
| 2541 | |
| 2542 | } |
| 2543 | |
| 2544 | void DispatchCmdSetLineWidth( |
| 2545 | VkCommandBuffer commandBuffer, |
| 2546 | float lineWidth) |
| 2547 | { |
| 2548 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2549 | layer_data->device_dispatch_table.CmdSetLineWidth(commandBuffer, lineWidth); |
| 2550 | |
| 2551 | } |
| 2552 | |
| 2553 | void DispatchCmdSetDepthBias( |
| 2554 | VkCommandBuffer commandBuffer, |
| 2555 | float depthBiasConstantFactor, |
| 2556 | float depthBiasClamp, |
| 2557 | float depthBiasSlopeFactor) |
| 2558 | { |
| 2559 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2560 | layer_data->device_dispatch_table.CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
| 2561 | |
| 2562 | } |
| 2563 | |
| 2564 | void DispatchCmdSetBlendConstants( |
| 2565 | VkCommandBuffer commandBuffer, |
| 2566 | const float blendConstants[4]) |
| 2567 | { |
| 2568 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2569 | layer_data->device_dispatch_table.CmdSetBlendConstants(commandBuffer, blendConstants); |
| 2570 | |
| 2571 | } |
| 2572 | |
| 2573 | void DispatchCmdSetDepthBounds( |
| 2574 | VkCommandBuffer commandBuffer, |
| 2575 | float minDepthBounds, |
| 2576 | float maxDepthBounds) |
| 2577 | { |
| 2578 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2579 | layer_data->device_dispatch_table.CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
| 2580 | |
| 2581 | } |
| 2582 | |
| 2583 | void DispatchCmdSetStencilCompareMask( |
| 2584 | VkCommandBuffer commandBuffer, |
| 2585 | VkStencilFaceFlags faceMask, |
| 2586 | uint32_t compareMask) |
| 2587 | { |
| 2588 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2589 | layer_data->device_dispatch_table.CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
| 2590 | |
| 2591 | } |
| 2592 | |
| 2593 | void DispatchCmdSetStencilWriteMask( |
| 2594 | VkCommandBuffer commandBuffer, |
| 2595 | VkStencilFaceFlags faceMask, |
| 2596 | uint32_t writeMask) |
| 2597 | { |
| 2598 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2599 | layer_data->device_dispatch_table.CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
| 2600 | |
| 2601 | } |
| 2602 | |
| 2603 | void DispatchCmdSetStencilReference( |
| 2604 | VkCommandBuffer commandBuffer, |
| 2605 | VkStencilFaceFlags faceMask, |
| 2606 | uint32_t reference) |
| 2607 | { |
| 2608 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2609 | layer_data->device_dispatch_table.CmdSetStencilReference(commandBuffer, faceMask, reference); |
| 2610 | |
| 2611 | } |
| 2612 | |
| 2613 | void DispatchCmdBindDescriptorSets( |
| 2614 | VkCommandBuffer commandBuffer, |
| 2615 | VkPipelineBindPoint pipelineBindPoint, |
| 2616 | VkPipelineLayout layout, |
| 2617 | uint32_t firstSet, |
| 2618 | uint32_t descriptorSetCount, |
| 2619 | const VkDescriptorSet* pDescriptorSets, |
| 2620 | uint32_t dynamicOffsetCount, |
| 2621 | const uint32_t* pDynamicOffsets) |
| 2622 | { |
| 2623 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2624 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
| 2625 | VkDescriptorSet *local_pDescriptorSets = NULL; |
| 2626 | { |
| 2627 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2628 | layout = layer_data->Unwrap(layout); |
| 2629 | if (pDescriptorSets) { |
| 2630 | local_pDescriptorSets = new VkDescriptorSet[descriptorSetCount]; |
| 2631 | for (uint32_t index0 = 0; index0 < descriptorSetCount; ++index0) { |
| 2632 | local_pDescriptorSets[index0] = layer_data->Unwrap(pDescriptorSets[index0]); |
| 2633 | } |
| 2634 | } |
| 2635 | } |
| 2636 | layer_data->device_dispatch_table.CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, (const VkDescriptorSet*)local_pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
| 2637 | if (local_pDescriptorSets) |
| 2638 | delete[] local_pDescriptorSets; |
| 2639 | } |
| 2640 | |
| 2641 | void DispatchCmdBindIndexBuffer( |
| 2642 | VkCommandBuffer commandBuffer, |
| 2643 | VkBuffer buffer, |
| 2644 | VkDeviceSize offset, |
| 2645 | VkIndexType indexType) |
| 2646 | { |
| 2647 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2648 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
| 2649 | { |
| 2650 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2651 | buffer = layer_data->Unwrap(buffer); |
| 2652 | } |
| 2653 | layer_data->device_dispatch_table.CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
| 2654 | |
| 2655 | } |
| 2656 | |
| 2657 | void DispatchCmdBindVertexBuffers( |
| 2658 | VkCommandBuffer commandBuffer, |
| 2659 | uint32_t firstBinding, |
| 2660 | uint32_t bindingCount, |
| 2661 | const VkBuffer* pBuffers, |
| 2662 | const VkDeviceSize* pOffsets) |
| 2663 | { |
| 2664 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2665 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
| 2666 | VkBuffer *local_pBuffers = NULL; |
| 2667 | { |
| 2668 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2669 | if (pBuffers) { |
| 2670 | local_pBuffers = new VkBuffer[bindingCount]; |
| 2671 | for (uint32_t index0 = 0; index0 < bindingCount; ++index0) { |
| 2672 | local_pBuffers[index0] = layer_data->Unwrap(pBuffers[index0]); |
| 2673 | } |
| 2674 | } |
| 2675 | } |
| 2676 | layer_data->device_dispatch_table.CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, (const VkBuffer*)local_pBuffers, pOffsets); |
| 2677 | if (local_pBuffers) |
| 2678 | delete[] local_pBuffers; |
| 2679 | } |
| 2680 | |
| 2681 | void DispatchCmdDraw( |
| 2682 | VkCommandBuffer commandBuffer, |
| 2683 | uint32_t vertexCount, |
| 2684 | uint32_t instanceCount, |
| 2685 | uint32_t firstVertex, |
| 2686 | uint32_t firstInstance) |
| 2687 | { |
| 2688 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2689 | layer_data->device_dispatch_table.CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
| 2690 | |
| 2691 | } |
| 2692 | |
| 2693 | void DispatchCmdDrawIndexed( |
| 2694 | VkCommandBuffer commandBuffer, |
| 2695 | uint32_t indexCount, |
| 2696 | uint32_t instanceCount, |
| 2697 | uint32_t firstIndex, |
| 2698 | int32_t vertexOffset, |
| 2699 | uint32_t firstInstance) |
| 2700 | { |
| 2701 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2702 | layer_data->device_dispatch_table.CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
| 2703 | |
| 2704 | } |
| 2705 | |
| 2706 | void DispatchCmdDrawIndirect( |
| 2707 | VkCommandBuffer commandBuffer, |
| 2708 | VkBuffer buffer, |
| 2709 | VkDeviceSize offset, |
| 2710 | uint32_t drawCount, |
| 2711 | uint32_t stride) |
| 2712 | { |
| 2713 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2714 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2715 | { |
| 2716 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2717 | buffer = layer_data->Unwrap(buffer); |
| 2718 | } |
| 2719 | layer_data->device_dispatch_table.CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2720 | |
| 2721 | } |
| 2722 | |
| 2723 | void DispatchCmdDrawIndexedIndirect( |
| 2724 | VkCommandBuffer commandBuffer, |
| 2725 | VkBuffer buffer, |
| 2726 | VkDeviceSize offset, |
| 2727 | uint32_t drawCount, |
| 2728 | uint32_t stride) |
| 2729 | { |
| 2730 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2731 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2732 | { |
| 2733 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2734 | buffer = layer_data->Unwrap(buffer); |
| 2735 | } |
| 2736 | layer_data->device_dispatch_table.CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2737 | |
| 2738 | } |
| 2739 | |
| 2740 | void DispatchCmdDispatch( |
| 2741 | VkCommandBuffer commandBuffer, |
| 2742 | uint32_t groupCountX, |
| 2743 | uint32_t groupCountY, |
| 2744 | uint32_t groupCountZ) |
| 2745 | { |
| 2746 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2747 | layer_data->device_dispatch_table.CmdDispatch(commandBuffer, groupCountX, groupCountY, groupCountZ); |
| 2748 | |
| 2749 | } |
| 2750 | |
| 2751 | void DispatchCmdDispatchIndirect( |
| 2752 | VkCommandBuffer commandBuffer, |
| 2753 | VkBuffer buffer, |
| 2754 | VkDeviceSize offset) |
| 2755 | { |
| 2756 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2757 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDispatchIndirect(commandBuffer, buffer, offset); |
| 2758 | { |
| 2759 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2760 | buffer = layer_data->Unwrap(buffer); |
| 2761 | } |
| 2762 | layer_data->device_dispatch_table.CmdDispatchIndirect(commandBuffer, buffer, offset); |
| 2763 | |
| 2764 | } |
| 2765 | |
| 2766 | void DispatchCmdCopyBuffer( |
| 2767 | VkCommandBuffer commandBuffer, |
| 2768 | VkBuffer srcBuffer, |
| 2769 | VkBuffer dstBuffer, |
| 2770 | uint32_t regionCount, |
| 2771 | const VkBufferCopy* pRegions) |
| 2772 | { |
| 2773 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2774 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
| 2775 | { |
| 2776 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2777 | srcBuffer = layer_data->Unwrap(srcBuffer); |
| 2778 | dstBuffer = layer_data->Unwrap(dstBuffer); |
| 2779 | } |
| 2780 | layer_data->device_dispatch_table.CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
| 2781 | |
| 2782 | } |
| 2783 | |
| 2784 | void DispatchCmdCopyImage( |
| 2785 | VkCommandBuffer commandBuffer, |
| 2786 | VkImage srcImage, |
| 2787 | VkImageLayout srcImageLayout, |
| 2788 | VkImage dstImage, |
| 2789 | VkImageLayout dstImageLayout, |
| 2790 | uint32_t regionCount, |
| 2791 | const VkImageCopy* pRegions) |
| 2792 | { |
| 2793 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2794 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2795 | { |
| 2796 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2797 | srcImage = layer_data->Unwrap(srcImage); |
| 2798 | dstImage = layer_data->Unwrap(dstImage); |
| 2799 | } |
| 2800 | layer_data->device_dispatch_table.CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2801 | |
| 2802 | } |
| 2803 | |
| 2804 | void DispatchCmdBlitImage( |
| 2805 | VkCommandBuffer commandBuffer, |
| 2806 | VkImage srcImage, |
| 2807 | VkImageLayout srcImageLayout, |
| 2808 | VkImage dstImage, |
| 2809 | VkImageLayout dstImageLayout, |
| 2810 | uint32_t regionCount, |
| 2811 | const VkImageBlit* pRegions, |
| 2812 | VkFilter filter) |
| 2813 | { |
| 2814 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2815 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); |
| 2816 | { |
| 2817 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2818 | srcImage = layer_data->Unwrap(srcImage); |
| 2819 | dstImage = layer_data->Unwrap(dstImage); |
| 2820 | } |
| 2821 | layer_data->device_dispatch_table.CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); |
| 2822 | |
| 2823 | } |
| 2824 | |
| 2825 | void DispatchCmdCopyBufferToImage( |
| 2826 | VkCommandBuffer commandBuffer, |
| 2827 | VkBuffer srcBuffer, |
| 2828 | VkImage dstImage, |
| 2829 | VkImageLayout dstImageLayout, |
| 2830 | uint32_t regionCount, |
| 2831 | const VkBufferImageCopy* pRegions) |
| 2832 | { |
| 2833 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2834 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
| 2835 | { |
| 2836 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2837 | srcBuffer = layer_data->Unwrap(srcBuffer); |
| 2838 | dstImage = layer_data->Unwrap(dstImage); |
| 2839 | } |
| 2840 | layer_data->device_dispatch_table.CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
| 2841 | |
| 2842 | } |
| 2843 | |
| 2844 | void DispatchCmdCopyImageToBuffer( |
| 2845 | VkCommandBuffer commandBuffer, |
| 2846 | VkImage srcImage, |
| 2847 | VkImageLayout srcImageLayout, |
| 2848 | VkBuffer dstBuffer, |
| 2849 | uint32_t regionCount, |
| 2850 | const VkBufferImageCopy* pRegions) |
| 2851 | { |
| 2852 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2853 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
| 2854 | { |
| 2855 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2856 | srcImage = layer_data->Unwrap(srcImage); |
| 2857 | dstBuffer = layer_data->Unwrap(dstBuffer); |
| 2858 | } |
| 2859 | layer_data->device_dispatch_table.CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
| 2860 | |
| 2861 | } |
| 2862 | |
| 2863 | void DispatchCmdUpdateBuffer( |
| 2864 | VkCommandBuffer commandBuffer, |
| 2865 | VkBuffer dstBuffer, |
| 2866 | VkDeviceSize dstOffset, |
| 2867 | VkDeviceSize dataSize, |
| 2868 | const void* pData) |
| 2869 | { |
| 2870 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2871 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
| 2872 | { |
| 2873 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2874 | dstBuffer = layer_data->Unwrap(dstBuffer); |
| 2875 | } |
| 2876 | layer_data->device_dispatch_table.CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
| 2877 | |
| 2878 | } |
| 2879 | |
| 2880 | void DispatchCmdFillBuffer( |
| 2881 | VkCommandBuffer commandBuffer, |
| 2882 | VkBuffer dstBuffer, |
| 2883 | VkDeviceSize dstOffset, |
| 2884 | VkDeviceSize size, |
| 2885 | uint32_t data) |
| 2886 | { |
| 2887 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2888 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
| 2889 | { |
| 2890 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2891 | dstBuffer = layer_data->Unwrap(dstBuffer); |
| 2892 | } |
| 2893 | layer_data->device_dispatch_table.CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
| 2894 | |
| 2895 | } |
| 2896 | |
| 2897 | void DispatchCmdClearColorImage( |
| 2898 | VkCommandBuffer commandBuffer, |
| 2899 | VkImage image, |
| 2900 | VkImageLayout imageLayout, |
| 2901 | const VkClearColorValue* pColor, |
| 2902 | uint32_t rangeCount, |
| 2903 | const VkImageSubresourceRange* pRanges) |
| 2904 | { |
| 2905 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2906 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
| 2907 | { |
| 2908 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2909 | image = layer_data->Unwrap(image); |
| 2910 | } |
| 2911 | layer_data->device_dispatch_table.CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
| 2912 | |
| 2913 | } |
| 2914 | |
| 2915 | void DispatchCmdClearDepthStencilImage( |
| 2916 | VkCommandBuffer commandBuffer, |
| 2917 | VkImage image, |
| 2918 | VkImageLayout imageLayout, |
| 2919 | const VkClearDepthStencilValue* pDepthStencil, |
| 2920 | uint32_t rangeCount, |
| 2921 | const VkImageSubresourceRange* pRanges) |
| 2922 | { |
| 2923 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2924 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
| 2925 | { |
| 2926 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2927 | image = layer_data->Unwrap(image); |
| 2928 | } |
| 2929 | layer_data->device_dispatch_table.CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
| 2930 | |
| 2931 | } |
| 2932 | |
| 2933 | void DispatchCmdClearAttachments( |
| 2934 | VkCommandBuffer commandBuffer, |
| 2935 | uint32_t attachmentCount, |
| 2936 | const VkClearAttachment* pAttachments, |
| 2937 | uint32_t rectCount, |
| 2938 | const VkClearRect* pRects) |
| 2939 | { |
| 2940 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2941 | layer_data->device_dispatch_table.CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
| 2942 | |
| 2943 | } |
| 2944 | |
| 2945 | void DispatchCmdResolveImage( |
| 2946 | VkCommandBuffer commandBuffer, |
| 2947 | VkImage srcImage, |
| 2948 | VkImageLayout srcImageLayout, |
| 2949 | VkImage dstImage, |
| 2950 | VkImageLayout dstImageLayout, |
| 2951 | uint32_t regionCount, |
| 2952 | const VkImageResolve* pRegions) |
| 2953 | { |
| 2954 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2955 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2956 | { |
| 2957 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2958 | srcImage = layer_data->Unwrap(srcImage); |
| 2959 | dstImage = layer_data->Unwrap(dstImage); |
| 2960 | } |
| 2961 | layer_data->device_dispatch_table.CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2962 | |
| 2963 | } |
| 2964 | |
| 2965 | void DispatchCmdSetEvent( |
| 2966 | VkCommandBuffer commandBuffer, |
| 2967 | VkEvent event, |
| 2968 | VkPipelineStageFlags stageMask) |
| 2969 | { |
| 2970 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2971 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdSetEvent(commandBuffer, event, stageMask); |
| 2972 | { |
| 2973 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2974 | event = layer_data->Unwrap(event); |
| 2975 | } |
| 2976 | layer_data->device_dispatch_table.CmdSetEvent(commandBuffer, event, stageMask); |
| 2977 | |
| 2978 | } |
| 2979 | |
| 2980 | void DispatchCmdResetEvent( |
| 2981 | VkCommandBuffer commandBuffer, |
| 2982 | VkEvent event, |
| 2983 | VkPipelineStageFlags stageMask) |
| 2984 | { |
| 2985 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 2986 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdResetEvent(commandBuffer, event, stageMask); |
| 2987 | { |
| 2988 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 2989 | event = layer_data->Unwrap(event); |
| 2990 | } |
| 2991 | layer_data->device_dispatch_table.CmdResetEvent(commandBuffer, event, stageMask); |
| 2992 | |
| 2993 | } |
| 2994 | |
| 2995 | void DispatchCmdWaitEvents( |
| 2996 | VkCommandBuffer commandBuffer, |
| 2997 | uint32_t eventCount, |
| 2998 | const VkEvent* pEvents, |
| 2999 | VkPipelineStageFlags srcStageMask, |
| 3000 | VkPipelineStageFlags dstStageMask, |
| 3001 | uint32_t memoryBarrierCount, |
| 3002 | const VkMemoryBarrier* pMemoryBarriers, |
| 3003 | uint32_t bufferMemoryBarrierCount, |
| 3004 | const VkBufferMemoryBarrier* pBufferMemoryBarriers, |
| 3005 | uint32_t imageMemoryBarrierCount, |
| 3006 | const VkImageMemoryBarrier* pImageMemoryBarriers) |
| 3007 | { |
| 3008 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3009 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
| 3010 | VkEvent *local_pEvents = NULL; |
| 3011 | safe_VkBufferMemoryBarrier *local_pBufferMemoryBarriers = NULL; |
| 3012 | safe_VkImageMemoryBarrier *local_pImageMemoryBarriers = NULL; |
| 3013 | { |
| 3014 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3015 | if (pEvents) { |
| 3016 | local_pEvents = new VkEvent[eventCount]; |
| 3017 | for (uint32_t index0 = 0; index0 < eventCount; ++index0) { |
| 3018 | local_pEvents[index0] = layer_data->Unwrap(pEvents[index0]); |
| 3019 | } |
| 3020 | } |
| 3021 | if (pBufferMemoryBarriers) { |
| 3022 | local_pBufferMemoryBarriers = new safe_VkBufferMemoryBarrier[bufferMemoryBarrierCount]; |
| 3023 | for (uint32_t index0 = 0; index0 < bufferMemoryBarrierCount; ++index0) { |
| 3024 | local_pBufferMemoryBarriers[index0].initialize(&pBufferMemoryBarriers[index0]); |
| 3025 | if (pBufferMemoryBarriers[index0].buffer) { |
| 3026 | local_pBufferMemoryBarriers[index0].buffer = layer_data->Unwrap(pBufferMemoryBarriers[index0].buffer); |
| 3027 | } |
| 3028 | } |
| 3029 | } |
| 3030 | if (pImageMemoryBarriers) { |
| 3031 | local_pImageMemoryBarriers = new safe_VkImageMemoryBarrier[imageMemoryBarrierCount]; |
| 3032 | for (uint32_t index0 = 0; index0 < imageMemoryBarrierCount; ++index0) { |
| 3033 | local_pImageMemoryBarriers[index0].initialize(&pImageMemoryBarriers[index0]); |
| 3034 | if (pImageMemoryBarriers[index0].image) { |
| 3035 | local_pImageMemoryBarriers[index0].image = layer_data->Unwrap(pImageMemoryBarriers[index0].image); |
| 3036 | } |
| 3037 | } |
| 3038 | } |
| 3039 | } |
| 3040 | layer_data->device_dispatch_table.CmdWaitEvents(commandBuffer, eventCount, (const VkEvent*)local_pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, (const VkBufferMemoryBarrier*)local_pBufferMemoryBarriers, imageMemoryBarrierCount, (const VkImageMemoryBarrier*)local_pImageMemoryBarriers); |
| 3041 | if (local_pEvents) |
| 3042 | delete[] local_pEvents; |
| 3043 | if (local_pBufferMemoryBarriers) { |
| 3044 | delete[] local_pBufferMemoryBarriers; |
| 3045 | } |
| 3046 | if (local_pImageMemoryBarriers) { |
| 3047 | delete[] local_pImageMemoryBarriers; |
| 3048 | } |
| 3049 | } |
| 3050 | |
| 3051 | void DispatchCmdPipelineBarrier( |
| 3052 | VkCommandBuffer commandBuffer, |
| 3053 | VkPipelineStageFlags srcStageMask, |
| 3054 | VkPipelineStageFlags dstStageMask, |
| 3055 | VkDependencyFlags dependencyFlags, |
| 3056 | uint32_t memoryBarrierCount, |
| 3057 | const VkMemoryBarrier* pMemoryBarriers, |
| 3058 | uint32_t bufferMemoryBarrierCount, |
| 3059 | const VkBufferMemoryBarrier* pBufferMemoryBarriers, |
| 3060 | uint32_t imageMemoryBarrierCount, |
| 3061 | const VkImageMemoryBarrier* pImageMemoryBarriers) |
| 3062 | { |
| 3063 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3064 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
| 3065 | safe_VkBufferMemoryBarrier *local_pBufferMemoryBarriers = NULL; |
| 3066 | safe_VkImageMemoryBarrier *local_pImageMemoryBarriers = NULL; |
| 3067 | { |
| 3068 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3069 | if (pBufferMemoryBarriers) { |
| 3070 | local_pBufferMemoryBarriers = new safe_VkBufferMemoryBarrier[bufferMemoryBarrierCount]; |
| 3071 | for (uint32_t index0 = 0; index0 < bufferMemoryBarrierCount; ++index0) { |
| 3072 | local_pBufferMemoryBarriers[index0].initialize(&pBufferMemoryBarriers[index0]); |
| 3073 | if (pBufferMemoryBarriers[index0].buffer) { |
| 3074 | local_pBufferMemoryBarriers[index0].buffer = layer_data->Unwrap(pBufferMemoryBarriers[index0].buffer); |
| 3075 | } |
| 3076 | } |
| 3077 | } |
| 3078 | if (pImageMemoryBarriers) { |
| 3079 | local_pImageMemoryBarriers = new safe_VkImageMemoryBarrier[imageMemoryBarrierCount]; |
| 3080 | for (uint32_t index0 = 0; index0 < imageMemoryBarrierCount; ++index0) { |
| 3081 | local_pImageMemoryBarriers[index0].initialize(&pImageMemoryBarriers[index0]); |
| 3082 | if (pImageMemoryBarriers[index0].image) { |
| 3083 | local_pImageMemoryBarriers[index0].image = layer_data->Unwrap(pImageMemoryBarriers[index0].image); |
| 3084 | } |
| 3085 | } |
| 3086 | } |
| 3087 | } |
| 3088 | layer_data->device_dispatch_table.CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, (const VkBufferMemoryBarrier*)local_pBufferMemoryBarriers, imageMemoryBarrierCount, (const VkImageMemoryBarrier*)local_pImageMemoryBarriers); |
| 3089 | if (local_pBufferMemoryBarriers) { |
| 3090 | delete[] local_pBufferMemoryBarriers; |
| 3091 | } |
| 3092 | if (local_pImageMemoryBarriers) { |
| 3093 | delete[] local_pImageMemoryBarriers; |
| 3094 | } |
| 3095 | } |
| 3096 | |
| 3097 | void DispatchCmdBeginQuery( |
| 3098 | VkCommandBuffer commandBuffer, |
| 3099 | VkQueryPool queryPool, |
| 3100 | uint32_t query, |
| 3101 | VkQueryControlFlags flags) |
| 3102 | { |
| 3103 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3104 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBeginQuery(commandBuffer, queryPool, query, flags); |
| 3105 | { |
| 3106 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3107 | queryPool = layer_data->Unwrap(queryPool); |
| 3108 | } |
| 3109 | layer_data->device_dispatch_table.CmdBeginQuery(commandBuffer, queryPool, query, flags); |
| 3110 | |
| 3111 | } |
| 3112 | |
| 3113 | void DispatchCmdEndQuery( |
| 3114 | VkCommandBuffer commandBuffer, |
| 3115 | VkQueryPool queryPool, |
| 3116 | uint32_t query) |
| 3117 | { |
| 3118 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3119 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdEndQuery(commandBuffer, queryPool, query); |
| 3120 | { |
| 3121 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3122 | queryPool = layer_data->Unwrap(queryPool); |
| 3123 | } |
| 3124 | layer_data->device_dispatch_table.CmdEndQuery(commandBuffer, queryPool, query); |
| 3125 | |
| 3126 | } |
| 3127 | |
| 3128 | void DispatchCmdResetQueryPool( |
| 3129 | VkCommandBuffer commandBuffer, |
| 3130 | VkQueryPool queryPool, |
| 3131 | uint32_t firstQuery, |
| 3132 | uint32_t queryCount) |
| 3133 | { |
| 3134 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3135 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
| 3136 | { |
| 3137 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3138 | queryPool = layer_data->Unwrap(queryPool); |
| 3139 | } |
| 3140 | layer_data->device_dispatch_table.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
| 3141 | |
| 3142 | } |
| 3143 | |
| 3144 | void DispatchCmdWriteTimestamp( |
| 3145 | VkCommandBuffer commandBuffer, |
| 3146 | VkPipelineStageFlagBits pipelineStage, |
| 3147 | VkQueryPool queryPool, |
| 3148 | uint32_t query) |
| 3149 | { |
| 3150 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3151 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 3152 | { |
| 3153 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3154 | queryPool = layer_data->Unwrap(queryPool); |
| 3155 | } |
| 3156 | layer_data->device_dispatch_table.CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 3157 | |
| 3158 | } |
| 3159 | |
| 3160 | void DispatchCmdCopyQueryPoolResults( |
| 3161 | VkCommandBuffer commandBuffer, |
| 3162 | VkQueryPool queryPool, |
| 3163 | uint32_t firstQuery, |
| 3164 | uint32_t queryCount, |
| 3165 | VkBuffer dstBuffer, |
| 3166 | VkDeviceSize dstOffset, |
| 3167 | VkDeviceSize stride, |
| 3168 | VkQueryResultFlags flags) |
| 3169 | { |
| 3170 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3171 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); |
| 3172 | { |
| 3173 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3174 | queryPool = layer_data->Unwrap(queryPool); |
| 3175 | dstBuffer = layer_data->Unwrap(dstBuffer); |
| 3176 | } |
| 3177 | layer_data->device_dispatch_table.CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); |
| 3178 | |
| 3179 | } |
| 3180 | |
| 3181 | void DispatchCmdPushConstants( |
| 3182 | VkCommandBuffer commandBuffer, |
| 3183 | VkPipelineLayout layout, |
| 3184 | VkShaderStageFlags stageFlags, |
| 3185 | uint32_t offset, |
| 3186 | uint32_t size, |
| 3187 | const void* pValues) |
| 3188 | { |
| 3189 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3190 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
| 3191 | { |
| 3192 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3193 | layout = layer_data->Unwrap(layout); |
| 3194 | } |
| 3195 | layer_data->device_dispatch_table.CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
| 3196 | |
| 3197 | } |
| 3198 | |
| 3199 | void DispatchCmdBeginRenderPass( |
| 3200 | VkCommandBuffer commandBuffer, |
| 3201 | const VkRenderPassBeginInfo* pRenderPassBegin, |
| 3202 | VkSubpassContents contents) |
| 3203 | { |
| 3204 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3205 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
| 3206 | safe_VkRenderPassBeginInfo *local_pRenderPassBegin = NULL; |
| 3207 | { |
| 3208 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3209 | if (pRenderPassBegin) { |
| 3210 | local_pRenderPassBegin = new safe_VkRenderPassBeginInfo(pRenderPassBegin); |
| 3211 | if (pRenderPassBegin->renderPass) { |
| 3212 | local_pRenderPassBegin->renderPass = layer_data->Unwrap(pRenderPassBegin->renderPass); |
| 3213 | } |
| 3214 | if (pRenderPassBegin->framebuffer) { |
| 3215 | local_pRenderPassBegin->framebuffer = layer_data->Unwrap(pRenderPassBegin->framebuffer); |
| 3216 | } |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 3217 | WrapPnextChainHandles(layer_data, local_pRenderPassBegin->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 3218 | } |
| 3219 | } |
| 3220 | layer_data->device_dispatch_table.CmdBeginRenderPass(commandBuffer, (const VkRenderPassBeginInfo*)local_pRenderPassBegin, contents); |
| 3221 | if (local_pRenderPassBegin) { |
| 3222 | delete local_pRenderPassBegin; |
| 3223 | } |
| 3224 | } |
| 3225 | |
| 3226 | void DispatchCmdNextSubpass( |
| 3227 | VkCommandBuffer commandBuffer, |
| 3228 | VkSubpassContents contents) |
| 3229 | { |
| 3230 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3231 | layer_data->device_dispatch_table.CmdNextSubpass(commandBuffer, contents); |
| 3232 | |
| 3233 | } |
| 3234 | |
| 3235 | void DispatchCmdEndRenderPass( |
| 3236 | VkCommandBuffer commandBuffer) |
| 3237 | { |
| 3238 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3239 | layer_data->device_dispatch_table.CmdEndRenderPass(commandBuffer); |
| 3240 | |
| 3241 | } |
| 3242 | |
| 3243 | void DispatchCmdExecuteCommands( |
| 3244 | VkCommandBuffer commandBuffer, |
| 3245 | uint32_t commandBufferCount, |
| 3246 | const VkCommandBuffer* pCommandBuffers) |
| 3247 | { |
| 3248 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3249 | layer_data->device_dispatch_table.CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
| 3250 | |
| 3251 | } |
| 3252 | |
| 3253 | // Skip vkEnumerateInstanceVersion dispatch, manually generated |
| 3254 | |
| 3255 | VkResult DispatchBindBufferMemory2( |
| 3256 | VkDevice device, |
| 3257 | uint32_t bindInfoCount, |
| 3258 | const VkBindBufferMemoryInfo* pBindInfos) |
| 3259 | { |
| 3260 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3261 | if (!wrap_handles) return layer_data->device_dispatch_table.BindBufferMemory2(device, bindInfoCount, pBindInfos); |
| 3262 | safe_VkBindBufferMemoryInfo *local_pBindInfos = NULL; |
| 3263 | { |
| 3264 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3265 | if (pBindInfos) { |
| 3266 | local_pBindInfos = new safe_VkBindBufferMemoryInfo[bindInfoCount]; |
| 3267 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
| 3268 | local_pBindInfos[index0].initialize(&pBindInfos[index0]); |
| 3269 | if (pBindInfos[index0].buffer) { |
| 3270 | local_pBindInfos[index0].buffer = layer_data->Unwrap(pBindInfos[index0].buffer); |
| 3271 | } |
| 3272 | if (pBindInfos[index0].memory) { |
| 3273 | local_pBindInfos[index0].memory = layer_data->Unwrap(pBindInfos[index0].memory); |
| 3274 | } |
| 3275 | } |
| 3276 | } |
| 3277 | } |
| 3278 | VkResult result = layer_data->device_dispatch_table.BindBufferMemory2(device, bindInfoCount, (const VkBindBufferMemoryInfo*)local_pBindInfos); |
| 3279 | if (local_pBindInfos) { |
| 3280 | delete[] local_pBindInfos; |
| 3281 | } |
| 3282 | return result; |
| 3283 | } |
| 3284 | |
| 3285 | VkResult DispatchBindImageMemory2( |
| 3286 | VkDevice device, |
| 3287 | uint32_t bindInfoCount, |
| 3288 | const VkBindImageMemoryInfo* pBindInfos) |
| 3289 | { |
| 3290 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3291 | if (!wrap_handles) return layer_data->device_dispatch_table.BindImageMemory2(device, bindInfoCount, pBindInfos); |
| 3292 | safe_VkBindImageMemoryInfo *local_pBindInfos = NULL; |
| 3293 | { |
| 3294 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3295 | if (pBindInfos) { |
| 3296 | local_pBindInfos = new safe_VkBindImageMemoryInfo[bindInfoCount]; |
| 3297 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
| 3298 | local_pBindInfos[index0].initialize(&pBindInfos[index0]); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 3299 | WrapPnextChainHandles(layer_data, local_pBindInfos[index0].pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 3300 | if (pBindInfos[index0].image) { |
| 3301 | local_pBindInfos[index0].image = layer_data->Unwrap(pBindInfos[index0].image); |
| 3302 | } |
| 3303 | if (pBindInfos[index0].memory) { |
| 3304 | local_pBindInfos[index0].memory = layer_data->Unwrap(pBindInfos[index0].memory); |
| 3305 | } |
| 3306 | } |
| 3307 | } |
| 3308 | } |
| 3309 | VkResult result = layer_data->device_dispatch_table.BindImageMemory2(device, bindInfoCount, (const VkBindImageMemoryInfo*)local_pBindInfos); |
| 3310 | if (local_pBindInfos) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 3311 | delete[] local_pBindInfos; |
| 3312 | } |
| 3313 | return result; |
| 3314 | } |
| 3315 | |
| 3316 | void DispatchGetDeviceGroupPeerMemoryFeatures( |
| 3317 | VkDevice device, |
| 3318 | uint32_t heapIndex, |
| 3319 | uint32_t localDeviceIndex, |
| 3320 | uint32_t remoteDeviceIndex, |
| 3321 | VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) |
| 3322 | { |
| 3323 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3324 | layer_data->device_dispatch_table.GetDeviceGroupPeerMemoryFeatures(device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures); |
| 3325 | |
| 3326 | } |
| 3327 | |
| 3328 | void DispatchCmdSetDeviceMask( |
| 3329 | VkCommandBuffer commandBuffer, |
| 3330 | uint32_t deviceMask) |
| 3331 | { |
| 3332 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3333 | layer_data->device_dispatch_table.CmdSetDeviceMask(commandBuffer, deviceMask); |
| 3334 | |
| 3335 | } |
| 3336 | |
| 3337 | void DispatchCmdDispatchBase( |
| 3338 | VkCommandBuffer commandBuffer, |
| 3339 | uint32_t baseGroupX, |
| 3340 | uint32_t baseGroupY, |
| 3341 | uint32_t baseGroupZ, |
| 3342 | uint32_t groupCountX, |
| 3343 | uint32_t groupCountY, |
| 3344 | uint32_t groupCountZ) |
| 3345 | { |
| 3346 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 3347 | layer_data->device_dispatch_table.CmdDispatchBase(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); |
| 3348 | |
| 3349 | } |
| 3350 | |
| 3351 | VkResult DispatchEnumeratePhysicalDeviceGroups( |
| 3352 | VkInstance instance, |
| 3353 | uint32_t* pPhysicalDeviceGroupCount, |
| 3354 | VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) |
| 3355 | { |
| 3356 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 3357 | VkResult result = layer_data->instance_dispatch_table.EnumeratePhysicalDeviceGroups(instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); |
| 3358 | |
| 3359 | return result; |
| 3360 | } |
| 3361 | |
| 3362 | void DispatchGetImageMemoryRequirements2( |
| 3363 | VkDevice device, |
| 3364 | const VkImageMemoryRequirementsInfo2* pInfo, |
| 3365 | VkMemoryRequirements2* pMemoryRequirements) |
| 3366 | { |
| 3367 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3368 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageMemoryRequirements2(device, pInfo, pMemoryRequirements); |
| 3369 | safe_VkImageMemoryRequirementsInfo2 *local_pInfo = NULL; |
| 3370 | { |
| 3371 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3372 | if (pInfo) { |
| 3373 | local_pInfo = new safe_VkImageMemoryRequirementsInfo2(pInfo); |
| 3374 | if (pInfo->image) { |
| 3375 | local_pInfo->image = layer_data->Unwrap(pInfo->image); |
| 3376 | } |
| 3377 | } |
| 3378 | } |
| 3379 | layer_data->device_dispatch_table.GetImageMemoryRequirements2(device, (const VkImageMemoryRequirementsInfo2*)local_pInfo, pMemoryRequirements); |
| 3380 | if (local_pInfo) { |
| 3381 | delete local_pInfo; |
| 3382 | } |
| 3383 | } |
| 3384 | |
| 3385 | void DispatchGetBufferMemoryRequirements2( |
| 3386 | VkDevice device, |
| 3387 | const VkBufferMemoryRequirementsInfo2* pInfo, |
| 3388 | VkMemoryRequirements2* pMemoryRequirements) |
| 3389 | { |
| 3390 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3391 | if (!wrap_handles) return layer_data->device_dispatch_table.GetBufferMemoryRequirements2(device, pInfo, pMemoryRequirements); |
| 3392 | safe_VkBufferMemoryRequirementsInfo2 *local_pInfo = NULL; |
| 3393 | { |
| 3394 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3395 | if (pInfo) { |
| 3396 | local_pInfo = new safe_VkBufferMemoryRequirementsInfo2(pInfo); |
| 3397 | if (pInfo->buffer) { |
| 3398 | local_pInfo->buffer = layer_data->Unwrap(pInfo->buffer); |
| 3399 | } |
| 3400 | } |
| 3401 | } |
| 3402 | layer_data->device_dispatch_table.GetBufferMemoryRequirements2(device, (const VkBufferMemoryRequirementsInfo2*)local_pInfo, pMemoryRequirements); |
| 3403 | if (local_pInfo) { |
| 3404 | delete local_pInfo; |
| 3405 | } |
| 3406 | } |
| 3407 | |
| 3408 | void DispatchGetImageSparseMemoryRequirements2( |
| 3409 | VkDevice device, |
| 3410 | const VkImageSparseMemoryRequirementsInfo2* pInfo, |
| 3411 | uint32_t* pSparseMemoryRequirementCount, |
| 3412 | VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) |
| 3413 | { |
| 3414 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3415 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageSparseMemoryRequirements2(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 3416 | safe_VkImageSparseMemoryRequirementsInfo2 *local_pInfo = NULL; |
| 3417 | { |
| 3418 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3419 | if (pInfo) { |
| 3420 | local_pInfo = new safe_VkImageSparseMemoryRequirementsInfo2(pInfo); |
| 3421 | if (pInfo->image) { |
| 3422 | local_pInfo->image = layer_data->Unwrap(pInfo->image); |
| 3423 | } |
| 3424 | } |
| 3425 | } |
| 3426 | layer_data->device_dispatch_table.GetImageSparseMemoryRequirements2(device, (const VkImageSparseMemoryRequirementsInfo2*)local_pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 3427 | if (local_pInfo) { |
| 3428 | delete local_pInfo; |
| 3429 | } |
| 3430 | } |
| 3431 | |
| 3432 | void DispatchGetPhysicalDeviceFeatures2( |
| 3433 | VkPhysicalDevice physicalDevice, |
| 3434 | VkPhysicalDeviceFeatures2* pFeatures) |
| 3435 | { |
| 3436 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3437 | layer_data->instance_dispatch_table.GetPhysicalDeviceFeatures2(physicalDevice, pFeatures); |
| 3438 | |
| 3439 | } |
| 3440 | |
| 3441 | void DispatchGetPhysicalDeviceProperties2( |
| 3442 | VkPhysicalDevice physicalDevice, |
| 3443 | VkPhysicalDeviceProperties2* pProperties) |
| 3444 | { |
| 3445 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3446 | layer_data->instance_dispatch_table.GetPhysicalDeviceProperties2(physicalDevice, pProperties); |
| 3447 | |
| 3448 | } |
| 3449 | |
| 3450 | void DispatchGetPhysicalDeviceFormatProperties2( |
| 3451 | VkPhysicalDevice physicalDevice, |
| 3452 | VkFormat format, |
| 3453 | VkFormatProperties2* pFormatProperties) |
| 3454 | { |
| 3455 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3456 | layer_data->instance_dispatch_table.GetPhysicalDeviceFormatProperties2(physicalDevice, format, pFormatProperties); |
| 3457 | |
| 3458 | } |
| 3459 | |
| 3460 | VkResult DispatchGetPhysicalDeviceImageFormatProperties2( |
| 3461 | VkPhysicalDevice physicalDevice, |
| 3462 | const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, |
| 3463 | VkImageFormatProperties2* pImageFormatProperties) |
| 3464 | { |
| 3465 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3466 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties); |
| 3467 | safe_VkPhysicalDeviceImageFormatInfo2 *local_pImageFormatInfo = NULL; |
| 3468 | { |
| 3469 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3470 | if (pImageFormatInfo) { |
| 3471 | local_pImageFormatInfo = new safe_VkPhysicalDeviceImageFormatInfo2(pImageFormatInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 3472 | WrapPnextChainHandles(layer_data, local_pImageFormatInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 3473 | } |
| 3474 | } |
| 3475 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceImageFormatProperties2(physicalDevice, (const VkPhysicalDeviceImageFormatInfo2*)local_pImageFormatInfo, pImageFormatProperties); |
| 3476 | if (local_pImageFormatInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 3477 | delete local_pImageFormatInfo; |
| 3478 | } |
| 3479 | return result; |
| 3480 | } |
| 3481 | |
| 3482 | void DispatchGetPhysicalDeviceQueueFamilyProperties2( |
| 3483 | VkPhysicalDevice physicalDevice, |
| 3484 | uint32_t* pQueueFamilyPropertyCount, |
| 3485 | VkQueueFamilyProperties2* pQueueFamilyProperties) |
| 3486 | { |
| 3487 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3488 | layer_data->instance_dispatch_table.GetPhysicalDeviceQueueFamilyProperties2(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 3489 | |
| 3490 | } |
| 3491 | |
| 3492 | void DispatchGetPhysicalDeviceMemoryProperties2( |
| 3493 | VkPhysicalDevice physicalDevice, |
| 3494 | VkPhysicalDeviceMemoryProperties2* pMemoryProperties) |
| 3495 | { |
| 3496 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3497 | layer_data->instance_dispatch_table.GetPhysicalDeviceMemoryProperties2(physicalDevice, pMemoryProperties); |
| 3498 | |
| 3499 | } |
| 3500 | |
| 3501 | void DispatchGetPhysicalDeviceSparseImageFormatProperties2( |
| 3502 | VkPhysicalDevice physicalDevice, |
| 3503 | const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, |
| 3504 | uint32_t* pPropertyCount, |
| 3505 | VkSparseImageFormatProperties2* pProperties) |
| 3506 | { |
| 3507 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3508 | layer_data->instance_dispatch_table.GetPhysicalDeviceSparseImageFormatProperties2(physicalDevice, pFormatInfo, pPropertyCount, pProperties); |
| 3509 | |
| 3510 | } |
| 3511 | |
| 3512 | void DispatchTrimCommandPool( |
| 3513 | VkDevice device, |
| 3514 | VkCommandPool commandPool, |
| 3515 | VkCommandPoolTrimFlags flags) |
| 3516 | { |
| 3517 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3518 | if (!wrap_handles) return layer_data->device_dispatch_table.TrimCommandPool(device, commandPool, flags); |
| 3519 | { |
| 3520 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3521 | commandPool = layer_data->Unwrap(commandPool); |
| 3522 | } |
| 3523 | layer_data->device_dispatch_table.TrimCommandPool(device, commandPool, flags); |
| 3524 | |
| 3525 | } |
| 3526 | |
| 3527 | void DispatchGetDeviceQueue2( |
| 3528 | VkDevice device, |
| 3529 | const VkDeviceQueueInfo2* pQueueInfo, |
| 3530 | VkQueue* pQueue) |
| 3531 | { |
| 3532 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3533 | layer_data->device_dispatch_table.GetDeviceQueue2(device, pQueueInfo, pQueue); |
| 3534 | |
| 3535 | } |
| 3536 | |
| 3537 | VkResult DispatchCreateSamplerYcbcrConversion( |
| 3538 | VkDevice device, |
| 3539 | const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, |
| 3540 | const VkAllocationCallbacks* pAllocator, |
| 3541 | VkSamplerYcbcrConversion* pYcbcrConversion) |
| 3542 | { |
| 3543 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3544 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion); |
| 3545 | safe_VkSamplerYcbcrConversionCreateInfo *local_pCreateInfo = NULL; |
| 3546 | { |
| 3547 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3548 | if (pCreateInfo) { |
| 3549 | local_pCreateInfo = new safe_VkSamplerYcbcrConversionCreateInfo(pCreateInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 3550 | WrapPnextChainHandles(layer_data, local_pCreateInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 3551 | } |
| 3552 | } |
| 3553 | VkResult result = layer_data->device_dispatch_table.CreateSamplerYcbcrConversion(device, (const VkSamplerYcbcrConversionCreateInfo*)local_pCreateInfo, pAllocator, pYcbcrConversion); |
| 3554 | if (local_pCreateInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 3555 | delete local_pCreateInfo; |
| 3556 | } |
| 3557 | if (VK_SUCCESS == result) { |
| 3558 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3559 | *pYcbcrConversion = layer_data->WrapNew(*pYcbcrConversion); |
| 3560 | } |
| 3561 | return result; |
| 3562 | } |
| 3563 | |
| 3564 | void DispatchDestroySamplerYcbcrConversion( |
| 3565 | VkDevice device, |
| 3566 | VkSamplerYcbcrConversion ycbcrConversion, |
| 3567 | const VkAllocationCallbacks* pAllocator) |
| 3568 | { |
| 3569 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3570 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroySamplerYcbcrConversion(device, ycbcrConversion, pAllocator); |
| 3571 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 3572 | uint64_t ycbcrConversion_id = reinterpret_cast<uint64_t &>(ycbcrConversion); |
| 3573 | ycbcrConversion = (VkSamplerYcbcrConversion)unique_id_mapping[ycbcrConversion_id]; |
| 3574 | unique_id_mapping.erase(ycbcrConversion_id); |
| 3575 | lock.unlock(); |
| 3576 | layer_data->device_dispatch_table.DestroySamplerYcbcrConversion(device, ycbcrConversion, pAllocator); |
| 3577 | |
| 3578 | } |
| 3579 | |
| 3580 | // Skip vkCreateDescriptorUpdateTemplate dispatch, manually generated |
| 3581 | |
| 3582 | // Skip vkDestroyDescriptorUpdateTemplate dispatch, manually generated |
| 3583 | |
| 3584 | // Skip vkUpdateDescriptorSetWithTemplate dispatch, manually generated |
| 3585 | |
| 3586 | void DispatchGetPhysicalDeviceExternalBufferProperties( |
| 3587 | VkPhysicalDevice physicalDevice, |
| 3588 | const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, |
| 3589 | VkExternalBufferProperties* pExternalBufferProperties) |
| 3590 | { |
| 3591 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3592 | layer_data->instance_dispatch_table.GetPhysicalDeviceExternalBufferProperties(physicalDevice, pExternalBufferInfo, pExternalBufferProperties); |
| 3593 | |
| 3594 | } |
| 3595 | |
| 3596 | void DispatchGetPhysicalDeviceExternalFenceProperties( |
| 3597 | VkPhysicalDevice physicalDevice, |
| 3598 | const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, |
| 3599 | VkExternalFenceProperties* pExternalFenceProperties) |
| 3600 | { |
| 3601 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3602 | layer_data->instance_dispatch_table.GetPhysicalDeviceExternalFenceProperties(physicalDevice, pExternalFenceInfo, pExternalFenceProperties); |
| 3603 | |
| 3604 | } |
| 3605 | |
| 3606 | void DispatchGetPhysicalDeviceExternalSemaphoreProperties( |
| 3607 | VkPhysicalDevice physicalDevice, |
| 3608 | const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, |
| 3609 | VkExternalSemaphoreProperties* pExternalSemaphoreProperties) |
| 3610 | { |
| 3611 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3612 | layer_data->instance_dispatch_table.GetPhysicalDeviceExternalSemaphoreProperties(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties); |
| 3613 | |
| 3614 | } |
| 3615 | |
| 3616 | void DispatchGetDescriptorSetLayoutSupport( |
| 3617 | VkDevice device, |
| 3618 | const VkDescriptorSetLayoutCreateInfo* pCreateInfo, |
| 3619 | VkDescriptorSetLayoutSupport* pSupport) |
| 3620 | { |
| 3621 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3622 | if (!wrap_handles) return layer_data->device_dispatch_table.GetDescriptorSetLayoutSupport(device, pCreateInfo, pSupport); |
| 3623 | safe_VkDescriptorSetLayoutCreateInfo *local_pCreateInfo = NULL; |
| 3624 | { |
| 3625 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3626 | if (pCreateInfo) { |
| 3627 | local_pCreateInfo = new safe_VkDescriptorSetLayoutCreateInfo(pCreateInfo); |
| 3628 | if (local_pCreateInfo->pBindings) { |
| 3629 | for (uint32_t index1 = 0; index1 < local_pCreateInfo->bindingCount; ++index1) { |
| 3630 | if (local_pCreateInfo->pBindings[index1].pImmutableSamplers) { |
| 3631 | for (uint32_t index2 = 0; index2 < local_pCreateInfo->pBindings[index1].descriptorCount; ++index2) { |
| 3632 | local_pCreateInfo->pBindings[index1].pImmutableSamplers[index2] = layer_data->Unwrap(local_pCreateInfo->pBindings[index1].pImmutableSamplers[index2]); |
| 3633 | } |
| 3634 | } |
| 3635 | } |
| 3636 | } |
| 3637 | } |
| 3638 | } |
| 3639 | layer_data->device_dispatch_table.GetDescriptorSetLayoutSupport(device, (const VkDescriptorSetLayoutCreateInfo*)local_pCreateInfo, pSupport); |
| 3640 | if (local_pCreateInfo) { |
| 3641 | delete local_pCreateInfo; |
| 3642 | } |
| 3643 | } |
| 3644 | |
| 3645 | void DispatchDestroySurfaceKHR( |
| 3646 | VkInstance instance, |
| 3647 | VkSurfaceKHR surface, |
| 3648 | const VkAllocationCallbacks* pAllocator) |
| 3649 | { |
| 3650 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 3651 | if (!wrap_handles) return layer_data->instance_dispatch_table.DestroySurfaceKHR(instance, surface, pAllocator); |
| 3652 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 3653 | uint64_t surface_id = reinterpret_cast<uint64_t &>(surface); |
| 3654 | surface = (VkSurfaceKHR)unique_id_mapping[surface_id]; |
| 3655 | unique_id_mapping.erase(surface_id); |
| 3656 | lock.unlock(); |
| 3657 | layer_data->instance_dispatch_table.DestroySurfaceKHR(instance, surface, pAllocator); |
| 3658 | |
| 3659 | } |
| 3660 | |
| 3661 | VkResult DispatchGetPhysicalDeviceSurfaceSupportKHR( |
| 3662 | VkPhysicalDevice physicalDevice, |
| 3663 | uint32_t queueFamilyIndex, |
| 3664 | VkSurfaceKHR surface, |
| 3665 | VkBool32* pSupported) |
| 3666 | { |
| 3667 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3668 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
| 3669 | { |
| 3670 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3671 | surface = layer_data->Unwrap(surface); |
| 3672 | } |
| 3673 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
| 3674 | |
| 3675 | return result; |
| 3676 | } |
| 3677 | |
| 3678 | VkResult DispatchGetPhysicalDeviceSurfaceCapabilitiesKHR( |
| 3679 | VkPhysicalDevice physicalDevice, |
| 3680 | VkSurfaceKHR surface, |
| 3681 | VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) |
| 3682 | { |
| 3683 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3684 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
| 3685 | { |
| 3686 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3687 | surface = layer_data->Unwrap(surface); |
| 3688 | } |
| 3689 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
| 3690 | |
| 3691 | return result; |
| 3692 | } |
| 3693 | |
| 3694 | VkResult DispatchGetPhysicalDeviceSurfaceFormatsKHR( |
| 3695 | VkPhysicalDevice physicalDevice, |
| 3696 | VkSurfaceKHR surface, |
| 3697 | uint32_t* pSurfaceFormatCount, |
| 3698 | VkSurfaceFormatKHR* pSurfaceFormats) |
| 3699 | { |
| 3700 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3701 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats); |
| 3702 | { |
| 3703 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3704 | surface = layer_data->Unwrap(surface); |
| 3705 | } |
| 3706 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats); |
| 3707 | |
| 3708 | return result; |
| 3709 | } |
| 3710 | |
| 3711 | VkResult DispatchGetPhysicalDeviceSurfacePresentModesKHR( |
| 3712 | VkPhysicalDevice physicalDevice, |
| 3713 | VkSurfaceKHR surface, |
| 3714 | uint32_t* pPresentModeCount, |
| 3715 | VkPresentModeKHR* pPresentModes) |
| 3716 | { |
| 3717 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3718 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes); |
| 3719 | { |
| 3720 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3721 | surface = layer_data->Unwrap(surface); |
| 3722 | } |
| 3723 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes); |
| 3724 | |
| 3725 | return result; |
| 3726 | } |
| 3727 | |
| 3728 | // Skip vkCreateSwapchainKHR dispatch, manually generated |
| 3729 | |
| 3730 | // Skip vkDestroySwapchainKHR dispatch, manually generated |
| 3731 | |
| 3732 | // Skip vkGetSwapchainImagesKHR dispatch, manually generated |
| 3733 | |
| 3734 | VkResult DispatchAcquireNextImageKHR( |
| 3735 | VkDevice device, |
| 3736 | VkSwapchainKHR swapchain, |
| 3737 | uint64_t timeout, |
| 3738 | VkSemaphore semaphore, |
| 3739 | VkFence fence, |
| 3740 | uint32_t* pImageIndex) |
| 3741 | { |
| 3742 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3743 | if (!wrap_handles) return layer_data->device_dispatch_table.AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
| 3744 | { |
| 3745 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3746 | swapchain = layer_data->Unwrap(swapchain); |
| 3747 | semaphore = layer_data->Unwrap(semaphore); |
| 3748 | fence = layer_data->Unwrap(fence); |
| 3749 | } |
| 3750 | VkResult result = layer_data->device_dispatch_table.AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
| 3751 | |
| 3752 | return result; |
| 3753 | } |
| 3754 | |
| 3755 | // Skip vkQueuePresentKHR dispatch, manually generated |
| 3756 | |
| 3757 | VkResult DispatchGetDeviceGroupPresentCapabilitiesKHR( |
| 3758 | VkDevice device, |
| 3759 | VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities) |
| 3760 | { |
| 3761 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3762 | VkResult result = layer_data->device_dispatch_table.GetDeviceGroupPresentCapabilitiesKHR(device, pDeviceGroupPresentCapabilities); |
| 3763 | |
| 3764 | return result; |
| 3765 | } |
| 3766 | |
| 3767 | VkResult DispatchGetDeviceGroupSurfacePresentModesKHR( |
| 3768 | VkDevice device, |
| 3769 | VkSurfaceKHR surface, |
| 3770 | VkDeviceGroupPresentModeFlagsKHR* pModes) |
| 3771 | { |
| 3772 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3773 | if (!wrap_handles) return layer_data->device_dispatch_table.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); |
| 3774 | { |
| 3775 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3776 | surface = layer_data->Unwrap(surface); |
| 3777 | } |
| 3778 | VkResult result = layer_data->device_dispatch_table.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); |
| 3779 | |
| 3780 | return result; |
| 3781 | } |
| 3782 | |
| 3783 | VkResult DispatchGetPhysicalDevicePresentRectanglesKHR( |
| 3784 | VkPhysicalDevice physicalDevice, |
| 3785 | VkSurfaceKHR surface, |
| 3786 | uint32_t* pRectCount, |
| 3787 | VkRect2D* pRects) |
| 3788 | { |
| 3789 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3790 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDevicePresentRectanglesKHR(physicalDevice, surface, pRectCount, pRects); |
| 3791 | { |
| 3792 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3793 | surface = layer_data->Unwrap(surface); |
| 3794 | } |
| 3795 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDevicePresentRectanglesKHR(physicalDevice, surface, pRectCount, pRects); |
| 3796 | |
| 3797 | return result; |
| 3798 | } |
| 3799 | |
| 3800 | VkResult DispatchAcquireNextImage2KHR( |
| 3801 | VkDevice device, |
| 3802 | const VkAcquireNextImageInfoKHR* pAcquireInfo, |
| 3803 | uint32_t* pImageIndex) |
| 3804 | { |
| 3805 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 3806 | if (!wrap_handles) return layer_data->device_dispatch_table.AcquireNextImage2KHR(device, pAcquireInfo, pImageIndex); |
| 3807 | safe_VkAcquireNextImageInfoKHR *local_pAcquireInfo = NULL; |
| 3808 | { |
| 3809 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3810 | if (pAcquireInfo) { |
| 3811 | local_pAcquireInfo = new safe_VkAcquireNextImageInfoKHR(pAcquireInfo); |
| 3812 | if (pAcquireInfo->swapchain) { |
| 3813 | local_pAcquireInfo->swapchain = layer_data->Unwrap(pAcquireInfo->swapchain); |
| 3814 | } |
| 3815 | if (pAcquireInfo->semaphore) { |
| 3816 | local_pAcquireInfo->semaphore = layer_data->Unwrap(pAcquireInfo->semaphore); |
| 3817 | } |
| 3818 | if (pAcquireInfo->fence) { |
| 3819 | local_pAcquireInfo->fence = layer_data->Unwrap(pAcquireInfo->fence); |
| 3820 | } |
| 3821 | } |
| 3822 | } |
| 3823 | VkResult result = layer_data->device_dispatch_table.AcquireNextImage2KHR(device, (const VkAcquireNextImageInfoKHR*)local_pAcquireInfo, pImageIndex); |
| 3824 | if (local_pAcquireInfo) { |
| 3825 | delete local_pAcquireInfo; |
| 3826 | } |
| 3827 | return result; |
| 3828 | } |
| 3829 | |
| 3830 | // Skip vkGetPhysicalDeviceDisplayPropertiesKHR dispatch, manually generated |
| 3831 | |
| 3832 | // Skip vkGetPhysicalDeviceDisplayPlanePropertiesKHR dispatch, manually generated |
| 3833 | |
| 3834 | // Skip vkGetDisplayPlaneSupportedDisplaysKHR dispatch, manually generated |
| 3835 | |
| 3836 | // Skip vkGetDisplayModePropertiesKHR dispatch, manually generated |
| 3837 | |
| 3838 | VkResult DispatchCreateDisplayModeKHR( |
| 3839 | VkPhysicalDevice physicalDevice, |
| 3840 | VkDisplayKHR display, |
| 3841 | const VkDisplayModeCreateInfoKHR* pCreateInfo, |
| 3842 | const VkAllocationCallbacks* pAllocator, |
| 3843 | VkDisplayModeKHR* pMode) |
| 3844 | { |
| 3845 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3846 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); |
| 3847 | { |
| 3848 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3849 | display = layer_data->Unwrap(display); |
| 3850 | } |
| 3851 | VkResult result = layer_data->instance_dispatch_table.CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); |
| 3852 | if (VK_SUCCESS == result) { |
| 3853 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3854 | *pMode = layer_data->WrapNew(*pMode); |
| 3855 | } |
| 3856 | return result; |
| 3857 | } |
| 3858 | |
| 3859 | VkResult DispatchGetDisplayPlaneCapabilitiesKHR( |
| 3860 | VkPhysicalDevice physicalDevice, |
| 3861 | VkDisplayModeKHR mode, |
| 3862 | uint32_t planeIndex, |
| 3863 | VkDisplayPlaneCapabilitiesKHR* pCapabilities) |
| 3864 | { |
| 3865 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3866 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); |
| 3867 | { |
| 3868 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3869 | mode = layer_data->Unwrap(mode); |
| 3870 | } |
| 3871 | VkResult result = layer_data->instance_dispatch_table.GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); |
| 3872 | |
| 3873 | return result; |
| 3874 | } |
| 3875 | |
| 3876 | VkResult DispatchCreateDisplayPlaneSurfaceKHR( |
| 3877 | VkInstance instance, |
| 3878 | const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, |
| 3879 | const VkAllocationCallbacks* pAllocator, |
| 3880 | VkSurfaceKHR* pSurface) |
| 3881 | { |
| 3882 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 3883 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3884 | safe_VkDisplaySurfaceCreateInfoKHR *local_pCreateInfo = NULL; |
| 3885 | { |
| 3886 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3887 | if (pCreateInfo) { |
| 3888 | local_pCreateInfo = new safe_VkDisplaySurfaceCreateInfoKHR(pCreateInfo); |
| 3889 | if (pCreateInfo->displayMode) { |
| 3890 | local_pCreateInfo->displayMode = layer_data->Unwrap(pCreateInfo->displayMode); |
| 3891 | } |
| 3892 | } |
| 3893 | } |
| 3894 | VkResult result = layer_data->instance_dispatch_table.CreateDisplayPlaneSurfaceKHR(instance, (const VkDisplaySurfaceCreateInfoKHR*)local_pCreateInfo, pAllocator, pSurface); |
| 3895 | if (local_pCreateInfo) { |
| 3896 | delete local_pCreateInfo; |
| 3897 | } |
| 3898 | if (VK_SUCCESS == result) { |
| 3899 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3900 | *pSurface = layer_data->WrapNew(*pSurface); |
| 3901 | } |
| 3902 | return result; |
| 3903 | } |
| 3904 | |
| 3905 | // Skip vkCreateSharedSwapchainsKHR dispatch, manually generated |
| 3906 | |
| 3907 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 3908 | |
| 3909 | VkResult DispatchCreateXlibSurfaceKHR( |
| 3910 | VkInstance instance, |
| 3911 | const VkXlibSurfaceCreateInfoKHR* pCreateInfo, |
| 3912 | const VkAllocationCallbacks* pAllocator, |
| 3913 | VkSurfaceKHR* pSurface) |
| 3914 | { |
| 3915 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 3916 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3917 | VkResult result = layer_data->instance_dispatch_table.CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3918 | if (VK_SUCCESS == result) { |
| 3919 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3920 | *pSurface = layer_data->WrapNew(*pSurface); |
| 3921 | } |
| 3922 | return result; |
| 3923 | } |
| 3924 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 3925 | |
| 3926 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 3927 | |
| 3928 | VkBool32 DispatchGetPhysicalDeviceXlibPresentationSupportKHR( |
| 3929 | VkPhysicalDevice physicalDevice, |
| 3930 | uint32_t queueFamilyIndex, |
| 3931 | Display* dpy, |
| 3932 | VisualID visualID) |
| 3933 | { |
| 3934 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3935 | VkBool32 result = layer_data->instance_dispatch_table.GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); |
| 3936 | |
| 3937 | return result; |
| 3938 | } |
| 3939 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 3940 | |
| 3941 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 3942 | |
| 3943 | VkResult DispatchCreateXcbSurfaceKHR( |
| 3944 | VkInstance instance, |
| 3945 | const VkXcbSurfaceCreateInfoKHR* pCreateInfo, |
| 3946 | const VkAllocationCallbacks* pAllocator, |
| 3947 | VkSurfaceKHR* pSurface) |
| 3948 | { |
| 3949 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 3950 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3951 | VkResult result = layer_data->instance_dispatch_table.CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3952 | if (VK_SUCCESS == result) { |
| 3953 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3954 | *pSurface = layer_data->WrapNew(*pSurface); |
| 3955 | } |
| 3956 | return result; |
| 3957 | } |
| 3958 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 3959 | |
| 3960 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 3961 | |
| 3962 | VkBool32 DispatchGetPhysicalDeviceXcbPresentationSupportKHR( |
| 3963 | VkPhysicalDevice physicalDevice, |
| 3964 | uint32_t queueFamilyIndex, |
| 3965 | xcb_connection_t* connection, |
| 3966 | xcb_visualid_t visual_id) |
| 3967 | { |
| 3968 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3969 | VkBool32 result = layer_data->instance_dispatch_table.GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, visual_id); |
| 3970 | |
| 3971 | return result; |
| 3972 | } |
| 3973 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 3974 | |
| 3975 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 3976 | |
| 3977 | VkResult DispatchCreateWaylandSurfaceKHR( |
| 3978 | VkInstance instance, |
| 3979 | const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, |
| 3980 | const VkAllocationCallbacks* pAllocator, |
| 3981 | VkSurfaceKHR* pSurface) |
| 3982 | { |
| 3983 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 3984 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3985 | VkResult result = layer_data->instance_dispatch_table.CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 3986 | if (VK_SUCCESS == result) { |
| 3987 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 3988 | *pSurface = layer_data->WrapNew(*pSurface); |
| 3989 | } |
| 3990 | return result; |
| 3991 | } |
| 3992 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 3993 | |
| 3994 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 3995 | |
| 3996 | VkBool32 DispatchGetPhysicalDeviceWaylandPresentationSupportKHR( |
| 3997 | VkPhysicalDevice physicalDevice, |
| 3998 | uint32_t queueFamilyIndex, |
| 3999 | struct wl_display* display) |
| 4000 | { |
| 4001 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4002 | VkBool32 result = layer_data->instance_dispatch_table.GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); |
| 4003 | |
| 4004 | return result; |
| 4005 | } |
| 4006 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 4007 | |
| 4008 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 4009 | |
| 4010 | VkResult DispatchCreateAndroidSurfaceKHR( |
| 4011 | VkInstance instance, |
| 4012 | const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, |
| 4013 | const VkAllocationCallbacks* pAllocator, |
| 4014 | VkSurfaceKHR* pSurface) |
| 4015 | { |
| 4016 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 4017 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4018 | VkResult result = layer_data->instance_dispatch_table.CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4019 | if (VK_SUCCESS == result) { |
| 4020 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4021 | *pSurface = layer_data->WrapNew(*pSurface); |
| 4022 | } |
| 4023 | return result; |
| 4024 | } |
| 4025 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 4026 | |
| 4027 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4028 | |
| 4029 | VkResult DispatchCreateWin32SurfaceKHR( |
| 4030 | VkInstance instance, |
| 4031 | const VkWin32SurfaceCreateInfoKHR* pCreateInfo, |
| 4032 | const VkAllocationCallbacks* pAllocator, |
| 4033 | VkSurfaceKHR* pSurface) |
| 4034 | { |
| 4035 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 4036 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4037 | VkResult result = layer_data->instance_dispatch_table.CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 4038 | if (VK_SUCCESS == result) { |
| 4039 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4040 | *pSurface = layer_data->WrapNew(*pSurface); |
| 4041 | } |
| 4042 | return result; |
| 4043 | } |
| 4044 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4045 | |
| 4046 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4047 | |
| 4048 | VkBool32 DispatchGetPhysicalDeviceWin32PresentationSupportKHR( |
| 4049 | VkPhysicalDevice physicalDevice, |
| 4050 | uint32_t queueFamilyIndex) |
| 4051 | { |
| 4052 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4053 | VkBool32 result = layer_data->instance_dispatch_table.GetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
| 4054 | |
| 4055 | return result; |
| 4056 | } |
| 4057 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4058 | |
| 4059 | void DispatchGetPhysicalDeviceFeatures2KHR( |
| 4060 | VkPhysicalDevice physicalDevice, |
| 4061 | VkPhysicalDeviceFeatures2* pFeatures) |
| 4062 | { |
| 4063 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4064 | layer_data->instance_dispatch_table.GetPhysicalDeviceFeatures2KHR(physicalDevice, pFeatures); |
| 4065 | |
| 4066 | } |
| 4067 | |
| 4068 | void DispatchGetPhysicalDeviceProperties2KHR( |
| 4069 | VkPhysicalDevice physicalDevice, |
| 4070 | VkPhysicalDeviceProperties2* pProperties) |
| 4071 | { |
| 4072 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4073 | layer_data->instance_dispatch_table.GetPhysicalDeviceProperties2KHR(physicalDevice, pProperties); |
| 4074 | |
| 4075 | } |
| 4076 | |
| 4077 | void DispatchGetPhysicalDeviceFormatProperties2KHR( |
| 4078 | VkPhysicalDevice physicalDevice, |
| 4079 | VkFormat format, |
| 4080 | VkFormatProperties2* pFormatProperties) |
| 4081 | { |
| 4082 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4083 | layer_data->instance_dispatch_table.GetPhysicalDeviceFormatProperties2KHR(physicalDevice, format, pFormatProperties); |
| 4084 | |
| 4085 | } |
| 4086 | |
| 4087 | VkResult DispatchGetPhysicalDeviceImageFormatProperties2KHR( |
| 4088 | VkPhysicalDevice physicalDevice, |
| 4089 | const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, |
| 4090 | VkImageFormatProperties2* pImageFormatProperties) |
| 4091 | { |
| 4092 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4093 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, pImageFormatInfo, pImageFormatProperties); |
| 4094 | safe_VkPhysicalDeviceImageFormatInfo2 *local_pImageFormatInfo = NULL; |
| 4095 | { |
| 4096 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4097 | if (pImageFormatInfo) { |
| 4098 | local_pImageFormatInfo = new safe_VkPhysicalDeviceImageFormatInfo2(pImageFormatInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 4099 | WrapPnextChainHandles(layer_data, local_pImageFormatInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4100 | } |
| 4101 | } |
| 4102 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, (const VkPhysicalDeviceImageFormatInfo2*)local_pImageFormatInfo, pImageFormatProperties); |
| 4103 | if (local_pImageFormatInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4104 | delete local_pImageFormatInfo; |
| 4105 | } |
| 4106 | return result; |
| 4107 | } |
| 4108 | |
| 4109 | void DispatchGetPhysicalDeviceQueueFamilyProperties2KHR( |
| 4110 | VkPhysicalDevice physicalDevice, |
| 4111 | uint32_t* pQueueFamilyPropertyCount, |
| 4112 | VkQueueFamilyProperties2* pQueueFamilyProperties) |
| 4113 | { |
| 4114 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4115 | layer_data->instance_dispatch_table.GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 4116 | |
| 4117 | } |
| 4118 | |
| 4119 | void DispatchGetPhysicalDeviceMemoryProperties2KHR( |
| 4120 | VkPhysicalDevice physicalDevice, |
| 4121 | VkPhysicalDeviceMemoryProperties2* pMemoryProperties) |
| 4122 | { |
| 4123 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4124 | layer_data->instance_dispatch_table.GetPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties); |
| 4125 | |
| 4126 | } |
| 4127 | |
| 4128 | void DispatchGetPhysicalDeviceSparseImageFormatProperties2KHR( |
| 4129 | VkPhysicalDevice physicalDevice, |
| 4130 | const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, |
| 4131 | uint32_t* pPropertyCount, |
| 4132 | VkSparseImageFormatProperties2* pProperties) |
| 4133 | { |
| 4134 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4135 | layer_data->instance_dispatch_table.GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, pProperties); |
| 4136 | |
| 4137 | } |
| 4138 | |
| 4139 | void DispatchGetDeviceGroupPeerMemoryFeaturesKHR( |
| 4140 | VkDevice device, |
| 4141 | uint32_t heapIndex, |
| 4142 | uint32_t localDeviceIndex, |
| 4143 | uint32_t remoteDeviceIndex, |
| 4144 | VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) |
| 4145 | { |
| 4146 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4147 | layer_data->device_dispatch_table.GetDeviceGroupPeerMemoryFeaturesKHR(device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures); |
| 4148 | |
| 4149 | } |
| 4150 | |
| 4151 | void DispatchCmdSetDeviceMaskKHR( |
| 4152 | VkCommandBuffer commandBuffer, |
| 4153 | uint32_t deviceMask) |
| 4154 | { |
| 4155 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4156 | layer_data->device_dispatch_table.CmdSetDeviceMaskKHR(commandBuffer, deviceMask); |
| 4157 | |
| 4158 | } |
| 4159 | |
| 4160 | void DispatchCmdDispatchBaseKHR( |
| 4161 | VkCommandBuffer commandBuffer, |
| 4162 | uint32_t baseGroupX, |
| 4163 | uint32_t baseGroupY, |
| 4164 | uint32_t baseGroupZ, |
| 4165 | uint32_t groupCountX, |
| 4166 | uint32_t groupCountY, |
| 4167 | uint32_t groupCountZ) |
| 4168 | { |
| 4169 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4170 | layer_data->device_dispatch_table.CmdDispatchBaseKHR(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); |
| 4171 | |
| 4172 | } |
| 4173 | |
| 4174 | void DispatchTrimCommandPoolKHR( |
| 4175 | VkDevice device, |
| 4176 | VkCommandPool commandPool, |
| 4177 | VkCommandPoolTrimFlags flags) |
| 4178 | { |
| 4179 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4180 | if (!wrap_handles) return layer_data->device_dispatch_table.TrimCommandPoolKHR(device, commandPool, flags); |
| 4181 | { |
| 4182 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4183 | commandPool = layer_data->Unwrap(commandPool); |
| 4184 | } |
| 4185 | layer_data->device_dispatch_table.TrimCommandPoolKHR(device, commandPool, flags); |
| 4186 | |
| 4187 | } |
| 4188 | |
| 4189 | VkResult DispatchEnumeratePhysicalDeviceGroupsKHR( |
| 4190 | VkInstance instance, |
| 4191 | uint32_t* pPhysicalDeviceGroupCount, |
| 4192 | VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) |
| 4193 | { |
| 4194 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 4195 | VkResult result = layer_data->instance_dispatch_table.EnumeratePhysicalDeviceGroupsKHR(instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); |
| 4196 | |
| 4197 | return result; |
| 4198 | } |
| 4199 | |
| 4200 | void DispatchGetPhysicalDeviceExternalBufferPropertiesKHR( |
| 4201 | VkPhysicalDevice physicalDevice, |
| 4202 | const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, |
| 4203 | VkExternalBufferProperties* pExternalBufferProperties) |
| 4204 | { |
| 4205 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4206 | layer_data->instance_dispatch_table.GetPhysicalDeviceExternalBufferPropertiesKHR(physicalDevice, pExternalBufferInfo, pExternalBufferProperties); |
| 4207 | |
| 4208 | } |
| 4209 | |
| 4210 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4211 | |
| 4212 | VkResult DispatchGetMemoryWin32HandleKHR( |
| 4213 | VkDevice device, |
| 4214 | const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, |
| 4215 | HANDLE* pHandle) |
| 4216 | { |
| 4217 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4218 | if (!wrap_handles) return layer_data->device_dispatch_table.GetMemoryWin32HandleKHR(device, pGetWin32HandleInfo, pHandle); |
| 4219 | safe_VkMemoryGetWin32HandleInfoKHR *local_pGetWin32HandleInfo = NULL; |
| 4220 | { |
| 4221 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4222 | if (pGetWin32HandleInfo) { |
| 4223 | local_pGetWin32HandleInfo = new safe_VkMemoryGetWin32HandleInfoKHR(pGetWin32HandleInfo); |
| 4224 | if (pGetWin32HandleInfo->memory) { |
| 4225 | local_pGetWin32HandleInfo->memory = layer_data->Unwrap(pGetWin32HandleInfo->memory); |
| 4226 | } |
| 4227 | } |
| 4228 | } |
| 4229 | VkResult result = layer_data->device_dispatch_table.GetMemoryWin32HandleKHR(device, (const VkMemoryGetWin32HandleInfoKHR*)local_pGetWin32HandleInfo, pHandle); |
| 4230 | if (local_pGetWin32HandleInfo) { |
| 4231 | delete local_pGetWin32HandleInfo; |
| 4232 | } |
| 4233 | return result; |
| 4234 | } |
| 4235 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4236 | |
| 4237 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4238 | |
| 4239 | VkResult DispatchGetMemoryWin32HandlePropertiesKHR( |
| 4240 | VkDevice device, |
| 4241 | VkExternalMemoryHandleTypeFlagBits handleType, |
| 4242 | HANDLE handle, |
| 4243 | VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties) |
| 4244 | { |
| 4245 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4246 | VkResult result = layer_data->device_dispatch_table.GetMemoryWin32HandlePropertiesKHR(device, handleType, handle, pMemoryWin32HandleProperties); |
| 4247 | |
| 4248 | return result; |
| 4249 | } |
| 4250 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4251 | |
| 4252 | VkResult DispatchGetMemoryFdKHR( |
| 4253 | VkDevice device, |
| 4254 | const VkMemoryGetFdInfoKHR* pGetFdInfo, |
| 4255 | int* pFd) |
| 4256 | { |
| 4257 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4258 | if (!wrap_handles) return layer_data->device_dispatch_table.GetMemoryFdKHR(device, pGetFdInfo, pFd); |
| 4259 | safe_VkMemoryGetFdInfoKHR *local_pGetFdInfo = NULL; |
| 4260 | { |
| 4261 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4262 | if (pGetFdInfo) { |
| 4263 | local_pGetFdInfo = new safe_VkMemoryGetFdInfoKHR(pGetFdInfo); |
| 4264 | if (pGetFdInfo->memory) { |
| 4265 | local_pGetFdInfo->memory = layer_data->Unwrap(pGetFdInfo->memory); |
| 4266 | } |
| 4267 | } |
| 4268 | } |
| 4269 | VkResult result = layer_data->device_dispatch_table.GetMemoryFdKHR(device, (const VkMemoryGetFdInfoKHR*)local_pGetFdInfo, pFd); |
| 4270 | if (local_pGetFdInfo) { |
| 4271 | delete local_pGetFdInfo; |
| 4272 | } |
| 4273 | return result; |
| 4274 | } |
| 4275 | |
| 4276 | VkResult DispatchGetMemoryFdPropertiesKHR( |
| 4277 | VkDevice device, |
| 4278 | VkExternalMemoryHandleTypeFlagBits handleType, |
| 4279 | int fd, |
| 4280 | VkMemoryFdPropertiesKHR* pMemoryFdProperties) |
| 4281 | { |
| 4282 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4283 | VkResult result = layer_data->device_dispatch_table.GetMemoryFdPropertiesKHR(device, handleType, fd, pMemoryFdProperties); |
| 4284 | |
| 4285 | return result; |
| 4286 | } |
| 4287 | |
| 4288 | void DispatchGetPhysicalDeviceExternalSemaphorePropertiesKHR( |
| 4289 | VkPhysicalDevice physicalDevice, |
| 4290 | const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, |
| 4291 | VkExternalSemaphoreProperties* pExternalSemaphoreProperties) |
| 4292 | { |
| 4293 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4294 | layer_data->instance_dispatch_table.GetPhysicalDeviceExternalSemaphorePropertiesKHR(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties); |
| 4295 | |
| 4296 | } |
| 4297 | |
| 4298 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4299 | |
| 4300 | VkResult DispatchImportSemaphoreWin32HandleKHR( |
| 4301 | VkDevice device, |
| 4302 | const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo) |
| 4303 | { |
| 4304 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4305 | if (!wrap_handles) return layer_data->device_dispatch_table.ImportSemaphoreWin32HandleKHR(device, pImportSemaphoreWin32HandleInfo); |
| 4306 | safe_VkImportSemaphoreWin32HandleInfoKHR *local_pImportSemaphoreWin32HandleInfo = NULL; |
| 4307 | { |
| 4308 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4309 | if (pImportSemaphoreWin32HandleInfo) { |
| 4310 | local_pImportSemaphoreWin32HandleInfo = new safe_VkImportSemaphoreWin32HandleInfoKHR(pImportSemaphoreWin32HandleInfo); |
| 4311 | if (pImportSemaphoreWin32HandleInfo->semaphore) { |
| 4312 | local_pImportSemaphoreWin32HandleInfo->semaphore = layer_data->Unwrap(pImportSemaphoreWin32HandleInfo->semaphore); |
| 4313 | } |
| 4314 | } |
| 4315 | } |
| 4316 | VkResult result = layer_data->device_dispatch_table.ImportSemaphoreWin32HandleKHR(device, (const VkImportSemaphoreWin32HandleInfoKHR*)local_pImportSemaphoreWin32HandleInfo); |
| 4317 | if (local_pImportSemaphoreWin32HandleInfo) { |
| 4318 | delete local_pImportSemaphoreWin32HandleInfo; |
| 4319 | } |
| 4320 | return result; |
| 4321 | } |
| 4322 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4323 | |
| 4324 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4325 | |
| 4326 | VkResult DispatchGetSemaphoreWin32HandleKHR( |
| 4327 | VkDevice device, |
| 4328 | const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, |
| 4329 | HANDLE* pHandle) |
| 4330 | { |
| 4331 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4332 | if (!wrap_handles) return layer_data->device_dispatch_table.GetSemaphoreWin32HandleKHR(device, pGetWin32HandleInfo, pHandle); |
| 4333 | safe_VkSemaphoreGetWin32HandleInfoKHR *local_pGetWin32HandleInfo = NULL; |
| 4334 | { |
| 4335 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4336 | if (pGetWin32HandleInfo) { |
| 4337 | local_pGetWin32HandleInfo = new safe_VkSemaphoreGetWin32HandleInfoKHR(pGetWin32HandleInfo); |
| 4338 | if (pGetWin32HandleInfo->semaphore) { |
| 4339 | local_pGetWin32HandleInfo->semaphore = layer_data->Unwrap(pGetWin32HandleInfo->semaphore); |
| 4340 | } |
| 4341 | } |
| 4342 | } |
| 4343 | VkResult result = layer_data->device_dispatch_table.GetSemaphoreWin32HandleKHR(device, (const VkSemaphoreGetWin32HandleInfoKHR*)local_pGetWin32HandleInfo, pHandle); |
| 4344 | if (local_pGetWin32HandleInfo) { |
| 4345 | delete local_pGetWin32HandleInfo; |
| 4346 | } |
| 4347 | return result; |
| 4348 | } |
| 4349 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4350 | |
| 4351 | VkResult DispatchImportSemaphoreFdKHR( |
| 4352 | VkDevice device, |
| 4353 | const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo) |
| 4354 | { |
| 4355 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4356 | if (!wrap_handles) return layer_data->device_dispatch_table.ImportSemaphoreFdKHR(device, pImportSemaphoreFdInfo); |
| 4357 | safe_VkImportSemaphoreFdInfoKHR *local_pImportSemaphoreFdInfo = NULL; |
| 4358 | { |
| 4359 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4360 | if (pImportSemaphoreFdInfo) { |
| 4361 | local_pImportSemaphoreFdInfo = new safe_VkImportSemaphoreFdInfoKHR(pImportSemaphoreFdInfo); |
| 4362 | if (pImportSemaphoreFdInfo->semaphore) { |
| 4363 | local_pImportSemaphoreFdInfo->semaphore = layer_data->Unwrap(pImportSemaphoreFdInfo->semaphore); |
| 4364 | } |
| 4365 | } |
| 4366 | } |
| 4367 | VkResult result = layer_data->device_dispatch_table.ImportSemaphoreFdKHR(device, (const VkImportSemaphoreFdInfoKHR*)local_pImportSemaphoreFdInfo); |
| 4368 | if (local_pImportSemaphoreFdInfo) { |
| 4369 | delete local_pImportSemaphoreFdInfo; |
| 4370 | } |
| 4371 | return result; |
| 4372 | } |
| 4373 | |
| 4374 | VkResult DispatchGetSemaphoreFdKHR( |
| 4375 | VkDevice device, |
| 4376 | const VkSemaphoreGetFdInfoKHR* pGetFdInfo, |
| 4377 | int* pFd) |
| 4378 | { |
| 4379 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4380 | if (!wrap_handles) return layer_data->device_dispatch_table.GetSemaphoreFdKHR(device, pGetFdInfo, pFd); |
| 4381 | safe_VkSemaphoreGetFdInfoKHR *local_pGetFdInfo = NULL; |
| 4382 | { |
| 4383 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4384 | if (pGetFdInfo) { |
| 4385 | local_pGetFdInfo = new safe_VkSemaphoreGetFdInfoKHR(pGetFdInfo); |
| 4386 | if (pGetFdInfo->semaphore) { |
| 4387 | local_pGetFdInfo->semaphore = layer_data->Unwrap(pGetFdInfo->semaphore); |
| 4388 | } |
| 4389 | } |
| 4390 | } |
| 4391 | VkResult result = layer_data->device_dispatch_table.GetSemaphoreFdKHR(device, (const VkSemaphoreGetFdInfoKHR*)local_pGetFdInfo, pFd); |
| 4392 | if (local_pGetFdInfo) { |
| 4393 | delete local_pGetFdInfo; |
| 4394 | } |
| 4395 | return result; |
| 4396 | } |
| 4397 | |
| 4398 | void DispatchCmdPushDescriptorSetKHR( |
| 4399 | VkCommandBuffer commandBuffer, |
| 4400 | VkPipelineBindPoint pipelineBindPoint, |
| 4401 | VkPipelineLayout layout, |
| 4402 | uint32_t set, |
| 4403 | uint32_t descriptorWriteCount, |
| 4404 | const VkWriteDescriptorSet* pDescriptorWrites) |
| 4405 | { |
| 4406 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4407 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites); |
| 4408 | safe_VkWriteDescriptorSet *local_pDescriptorWrites = NULL; |
| 4409 | { |
| 4410 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4411 | layout = layer_data->Unwrap(layout); |
| 4412 | if (pDescriptorWrites) { |
| 4413 | local_pDescriptorWrites = new safe_VkWriteDescriptorSet[descriptorWriteCount]; |
| 4414 | for (uint32_t index0 = 0; index0 < descriptorWriteCount; ++index0) { |
| 4415 | local_pDescriptorWrites[index0].initialize(&pDescriptorWrites[index0]); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 4416 | WrapPnextChainHandles(layer_data, local_pDescriptorWrites[index0].pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4417 | if (pDescriptorWrites[index0].dstSet) { |
| 4418 | local_pDescriptorWrites[index0].dstSet = layer_data->Unwrap(pDescriptorWrites[index0].dstSet); |
| 4419 | } |
| 4420 | if (local_pDescriptorWrites[index0].pImageInfo) { |
| 4421 | for (uint32_t index1 = 0; index1 < local_pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 4422 | if (pDescriptorWrites[index0].pImageInfo[index1].sampler) { |
| 4423 | local_pDescriptorWrites[index0].pImageInfo[index1].sampler = layer_data->Unwrap(pDescriptorWrites[index0].pImageInfo[index1].sampler); |
| 4424 | } |
| 4425 | if (pDescriptorWrites[index0].pImageInfo[index1].imageView) { |
| 4426 | local_pDescriptorWrites[index0].pImageInfo[index1].imageView = layer_data->Unwrap(pDescriptorWrites[index0].pImageInfo[index1].imageView); |
| 4427 | } |
| 4428 | } |
| 4429 | } |
| 4430 | if (local_pDescriptorWrites[index0].pBufferInfo) { |
| 4431 | for (uint32_t index1 = 0; index1 < local_pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 4432 | if (pDescriptorWrites[index0].pBufferInfo[index1].buffer) { |
| 4433 | local_pDescriptorWrites[index0].pBufferInfo[index1].buffer = layer_data->Unwrap(pDescriptorWrites[index0].pBufferInfo[index1].buffer); |
| 4434 | } |
| 4435 | } |
| 4436 | } |
| 4437 | if (local_pDescriptorWrites[index0].pTexelBufferView) { |
| 4438 | for (uint32_t index1 = 0; index1 < local_pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 4439 | local_pDescriptorWrites[index0].pTexelBufferView[index1] = layer_data->Unwrap(local_pDescriptorWrites[index0].pTexelBufferView[index1]); |
| 4440 | } |
| 4441 | } |
| 4442 | } |
| 4443 | } |
| 4444 | } |
| 4445 | layer_data->device_dispatch_table.CmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, (const VkWriteDescriptorSet*)local_pDescriptorWrites); |
| 4446 | if (local_pDescriptorWrites) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4447 | delete[] local_pDescriptorWrites; |
| 4448 | } |
| 4449 | } |
| 4450 | |
| 4451 | // Skip vkCmdPushDescriptorSetWithTemplateKHR dispatch, manually generated |
| 4452 | |
| 4453 | // Skip vkCreateDescriptorUpdateTemplateKHR dispatch, manually generated |
| 4454 | |
| 4455 | // Skip vkDestroyDescriptorUpdateTemplateKHR dispatch, manually generated |
| 4456 | |
| 4457 | // Skip vkUpdateDescriptorSetWithTemplateKHR dispatch, manually generated |
| 4458 | |
| 4459 | // Skip vkCreateRenderPass2KHR dispatch, manually generated |
| 4460 | |
| 4461 | void DispatchCmdBeginRenderPass2KHR( |
| 4462 | VkCommandBuffer commandBuffer, |
| 4463 | const VkRenderPassBeginInfo* pRenderPassBegin, |
| 4464 | const VkSubpassBeginInfoKHR* pSubpassBeginInfo) |
| 4465 | { |
| 4466 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4467 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBeginRenderPass2KHR(commandBuffer, pRenderPassBegin, pSubpassBeginInfo); |
| 4468 | safe_VkRenderPassBeginInfo *local_pRenderPassBegin = NULL; |
| 4469 | { |
| 4470 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4471 | if (pRenderPassBegin) { |
| 4472 | local_pRenderPassBegin = new safe_VkRenderPassBeginInfo(pRenderPassBegin); |
| 4473 | if (pRenderPassBegin->renderPass) { |
| 4474 | local_pRenderPassBegin->renderPass = layer_data->Unwrap(pRenderPassBegin->renderPass); |
| 4475 | } |
| 4476 | if (pRenderPassBegin->framebuffer) { |
| 4477 | local_pRenderPassBegin->framebuffer = layer_data->Unwrap(pRenderPassBegin->framebuffer); |
| 4478 | } |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 4479 | WrapPnextChainHandles(layer_data, local_pRenderPassBegin->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4480 | } |
| 4481 | } |
| 4482 | layer_data->device_dispatch_table.CmdBeginRenderPass2KHR(commandBuffer, (const VkRenderPassBeginInfo*)local_pRenderPassBegin, pSubpassBeginInfo); |
| 4483 | if (local_pRenderPassBegin) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4484 | delete local_pRenderPassBegin; |
| 4485 | } |
| 4486 | } |
| 4487 | |
| 4488 | void DispatchCmdNextSubpass2KHR( |
| 4489 | VkCommandBuffer commandBuffer, |
| 4490 | const VkSubpassBeginInfoKHR* pSubpassBeginInfo, |
| 4491 | const VkSubpassEndInfoKHR* pSubpassEndInfo) |
| 4492 | { |
| 4493 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4494 | layer_data->device_dispatch_table.CmdNextSubpass2KHR(commandBuffer, pSubpassBeginInfo, pSubpassEndInfo); |
| 4495 | |
| 4496 | } |
| 4497 | |
| 4498 | void DispatchCmdEndRenderPass2KHR( |
| 4499 | VkCommandBuffer commandBuffer, |
| 4500 | const VkSubpassEndInfoKHR* pSubpassEndInfo) |
| 4501 | { |
| 4502 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4503 | layer_data->device_dispatch_table.CmdEndRenderPass2KHR(commandBuffer, pSubpassEndInfo); |
| 4504 | |
| 4505 | } |
| 4506 | |
| 4507 | VkResult DispatchGetSwapchainStatusKHR( |
| 4508 | VkDevice device, |
| 4509 | VkSwapchainKHR swapchain) |
| 4510 | { |
| 4511 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4512 | if (!wrap_handles) return layer_data->device_dispatch_table.GetSwapchainStatusKHR(device, swapchain); |
| 4513 | { |
| 4514 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4515 | swapchain = layer_data->Unwrap(swapchain); |
| 4516 | } |
| 4517 | VkResult result = layer_data->device_dispatch_table.GetSwapchainStatusKHR(device, swapchain); |
| 4518 | |
| 4519 | return result; |
| 4520 | } |
| 4521 | |
| 4522 | void DispatchGetPhysicalDeviceExternalFencePropertiesKHR( |
| 4523 | VkPhysicalDevice physicalDevice, |
| 4524 | const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, |
| 4525 | VkExternalFenceProperties* pExternalFenceProperties) |
| 4526 | { |
| 4527 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4528 | layer_data->instance_dispatch_table.GetPhysicalDeviceExternalFencePropertiesKHR(physicalDevice, pExternalFenceInfo, pExternalFenceProperties); |
| 4529 | |
| 4530 | } |
| 4531 | |
| 4532 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4533 | |
| 4534 | VkResult DispatchImportFenceWin32HandleKHR( |
| 4535 | VkDevice device, |
| 4536 | const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo) |
| 4537 | { |
| 4538 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4539 | if (!wrap_handles) return layer_data->device_dispatch_table.ImportFenceWin32HandleKHR(device, pImportFenceWin32HandleInfo); |
| 4540 | safe_VkImportFenceWin32HandleInfoKHR *local_pImportFenceWin32HandleInfo = NULL; |
| 4541 | { |
| 4542 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4543 | if (pImportFenceWin32HandleInfo) { |
| 4544 | local_pImportFenceWin32HandleInfo = new safe_VkImportFenceWin32HandleInfoKHR(pImportFenceWin32HandleInfo); |
| 4545 | if (pImportFenceWin32HandleInfo->fence) { |
| 4546 | local_pImportFenceWin32HandleInfo->fence = layer_data->Unwrap(pImportFenceWin32HandleInfo->fence); |
| 4547 | } |
| 4548 | } |
| 4549 | } |
| 4550 | VkResult result = layer_data->device_dispatch_table.ImportFenceWin32HandleKHR(device, (const VkImportFenceWin32HandleInfoKHR*)local_pImportFenceWin32HandleInfo); |
| 4551 | if (local_pImportFenceWin32HandleInfo) { |
| 4552 | delete local_pImportFenceWin32HandleInfo; |
| 4553 | } |
| 4554 | return result; |
| 4555 | } |
| 4556 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4557 | |
| 4558 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 4559 | |
| 4560 | VkResult DispatchGetFenceWin32HandleKHR( |
| 4561 | VkDevice device, |
| 4562 | const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, |
| 4563 | HANDLE* pHandle) |
| 4564 | { |
| 4565 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4566 | if (!wrap_handles) return layer_data->device_dispatch_table.GetFenceWin32HandleKHR(device, pGetWin32HandleInfo, pHandle); |
| 4567 | safe_VkFenceGetWin32HandleInfoKHR *local_pGetWin32HandleInfo = NULL; |
| 4568 | { |
| 4569 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4570 | if (pGetWin32HandleInfo) { |
| 4571 | local_pGetWin32HandleInfo = new safe_VkFenceGetWin32HandleInfoKHR(pGetWin32HandleInfo); |
| 4572 | if (pGetWin32HandleInfo->fence) { |
| 4573 | local_pGetWin32HandleInfo->fence = layer_data->Unwrap(pGetWin32HandleInfo->fence); |
| 4574 | } |
| 4575 | } |
| 4576 | } |
| 4577 | VkResult result = layer_data->device_dispatch_table.GetFenceWin32HandleKHR(device, (const VkFenceGetWin32HandleInfoKHR*)local_pGetWin32HandleInfo, pHandle); |
| 4578 | if (local_pGetWin32HandleInfo) { |
| 4579 | delete local_pGetWin32HandleInfo; |
| 4580 | } |
| 4581 | return result; |
| 4582 | } |
| 4583 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4584 | |
| 4585 | VkResult DispatchImportFenceFdKHR( |
| 4586 | VkDevice device, |
| 4587 | const VkImportFenceFdInfoKHR* pImportFenceFdInfo) |
| 4588 | { |
| 4589 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4590 | if (!wrap_handles) return layer_data->device_dispatch_table.ImportFenceFdKHR(device, pImportFenceFdInfo); |
| 4591 | safe_VkImportFenceFdInfoKHR *local_pImportFenceFdInfo = NULL; |
| 4592 | { |
| 4593 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4594 | if (pImportFenceFdInfo) { |
| 4595 | local_pImportFenceFdInfo = new safe_VkImportFenceFdInfoKHR(pImportFenceFdInfo); |
| 4596 | if (pImportFenceFdInfo->fence) { |
| 4597 | local_pImportFenceFdInfo->fence = layer_data->Unwrap(pImportFenceFdInfo->fence); |
| 4598 | } |
| 4599 | } |
| 4600 | } |
| 4601 | VkResult result = layer_data->device_dispatch_table.ImportFenceFdKHR(device, (const VkImportFenceFdInfoKHR*)local_pImportFenceFdInfo); |
| 4602 | if (local_pImportFenceFdInfo) { |
| 4603 | delete local_pImportFenceFdInfo; |
| 4604 | } |
| 4605 | return result; |
| 4606 | } |
| 4607 | |
| 4608 | VkResult DispatchGetFenceFdKHR( |
| 4609 | VkDevice device, |
| 4610 | const VkFenceGetFdInfoKHR* pGetFdInfo, |
| 4611 | int* pFd) |
| 4612 | { |
| 4613 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4614 | if (!wrap_handles) return layer_data->device_dispatch_table.GetFenceFdKHR(device, pGetFdInfo, pFd); |
| 4615 | safe_VkFenceGetFdInfoKHR *local_pGetFdInfo = NULL; |
| 4616 | { |
| 4617 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4618 | if (pGetFdInfo) { |
| 4619 | local_pGetFdInfo = new safe_VkFenceGetFdInfoKHR(pGetFdInfo); |
| 4620 | if (pGetFdInfo->fence) { |
| 4621 | local_pGetFdInfo->fence = layer_data->Unwrap(pGetFdInfo->fence); |
| 4622 | } |
| 4623 | } |
| 4624 | } |
| 4625 | VkResult result = layer_data->device_dispatch_table.GetFenceFdKHR(device, (const VkFenceGetFdInfoKHR*)local_pGetFdInfo, pFd); |
| 4626 | if (local_pGetFdInfo) { |
| 4627 | delete local_pGetFdInfo; |
| 4628 | } |
| 4629 | return result; |
| 4630 | } |
| 4631 | |
| 4632 | VkResult DispatchGetPhysicalDeviceSurfaceCapabilities2KHR( |
| 4633 | VkPhysicalDevice physicalDevice, |
| 4634 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, |
| 4635 | VkSurfaceCapabilities2KHR* pSurfaceCapabilities) |
| 4636 | { |
| 4637 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4638 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice, pSurfaceInfo, pSurfaceCapabilities); |
| 4639 | safe_VkPhysicalDeviceSurfaceInfo2KHR *local_pSurfaceInfo = NULL; |
| 4640 | { |
| 4641 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4642 | if (pSurfaceInfo) { |
| 4643 | local_pSurfaceInfo = new safe_VkPhysicalDeviceSurfaceInfo2KHR(pSurfaceInfo); |
| 4644 | if (pSurfaceInfo->surface) { |
| 4645 | local_pSurfaceInfo->surface = layer_data->Unwrap(pSurfaceInfo->surface); |
| 4646 | } |
| 4647 | } |
| 4648 | } |
| 4649 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice, (const VkPhysicalDeviceSurfaceInfo2KHR*)local_pSurfaceInfo, pSurfaceCapabilities); |
| 4650 | if (local_pSurfaceInfo) { |
| 4651 | delete local_pSurfaceInfo; |
| 4652 | } |
| 4653 | return result; |
| 4654 | } |
| 4655 | |
| 4656 | VkResult DispatchGetPhysicalDeviceSurfaceFormats2KHR( |
| 4657 | VkPhysicalDevice physicalDevice, |
| 4658 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, |
| 4659 | uint32_t* pSurfaceFormatCount, |
| 4660 | VkSurfaceFormat2KHR* pSurfaceFormats) |
| 4661 | { |
| 4662 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4663 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceFormats2KHR(physicalDevice, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); |
| 4664 | safe_VkPhysicalDeviceSurfaceInfo2KHR *local_pSurfaceInfo = NULL; |
| 4665 | { |
| 4666 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4667 | if (pSurfaceInfo) { |
| 4668 | local_pSurfaceInfo = new safe_VkPhysicalDeviceSurfaceInfo2KHR(pSurfaceInfo); |
| 4669 | if (pSurfaceInfo->surface) { |
| 4670 | local_pSurfaceInfo->surface = layer_data->Unwrap(pSurfaceInfo->surface); |
| 4671 | } |
| 4672 | } |
| 4673 | } |
| 4674 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceFormats2KHR(physicalDevice, (const VkPhysicalDeviceSurfaceInfo2KHR*)local_pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); |
| 4675 | if (local_pSurfaceInfo) { |
| 4676 | delete local_pSurfaceInfo; |
| 4677 | } |
| 4678 | return result; |
| 4679 | } |
| 4680 | |
| 4681 | // Skip vkGetPhysicalDeviceDisplayProperties2KHR dispatch, manually generated |
| 4682 | |
| 4683 | // Skip vkGetPhysicalDeviceDisplayPlaneProperties2KHR dispatch, manually generated |
| 4684 | |
| 4685 | // Skip vkGetDisplayModeProperties2KHR dispatch, manually generated |
| 4686 | |
| 4687 | VkResult DispatchGetDisplayPlaneCapabilities2KHR( |
| 4688 | VkPhysicalDevice physicalDevice, |
| 4689 | const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo, |
| 4690 | VkDisplayPlaneCapabilities2KHR* pCapabilities) |
| 4691 | { |
| 4692 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 4693 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetDisplayPlaneCapabilities2KHR(physicalDevice, pDisplayPlaneInfo, pCapabilities); |
| 4694 | safe_VkDisplayPlaneInfo2KHR *local_pDisplayPlaneInfo = NULL; |
| 4695 | { |
| 4696 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4697 | if (pDisplayPlaneInfo) { |
| 4698 | local_pDisplayPlaneInfo = new safe_VkDisplayPlaneInfo2KHR(pDisplayPlaneInfo); |
| 4699 | if (pDisplayPlaneInfo->mode) { |
| 4700 | local_pDisplayPlaneInfo->mode = layer_data->Unwrap(pDisplayPlaneInfo->mode); |
| 4701 | } |
| 4702 | } |
| 4703 | } |
| 4704 | VkResult result = layer_data->instance_dispatch_table.GetDisplayPlaneCapabilities2KHR(physicalDevice, (const VkDisplayPlaneInfo2KHR*)local_pDisplayPlaneInfo, pCapabilities); |
| 4705 | if (local_pDisplayPlaneInfo) { |
| 4706 | delete local_pDisplayPlaneInfo; |
| 4707 | } |
| 4708 | return result; |
| 4709 | } |
| 4710 | |
| 4711 | void DispatchGetImageMemoryRequirements2KHR( |
| 4712 | VkDevice device, |
| 4713 | const VkImageMemoryRequirementsInfo2* pInfo, |
| 4714 | VkMemoryRequirements2* pMemoryRequirements) |
| 4715 | { |
| 4716 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4717 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageMemoryRequirements2KHR(device, pInfo, pMemoryRequirements); |
| 4718 | safe_VkImageMemoryRequirementsInfo2 *local_pInfo = NULL; |
| 4719 | { |
| 4720 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4721 | if (pInfo) { |
| 4722 | local_pInfo = new safe_VkImageMemoryRequirementsInfo2(pInfo); |
| 4723 | if (pInfo->image) { |
| 4724 | local_pInfo->image = layer_data->Unwrap(pInfo->image); |
| 4725 | } |
| 4726 | } |
| 4727 | } |
| 4728 | layer_data->device_dispatch_table.GetImageMemoryRequirements2KHR(device, (const VkImageMemoryRequirementsInfo2*)local_pInfo, pMemoryRequirements); |
| 4729 | if (local_pInfo) { |
| 4730 | delete local_pInfo; |
| 4731 | } |
| 4732 | } |
| 4733 | |
| 4734 | void DispatchGetBufferMemoryRequirements2KHR( |
| 4735 | VkDevice device, |
| 4736 | const VkBufferMemoryRequirementsInfo2* pInfo, |
| 4737 | VkMemoryRequirements2* pMemoryRequirements) |
| 4738 | { |
| 4739 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4740 | if (!wrap_handles) return layer_data->device_dispatch_table.GetBufferMemoryRequirements2KHR(device, pInfo, pMemoryRequirements); |
| 4741 | safe_VkBufferMemoryRequirementsInfo2 *local_pInfo = NULL; |
| 4742 | { |
| 4743 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4744 | if (pInfo) { |
| 4745 | local_pInfo = new safe_VkBufferMemoryRequirementsInfo2(pInfo); |
| 4746 | if (pInfo->buffer) { |
| 4747 | local_pInfo->buffer = layer_data->Unwrap(pInfo->buffer); |
| 4748 | } |
| 4749 | } |
| 4750 | } |
| 4751 | layer_data->device_dispatch_table.GetBufferMemoryRequirements2KHR(device, (const VkBufferMemoryRequirementsInfo2*)local_pInfo, pMemoryRequirements); |
| 4752 | if (local_pInfo) { |
| 4753 | delete local_pInfo; |
| 4754 | } |
| 4755 | } |
| 4756 | |
| 4757 | void DispatchGetImageSparseMemoryRequirements2KHR( |
| 4758 | VkDevice device, |
| 4759 | const VkImageSparseMemoryRequirementsInfo2* pInfo, |
| 4760 | uint32_t* pSparseMemoryRequirementCount, |
| 4761 | VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) |
| 4762 | { |
| 4763 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4764 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageSparseMemoryRequirements2KHR(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 4765 | safe_VkImageSparseMemoryRequirementsInfo2 *local_pInfo = NULL; |
| 4766 | { |
| 4767 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4768 | if (pInfo) { |
| 4769 | local_pInfo = new safe_VkImageSparseMemoryRequirementsInfo2(pInfo); |
| 4770 | if (pInfo->image) { |
| 4771 | local_pInfo->image = layer_data->Unwrap(pInfo->image); |
| 4772 | } |
| 4773 | } |
| 4774 | } |
| 4775 | layer_data->device_dispatch_table.GetImageSparseMemoryRequirements2KHR(device, (const VkImageSparseMemoryRequirementsInfo2*)local_pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 4776 | if (local_pInfo) { |
| 4777 | delete local_pInfo; |
| 4778 | } |
| 4779 | } |
| 4780 | |
| 4781 | VkResult DispatchCreateSamplerYcbcrConversionKHR( |
| 4782 | VkDevice device, |
| 4783 | const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, |
| 4784 | const VkAllocationCallbacks* pAllocator, |
| 4785 | VkSamplerYcbcrConversion* pYcbcrConversion) |
| 4786 | { |
| 4787 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4788 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateSamplerYcbcrConversionKHR(device, pCreateInfo, pAllocator, pYcbcrConversion); |
| 4789 | safe_VkSamplerYcbcrConversionCreateInfo *local_pCreateInfo = NULL; |
| 4790 | { |
| 4791 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4792 | if (pCreateInfo) { |
| 4793 | local_pCreateInfo = new safe_VkSamplerYcbcrConversionCreateInfo(pCreateInfo); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 4794 | WrapPnextChainHandles(layer_data, local_pCreateInfo->pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4795 | } |
| 4796 | } |
| 4797 | VkResult result = layer_data->device_dispatch_table.CreateSamplerYcbcrConversionKHR(device, (const VkSamplerYcbcrConversionCreateInfo*)local_pCreateInfo, pAllocator, pYcbcrConversion); |
| 4798 | if (local_pCreateInfo) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4799 | delete local_pCreateInfo; |
| 4800 | } |
| 4801 | if (VK_SUCCESS == result) { |
| 4802 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4803 | *pYcbcrConversion = layer_data->WrapNew(*pYcbcrConversion); |
| 4804 | } |
| 4805 | return result; |
| 4806 | } |
| 4807 | |
| 4808 | void DispatchDestroySamplerYcbcrConversionKHR( |
| 4809 | VkDevice device, |
| 4810 | VkSamplerYcbcrConversion ycbcrConversion, |
| 4811 | const VkAllocationCallbacks* pAllocator) |
| 4812 | { |
| 4813 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4814 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroySamplerYcbcrConversionKHR(device, ycbcrConversion, pAllocator); |
| 4815 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 4816 | uint64_t ycbcrConversion_id = reinterpret_cast<uint64_t &>(ycbcrConversion); |
| 4817 | ycbcrConversion = (VkSamplerYcbcrConversion)unique_id_mapping[ycbcrConversion_id]; |
| 4818 | unique_id_mapping.erase(ycbcrConversion_id); |
| 4819 | lock.unlock(); |
| 4820 | layer_data->device_dispatch_table.DestroySamplerYcbcrConversionKHR(device, ycbcrConversion, pAllocator); |
| 4821 | |
| 4822 | } |
| 4823 | |
| 4824 | VkResult DispatchBindBufferMemory2KHR( |
| 4825 | VkDevice device, |
| 4826 | uint32_t bindInfoCount, |
| 4827 | const VkBindBufferMemoryInfo* pBindInfos) |
| 4828 | { |
| 4829 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4830 | if (!wrap_handles) return layer_data->device_dispatch_table.BindBufferMemory2KHR(device, bindInfoCount, pBindInfos); |
| 4831 | safe_VkBindBufferMemoryInfo *local_pBindInfos = NULL; |
| 4832 | { |
| 4833 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4834 | if (pBindInfos) { |
| 4835 | local_pBindInfos = new safe_VkBindBufferMemoryInfo[bindInfoCount]; |
| 4836 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
| 4837 | local_pBindInfos[index0].initialize(&pBindInfos[index0]); |
| 4838 | if (pBindInfos[index0].buffer) { |
| 4839 | local_pBindInfos[index0].buffer = layer_data->Unwrap(pBindInfos[index0].buffer); |
| 4840 | } |
| 4841 | if (pBindInfos[index0].memory) { |
| 4842 | local_pBindInfos[index0].memory = layer_data->Unwrap(pBindInfos[index0].memory); |
| 4843 | } |
| 4844 | } |
| 4845 | } |
| 4846 | } |
| 4847 | VkResult result = layer_data->device_dispatch_table.BindBufferMemory2KHR(device, bindInfoCount, (const VkBindBufferMemoryInfo*)local_pBindInfos); |
| 4848 | if (local_pBindInfos) { |
| 4849 | delete[] local_pBindInfos; |
| 4850 | } |
| 4851 | return result; |
| 4852 | } |
| 4853 | |
| 4854 | VkResult DispatchBindImageMemory2KHR( |
| 4855 | VkDevice device, |
| 4856 | uint32_t bindInfoCount, |
| 4857 | const VkBindImageMemoryInfo* pBindInfos) |
| 4858 | { |
| 4859 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4860 | if (!wrap_handles) return layer_data->device_dispatch_table.BindImageMemory2KHR(device, bindInfoCount, pBindInfos); |
| 4861 | safe_VkBindImageMemoryInfo *local_pBindInfos = NULL; |
| 4862 | { |
| 4863 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4864 | if (pBindInfos) { |
| 4865 | local_pBindInfos = new safe_VkBindImageMemoryInfo[bindInfoCount]; |
| 4866 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
| 4867 | local_pBindInfos[index0].initialize(&pBindInfos[index0]); |
| Mark Lobodzinski | 1d70bce | 2019-07-18 17:30:54 -0600 | [diff] [blame] | 4868 | WrapPnextChainHandles(layer_data, local_pBindInfos[index0].pNext); |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4869 | if (pBindInfos[index0].image) { |
| 4870 | local_pBindInfos[index0].image = layer_data->Unwrap(pBindInfos[index0].image); |
| 4871 | } |
| 4872 | if (pBindInfos[index0].memory) { |
| 4873 | local_pBindInfos[index0].memory = layer_data->Unwrap(pBindInfos[index0].memory); |
| 4874 | } |
| 4875 | } |
| 4876 | } |
| 4877 | } |
| 4878 | VkResult result = layer_data->device_dispatch_table.BindImageMemory2KHR(device, bindInfoCount, (const VkBindImageMemoryInfo*)local_pBindInfos); |
| 4879 | if (local_pBindInfos) { |
| Mike Schuchardt | 440d464 | 2019-06-20 17:14:57 -0700 | [diff] [blame] | 4880 | delete[] local_pBindInfos; |
| 4881 | } |
| 4882 | return result; |
| 4883 | } |
| 4884 | |
| 4885 | void DispatchGetDescriptorSetLayoutSupportKHR( |
| 4886 | VkDevice device, |
| 4887 | const VkDescriptorSetLayoutCreateInfo* pCreateInfo, |
| 4888 | VkDescriptorSetLayoutSupport* pSupport) |
| 4889 | { |
| 4890 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 4891 | if (!wrap_handles) return layer_data->device_dispatch_table.GetDescriptorSetLayoutSupportKHR(device, pCreateInfo, pSupport); |
| 4892 | safe_VkDescriptorSetLayoutCreateInfo *local_pCreateInfo = NULL; |
| 4893 | { |
| 4894 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4895 | if (pCreateInfo) { |
| 4896 | local_pCreateInfo = new safe_VkDescriptorSetLayoutCreateInfo(pCreateInfo); |
| 4897 | if (local_pCreateInfo->pBindings) { |
| 4898 | for (uint32_t index1 = 0; index1 < local_pCreateInfo->bindingCount; ++index1) { |
| 4899 | if (local_pCreateInfo->pBindings[index1].pImmutableSamplers) { |
| 4900 | for (uint32_t index2 = 0; index2 < local_pCreateInfo->pBindings[index1].descriptorCount; ++index2) { |
| 4901 | local_pCreateInfo->pBindings[index1].pImmutableSamplers[index2] = layer_data->Unwrap(local_pCreateInfo->pBindings[index1].pImmutableSamplers[index2]); |
| 4902 | } |
| 4903 | } |
| 4904 | } |
| 4905 | } |
| 4906 | } |
| 4907 | } |
| 4908 | layer_data->device_dispatch_table.GetDescriptorSetLayoutSupportKHR(device, (const VkDescriptorSetLayoutCreateInfo*)local_pCreateInfo, pSupport); |
| 4909 | if (local_pCreateInfo) { |
| 4910 | delete local_pCreateInfo; |
| 4911 | } |
| 4912 | } |
| 4913 | |
| 4914 | void DispatchCmdDrawIndirectCountKHR( |
| 4915 | VkCommandBuffer commandBuffer, |
| 4916 | VkBuffer buffer, |
| 4917 | VkDeviceSize offset, |
| 4918 | VkBuffer countBuffer, |
| 4919 | VkDeviceSize countBufferOffset, |
| 4920 | uint32_t maxDrawCount, |
| 4921 | uint32_t stride) |
| 4922 | { |
| 4923 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4924 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawIndirectCountKHR(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 4925 | { |
| 4926 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4927 | buffer = layer_data->Unwrap(buffer); |
| 4928 | countBuffer = layer_data->Unwrap(countBuffer); |
| 4929 | } |
| 4930 | layer_data->device_dispatch_table.CmdDrawIndirectCountKHR(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 4931 | |
| 4932 | } |
| 4933 | |
| 4934 | void DispatchCmdDrawIndexedIndirectCountKHR( |
| 4935 | VkCommandBuffer commandBuffer, |
| 4936 | VkBuffer buffer, |
| 4937 | VkDeviceSize offset, |
| 4938 | VkBuffer countBuffer, |
| 4939 | VkDeviceSize countBufferOffset, |
| 4940 | uint32_t maxDrawCount, |
| 4941 | uint32_t stride) |
| 4942 | { |
| 4943 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 4944 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawIndexedIndirectCountKHR(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 4945 | { |
| 4946 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4947 | buffer = layer_data->Unwrap(buffer); |
| 4948 | countBuffer = layer_data->Unwrap(countBuffer); |
| 4949 | } |
| 4950 | layer_data->device_dispatch_table.CmdDrawIndexedIndirectCountKHR(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 4951 | |
| 4952 | } |
| 4953 | |
| 4954 | VkResult DispatchCreateDebugReportCallbackEXT( |
| 4955 | VkInstance instance, |
| 4956 | const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, |
| 4957 | const VkAllocationCallbacks* pAllocator, |
| 4958 | VkDebugReportCallbackEXT* pCallback) |
| 4959 | { |
| 4960 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 4961 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback); |
| 4962 | VkResult result = layer_data->instance_dispatch_table.CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback); |
| 4963 | if (VK_SUCCESS == result) { |
| 4964 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 4965 | *pCallback = layer_data->WrapNew(*pCallback); |
| 4966 | } |
| 4967 | return result; |
| 4968 | } |
| 4969 | |
| 4970 | void DispatchDestroyDebugReportCallbackEXT( |
| 4971 | VkInstance instance, |
| 4972 | VkDebugReportCallbackEXT callback, |
| 4973 | const VkAllocationCallbacks* pAllocator) |
| 4974 | { |
| 4975 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 4976 | if (!wrap_handles) return layer_data->instance_dispatch_table.DestroyDebugReportCallbackEXT(instance, callback, pAllocator); |
| 4977 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 4978 | uint64_t callback_id = reinterpret_cast<uint64_t &>(callback); |
| 4979 | callback = (VkDebugReportCallbackEXT)unique_id_mapping[callback_id]; |
| 4980 | unique_id_mapping.erase(callback_id); |
| 4981 | lock.unlock(); |
| 4982 | layer_data->instance_dispatch_table.DestroyDebugReportCallbackEXT(instance, callback, pAllocator); |
| 4983 | |
| 4984 | } |
| 4985 | |
| 4986 | void DispatchDebugReportMessageEXT( |
| 4987 | VkInstance instance, |
| 4988 | VkDebugReportFlagsEXT flags, |
| 4989 | VkDebugReportObjectTypeEXT objectType, |
| 4990 | uint64_t object, |
| 4991 | size_t location, |
| 4992 | int32_t messageCode, |
| 4993 | const char* pLayerPrefix, |
| 4994 | const char* pMessage) |
| 4995 | { |
| 4996 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 4997 | layer_data->instance_dispatch_table.DebugReportMessageEXT(instance, flags, objectType, object, location, messageCode, pLayerPrefix, pMessage); |
| 4998 | |
| 4999 | } |
| 5000 | |
| 5001 | // Skip vkDebugMarkerSetObjectTagEXT dispatch, manually generated |
| 5002 | |
| 5003 | // Skip vkDebugMarkerSetObjectNameEXT dispatch, manually generated |
| 5004 | |
| 5005 | void DispatchCmdDebugMarkerBeginEXT( |
| 5006 | VkCommandBuffer commandBuffer, |
| 5007 | const VkDebugMarkerMarkerInfoEXT* pMarkerInfo) |
| 5008 | { |
| 5009 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5010 | layer_data->device_dispatch_table.CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); |
| 5011 | |
| 5012 | } |
| 5013 | |
| 5014 | void DispatchCmdDebugMarkerEndEXT( |
| 5015 | VkCommandBuffer commandBuffer) |
| 5016 | { |
| 5017 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5018 | layer_data->device_dispatch_table.CmdDebugMarkerEndEXT(commandBuffer); |
| 5019 | |
| 5020 | } |
| 5021 | |
| 5022 | void DispatchCmdDebugMarkerInsertEXT( |
| 5023 | VkCommandBuffer commandBuffer, |
| 5024 | const VkDebugMarkerMarkerInfoEXT* pMarkerInfo) |
| 5025 | { |
| 5026 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5027 | layer_data->device_dispatch_table.CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); |
| 5028 | |
| 5029 | } |
| 5030 | |
| 5031 | void DispatchCmdBindTransformFeedbackBuffersEXT( |
| 5032 | VkCommandBuffer commandBuffer, |
| 5033 | uint32_t firstBinding, |
| 5034 | uint32_t bindingCount, |
| 5035 | const VkBuffer* pBuffers, |
| 5036 | const VkDeviceSize* pOffsets, |
| 5037 | const VkDeviceSize* pSizes) |
| 5038 | { |
| 5039 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5040 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBindTransformFeedbackBuffersEXT(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets, pSizes); |
| 5041 | VkBuffer *local_pBuffers = NULL; |
| 5042 | { |
| 5043 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5044 | if (pBuffers) { |
| 5045 | local_pBuffers = new VkBuffer[bindingCount]; |
| 5046 | for (uint32_t index0 = 0; index0 < bindingCount; ++index0) { |
| 5047 | local_pBuffers[index0] = layer_data->Unwrap(pBuffers[index0]); |
| 5048 | } |
| 5049 | } |
| 5050 | } |
| 5051 | layer_data->device_dispatch_table.CmdBindTransformFeedbackBuffersEXT(commandBuffer, firstBinding, bindingCount, (const VkBuffer*)local_pBuffers, pOffsets, pSizes); |
| 5052 | if (local_pBuffers) |
| 5053 | delete[] local_pBuffers; |
| 5054 | } |
| 5055 | |
| 5056 | void DispatchCmdBeginTransformFeedbackEXT( |
| 5057 | VkCommandBuffer commandBuffer, |
| 5058 | uint32_t firstCounterBuffer, |
| 5059 | uint32_t counterBufferCount, |
| 5060 | const VkBuffer* pCounterBuffers, |
| 5061 | const VkDeviceSize* pCounterBufferOffsets) |
| 5062 | { |
| 5063 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5064 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBeginTransformFeedbackEXT(commandBuffer, firstCounterBuffer, counterBufferCount, pCounterBuffers, pCounterBufferOffsets); |
| 5065 | VkBuffer *local_pCounterBuffers = NULL; |
| 5066 | { |
| 5067 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5068 | if (pCounterBuffers) { |
| 5069 | local_pCounterBuffers = new VkBuffer[counterBufferCount]; |
| 5070 | for (uint32_t index0 = 0; index0 < counterBufferCount; ++index0) { |
| 5071 | local_pCounterBuffers[index0] = layer_data->Unwrap(pCounterBuffers[index0]); |
| 5072 | } |
| 5073 | } |
| 5074 | } |
| 5075 | layer_data->device_dispatch_table.CmdBeginTransformFeedbackEXT(commandBuffer, firstCounterBuffer, counterBufferCount, (const VkBuffer*)local_pCounterBuffers, pCounterBufferOffsets); |
| 5076 | if (local_pCounterBuffers) |
| 5077 | delete[] local_pCounterBuffers; |
| 5078 | } |
| 5079 | |
| 5080 | void DispatchCmdEndTransformFeedbackEXT( |
| 5081 | VkCommandBuffer commandBuffer, |
| 5082 | uint32_t firstCounterBuffer, |
| 5083 | uint32_t counterBufferCount, |
| 5084 | const VkBuffer* pCounterBuffers, |
| 5085 | const VkDeviceSize* pCounterBufferOffsets) |
| 5086 | { |
| 5087 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5088 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdEndTransformFeedbackEXT(commandBuffer, firstCounterBuffer, counterBufferCount, pCounterBuffers, pCounterBufferOffsets); |
| 5089 | VkBuffer *local_pCounterBuffers = NULL; |
| 5090 | { |
| 5091 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5092 | if (pCounterBuffers) { |
| 5093 | local_pCounterBuffers = new VkBuffer[counterBufferCount]; |
| 5094 | for (uint32_t index0 = 0; index0 < counterBufferCount; ++index0) { |
| 5095 | local_pCounterBuffers[index0] = layer_data->Unwrap(pCounterBuffers[index0]); |
| 5096 | } |
| 5097 | } |
| 5098 | } |
| 5099 | layer_data->device_dispatch_table.CmdEndTransformFeedbackEXT(commandBuffer, firstCounterBuffer, counterBufferCount, (const VkBuffer*)local_pCounterBuffers, pCounterBufferOffsets); |
| 5100 | if (local_pCounterBuffers) |
| 5101 | delete[] local_pCounterBuffers; |
| 5102 | } |
| 5103 | |
| 5104 | void DispatchCmdBeginQueryIndexedEXT( |
| 5105 | VkCommandBuffer commandBuffer, |
| 5106 | VkQueryPool queryPool, |
| 5107 | uint32_t query, |
| 5108 | VkQueryControlFlags flags, |
| 5109 | uint32_t index) |
| 5110 | { |
| 5111 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5112 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBeginQueryIndexedEXT(commandBuffer, queryPool, query, flags, index); |
| 5113 | { |
| 5114 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5115 | queryPool = layer_data->Unwrap(queryPool); |
| 5116 | } |
| 5117 | layer_data->device_dispatch_table.CmdBeginQueryIndexedEXT(commandBuffer, queryPool, query, flags, index); |
| 5118 | |
| 5119 | } |
| 5120 | |
| 5121 | void DispatchCmdEndQueryIndexedEXT( |
| 5122 | VkCommandBuffer commandBuffer, |
| 5123 | VkQueryPool queryPool, |
| 5124 | uint32_t query, |
| 5125 | uint32_t index) |
| 5126 | { |
| 5127 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5128 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdEndQueryIndexedEXT(commandBuffer, queryPool, query, index); |
| 5129 | { |
| 5130 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5131 | queryPool = layer_data->Unwrap(queryPool); |
| 5132 | } |
| 5133 | layer_data->device_dispatch_table.CmdEndQueryIndexedEXT(commandBuffer, queryPool, query, index); |
| 5134 | |
| 5135 | } |
| 5136 | |
| 5137 | void DispatchCmdDrawIndirectByteCountEXT( |
| 5138 | VkCommandBuffer commandBuffer, |
| 5139 | uint32_t instanceCount, |
| 5140 | uint32_t firstInstance, |
| 5141 | VkBuffer counterBuffer, |
| 5142 | VkDeviceSize counterBufferOffset, |
| 5143 | uint32_t counterOffset, |
| 5144 | uint32_t vertexStride) |
| 5145 | { |
| 5146 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5147 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawIndirectByteCountEXT(commandBuffer, instanceCount, firstInstance, counterBuffer, counterBufferOffset, counterOffset, vertexStride); |
| 5148 | { |
| 5149 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5150 | counterBuffer = layer_data->Unwrap(counterBuffer); |
| 5151 | } |
| 5152 | layer_data->device_dispatch_table.CmdDrawIndirectByteCountEXT(commandBuffer, instanceCount, firstInstance, counterBuffer, counterBufferOffset, counterOffset, vertexStride); |
| 5153 | |
| 5154 | } |
| 5155 | |
| 5156 | uint32_t DispatchGetImageViewHandleNVX( |
| 5157 | VkDevice device, |
| 5158 | const VkImageViewHandleInfoNVX* pInfo) |
| 5159 | { |
| 5160 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5161 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageViewHandleNVX(device, pInfo); |
| 5162 | safe_VkImageViewHandleInfoNVX *local_pInfo = NULL; |
| 5163 | { |
| 5164 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5165 | if (pInfo) { |
| 5166 | local_pInfo = new safe_VkImageViewHandleInfoNVX(pInfo); |
| 5167 | if (pInfo->imageView) { |
| 5168 | local_pInfo->imageView = layer_data->Unwrap(pInfo->imageView); |
| 5169 | } |
| 5170 | if (pInfo->sampler) { |
| 5171 | local_pInfo->sampler = layer_data->Unwrap(pInfo->sampler); |
| 5172 | } |
| 5173 | } |
| 5174 | } |
| 5175 | uint32_t result = layer_data->device_dispatch_table.GetImageViewHandleNVX(device, (const VkImageViewHandleInfoNVX*)local_pInfo); |
| 5176 | if (local_pInfo) { |
| 5177 | delete local_pInfo; |
| 5178 | } |
| 5179 | return result; |
| 5180 | } |
| 5181 | |
| 5182 | void DispatchCmdDrawIndirectCountAMD( |
| 5183 | VkCommandBuffer commandBuffer, |
| 5184 | VkBuffer buffer, |
| 5185 | VkDeviceSize offset, |
| 5186 | VkBuffer countBuffer, |
| 5187 | VkDeviceSize countBufferOffset, |
| 5188 | uint32_t maxDrawCount, |
| 5189 | uint32_t stride) |
| 5190 | { |
| 5191 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5192 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 5193 | { |
| 5194 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5195 | buffer = layer_data->Unwrap(buffer); |
| 5196 | countBuffer = layer_data->Unwrap(countBuffer); |
| 5197 | } |
| 5198 | layer_data->device_dispatch_table.CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 5199 | |
| 5200 | } |
| 5201 | |
| 5202 | void DispatchCmdDrawIndexedIndirectCountAMD( |
| 5203 | VkCommandBuffer commandBuffer, |
| 5204 | VkBuffer buffer, |
| 5205 | VkDeviceSize offset, |
| 5206 | VkBuffer countBuffer, |
| 5207 | VkDeviceSize countBufferOffset, |
| 5208 | uint32_t maxDrawCount, |
| 5209 | uint32_t stride) |
| 5210 | { |
| 5211 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5212 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 5213 | { |
| 5214 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5215 | buffer = layer_data->Unwrap(buffer); |
| 5216 | countBuffer = layer_data->Unwrap(countBuffer); |
| 5217 | } |
| 5218 | layer_data->device_dispatch_table.CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 5219 | |
| 5220 | } |
| 5221 | |
| 5222 | VkResult DispatchGetShaderInfoAMD( |
| 5223 | VkDevice device, |
| 5224 | VkPipeline pipeline, |
| 5225 | VkShaderStageFlagBits shaderStage, |
| 5226 | VkShaderInfoTypeAMD infoType, |
| 5227 | size_t* pInfoSize, |
| 5228 | void* pInfo) |
| 5229 | { |
| 5230 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5231 | if (!wrap_handles) return layer_data->device_dispatch_table.GetShaderInfoAMD(device, pipeline, shaderStage, infoType, pInfoSize, pInfo); |
| 5232 | { |
| 5233 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5234 | pipeline = layer_data->Unwrap(pipeline); |
| 5235 | } |
| 5236 | VkResult result = layer_data->device_dispatch_table.GetShaderInfoAMD(device, pipeline, shaderStage, infoType, pInfoSize, pInfo); |
| 5237 | |
| 5238 | return result; |
| 5239 | } |
| 5240 | |
| 5241 | #ifdef VK_USE_PLATFORM_GGP |
| 5242 | |
| 5243 | VkResult DispatchCreateStreamDescriptorSurfaceGGP( |
| 5244 | VkInstance instance, |
| 5245 | const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, |
| 5246 | const VkAllocationCallbacks* pAllocator, |
| 5247 | VkSurfaceKHR* pSurface) |
| 5248 | { |
| 5249 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 5250 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateStreamDescriptorSurfaceGGP(instance, pCreateInfo, pAllocator, pSurface); |
| 5251 | VkResult result = layer_data->instance_dispatch_table.CreateStreamDescriptorSurfaceGGP(instance, pCreateInfo, pAllocator, pSurface); |
| 5252 | if (VK_SUCCESS == result) { |
| 5253 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5254 | *pSurface = layer_data->WrapNew(*pSurface); |
| 5255 | } |
| 5256 | return result; |
| 5257 | } |
| 5258 | #endif // VK_USE_PLATFORM_GGP |
| 5259 | |
| 5260 | VkResult DispatchGetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 5261 | VkPhysicalDevice physicalDevice, |
| 5262 | VkFormat format, |
| 5263 | VkImageType type, |
| 5264 | VkImageTiling tiling, |
| 5265 | VkImageUsageFlags usage, |
| 5266 | VkImageCreateFlags flags, |
| 5267 | VkExternalMemoryHandleTypeFlagsNV externalHandleType, |
| 5268 | VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties) |
| 5269 | { |
| 5270 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5271 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); |
| 5272 | |
| 5273 | return result; |
| 5274 | } |
| 5275 | |
| 5276 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5277 | |
| 5278 | VkResult DispatchGetMemoryWin32HandleNV( |
| 5279 | VkDevice device, |
| 5280 | VkDeviceMemory memory, |
| 5281 | VkExternalMemoryHandleTypeFlagsNV handleType, |
| 5282 | HANDLE* pHandle) |
| 5283 | { |
| 5284 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5285 | if (!wrap_handles) return layer_data->device_dispatch_table.GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
| 5286 | { |
| 5287 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5288 | memory = layer_data->Unwrap(memory); |
| 5289 | } |
| 5290 | VkResult result = layer_data->device_dispatch_table.GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
| 5291 | |
| 5292 | return result; |
| 5293 | } |
| 5294 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 5295 | |
| 5296 | #ifdef VK_USE_PLATFORM_VI_NN |
| 5297 | |
| 5298 | VkResult DispatchCreateViSurfaceNN( |
| 5299 | VkInstance instance, |
| 5300 | const VkViSurfaceCreateInfoNN* pCreateInfo, |
| 5301 | const VkAllocationCallbacks* pAllocator, |
| 5302 | VkSurfaceKHR* pSurface) |
| 5303 | { |
| 5304 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 5305 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateViSurfaceNN(instance, pCreateInfo, pAllocator, pSurface); |
| 5306 | VkResult result = layer_data->instance_dispatch_table.CreateViSurfaceNN(instance, pCreateInfo, pAllocator, pSurface); |
| 5307 | if (VK_SUCCESS == result) { |
| 5308 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5309 | *pSurface = layer_data->WrapNew(*pSurface); |
| 5310 | } |
| 5311 | return result; |
| 5312 | } |
| 5313 | #endif // VK_USE_PLATFORM_VI_NN |
| 5314 | |
| 5315 | void DispatchCmdBeginConditionalRenderingEXT( |
| 5316 | VkCommandBuffer commandBuffer, |
| 5317 | const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin) |
| 5318 | { |
| 5319 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5320 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBeginConditionalRenderingEXT(commandBuffer, pConditionalRenderingBegin); |
| 5321 | safe_VkConditionalRenderingBeginInfoEXT *local_pConditionalRenderingBegin = NULL; |
| 5322 | { |
| 5323 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5324 | if (pConditionalRenderingBegin) { |
| 5325 | local_pConditionalRenderingBegin = new safe_VkConditionalRenderingBeginInfoEXT(pConditionalRenderingBegin); |
| 5326 | if (pConditionalRenderingBegin->buffer) { |
| 5327 | local_pConditionalRenderingBegin->buffer = layer_data->Unwrap(pConditionalRenderingBegin->buffer); |
| 5328 | } |
| 5329 | } |
| 5330 | } |
| 5331 | layer_data->device_dispatch_table.CmdBeginConditionalRenderingEXT(commandBuffer, (const VkConditionalRenderingBeginInfoEXT*)local_pConditionalRenderingBegin); |
| 5332 | if (local_pConditionalRenderingBegin) { |
| 5333 | delete local_pConditionalRenderingBegin; |
| 5334 | } |
| 5335 | } |
| 5336 | |
| 5337 | void DispatchCmdEndConditionalRenderingEXT( |
| 5338 | VkCommandBuffer commandBuffer) |
| 5339 | { |
| 5340 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5341 | layer_data->device_dispatch_table.CmdEndConditionalRenderingEXT(commandBuffer); |
| 5342 | |
| 5343 | } |
| 5344 | |
| 5345 | void DispatchCmdProcessCommandsNVX( |
| 5346 | VkCommandBuffer commandBuffer, |
| 5347 | const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo) |
| 5348 | { |
| 5349 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5350 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdProcessCommandsNVX(commandBuffer, pProcessCommandsInfo); |
| 5351 | safe_VkCmdProcessCommandsInfoNVX *local_pProcessCommandsInfo = NULL; |
| 5352 | { |
| 5353 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5354 | if (pProcessCommandsInfo) { |
| 5355 | local_pProcessCommandsInfo = new safe_VkCmdProcessCommandsInfoNVX(pProcessCommandsInfo); |
| 5356 | if (pProcessCommandsInfo->objectTable) { |
| 5357 | local_pProcessCommandsInfo->objectTable = layer_data->Unwrap(pProcessCommandsInfo->objectTable); |
| 5358 | } |
| 5359 | if (pProcessCommandsInfo->indirectCommandsLayout) { |
| 5360 | local_pProcessCommandsInfo->indirectCommandsLayout = layer_data->Unwrap(pProcessCommandsInfo->indirectCommandsLayout); |
| 5361 | } |
| 5362 | if (local_pProcessCommandsInfo->pIndirectCommandsTokens) { |
| 5363 | for (uint32_t index1 = 0; index1 < local_pProcessCommandsInfo->indirectCommandsTokenCount; ++index1) { |
| 5364 | if (pProcessCommandsInfo->pIndirectCommandsTokens[index1].buffer) { |
| 5365 | local_pProcessCommandsInfo->pIndirectCommandsTokens[index1].buffer = layer_data->Unwrap(pProcessCommandsInfo->pIndirectCommandsTokens[index1].buffer); |
| 5366 | } |
| 5367 | } |
| 5368 | } |
| 5369 | if (pProcessCommandsInfo->sequencesCountBuffer) { |
| 5370 | local_pProcessCommandsInfo->sequencesCountBuffer = layer_data->Unwrap(pProcessCommandsInfo->sequencesCountBuffer); |
| 5371 | } |
| 5372 | if (pProcessCommandsInfo->sequencesIndexBuffer) { |
| 5373 | local_pProcessCommandsInfo->sequencesIndexBuffer = layer_data->Unwrap(pProcessCommandsInfo->sequencesIndexBuffer); |
| 5374 | } |
| 5375 | } |
| 5376 | } |
| 5377 | layer_data->device_dispatch_table.CmdProcessCommandsNVX(commandBuffer, (const VkCmdProcessCommandsInfoNVX*)local_pProcessCommandsInfo); |
| 5378 | if (local_pProcessCommandsInfo) { |
| 5379 | delete local_pProcessCommandsInfo; |
| 5380 | } |
| 5381 | } |
| 5382 | |
| 5383 | void DispatchCmdReserveSpaceForCommandsNVX( |
| 5384 | VkCommandBuffer commandBuffer, |
| 5385 | const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo) |
| 5386 | { |
| 5387 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5388 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdReserveSpaceForCommandsNVX(commandBuffer, pReserveSpaceInfo); |
| 5389 | safe_VkCmdReserveSpaceForCommandsInfoNVX *local_pReserveSpaceInfo = NULL; |
| 5390 | { |
| 5391 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5392 | if (pReserveSpaceInfo) { |
| 5393 | local_pReserveSpaceInfo = new safe_VkCmdReserveSpaceForCommandsInfoNVX(pReserveSpaceInfo); |
| 5394 | if (pReserveSpaceInfo->objectTable) { |
| 5395 | local_pReserveSpaceInfo->objectTable = layer_data->Unwrap(pReserveSpaceInfo->objectTable); |
| 5396 | } |
| 5397 | if (pReserveSpaceInfo->indirectCommandsLayout) { |
| 5398 | local_pReserveSpaceInfo->indirectCommandsLayout = layer_data->Unwrap(pReserveSpaceInfo->indirectCommandsLayout); |
| 5399 | } |
| 5400 | } |
| 5401 | } |
| 5402 | layer_data->device_dispatch_table.CmdReserveSpaceForCommandsNVX(commandBuffer, (const VkCmdReserveSpaceForCommandsInfoNVX*)local_pReserveSpaceInfo); |
| 5403 | if (local_pReserveSpaceInfo) { |
| 5404 | delete local_pReserveSpaceInfo; |
| 5405 | } |
| 5406 | } |
| 5407 | |
| 5408 | VkResult DispatchCreateIndirectCommandsLayoutNVX( |
| 5409 | VkDevice device, |
| 5410 | const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, |
| 5411 | const VkAllocationCallbacks* pAllocator, |
| 5412 | VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout) |
| 5413 | { |
| 5414 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5415 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateIndirectCommandsLayoutNVX(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); |
| 5416 | VkResult result = layer_data->device_dispatch_table.CreateIndirectCommandsLayoutNVX(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); |
| 5417 | if (VK_SUCCESS == result) { |
| 5418 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5419 | *pIndirectCommandsLayout = layer_data->WrapNew(*pIndirectCommandsLayout); |
| 5420 | } |
| 5421 | return result; |
| 5422 | } |
| 5423 | |
| 5424 | void DispatchDestroyIndirectCommandsLayoutNVX( |
| 5425 | VkDevice device, |
| 5426 | VkIndirectCommandsLayoutNVX indirectCommandsLayout, |
| 5427 | const VkAllocationCallbacks* pAllocator) |
| 5428 | { |
| 5429 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5430 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, pAllocator); |
| 5431 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 5432 | uint64_t indirectCommandsLayout_id = reinterpret_cast<uint64_t &>(indirectCommandsLayout); |
| 5433 | indirectCommandsLayout = (VkIndirectCommandsLayoutNVX)unique_id_mapping[indirectCommandsLayout_id]; |
| 5434 | unique_id_mapping.erase(indirectCommandsLayout_id); |
| 5435 | lock.unlock(); |
| 5436 | layer_data->device_dispatch_table.DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, pAllocator); |
| 5437 | |
| 5438 | } |
| 5439 | |
| 5440 | VkResult DispatchCreateObjectTableNVX( |
| 5441 | VkDevice device, |
| 5442 | const VkObjectTableCreateInfoNVX* pCreateInfo, |
| 5443 | const VkAllocationCallbacks* pAllocator, |
| 5444 | VkObjectTableNVX* pObjectTable) |
| 5445 | { |
| 5446 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5447 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateObjectTableNVX(device, pCreateInfo, pAllocator, pObjectTable); |
| 5448 | VkResult result = layer_data->device_dispatch_table.CreateObjectTableNVX(device, pCreateInfo, pAllocator, pObjectTable); |
| 5449 | if (VK_SUCCESS == result) { |
| 5450 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5451 | *pObjectTable = layer_data->WrapNew(*pObjectTable); |
| 5452 | } |
| 5453 | return result; |
| 5454 | } |
| 5455 | |
| 5456 | void DispatchDestroyObjectTableNVX( |
| 5457 | VkDevice device, |
| 5458 | VkObjectTableNVX objectTable, |
| 5459 | const VkAllocationCallbacks* pAllocator) |
| 5460 | { |
| 5461 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5462 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyObjectTableNVX(device, objectTable, pAllocator); |
| 5463 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 5464 | uint64_t objectTable_id = reinterpret_cast<uint64_t &>(objectTable); |
| 5465 | objectTable = (VkObjectTableNVX)unique_id_mapping[objectTable_id]; |
| 5466 | unique_id_mapping.erase(objectTable_id); |
| 5467 | lock.unlock(); |
| 5468 | layer_data->device_dispatch_table.DestroyObjectTableNVX(device, objectTable, pAllocator); |
| 5469 | |
| 5470 | } |
| 5471 | |
| 5472 | VkResult DispatchRegisterObjectsNVX( |
| 5473 | VkDevice device, |
| 5474 | VkObjectTableNVX objectTable, |
| 5475 | uint32_t objectCount, |
| 5476 | const VkObjectTableEntryNVX* const* ppObjectTableEntries, |
| 5477 | const uint32_t* pObjectIndices) |
| 5478 | { |
| 5479 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5480 | if (!wrap_handles) return layer_data->device_dispatch_table.RegisterObjectsNVX(device, objectTable, objectCount, ppObjectTableEntries, pObjectIndices); |
| 5481 | { |
| 5482 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5483 | objectTable = layer_data->Unwrap(objectTable); |
| 5484 | } |
| 5485 | VkResult result = layer_data->device_dispatch_table.RegisterObjectsNVX(device, objectTable, objectCount, ppObjectTableEntries, pObjectIndices); |
| 5486 | |
| 5487 | return result; |
| 5488 | } |
| 5489 | |
| 5490 | VkResult DispatchUnregisterObjectsNVX( |
| 5491 | VkDevice device, |
| 5492 | VkObjectTableNVX objectTable, |
| 5493 | uint32_t objectCount, |
| 5494 | const VkObjectEntryTypeNVX* pObjectEntryTypes, |
| 5495 | const uint32_t* pObjectIndices) |
| 5496 | { |
| 5497 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5498 | if (!wrap_handles) return layer_data->device_dispatch_table.UnregisterObjectsNVX(device, objectTable, objectCount, pObjectEntryTypes, pObjectIndices); |
| 5499 | { |
| 5500 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5501 | objectTable = layer_data->Unwrap(objectTable); |
| 5502 | } |
| 5503 | VkResult result = layer_data->device_dispatch_table.UnregisterObjectsNVX(device, objectTable, objectCount, pObjectEntryTypes, pObjectIndices); |
| 5504 | |
| 5505 | return result; |
| 5506 | } |
| 5507 | |
| 5508 | void DispatchGetPhysicalDeviceGeneratedCommandsPropertiesNVX( |
| 5509 | VkPhysicalDevice physicalDevice, |
| 5510 | VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, |
| 5511 | VkDeviceGeneratedCommandsLimitsNVX* pLimits) |
| 5512 | { |
| 5513 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5514 | layer_data->instance_dispatch_table.GetPhysicalDeviceGeneratedCommandsPropertiesNVX(physicalDevice, pFeatures, pLimits); |
| 5515 | |
| 5516 | } |
| 5517 | |
| 5518 | void DispatchCmdSetViewportWScalingNV( |
| 5519 | VkCommandBuffer commandBuffer, |
| 5520 | uint32_t firstViewport, |
| 5521 | uint32_t viewportCount, |
| 5522 | const VkViewportWScalingNV* pViewportWScalings) |
| 5523 | { |
| 5524 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5525 | layer_data->device_dispatch_table.CmdSetViewportWScalingNV(commandBuffer, firstViewport, viewportCount, pViewportWScalings); |
| 5526 | |
| 5527 | } |
| 5528 | |
| 5529 | VkResult DispatchReleaseDisplayEXT( |
| 5530 | VkPhysicalDevice physicalDevice, |
| 5531 | VkDisplayKHR display) |
| 5532 | { |
| 5533 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5534 | if (!wrap_handles) return layer_data->instance_dispatch_table.ReleaseDisplayEXT(physicalDevice, display); |
| 5535 | { |
| 5536 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5537 | display = layer_data->Unwrap(display); |
| 5538 | } |
| 5539 | VkResult result = layer_data->instance_dispatch_table.ReleaseDisplayEXT(physicalDevice, display); |
| 5540 | |
| 5541 | return result; |
| 5542 | } |
| 5543 | |
| 5544 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 5545 | |
| 5546 | VkResult DispatchAcquireXlibDisplayEXT( |
| 5547 | VkPhysicalDevice physicalDevice, |
| 5548 | Display* dpy, |
| 5549 | VkDisplayKHR display) |
| 5550 | { |
| 5551 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5552 | if (!wrap_handles) return layer_data->instance_dispatch_table.AcquireXlibDisplayEXT(physicalDevice, dpy, display); |
| 5553 | { |
| 5554 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5555 | display = layer_data->Unwrap(display); |
| 5556 | } |
| 5557 | VkResult result = layer_data->instance_dispatch_table.AcquireXlibDisplayEXT(physicalDevice, dpy, display); |
| 5558 | |
| 5559 | return result; |
| 5560 | } |
| 5561 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 5562 | |
| 5563 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 5564 | |
| 5565 | VkResult DispatchGetRandROutputDisplayEXT( |
| 5566 | VkPhysicalDevice physicalDevice, |
| 5567 | Display* dpy, |
| 5568 | RROutput rrOutput, |
| 5569 | VkDisplayKHR* pDisplay) |
| 5570 | { |
| 5571 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5572 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetRandROutputDisplayEXT(physicalDevice, dpy, rrOutput, pDisplay); |
| 5573 | VkResult result = layer_data->instance_dispatch_table.GetRandROutputDisplayEXT(physicalDevice, dpy, rrOutput, pDisplay); |
| 5574 | if (VK_SUCCESS == result) { |
| 5575 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5576 | *pDisplay = layer_data->WrapNew(*pDisplay); |
| 5577 | } |
| 5578 | return result; |
| 5579 | } |
| 5580 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT |
| 5581 | |
| 5582 | VkResult DispatchGetPhysicalDeviceSurfaceCapabilities2EXT( |
| 5583 | VkPhysicalDevice physicalDevice, |
| 5584 | VkSurfaceKHR surface, |
| 5585 | VkSurfaceCapabilities2EXT* pSurfaceCapabilities) |
| 5586 | { |
| 5587 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5588 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice, surface, pSurfaceCapabilities); |
| 5589 | { |
| 5590 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5591 | surface = layer_data->Unwrap(surface); |
| 5592 | } |
| 5593 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice, surface, pSurfaceCapabilities); |
| 5594 | |
| 5595 | return result; |
| 5596 | } |
| 5597 | |
| 5598 | VkResult DispatchDisplayPowerControlEXT( |
| 5599 | VkDevice device, |
| 5600 | VkDisplayKHR display, |
| 5601 | const VkDisplayPowerInfoEXT* pDisplayPowerInfo) |
| 5602 | { |
| 5603 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5604 | if (!wrap_handles) return layer_data->device_dispatch_table.DisplayPowerControlEXT(device, display, pDisplayPowerInfo); |
| 5605 | { |
| 5606 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5607 | display = layer_data->Unwrap(display); |
| 5608 | } |
| 5609 | VkResult result = layer_data->device_dispatch_table.DisplayPowerControlEXT(device, display, pDisplayPowerInfo); |
| 5610 | |
| 5611 | return result; |
| 5612 | } |
| 5613 | |
| 5614 | VkResult DispatchRegisterDeviceEventEXT( |
| 5615 | VkDevice device, |
| 5616 | const VkDeviceEventInfoEXT* pDeviceEventInfo, |
| 5617 | const VkAllocationCallbacks* pAllocator, |
| 5618 | VkFence* pFence) |
| 5619 | { |
| 5620 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5621 | if (!wrap_handles) return layer_data->device_dispatch_table.RegisterDeviceEventEXT(device, pDeviceEventInfo, pAllocator, pFence); |
| 5622 | VkResult result = layer_data->device_dispatch_table.RegisterDeviceEventEXT(device, pDeviceEventInfo, pAllocator, pFence); |
| 5623 | if (VK_SUCCESS == result) { |
| 5624 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5625 | *pFence = layer_data->WrapNew(*pFence); |
| 5626 | } |
| 5627 | return result; |
| 5628 | } |
| 5629 | |
| 5630 | VkResult DispatchRegisterDisplayEventEXT( |
| 5631 | VkDevice device, |
| 5632 | VkDisplayKHR display, |
| 5633 | const VkDisplayEventInfoEXT* pDisplayEventInfo, |
| 5634 | const VkAllocationCallbacks* pAllocator, |
| 5635 | VkFence* pFence) |
| 5636 | { |
| 5637 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5638 | if (!wrap_handles) return layer_data->device_dispatch_table.RegisterDisplayEventEXT(device, display, pDisplayEventInfo, pAllocator, pFence); |
| 5639 | { |
| 5640 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5641 | display = layer_data->Unwrap(display); |
| 5642 | } |
| 5643 | VkResult result = layer_data->device_dispatch_table.RegisterDisplayEventEXT(device, display, pDisplayEventInfo, pAllocator, pFence); |
| 5644 | if (VK_SUCCESS == result) { |
| 5645 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5646 | *pFence = layer_data->WrapNew(*pFence); |
| 5647 | } |
| 5648 | return result; |
| 5649 | } |
| 5650 | |
| 5651 | VkResult DispatchGetSwapchainCounterEXT( |
| 5652 | VkDevice device, |
| 5653 | VkSwapchainKHR swapchain, |
| 5654 | VkSurfaceCounterFlagBitsEXT counter, |
| 5655 | uint64_t* pCounterValue) |
| 5656 | { |
| 5657 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5658 | if (!wrap_handles) return layer_data->device_dispatch_table.GetSwapchainCounterEXT(device, swapchain, counter, pCounterValue); |
| 5659 | { |
| 5660 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5661 | swapchain = layer_data->Unwrap(swapchain); |
| 5662 | } |
| 5663 | VkResult result = layer_data->device_dispatch_table.GetSwapchainCounterEXT(device, swapchain, counter, pCounterValue); |
| 5664 | |
| 5665 | return result; |
| 5666 | } |
| 5667 | |
| 5668 | VkResult DispatchGetRefreshCycleDurationGOOGLE( |
| 5669 | VkDevice device, |
| 5670 | VkSwapchainKHR swapchain, |
| 5671 | VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties) |
| 5672 | { |
| 5673 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5674 | if (!wrap_handles) return layer_data->device_dispatch_table.GetRefreshCycleDurationGOOGLE(device, swapchain, pDisplayTimingProperties); |
| 5675 | { |
| 5676 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5677 | swapchain = layer_data->Unwrap(swapchain); |
| 5678 | } |
| 5679 | VkResult result = layer_data->device_dispatch_table.GetRefreshCycleDurationGOOGLE(device, swapchain, pDisplayTimingProperties); |
| 5680 | |
| 5681 | return result; |
| 5682 | } |
| 5683 | |
| 5684 | VkResult DispatchGetPastPresentationTimingGOOGLE( |
| 5685 | VkDevice device, |
| 5686 | VkSwapchainKHR swapchain, |
| 5687 | uint32_t* pPresentationTimingCount, |
| 5688 | VkPastPresentationTimingGOOGLE* pPresentationTimings) |
| 5689 | { |
| 5690 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5691 | if (!wrap_handles) return layer_data->device_dispatch_table.GetPastPresentationTimingGOOGLE(device, swapchain, pPresentationTimingCount, pPresentationTimings); |
| 5692 | { |
| 5693 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5694 | swapchain = layer_data->Unwrap(swapchain); |
| 5695 | } |
| 5696 | VkResult result = layer_data->device_dispatch_table.GetPastPresentationTimingGOOGLE(device, swapchain, pPresentationTimingCount, pPresentationTimings); |
| 5697 | |
| 5698 | return result; |
| 5699 | } |
| 5700 | |
| 5701 | void DispatchCmdSetDiscardRectangleEXT( |
| 5702 | VkCommandBuffer commandBuffer, |
| 5703 | uint32_t firstDiscardRectangle, |
| 5704 | uint32_t discardRectangleCount, |
| 5705 | const VkRect2D* pDiscardRectangles) |
| 5706 | { |
| 5707 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5708 | layer_data->device_dispatch_table.CmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, pDiscardRectangles); |
| 5709 | |
| 5710 | } |
| 5711 | |
| 5712 | void DispatchSetHdrMetadataEXT( |
| 5713 | VkDevice device, |
| 5714 | uint32_t swapchainCount, |
| 5715 | const VkSwapchainKHR* pSwapchains, |
| 5716 | const VkHdrMetadataEXT* pMetadata) |
| 5717 | { |
| 5718 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5719 | if (!wrap_handles) return layer_data->device_dispatch_table.SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata); |
| 5720 | VkSwapchainKHR *local_pSwapchains = NULL; |
| 5721 | { |
| 5722 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5723 | if (pSwapchains) { |
| 5724 | local_pSwapchains = new VkSwapchainKHR[swapchainCount]; |
| 5725 | for (uint32_t index0 = 0; index0 < swapchainCount; ++index0) { |
| 5726 | local_pSwapchains[index0] = layer_data->Unwrap(pSwapchains[index0]); |
| 5727 | } |
| 5728 | } |
| 5729 | } |
| 5730 | layer_data->device_dispatch_table.SetHdrMetadataEXT(device, swapchainCount, (const VkSwapchainKHR*)local_pSwapchains, pMetadata); |
| 5731 | if (local_pSwapchains) |
| 5732 | delete[] local_pSwapchains; |
| 5733 | } |
| 5734 | |
| 5735 | #ifdef VK_USE_PLATFORM_IOS_MVK |
| 5736 | |
| 5737 | VkResult DispatchCreateIOSSurfaceMVK( |
| 5738 | VkInstance instance, |
| 5739 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, |
| 5740 | const VkAllocationCallbacks* pAllocator, |
| 5741 | VkSurfaceKHR* pSurface) |
| 5742 | { |
| 5743 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 5744 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateIOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 5745 | VkResult result = layer_data->instance_dispatch_table.CreateIOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 5746 | if (VK_SUCCESS == result) { |
| 5747 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5748 | *pSurface = layer_data->WrapNew(*pSurface); |
| 5749 | } |
| 5750 | return result; |
| 5751 | } |
| 5752 | #endif // VK_USE_PLATFORM_IOS_MVK |
| 5753 | |
| 5754 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 5755 | |
| 5756 | VkResult DispatchCreateMacOSSurfaceMVK( |
| 5757 | VkInstance instance, |
| 5758 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, |
| 5759 | const VkAllocationCallbacks* pAllocator, |
| 5760 | VkSurfaceKHR* pSurface) |
| 5761 | { |
| 5762 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 5763 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateMacOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 5764 | VkResult result = layer_data->instance_dispatch_table.CreateMacOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 5765 | if (VK_SUCCESS == result) { |
| 5766 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5767 | *pSurface = layer_data->WrapNew(*pSurface); |
| 5768 | } |
| 5769 | return result; |
| 5770 | } |
| 5771 | #endif // VK_USE_PLATFORM_MACOS_MVK |
| 5772 | |
| 5773 | // Skip vkSetDebugUtilsObjectNameEXT dispatch, manually generated |
| 5774 | |
| 5775 | // Skip vkSetDebugUtilsObjectTagEXT dispatch, manually generated |
| 5776 | |
| 5777 | void DispatchQueueBeginDebugUtilsLabelEXT( |
| 5778 | VkQueue queue, |
| 5779 | const VkDebugUtilsLabelEXT* pLabelInfo) |
| 5780 | { |
| 5781 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 5782 | layer_data->device_dispatch_table.QueueBeginDebugUtilsLabelEXT(queue, pLabelInfo); |
| 5783 | |
| 5784 | } |
| 5785 | |
| 5786 | void DispatchQueueEndDebugUtilsLabelEXT( |
| 5787 | VkQueue queue) |
| 5788 | { |
| 5789 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 5790 | layer_data->device_dispatch_table.QueueEndDebugUtilsLabelEXT(queue); |
| 5791 | |
| 5792 | } |
| 5793 | |
| 5794 | void DispatchQueueInsertDebugUtilsLabelEXT( |
| 5795 | VkQueue queue, |
| 5796 | const VkDebugUtilsLabelEXT* pLabelInfo) |
| 5797 | { |
| 5798 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 5799 | layer_data->device_dispatch_table.QueueInsertDebugUtilsLabelEXT(queue, pLabelInfo); |
| 5800 | |
| 5801 | } |
| 5802 | |
| 5803 | void DispatchCmdBeginDebugUtilsLabelEXT( |
| 5804 | VkCommandBuffer commandBuffer, |
| 5805 | const VkDebugUtilsLabelEXT* pLabelInfo) |
| 5806 | { |
| 5807 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5808 | layer_data->device_dispatch_table.CmdBeginDebugUtilsLabelEXT(commandBuffer, pLabelInfo); |
| 5809 | |
| 5810 | } |
| 5811 | |
| 5812 | void DispatchCmdEndDebugUtilsLabelEXT( |
| 5813 | VkCommandBuffer commandBuffer) |
| 5814 | { |
| 5815 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5816 | layer_data->device_dispatch_table.CmdEndDebugUtilsLabelEXT(commandBuffer); |
| 5817 | |
| 5818 | } |
| 5819 | |
| 5820 | void DispatchCmdInsertDebugUtilsLabelEXT( |
| 5821 | VkCommandBuffer commandBuffer, |
| 5822 | const VkDebugUtilsLabelEXT* pLabelInfo) |
| 5823 | { |
| 5824 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5825 | layer_data->device_dispatch_table.CmdInsertDebugUtilsLabelEXT(commandBuffer, pLabelInfo); |
| 5826 | |
| 5827 | } |
| 5828 | |
| 5829 | VkResult DispatchCreateDebugUtilsMessengerEXT( |
| 5830 | VkInstance instance, |
| 5831 | const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, |
| 5832 | const VkAllocationCallbacks* pAllocator, |
| 5833 | VkDebugUtilsMessengerEXT* pMessenger) |
| 5834 | { |
| 5835 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 5836 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateDebugUtilsMessengerEXT(instance, pCreateInfo, pAllocator, pMessenger); |
| 5837 | VkResult result = layer_data->instance_dispatch_table.CreateDebugUtilsMessengerEXT(instance, pCreateInfo, pAllocator, pMessenger); |
| 5838 | if (VK_SUCCESS == result) { |
| 5839 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5840 | *pMessenger = layer_data->WrapNew(*pMessenger); |
| 5841 | } |
| 5842 | return result; |
| 5843 | } |
| 5844 | |
| 5845 | void DispatchDestroyDebugUtilsMessengerEXT( |
| 5846 | VkInstance instance, |
| 5847 | VkDebugUtilsMessengerEXT messenger, |
| 5848 | const VkAllocationCallbacks* pAllocator) |
| 5849 | { |
| 5850 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 5851 | if (!wrap_handles) return layer_data->instance_dispatch_table.DestroyDebugUtilsMessengerEXT(instance, messenger, pAllocator); |
| 5852 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 5853 | uint64_t messenger_id = reinterpret_cast<uint64_t &>(messenger); |
| 5854 | messenger = (VkDebugUtilsMessengerEXT)unique_id_mapping[messenger_id]; |
| 5855 | unique_id_mapping.erase(messenger_id); |
| 5856 | lock.unlock(); |
| 5857 | layer_data->instance_dispatch_table.DestroyDebugUtilsMessengerEXT(instance, messenger, pAllocator); |
| 5858 | |
| 5859 | } |
| 5860 | |
| 5861 | void DispatchSubmitDebugUtilsMessageEXT( |
| 5862 | VkInstance instance, |
| 5863 | VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, |
| 5864 | VkDebugUtilsMessageTypeFlagsEXT messageTypes, |
| 5865 | const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData) |
| 5866 | { |
| 5867 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 5868 | layer_data->instance_dispatch_table.SubmitDebugUtilsMessageEXT(instance, messageSeverity, messageTypes, pCallbackData); |
| 5869 | |
| 5870 | } |
| 5871 | |
| 5872 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 5873 | |
| 5874 | VkResult DispatchGetAndroidHardwareBufferPropertiesANDROID( |
| 5875 | VkDevice device, |
| 5876 | const struct AHardwareBuffer* buffer, |
| 5877 | VkAndroidHardwareBufferPropertiesANDROID* pProperties) |
| 5878 | { |
| 5879 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5880 | VkResult result = layer_data->device_dispatch_table.GetAndroidHardwareBufferPropertiesANDROID(device, buffer, pProperties); |
| 5881 | |
| 5882 | return result; |
| 5883 | } |
| 5884 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 5885 | |
| 5886 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 5887 | |
| 5888 | VkResult DispatchGetMemoryAndroidHardwareBufferANDROID( |
| 5889 | VkDevice device, |
| 5890 | const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, |
| 5891 | struct AHardwareBuffer** pBuffer) |
| 5892 | { |
| 5893 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5894 | if (!wrap_handles) return layer_data->device_dispatch_table.GetMemoryAndroidHardwareBufferANDROID(device, pInfo, pBuffer); |
| 5895 | safe_VkMemoryGetAndroidHardwareBufferInfoANDROID *local_pInfo = NULL; |
| 5896 | { |
| 5897 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5898 | if (pInfo) { |
| 5899 | local_pInfo = new safe_VkMemoryGetAndroidHardwareBufferInfoANDROID(pInfo); |
| 5900 | if (pInfo->memory) { |
| 5901 | local_pInfo->memory = layer_data->Unwrap(pInfo->memory); |
| 5902 | } |
| 5903 | } |
| 5904 | } |
| 5905 | VkResult result = layer_data->device_dispatch_table.GetMemoryAndroidHardwareBufferANDROID(device, (const VkMemoryGetAndroidHardwareBufferInfoANDROID*)local_pInfo, pBuffer); |
| 5906 | if (local_pInfo) { |
| 5907 | delete local_pInfo; |
| 5908 | } |
| 5909 | return result; |
| 5910 | } |
| 5911 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 5912 | |
| 5913 | void DispatchCmdSetSampleLocationsEXT( |
| 5914 | VkCommandBuffer commandBuffer, |
| 5915 | const VkSampleLocationsInfoEXT* pSampleLocationsInfo) |
| 5916 | { |
| 5917 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 5918 | layer_data->device_dispatch_table.CmdSetSampleLocationsEXT(commandBuffer, pSampleLocationsInfo); |
| 5919 | |
| 5920 | } |
| 5921 | |
| 5922 | void DispatchGetPhysicalDeviceMultisamplePropertiesEXT( |
| 5923 | VkPhysicalDevice physicalDevice, |
| 5924 | VkSampleCountFlagBits samples, |
| 5925 | VkMultisamplePropertiesEXT* pMultisampleProperties) |
| 5926 | { |
| 5927 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 5928 | layer_data->instance_dispatch_table.GetPhysicalDeviceMultisamplePropertiesEXT(physicalDevice, samples, pMultisampleProperties); |
| 5929 | |
| 5930 | } |
| 5931 | |
| 5932 | VkResult DispatchGetImageDrmFormatModifierPropertiesEXT( |
| 5933 | VkDevice device, |
| 5934 | VkImage image, |
| 5935 | VkImageDrmFormatModifierPropertiesEXT* pProperties) |
| 5936 | { |
| 5937 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5938 | if (!wrap_handles) return layer_data->device_dispatch_table.GetImageDrmFormatModifierPropertiesEXT(device, image, pProperties); |
| 5939 | { |
| 5940 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5941 | image = layer_data->Unwrap(image); |
| 5942 | } |
| 5943 | VkResult result = layer_data->device_dispatch_table.GetImageDrmFormatModifierPropertiesEXT(device, image, pProperties); |
| 5944 | |
| 5945 | return result; |
| 5946 | } |
| 5947 | |
| 5948 | VkResult DispatchCreateValidationCacheEXT( |
| 5949 | VkDevice device, |
| 5950 | const VkValidationCacheCreateInfoEXT* pCreateInfo, |
| 5951 | const VkAllocationCallbacks* pAllocator, |
| 5952 | VkValidationCacheEXT* pValidationCache) |
| 5953 | { |
| 5954 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5955 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateValidationCacheEXT(device, pCreateInfo, pAllocator, pValidationCache); |
| 5956 | VkResult result = layer_data->device_dispatch_table.CreateValidationCacheEXT(device, pCreateInfo, pAllocator, pValidationCache); |
| 5957 | if (VK_SUCCESS == result) { |
| 5958 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5959 | *pValidationCache = layer_data->WrapNew(*pValidationCache); |
| 5960 | } |
| 5961 | return result; |
| 5962 | } |
| 5963 | |
| 5964 | void DispatchDestroyValidationCacheEXT( |
| 5965 | VkDevice device, |
| 5966 | VkValidationCacheEXT validationCache, |
| 5967 | const VkAllocationCallbacks* pAllocator) |
| 5968 | { |
| 5969 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5970 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyValidationCacheEXT(device, validationCache, pAllocator); |
| 5971 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 5972 | uint64_t validationCache_id = reinterpret_cast<uint64_t &>(validationCache); |
| 5973 | validationCache = (VkValidationCacheEXT)unique_id_mapping[validationCache_id]; |
| 5974 | unique_id_mapping.erase(validationCache_id); |
| 5975 | lock.unlock(); |
| 5976 | layer_data->device_dispatch_table.DestroyValidationCacheEXT(device, validationCache, pAllocator); |
| 5977 | |
| 5978 | } |
| 5979 | |
| 5980 | VkResult DispatchMergeValidationCachesEXT( |
| 5981 | VkDevice device, |
| 5982 | VkValidationCacheEXT dstCache, |
| 5983 | uint32_t srcCacheCount, |
| 5984 | const VkValidationCacheEXT* pSrcCaches) |
| 5985 | { |
| 5986 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 5987 | if (!wrap_handles) return layer_data->device_dispatch_table.MergeValidationCachesEXT(device, dstCache, srcCacheCount, pSrcCaches); |
| 5988 | VkValidationCacheEXT *local_pSrcCaches = NULL; |
| 5989 | { |
| 5990 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 5991 | dstCache = layer_data->Unwrap(dstCache); |
| 5992 | if (pSrcCaches) { |
| 5993 | local_pSrcCaches = new VkValidationCacheEXT[srcCacheCount]; |
| 5994 | for (uint32_t index0 = 0; index0 < srcCacheCount; ++index0) { |
| 5995 | local_pSrcCaches[index0] = layer_data->Unwrap(pSrcCaches[index0]); |
| 5996 | } |
| 5997 | } |
| 5998 | } |
| 5999 | VkResult result = layer_data->device_dispatch_table.MergeValidationCachesEXT(device, dstCache, srcCacheCount, (const VkValidationCacheEXT*)local_pSrcCaches); |
| 6000 | if (local_pSrcCaches) |
| 6001 | delete[] local_pSrcCaches; |
| 6002 | return result; |
| 6003 | } |
| 6004 | |
| 6005 | VkResult DispatchGetValidationCacheDataEXT( |
| 6006 | VkDevice device, |
| 6007 | VkValidationCacheEXT validationCache, |
| 6008 | size_t* pDataSize, |
| 6009 | void* pData) |
| 6010 | { |
| 6011 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6012 | if (!wrap_handles) return layer_data->device_dispatch_table.GetValidationCacheDataEXT(device, validationCache, pDataSize, pData); |
| 6013 | { |
| 6014 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6015 | validationCache = layer_data->Unwrap(validationCache); |
| 6016 | } |
| 6017 | VkResult result = layer_data->device_dispatch_table.GetValidationCacheDataEXT(device, validationCache, pDataSize, pData); |
| 6018 | |
| 6019 | return result; |
| 6020 | } |
| 6021 | |
| 6022 | void DispatchCmdBindShadingRateImageNV( |
| 6023 | VkCommandBuffer commandBuffer, |
| 6024 | VkImageView imageView, |
| 6025 | VkImageLayout imageLayout) |
| 6026 | { |
| 6027 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6028 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBindShadingRateImageNV(commandBuffer, imageView, imageLayout); |
| 6029 | { |
| 6030 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6031 | imageView = layer_data->Unwrap(imageView); |
| 6032 | } |
| 6033 | layer_data->device_dispatch_table.CmdBindShadingRateImageNV(commandBuffer, imageView, imageLayout); |
| 6034 | |
| 6035 | } |
| 6036 | |
| 6037 | void DispatchCmdSetViewportShadingRatePaletteNV( |
| 6038 | VkCommandBuffer commandBuffer, |
| 6039 | uint32_t firstViewport, |
| 6040 | uint32_t viewportCount, |
| 6041 | const VkShadingRatePaletteNV* pShadingRatePalettes) |
| 6042 | { |
| 6043 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6044 | layer_data->device_dispatch_table.CmdSetViewportShadingRatePaletteNV(commandBuffer, firstViewport, viewportCount, pShadingRatePalettes); |
| 6045 | |
| 6046 | } |
| 6047 | |
| 6048 | void DispatchCmdSetCoarseSampleOrderNV( |
| 6049 | VkCommandBuffer commandBuffer, |
| 6050 | VkCoarseSampleOrderTypeNV sampleOrderType, |
| 6051 | uint32_t customSampleOrderCount, |
| 6052 | const VkCoarseSampleOrderCustomNV* pCustomSampleOrders) |
| 6053 | { |
| 6054 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6055 | layer_data->device_dispatch_table.CmdSetCoarseSampleOrderNV(commandBuffer, sampleOrderType, customSampleOrderCount, pCustomSampleOrders); |
| 6056 | |
| 6057 | } |
| 6058 | |
| 6059 | VkResult DispatchCreateAccelerationStructureNV( |
| 6060 | VkDevice device, |
| 6061 | const VkAccelerationStructureCreateInfoNV* pCreateInfo, |
| 6062 | const VkAllocationCallbacks* pAllocator, |
| 6063 | VkAccelerationStructureNV* pAccelerationStructure) |
| 6064 | { |
| 6065 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6066 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateAccelerationStructureNV(device, pCreateInfo, pAllocator, pAccelerationStructure); |
| 6067 | safe_VkAccelerationStructureCreateInfoNV *local_pCreateInfo = NULL; |
| 6068 | { |
| 6069 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6070 | if (pCreateInfo) { |
| 6071 | local_pCreateInfo = new safe_VkAccelerationStructureCreateInfoNV(pCreateInfo); |
| 6072 | if (local_pCreateInfo->info.pGeometries) { |
| 6073 | for (uint32_t index2 = 0; index2 < local_pCreateInfo->info.geometryCount; ++index2) { |
| 6074 | if (pCreateInfo->info.pGeometries[index2].geometry.triangles.vertexData) { |
| 6075 | local_pCreateInfo->info.pGeometries[index2].geometry.triangles.vertexData = layer_data->Unwrap(pCreateInfo->info.pGeometries[index2].geometry.triangles.vertexData); |
| 6076 | } |
| 6077 | if (pCreateInfo->info.pGeometries[index2].geometry.triangles.indexData) { |
| 6078 | local_pCreateInfo->info.pGeometries[index2].geometry.triangles.indexData = layer_data->Unwrap(pCreateInfo->info.pGeometries[index2].geometry.triangles.indexData); |
| 6079 | } |
| 6080 | if (pCreateInfo->info.pGeometries[index2].geometry.triangles.transformData) { |
| 6081 | local_pCreateInfo->info.pGeometries[index2].geometry.triangles.transformData = layer_data->Unwrap(pCreateInfo->info.pGeometries[index2].geometry.triangles.transformData); |
| 6082 | } |
| 6083 | if (pCreateInfo->info.pGeometries[index2].geometry.aabbs.aabbData) { |
| 6084 | local_pCreateInfo->info.pGeometries[index2].geometry.aabbs.aabbData = layer_data->Unwrap(pCreateInfo->info.pGeometries[index2].geometry.aabbs.aabbData); |
| 6085 | } |
| 6086 | } |
| 6087 | } |
| 6088 | } |
| 6089 | } |
| 6090 | VkResult result = layer_data->device_dispatch_table.CreateAccelerationStructureNV(device, (const VkAccelerationStructureCreateInfoNV*)local_pCreateInfo, pAllocator, pAccelerationStructure); |
| 6091 | if (local_pCreateInfo) { |
| 6092 | delete local_pCreateInfo; |
| 6093 | } |
| 6094 | if (VK_SUCCESS == result) { |
| 6095 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6096 | *pAccelerationStructure = layer_data->WrapNew(*pAccelerationStructure); |
| 6097 | } |
| 6098 | return result; |
| 6099 | } |
| 6100 | |
| 6101 | void DispatchDestroyAccelerationStructureNV( |
| 6102 | VkDevice device, |
| 6103 | VkAccelerationStructureNV accelerationStructure, |
| 6104 | const VkAllocationCallbacks* pAllocator) |
| 6105 | { |
| 6106 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6107 | if (!wrap_handles) return layer_data->device_dispatch_table.DestroyAccelerationStructureNV(device, accelerationStructure, pAllocator); |
| 6108 | std::unique_lock<std::mutex> lock(dispatch_lock); |
| 6109 | uint64_t accelerationStructure_id = reinterpret_cast<uint64_t &>(accelerationStructure); |
| 6110 | accelerationStructure = (VkAccelerationStructureNV)unique_id_mapping[accelerationStructure_id]; |
| 6111 | unique_id_mapping.erase(accelerationStructure_id); |
| 6112 | lock.unlock(); |
| 6113 | layer_data->device_dispatch_table.DestroyAccelerationStructureNV(device, accelerationStructure, pAllocator); |
| 6114 | |
| 6115 | } |
| 6116 | |
| 6117 | void DispatchGetAccelerationStructureMemoryRequirementsNV( |
| 6118 | VkDevice device, |
| 6119 | const VkAccelerationStructureMemoryRequirementsInfoNV* pInfo, |
| 6120 | VkMemoryRequirements2KHR* pMemoryRequirements) |
| 6121 | { |
| 6122 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6123 | if (!wrap_handles) return layer_data->device_dispatch_table.GetAccelerationStructureMemoryRequirementsNV(device, pInfo, pMemoryRequirements); |
| 6124 | safe_VkAccelerationStructureMemoryRequirementsInfoNV *local_pInfo = NULL; |
| 6125 | { |
| 6126 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6127 | if (pInfo) { |
| 6128 | local_pInfo = new safe_VkAccelerationStructureMemoryRequirementsInfoNV(pInfo); |
| 6129 | if (pInfo->accelerationStructure) { |
| 6130 | local_pInfo->accelerationStructure = layer_data->Unwrap(pInfo->accelerationStructure); |
| 6131 | } |
| 6132 | } |
| 6133 | } |
| 6134 | layer_data->device_dispatch_table.GetAccelerationStructureMemoryRequirementsNV(device, (const VkAccelerationStructureMemoryRequirementsInfoNV*)local_pInfo, pMemoryRequirements); |
| 6135 | if (local_pInfo) { |
| 6136 | delete local_pInfo; |
| 6137 | } |
| 6138 | } |
| 6139 | |
| 6140 | VkResult DispatchBindAccelerationStructureMemoryNV( |
| 6141 | VkDevice device, |
| 6142 | uint32_t bindInfoCount, |
| 6143 | const VkBindAccelerationStructureMemoryInfoNV* pBindInfos) |
| 6144 | { |
| 6145 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6146 | if (!wrap_handles) return layer_data->device_dispatch_table.BindAccelerationStructureMemoryNV(device, bindInfoCount, pBindInfos); |
| 6147 | safe_VkBindAccelerationStructureMemoryInfoNV *local_pBindInfos = NULL; |
| 6148 | { |
| 6149 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6150 | if (pBindInfos) { |
| 6151 | local_pBindInfos = new safe_VkBindAccelerationStructureMemoryInfoNV[bindInfoCount]; |
| 6152 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
| 6153 | local_pBindInfos[index0].initialize(&pBindInfos[index0]); |
| 6154 | if (pBindInfos[index0].accelerationStructure) { |
| 6155 | local_pBindInfos[index0].accelerationStructure = layer_data->Unwrap(pBindInfos[index0].accelerationStructure); |
| 6156 | } |
| 6157 | if (pBindInfos[index0].memory) { |
| 6158 | local_pBindInfos[index0].memory = layer_data->Unwrap(pBindInfos[index0].memory); |
| 6159 | } |
| 6160 | } |
| 6161 | } |
| 6162 | } |
| 6163 | VkResult result = layer_data->device_dispatch_table.BindAccelerationStructureMemoryNV(device, bindInfoCount, (const VkBindAccelerationStructureMemoryInfoNV*)local_pBindInfos); |
| 6164 | if (local_pBindInfos) { |
| 6165 | delete[] local_pBindInfos; |
| 6166 | } |
| 6167 | return result; |
| 6168 | } |
| 6169 | |
| 6170 | void DispatchCmdBuildAccelerationStructureNV( |
| 6171 | VkCommandBuffer commandBuffer, |
| 6172 | const VkAccelerationStructureInfoNV* pInfo, |
| 6173 | VkBuffer instanceData, |
| 6174 | VkDeviceSize instanceOffset, |
| 6175 | VkBool32 update, |
| 6176 | VkAccelerationStructureNV dst, |
| 6177 | VkAccelerationStructureNV src, |
| 6178 | VkBuffer scratch, |
| 6179 | VkDeviceSize scratchOffset) |
| 6180 | { |
| 6181 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6182 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdBuildAccelerationStructureNV(commandBuffer, pInfo, instanceData, instanceOffset, update, dst, src, scratch, scratchOffset); |
| 6183 | safe_VkAccelerationStructureInfoNV *local_pInfo = NULL; |
| 6184 | { |
| 6185 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6186 | if (pInfo) { |
| 6187 | local_pInfo = new safe_VkAccelerationStructureInfoNV(pInfo); |
| 6188 | if (local_pInfo->pGeometries) { |
| 6189 | for (uint32_t index1 = 0; index1 < local_pInfo->geometryCount; ++index1) { |
| 6190 | if (pInfo->pGeometries[index1].geometry.triangles.vertexData) { |
| 6191 | local_pInfo->pGeometries[index1].geometry.triangles.vertexData = layer_data->Unwrap(pInfo->pGeometries[index1].geometry.triangles.vertexData); |
| 6192 | } |
| 6193 | if (pInfo->pGeometries[index1].geometry.triangles.indexData) { |
| 6194 | local_pInfo->pGeometries[index1].geometry.triangles.indexData = layer_data->Unwrap(pInfo->pGeometries[index1].geometry.triangles.indexData); |
| 6195 | } |
| 6196 | if (pInfo->pGeometries[index1].geometry.triangles.transformData) { |
| 6197 | local_pInfo->pGeometries[index1].geometry.triangles.transformData = layer_data->Unwrap(pInfo->pGeometries[index1].geometry.triangles.transformData); |
| 6198 | } |
| 6199 | if (pInfo->pGeometries[index1].geometry.aabbs.aabbData) { |
| 6200 | local_pInfo->pGeometries[index1].geometry.aabbs.aabbData = layer_data->Unwrap(pInfo->pGeometries[index1].geometry.aabbs.aabbData); |
| 6201 | } |
| 6202 | } |
| 6203 | } |
| 6204 | } |
| 6205 | instanceData = layer_data->Unwrap(instanceData); |
| 6206 | dst = layer_data->Unwrap(dst); |
| 6207 | src = layer_data->Unwrap(src); |
| 6208 | scratch = layer_data->Unwrap(scratch); |
| 6209 | } |
| 6210 | layer_data->device_dispatch_table.CmdBuildAccelerationStructureNV(commandBuffer, (const VkAccelerationStructureInfoNV*)local_pInfo, instanceData, instanceOffset, update, dst, src, scratch, scratchOffset); |
| 6211 | if (local_pInfo) { |
| 6212 | delete local_pInfo; |
| 6213 | } |
| 6214 | } |
| 6215 | |
| 6216 | void DispatchCmdCopyAccelerationStructureNV( |
| 6217 | VkCommandBuffer commandBuffer, |
| 6218 | VkAccelerationStructureNV dst, |
| 6219 | VkAccelerationStructureNV src, |
| 6220 | VkCopyAccelerationStructureModeNV mode) |
| 6221 | { |
| 6222 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6223 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdCopyAccelerationStructureNV(commandBuffer, dst, src, mode); |
| 6224 | { |
| 6225 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6226 | dst = layer_data->Unwrap(dst); |
| 6227 | src = layer_data->Unwrap(src); |
| 6228 | } |
| 6229 | layer_data->device_dispatch_table.CmdCopyAccelerationStructureNV(commandBuffer, dst, src, mode); |
| 6230 | |
| 6231 | } |
| 6232 | |
| 6233 | void DispatchCmdTraceRaysNV( |
| 6234 | VkCommandBuffer commandBuffer, |
| 6235 | VkBuffer raygenShaderBindingTableBuffer, |
| 6236 | VkDeviceSize raygenShaderBindingOffset, |
| 6237 | VkBuffer missShaderBindingTableBuffer, |
| 6238 | VkDeviceSize missShaderBindingOffset, |
| 6239 | VkDeviceSize missShaderBindingStride, |
| 6240 | VkBuffer hitShaderBindingTableBuffer, |
| 6241 | VkDeviceSize hitShaderBindingOffset, |
| 6242 | VkDeviceSize hitShaderBindingStride, |
| 6243 | VkBuffer callableShaderBindingTableBuffer, |
| 6244 | VkDeviceSize callableShaderBindingOffset, |
| 6245 | VkDeviceSize callableShaderBindingStride, |
| 6246 | uint32_t width, |
| 6247 | uint32_t height, |
| 6248 | uint32_t depth) |
| 6249 | { |
| 6250 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6251 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdTraceRaysNV(commandBuffer, raygenShaderBindingTableBuffer, raygenShaderBindingOffset, missShaderBindingTableBuffer, missShaderBindingOffset, missShaderBindingStride, hitShaderBindingTableBuffer, hitShaderBindingOffset, hitShaderBindingStride, callableShaderBindingTableBuffer, callableShaderBindingOffset, callableShaderBindingStride, width, height, depth); |
| 6252 | { |
| 6253 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6254 | raygenShaderBindingTableBuffer = layer_data->Unwrap(raygenShaderBindingTableBuffer); |
| 6255 | missShaderBindingTableBuffer = layer_data->Unwrap(missShaderBindingTableBuffer); |
| 6256 | hitShaderBindingTableBuffer = layer_data->Unwrap(hitShaderBindingTableBuffer); |
| 6257 | callableShaderBindingTableBuffer = layer_data->Unwrap(callableShaderBindingTableBuffer); |
| 6258 | } |
| 6259 | layer_data->device_dispatch_table.CmdTraceRaysNV(commandBuffer, raygenShaderBindingTableBuffer, raygenShaderBindingOffset, missShaderBindingTableBuffer, missShaderBindingOffset, missShaderBindingStride, hitShaderBindingTableBuffer, hitShaderBindingOffset, hitShaderBindingStride, callableShaderBindingTableBuffer, callableShaderBindingOffset, callableShaderBindingStride, width, height, depth); |
| 6260 | |
| 6261 | } |
| 6262 | |
| 6263 | VkResult DispatchCreateRayTracingPipelinesNV( |
| 6264 | VkDevice device, |
| 6265 | VkPipelineCache pipelineCache, |
| 6266 | uint32_t createInfoCount, |
| 6267 | const VkRayTracingPipelineCreateInfoNV* pCreateInfos, |
| 6268 | const VkAllocationCallbacks* pAllocator, |
| 6269 | VkPipeline* pPipelines) |
| 6270 | { |
| 6271 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6272 | if (!wrap_handles) return layer_data->device_dispatch_table.CreateRayTracingPipelinesNV(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
| 6273 | safe_VkRayTracingPipelineCreateInfoNV *local_pCreateInfos = NULL; |
| 6274 | { |
| 6275 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6276 | pipelineCache = layer_data->Unwrap(pipelineCache); |
| 6277 | if (pCreateInfos) { |
| 6278 | local_pCreateInfos = new safe_VkRayTracingPipelineCreateInfoNV[createInfoCount]; |
| 6279 | for (uint32_t index0 = 0; index0 < createInfoCount; ++index0) { |
| 6280 | local_pCreateInfos[index0].initialize(&pCreateInfos[index0]); |
| 6281 | if (local_pCreateInfos[index0].pStages) { |
| 6282 | for (uint32_t index1 = 0; index1 < local_pCreateInfos[index0].stageCount; ++index1) { |
| 6283 | if (pCreateInfos[index0].pStages[index1].module) { |
| 6284 | local_pCreateInfos[index0].pStages[index1].module = layer_data->Unwrap(pCreateInfos[index0].pStages[index1].module); |
| 6285 | } |
| 6286 | } |
| 6287 | } |
| 6288 | if (pCreateInfos[index0].layout) { |
| 6289 | local_pCreateInfos[index0].layout = layer_data->Unwrap(pCreateInfos[index0].layout); |
| 6290 | } |
| 6291 | if (pCreateInfos[index0].basePipelineHandle) { |
| 6292 | local_pCreateInfos[index0].basePipelineHandle = layer_data->Unwrap(pCreateInfos[index0].basePipelineHandle); |
| 6293 | } |
| 6294 | } |
| 6295 | } |
| 6296 | } |
| 6297 | VkResult result = layer_data->device_dispatch_table.CreateRayTracingPipelinesNV(device, pipelineCache, createInfoCount, (const VkRayTracingPipelineCreateInfoNV*)local_pCreateInfos, pAllocator, pPipelines); |
| 6298 | if (local_pCreateInfos) { |
| 6299 | delete[] local_pCreateInfos; |
| 6300 | } |
| 6301 | if (VK_SUCCESS == result) { |
| 6302 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6303 | for (uint32_t index0 = 0; index0 < createInfoCount; index0++) { |
| 6304 | pPipelines[index0] = layer_data->WrapNew(pPipelines[index0]); |
| 6305 | } |
| 6306 | } |
| 6307 | return result; |
| 6308 | } |
| 6309 | |
| 6310 | VkResult DispatchGetRayTracingShaderGroupHandlesNV( |
| 6311 | VkDevice device, |
| 6312 | VkPipeline pipeline, |
| 6313 | uint32_t firstGroup, |
| 6314 | uint32_t groupCount, |
| 6315 | size_t dataSize, |
| 6316 | void* pData) |
| 6317 | { |
| 6318 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6319 | if (!wrap_handles) return layer_data->device_dispatch_table.GetRayTracingShaderGroupHandlesNV(device, pipeline, firstGroup, groupCount, dataSize, pData); |
| 6320 | { |
| 6321 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6322 | pipeline = layer_data->Unwrap(pipeline); |
| 6323 | } |
| 6324 | VkResult result = layer_data->device_dispatch_table.GetRayTracingShaderGroupHandlesNV(device, pipeline, firstGroup, groupCount, dataSize, pData); |
| 6325 | |
| 6326 | return result; |
| 6327 | } |
| 6328 | |
| 6329 | VkResult DispatchGetAccelerationStructureHandleNV( |
| 6330 | VkDevice device, |
| 6331 | VkAccelerationStructureNV accelerationStructure, |
| 6332 | size_t dataSize, |
| 6333 | void* pData) |
| 6334 | { |
| 6335 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6336 | if (!wrap_handles) return layer_data->device_dispatch_table.GetAccelerationStructureHandleNV(device, accelerationStructure, dataSize, pData); |
| 6337 | { |
| 6338 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6339 | accelerationStructure = layer_data->Unwrap(accelerationStructure); |
| 6340 | } |
| 6341 | VkResult result = layer_data->device_dispatch_table.GetAccelerationStructureHandleNV(device, accelerationStructure, dataSize, pData); |
| 6342 | |
| 6343 | return result; |
| 6344 | } |
| 6345 | |
| 6346 | void DispatchCmdWriteAccelerationStructuresPropertiesNV( |
| 6347 | VkCommandBuffer commandBuffer, |
| 6348 | uint32_t accelerationStructureCount, |
| 6349 | const VkAccelerationStructureNV* pAccelerationStructures, |
| 6350 | VkQueryType queryType, |
| 6351 | VkQueryPool queryPool, |
| 6352 | uint32_t firstQuery) |
| 6353 | { |
| 6354 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6355 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdWriteAccelerationStructuresPropertiesNV(commandBuffer, accelerationStructureCount, pAccelerationStructures, queryType, queryPool, firstQuery); |
| 6356 | VkAccelerationStructureNV *local_pAccelerationStructures = NULL; |
| 6357 | { |
| 6358 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6359 | if (pAccelerationStructures) { |
| 6360 | local_pAccelerationStructures = new VkAccelerationStructureNV[accelerationStructureCount]; |
| 6361 | for (uint32_t index0 = 0; index0 < accelerationStructureCount; ++index0) { |
| 6362 | local_pAccelerationStructures[index0] = layer_data->Unwrap(pAccelerationStructures[index0]); |
| 6363 | } |
| 6364 | } |
| 6365 | queryPool = layer_data->Unwrap(queryPool); |
| 6366 | } |
| 6367 | layer_data->device_dispatch_table.CmdWriteAccelerationStructuresPropertiesNV(commandBuffer, accelerationStructureCount, (const VkAccelerationStructureNV*)local_pAccelerationStructures, queryType, queryPool, firstQuery); |
| 6368 | if (local_pAccelerationStructures) |
| 6369 | delete[] local_pAccelerationStructures; |
| 6370 | } |
| 6371 | |
| 6372 | VkResult DispatchCompileDeferredNV( |
| 6373 | VkDevice device, |
| 6374 | VkPipeline pipeline, |
| 6375 | uint32_t shader) |
| 6376 | { |
| 6377 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6378 | if (!wrap_handles) return layer_data->device_dispatch_table.CompileDeferredNV(device, pipeline, shader); |
| 6379 | { |
| 6380 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6381 | pipeline = layer_data->Unwrap(pipeline); |
| 6382 | } |
| 6383 | VkResult result = layer_data->device_dispatch_table.CompileDeferredNV(device, pipeline, shader); |
| 6384 | |
| 6385 | return result; |
| 6386 | } |
| 6387 | |
| 6388 | VkResult DispatchGetMemoryHostPointerPropertiesEXT( |
| 6389 | VkDevice device, |
| 6390 | VkExternalMemoryHandleTypeFlagBits handleType, |
| 6391 | const void* pHostPointer, |
| 6392 | VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties) |
| 6393 | { |
| 6394 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6395 | VkResult result = layer_data->device_dispatch_table.GetMemoryHostPointerPropertiesEXT(device, handleType, pHostPointer, pMemoryHostPointerProperties); |
| 6396 | |
| 6397 | return result; |
| 6398 | } |
| 6399 | |
| 6400 | void DispatchCmdWriteBufferMarkerAMD( |
| 6401 | VkCommandBuffer commandBuffer, |
| 6402 | VkPipelineStageFlagBits pipelineStage, |
| 6403 | VkBuffer dstBuffer, |
| 6404 | VkDeviceSize dstOffset, |
| 6405 | uint32_t marker) |
| 6406 | { |
| 6407 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6408 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdWriteBufferMarkerAMD(commandBuffer, pipelineStage, dstBuffer, dstOffset, marker); |
| 6409 | { |
| 6410 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6411 | dstBuffer = layer_data->Unwrap(dstBuffer); |
| 6412 | } |
| 6413 | layer_data->device_dispatch_table.CmdWriteBufferMarkerAMD(commandBuffer, pipelineStage, dstBuffer, dstOffset, marker); |
| 6414 | |
| 6415 | } |
| 6416 | |
| 6417 | VkResult DispatchGetPhysicalDeviceCalibrateableTimeDomainsEXT( |
| 6418 | VkPhysicalDevice physicalDevice, |
| 6419 | uint32_t* pTimeDomainCount, |
| 6420 | VkTimeDomainEXT* pTimeDomains) |
| 6421 | { |
| 6422 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 6423 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice, pTimeDomainCount, pTimeDomains); |
| 6424 | |
| 6425 | return result; |
| 6426 | } |
| 6427 | |
| 6428 | VkResult DispatchGetCalibratedTimestampsEXT( |
| 6429 | VkDevice device, |
| 6430 | uint32_t timestampCount, |
| 6431 | const VkCalibratedTimestampInfoEXT* pTimestampInfos, |
| 6432 | uint64_t* pTimestamps, |
| 6433 | uint64_t* pMaxDeviation) |
| 6434 | { |
| 6435 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6436 | VkResult result = layer_data->device_dispatch_table.GetCalibratedTimestampsEXT(device, timestampCount, pTimestampInfos, pTimestamps, pMaxDeviation); |
| 6437 | |
| 6438 | return result; |
| 6439 | } |
| 6440 | |
| 6441 | void DispatchCmdDrawMeshTasksNV( |
| 6442 | VkCommandBuffer commandBuffer, |
| 6443 | uint32_t taskCount, |
| 6444 | uint32_t firstTask) |
| 6445 | { |
| 6446 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6447 | layer_data->device_dispatch_table.CmdDrawMeshTasksNV(commandBuffer, taskCount, firstTask); |
| 6448 | |
| 6449 | } |
| 6450 | |
| 6451 | void DispatchCmdDrawMeshTasksIndirectNV( |
| 6452 | VkCommandBuffer commandBuffer, |
| 6453 | VkBuffer buffer, |
| 6454 | VkDeviceSize offset, |
| 6455 | uint32_t drawCount, |
| 6456 | uint32_t stride) |
| 6457 | { |
| 6458 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6459 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawMeshTasksIndirectNV(commandBuffer, buffer, offset, drawCount, stride); |
| 6460 | { |
| 6461 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6462 | buffer = layer_data->Unwrap(buffer); |
| 6463 | } |
| 6464 | layer_data->device_dispatch_table.CmdDrawMeshTasksIndirectNV(commandBuffer, buffer, offset, drawCount, stride); |
| 6465 | |
| 6466 | } |
| 6467 | |
| 6468 | void DispatchCmdDrawMeshTasksIndirectCountNV( |
| 6469 | VkCommandBuffer commandBuffer, |
| 6470 | VkBuffer buffer, |
| 6471 | VkDeviceSize offset, |
| 6472 | VkBuffer countBuffer, |
| 6473 | VkDeviceSize countBufferOffset, |
| 6474 | uint32_t maxDrawCount, |
| 6475 | uint32_t stride) |
| 6476 | { |
| 6477 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6478 | if (!wrap_handles) return layer_data->device_dispatch_table.CmdDrawMeshTasksIndirectCountNV(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 6479 | { |
| 6480 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6481 | buffer = layer_data->Unwrap(buffer); |
| 6482 | countBuffer = layer_data->Unwrap(countBuffer); |
| 6483 | } |
| 6484 | layer_data->device_dispatch_table.CmdDrawMeshTasksIndirectCountNV(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 6485 | |
| 6486 | } |
| 6487 | |
| 6488 | void DispatchCmdSetExclusiveScissorNV( |
| 6489 | VkCommandBuffer commandBuffer, |
| 6490 | uint32_t firstExclusiveScissor, |
| 6491 | uint32_t exclusiveScissorCount, |
| 6492 | const VkRect2D* pExclusiveScissors) |
| 6493 | { |
| 6494 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6495 | layer_data->device_dispatch_table.CmdSetExclusiveScissorNV(commandBuffer, firstExclusiveScissor, exclusiveScissorCount, pExclusiveScissors); |
| 6496 | |
| 6497 | } |
| 6498 | |
| 6499 | void DispatchCmdSetCheckpointNV( |
| 6500 | VkCommandBuffer commandBuffer, |
| 6501 | const void* pCheckpointMarker) |
| 6502 | { |
| 6503 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6504 | layer_data->device_dispatch_table.CmdSetCheckpointNV(commandBuffer, pCheckpointMarker); |
| 6505 | |
| 6506 | } |
| 6507 | |
| 6508 | void DispatchGetQueueCheckpointDataNV( |
| 6509 | VkQueue queue, |
| 6510 | uint32_t* pCheckpointDataCount, |
| 6511 | VkCheckpointDataNV* pCheckpointData) |
| 6512 | { |
| 6513 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 6514 | layer_data->device_dispatch_table.GetQueueCheckpointDataNV(queue, pCheckpointDataCount, pCheckpointData); |
| 6515 | |
| 6516 | } |
| 6517 | |
| 6518 | VkResult DispatchInitializePerformanceApiINTEL( |
| 6519 | VkDevice device, |
| 6520 | const VkInitializePerformanceApiInfoINTEL* pInitializeInfo) |
| 6521 | { |
| 6522 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6523 | VkResult result = layer_data->device_dispatch_table.InitializePerformanceApiINTEL(device, pInitializeInfo); |
| 6524 | |
| 6525 | return result; |
| 6526 | } |
| 6527 | |
| 6528 | void DispatchUninitializePerformanceApiINTEL( |
| 6529 | VkDevice device) |
| 6530 | { |
| 6531 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6532 | layer_data->device_dispatch_table.UninitializePerformanceApiINTEL(device); |
| 6533 | |
| 6534 | } |
| 6535 | |
| 6536 | VkResult DispatchCmdSetPerformanceMarkerINTEL( |
| 6537 | VkCommandBuffer commandBuffer, |
| 6538 | const VkPerformanceMarkerInfoINTEL* pMarkerInfo) |
| 6539 | { |
| 6540 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6541 | VkResult result = layer_data->device_dispatch_table.CmdSetPerformanceMarkerINTEL(commandBuffer, pMarkerInfo); |
| 6542 | |
| 6543 | return result; |
| 6544 | } |
| 6545 | |
| 6546 | VkResult DispatchCmdSetPerformanceStreamMarkerINTEL( |
| 6547 | VkCommandBuffer commandBuffer, |
| 6548 | const VkPerformanceStreamMarkerInfoINTEL* pMarkerInfo) |
| 6549 | { |
| 6550 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6551 | VkResult result = layer_data->device_dispatch_table.CmdSetPerformanceStreamMarkerINTEL(commandBuffer, pMarkerInfo); |
| 6552 | |
| 6553 | return result; |
| 6554 | } |
| 6555 | |
| 6556 | VkResult DispatchCmdSetPerformanceOverrideINTEL( |
| 6557 | VkCommandBuffer commandBuffer, |
| 6558 | const VkPerformanceOverrideInfoINTEL* pOverrideInfo) |
| 6559 | { |
| 6560 | auto layer_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map); |
| 6561 | VkResult result = layer_data->device_dispatch_table.CmdSetPerformanceOverrideINTEL(commandBuffer, pOverrideInfo); |
| 6562 | |
| 6563 | return result; |
| 6564 | } |
| 6565 | |
| 6566 | VkResult DispatchAcquirePerformanceConfigurationINTEL( |
| 6567 | VkDevice device, |
| 6568 | const VkPerformanceConfigurationAcquireInfoINTEL* pAcquireInfo, |
| 6569 | VkPerformanceConfigurationINTEL* pConfiguration) |
| 6570 | { |
| 6571 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6572 | if (!wrap_handles) return layer_data->device_dispatch_table.AcquirePerformanceConfigurationINTEL(device, pAcquireInfo, pConfiguration); |
| 6573 | { |
| 6574 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6575 | pConfiguration = layer_data->Unwrap(pConfiguration); |
| 6576 | } |
| 6577 | VkResult result = layer_data->device_dispatch_table.AcquirePerformanceConfigurationINTEL(device, pAcquireInfo, pConfiguration); |
| 6578 | |
| 6579 | return result; |
| 6580 | } |
| 6581 | |
| 6582 | VkResult DispatchReleasePerformanceConfigurationINTEL( |
| 6583 | VkDevice device, |
| 6584 | VkPerformanceConfigurationINTEL configuration) |
| 6585 | { |
| 6586 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6587 | if (!wrap_handles) return layer_data->device_dispatch_table.ReleasePerformanceConfigurationINTEL(device, configuration); |
| 6588 | { |
| 6589 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6590 | configuration = layer_data->Unwrap(configuration); |
| 6591 | } |
| 6592 | VkResult result = layer_data->device_dispatch_table.ReleasePerformanceConfigurationINTEL(device, configuration); |
| 6593 | |
| 6594 | return result; |
| 6595 | } |
| 6596 | |
| 6597 | VkResult DispatchQueueSetPerformanceConfigurationINTEL( |
| 6598 | VkQueue queue, |
| 6599 | VkPerformanceConfigurationINTEL configuration) |
| 6600 | { |
| 6601 | auto layer_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map); |
| 6602 | if (!wrap_handles) return layer_data->device_dispatch_table.QueueSetPerformanceConfigurationINTEL(queue, configuration); |
| 6603 | { |
| 6604 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6605 | configuration = layer_data->Unwrap(configuration); |
| 6606 | } |
| 6607 | VkResult result = layer_data->device_dispatch_table.QueueSetPerformanceConfigurationINTEL(queue, configuration); |
| 6608 | |
| 6609 | return result; |
| 6610 | } |
| 6611 | |
| 6612 | VkResult DispatchGetPerformanceParameterINTEL( |
| 6613 | VkDevice device, |
| 6614 | VkPerformanceParameterTypeINTEL parameter, |
| 6615 | VkPerformanceValueINTEL* pValue) |
| 6616 | { |
| 6617 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6618 | VkResult result = layer_data->device_dispatch_table.GetPerformanceParameterINTEL(device, parameter, pValue); |
| 6619 | |
| 6620 | return result; |
| 6621 | } |
| 6622 | |
| 6623 | void DispatchSetLocalDimmingAMD( |
| 6624 | VkDevice device, |
| 6625 | VkSwapchainKHR swapChain, |
| 6626 | VkBool32 localDimmingEnable) |
| 6627 | { |
| 6628 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6629 | if (!wrap_handles) return layer_data->device_dispatch_table.SetLocalDimmingAMD(device, swapChain, localDimmingEnable); |
| 6630 | { |
| 6631 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6632 | swapChain = layer_data->Unwrap(swapChain); |
| 6633 | } |
| 6634 | layer_data->device_dispatch_table.SetLocalDimmingAMD(device, swapChain, localDimmingEnable); |
| 6635 | |
| 6636 | } |
| 6637 | |
| 6638 | #ifdef VK_USE_PLATFORM_FUCHSIA |
| 6639 | |
| 6640 | VkResult DispatchCreateImagePipeSurfaceFUCHSIA( |
| 6641 | VkInstance instance, |
| 6642 | const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, |
| 6643 | const VkAllocationCallbacks* pAllocator, |
| 6644 | VkSurfaceKHR* pSurface) |
| 6645 | { |
| 6646 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 6647 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateImagePipeSurfaceFUCHSIA(instance, pCreateInfo, pAllocator, pSurface); |
| 6648 | VkResult result = layer_data->instance_dispatch_table.CreateImagePipeSurfaceFUCHSIA(instance, pCreateInfo, pAllocator, pSurface); |
| 6649 | if (VK_SUCCESS == result) { |
| 6650 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6651 | *pSurface = layer_data->WrapNew(*pSurface); |
| 6652 | } |
| 6653 | return result; |
| 6654 | } |
| 6655 | #endif // VK_USE_PLATFORM_FUCHSIA |
| 6656 | |
| 6657 | #ifdef VK_USE_PLATFORM_METAL_EXT |
| 6658 | |
| 6659 | VkResult DispatchCreateMetalSurfaceEXT( |
| 6660 | VkInstance instance, |
| 6661 | const VkMetalSurfaceCreateInfoEXT* pCreateInfo, |
| 6662 | const VkAllocationCallbacks* pAllocator, |
| 6663 | VkSurfaceKHR* pSurface) |
| 6664 | { |
| 6665 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 6666 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateMetalSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); |
| 6667 | VkResult result = layer_data->instance_dispatch_table.CreateMetalSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); |
| 6668 | if (VK_SUCCESS == result) { |
| 6669 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6670 | *pSurface = layer_data->WrapNew(*pSurface); |
| 6671 | } |
| 6672 | return result; |
| 6673 | } |
| 6674 | #endif // VK_USE_PLATFORM_METAL_EXT |
| 6675 | |
| 6676 | VkDeviceAddress DispatchGetBufferDeviceAddressEXT( |
| 6677 | VkDevice device, |
| 6678 | const VkBufferDeviceAddressInfoEXT* pInfo) |
| 6679 | { |
| 6680 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6681 | if (!wrap_handles) return layer_data->device_dispatch_table.GetBufferDeviceAddressEXT(device, pInfo); |
| 6682 | safe_VkBufferDeviceAddressInfoEXT *local_pInfo = NULL; |
| 6683 | { |
| 6684 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6685 | if (pInfo) { |
| 6686 | local_pInfo = new safe_VkBufferDeviceAddressInfoEXT(pInfo); |
| 6687 | if (pInfo->buffer) { |
| 6688 | local_pInfo->buffer = layer_data->Unwrap(pInfo->buffer); |
| 6689 | } |
| 6690 | } |
| 6691 | } |
| 6692 | VkDeviceAddress result = layer_data->device_dispatch_table.GetBufferDeviceAddressEXT(device, (const VkBufferDeviceAddressInfoEXT*)local_pInfo); |
| 6693 | if (local_pInfo) { |
| 6694 | delete local_pInfo; |
| 6695 | } |
| 6696 | return result; |
| 6697 | } |
| 6698 | |
| 6699 | VkResult DispatchGetPhysicalDeviceCooperativeMatrixPropertiesNV( |
| 6700 | VkPhysicalDevice physicalDevice, |
| 6701 | uint32_t* pPropertyCount, |
| 6702 | VkCooperativeMatrixPropertiesNV* pProperties) |
| 6703 | { |
| 6704 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 6705 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceCooperativeMatrixPropertiesNV(physicalDevice, pPropertyCount, pProperties); |
| 6706 | |
| 6707 | return result; |
| 6708 | } |
| 6709 | |
| 6710 | VkResult DispatchGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV( |
| 6711 | VkPhysicalDevice physicalDevice, |
| 6712 | uint32_t* pCombinationCount, |
| 6713 | VkFramebufferMixedSamplesCombinationNV* pCombinations) |
| 6714 | { |
| 6715 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 6716 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(physicalDevice, pCombinationCount, pCombinations); |
| 6717 | |
| 6718 | return result; |
| 6719 | } |
| 6720 | |
| 6721 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 6722 | |
| 6723 | VkResult DispatchGetPhysicalDeviceSurfacePresentModes2EXT( |
| 6724 | VkPhysicalDevice physicalDevice, |
| 6725 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, |
| 6726 | uint32_t* pPresentModeCount, |
| 6727 | VkPresentModeKHR* pPresentModes) |
| 6728 | { |
| 6729 | auto layer_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); |
| 6730 | if (!wrap_handles) return layer_data->instance_dispatch_table.GetPhysicalDeviceSurfacePresentModes2EXT(physicalDevice, pSurfaceInfo, pPresentModeCount, pPresentModes); |
| 6731 | safe_VkPhysicalDeviceSurfaceInfo2KHR *local_pSurfaceInfo = NULL; |
| 6732 | { |
| 6733 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6734 | if (pSurfaceInfo) { |
| 6735 | local_pSurfaceInfo = new safe_VkPhysicalDeviceSurfaceInfo2KHR(pSurfaceInfo); |
| 6736 | if (pSurfaceInfo->surface) { |
| 6737 | local_pSurfaceInfo->surface = layer_data->Unwrap(pSurfaceInfo->surface); |
| 6738 | } |
| 6739 | } |
| 6740 | } |
| 6741 | VkResult result = layer_data->instance_dispatch_table.GetPhysicalDeviceSurfacePresentModes2EXT(physicalDevice, (const VkPhysicalDeviceSurfaceInfo2KHR*)local_pSurfaceInfo, pPresentModeCount, pPresentModes); |
| 6742 | if (local_pSurfaceInfo) { |
| 6743 | delete local_pSurfaceInfo; |
| 6744 | } |
| 6745 | return result; |
| 6746 | } |
| 6747 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 6748 | |
| 6749 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 6750 | |
| 6751 | VkResult DispatchAcquireFullScreenExclusiveModeEXT( |
| 6752 | VkDevice device, |
| 6753 | VkSwapchainKHR swapchain) |
| 6754 | { |
| 6755 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6756 | if (!wrap_handles) return layer_data->device_dispatch_table.AcquireFullScreenExclusiveModeEXT(device, swapchain); |
| 6757 | { |
| 6758 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6759 | swapchain = layer_data->Unwrap(swapchain); |
| 6760 | } |
| 6761 | VkResult result = layer_data->device_dispatch_table.AcquireFullScreenExclusiveModeEXT(device, swapchain); |
| 6762 | |
| 6763 | return result; |
| 6764 | } |
| 6765 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 6766 | |
| 6767 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 6768 | |
| 6769 | VkResult DispatchReleaseFullScreenExclusiveModeEXT( |
| 6770 | VkDevice device, |
| 6771 | VkSwapchainKHR swapchain) |
| 6772 | { |
| 6773 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6774 | if (!wrap_handles) return layer_data->device_dispatch_table.ReleaseFullScreenExclusiveModeEXT(device, swapchain); |
| 6775 | { |
| 6776 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6777 | swapchain = layer_data->Unwrap(swapchain); |
| 6778 | } |
| 6779 | VkResult result = layer_data->device_dispatch_table.ReleaseFullScreenExclusiveModeEXT(device, swapchain); |
| 6780 | |
| 6781 | return result; |
| 6782 | } |
| 6783 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 6784 | |
| 6785 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 6786 | |
| 6787 | VkResult DispatchGetDeviceGroupSurfacePresentModes2EXT( |
| 6788 | VkDevice device, |
| 6789 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, |
| 6790 | VkDeviceGroupPresentModeFlagsKHR* pModes) |
| 6791 | { |
| 6792 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6793 | if (!wrap_handles) return layer_data->device_dispatch_table.GetDeviceGroupSurfacePresentModes2EXT(device, pSurfaceInfo, pModes); |
| 6794 | safe_VkPhysicalDeviceSurfaceInfo2KHR *local_pSurfaceInfo = NULL; |
| 6795 | { |
| 6796 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6797 | if (pSurfaceInfo) { |
| 6798 | local_pSurfaceInfo = new safe_VkPhysicalDeviceSurfaceInfo2KHR(pSurfaceInfo); |
| 6799 | if (pSurfaceInfo->surface) { |
| 6800 | local_pSurfaceInfo->surface = layer_data->Unwrap(pSurfaceInfo->surface); |
| 6801 | } |
| 6802 | } |
| 6803 | } |
| 6804 | VkResult result = layer_data->device_dispatch_table.GetDeviceGroupSurfacePresentModes2EXT(device, (const VkPhysicalDeviceSurfaceInfo2KHR*)local_pSurfaceInfo, pModes); |
| 6805 | if (local_pSurfaceInfo) { |
| 6806 | delete local_pSurfaceInfo; |
| 6807 | } |
| 6808 | return result; |
| 6809 | } |
| 6810 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 6811 | |
| 6812 | VkResult DispatchCreateHeadlessSurfaceEXT( |
| 6813 | VkInstance instance, |
| 6814 | const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo, |
| 6815 | const VkAllocationCallbacks* pAllocator, |
| 6816 | VkSurfaceKHR* pSurface) |
| 6817 | { |
| 6818 | auto layer_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 6819 | if (!wrap_handles) return layer_data->instance_dispatch_table.CreateHeadlessSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); |
| 6820 | VkResult result = layer_data->instance_dispatch_table.CreateHeadlessSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); |
| 6821 | if (VK_SUCCESS == result) { |
| 6822 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6823 | *pSurface = layer_data->WrapNew(*pSurface); |
| 6824 | } |
| 6825 | return result; |
| 6826 | } |
| 6827 | |
| 6828 | void DispatchResetQueryPoolEXT( |
| 6829 | VkDevice device, |
| 6830 | VkQueryPool queryPool, |
| 6831 | uint32_t firstQuery, |
| 6832 | uint32_t queryCount) |
| 6833 | { |
| 6834 | auto layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 6835 | if (!wrap_handles) return layer_data->device_dispatch_table.ResetQueryPoolEXT(device, queryPool, firstQuery, queryCount); |
| 6836 | { |
| 6837 | std::lock_guard<std::mutex> lock(dispatch_lock); |
| 6838 | queryPool = layer_data->Unwrap(queryPool); |
| 6839 | } |
| 6840 | layer_data->device_dispatch_table.ResetQueryPoolEXT(device, queryPool, firstQuery, queryCount); |
| 6841 | |
| 6842 | } |