Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * |
| 3 | * Copyright (C) 2015 Google, Inc. |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included |
| 13 | * in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
| 22 | * |
| 23 | * Author: Tobin Ehlis <tobine@google.com> |
| 24 | */ |
| 25 | |
| 26 | // CODEGEN : file vk-layer-generate.py line #1757 |
| 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <string.h> |
| 30 | #include <inttypes.h> |
| 31 | |
| 32 | #include "vulkan/vulkan.h" |
| 33 | #include "vk_loader_platform.h" |
| 34 | |
| 35 | #include <vector> |
| 36 | #include <unordered_map> |
| 37 | |
| 38 | #include "vulkan/vk_layer.h" |
| 39 | #include "vk_layer_config.h" |
| 40 | //#include "vulkan/vk_lunarg_debug_report.h" |
| 41 | #include "vk_layer_table.h" |
| 42 | #include "vk_layer_data.h" |
| 43 | #include "vk_layer_logging.h" |
| 44 | #include "vk_layer_extension_utils.h" |
| 45 | |
| 46 | struct layer_data { |
| 47 | debug_report_data *report_data; |
| 48 | VkDebugReportCallbackEXT logging_callback; |
| 49 | bool wsi_enabled; |
| 50 | |
| 51 | layer_data() : |
| 52 | report_data(nullptr), |
| 53 | logging_callback(VK_NULL_HANDLE), |
| 54 | wsi_enabled(false) |
| 55 | {}; |
| 56 | }; |
| 57 | |
| 58 | struct instExts { |
| 59 | bool wsi_enabled; |
| 60 | }; |
| 61 | |
| 62 | static std::unordered_map<void*, struct instExts> instanceExtMap; |
| 63 | static std::unordered_map<void*, layer_data *> layer_data_map; |
| 64 | static device_table_map unique_objects_device_table_map; |
| 65 | static instance_table_map unique_objects_instance_table_map; |
| 66 | // Structure to wrap returned non-dispatchable objects to guarantee they have unique handles |
| 67 | // address of struct will be used as the unique handle |
| 68 | struct VkUniqueObject |
| 69 | { |
| 70 | uint64_t actualObject; |
| 71 | }; |
| 72 | |
| 73 | static void |
| 74 | initUniqueObjects( |
| 75 | layer_data *my_data, |
| 76 | const VkAllocationCallbacks *pAllocator) |
| 77 | { |
| 78 | uint32_t report_flags = 0; |
| 79 | uint32_t debug_action = 0; |
| 80 | FILE *log_output = NULL; |
| 81 | const char *option_str; |
| 82 | // initialize UniqueObjects options |
| 83 | report_flags = getLayerOptionFlags("UniqueObjectsReportFlags", 0); |
| 84 | getLayerOptionEnum("UniqueObjectsDebugAction", (uint32_t *) &debug_action); |
| 85 | |
| 86 | if (debug_action & VK_DBG_LAYER_ACTION_LOG_MSG) |
| 87 | { |
| 88 | option_str = getLayerOption("UniqueObjectsLogFilename"); |
| 89 | log_output = getLayerLogOutput(option_str, "UniqueObjects"); |
| 90 | VkDebugReportCallbackCreateInfoEXT dbgInfo; |
| 91 | memset(&dbgInfo, 0, sizeof(dbgInfo)); |
| 92 | dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; |
| 93 | dbgInfo.pfnCallback = log_callback; |
| 94 | dbgInfo.pUserData = log_output; |
| 95 | dbgInfo.flags = report_flags; |
| 96 | layer_create_msg_callback(my_data->report_data, &dbgInfo, pAllocator, &my_data->logging_callback); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | // Handle CreateInstance |
| 101 | static void createInstanceRegisterExtensions(const VkInstanceCreateInfo* pCreateInfo, VkInstance instance) |
| 102 | { |
| 103 | uint32_t i; |
| 104 | VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(unique_objects_instance_table_map, instance); |
| 105 | PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr; |
| 106 | pDisp->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR"); |
| 107 | pDisp->GetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); |
| 108 | pDisp->GetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"); |
| 109 | pDisp->GetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) gpa(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"); |
| 110 | #if VK_USE_PLATFORM_WIN32_KHR |
| 111 | pDisp->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR) gpa(instance, "vkCreateWin32SurfaceKHR"); |
| 112 | pDisp->GetPhysicalDeviceWin32PresentationSupportKHR = (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); |
| 113 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 114 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 115 | pDisp->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR) gpa(instance, "vkCreateXcbSurfaceKHR"); |
| 116 | pDisp->GetPhysicalDeviceXcbPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); |
| 117 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 118 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 119 | pDisp->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR) gpa(instance, "vkCreateXlibSurfaceKHR"); |
| 120 | pDisp->GetPhysicalDeviceXlibPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); |
| 121 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 122 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 123 | pDisp->CreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR) gpa(instance, "vkCreateMirSurfaceKHR"); |
| 124 | pDisp->GetPhysicalDeviceMirPresentationSupportKHR = (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceMirPresentationSupportKHR"); |
| 125 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 126 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 127 | pDisp->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR) gpa(instance, "vkCreateWaylandSurfaceKHR"); |
| 128 | pDisp->GetPhysicalDeviceWaylandPresentationSupportKHR = (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR) gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); |
| 129 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 130 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 131 | pDisp->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR) gpa(instance, "vkCreateAndroidSurfaceKHR"); |
| 132 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 133 | |
| 134 | instanceExtMap[pDisp].wsi_enabled = false; |
| 135 | for (i = 0; i < pCreateInfo->enabledExtensionNameCount; i++) { |
| 136 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) |
| 137 | instanceExtMap[pDisp].wsi_enabled = true; |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | VkResult |
| 142 | explicit_CreateInstance( |
| 143 | const VkInstanceCreateInfo *pCreateInfo, |
| 144 | const VkAllocationCallbacks *pAllocator, |
| 145 | VkInstance *pInstance) |
| 146 | { |
| 147 | |
| 148 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(unique_objects_instance_table_map, *pInstance); |
| 149 | VkResult result = pInstanceTable->CreateInstance(pCreateInfo, pAllocator, pInstance); |
| 150 | |
| 151 | if (result == VK_SUCCESS) { |
| 152 | layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); |
| 153 | my_data->report_data = debug_report_create_instance( |
| 154 | pInstanceTable, |
| 155 | *pInstance, |
| 156 | pCreateInfo->enabledExtensionNameCount, |
| 157 | pCreateInfo->ppEnabledExtensionNames); |
| 158 | createInstanceRegisterExtensions(pCreateInfo, *pInstance); |
| 159 | |
| 160 | initUniqueObjects(my_data, pAllocator); |
| 161 | } |
| 162 | return result; |
| 163 | } |
| 164 | |
| 165 | // Handle CreateDevice |
| 166 | static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device) |
| 167 | { |
| 168 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 169 | VkLayerDispatchTable *pDisp = get_dispatch_table(unique_objects_device_table_map, device); |
| 170 | PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr; |
| 171 | pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(device, "vkCreateSwapchainKHR"); |
| 172 | pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) gpa(device, "vkDestroySwapchainKHR"); |
| 173 | pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) gpa(device, "vkGetSwapchainImagesKHR"); |
| 174 | pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(device, "vkAcquireNextImageKHR"); |
| 175 | pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR) gpa(device, "vkQueuePresentKHR"); |
| 176 | my_device_data->wsi_enabled = false; |
| 177 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionNameCount; i++) { |
| 178 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) |
| 179 | my_device_data->wsi_enabled = true; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | VkResult |
| 184 | explicit_CreateDevice( |
| 185 | VkPhysicalDevice gpu, |
| 186 | const VkDeviceCreateInfo *pCreateInfo, |
| 187 | const VkAllocationCallbacks *pAllocator, |
| 188 | VkDevice *pDevice) |
| 189 | { |
| 190 | VkLayerDispatchTable *pDeviceTable = get_dispatch_table(unique_objects_device_table_map, *pDevice); |
| 191 | VkResult result = pDeviceTable->CreateDevice(gpu, pCreateInfo, pAllocator, pDevice); |
| 192 | if (result == VK_SUCCESS) { |
| 193 | layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map); |
| 194 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); |
| 195 | my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); |
| 196 | createDeviceRegisterExtensions(pCreateInfo, *pDevice); |
| 197 | } |
| 198 | return result; |
| 199 | } |
| 200 | |
| 201 | VkResult explicit_QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) |
| 202 | { |
| 203 | // UNWRAP USES: |
| 204 | // 0 : fence,VkFence |
| 205 | if (VK_NULL_HANDLE != fence) { |
| 206 | fence = (VkFence)((VkUniqueObject*)fence)->actualObject; |
| 207 | } |
| 208 | // waitSemaphoreCount : pSubmits[submitCount]->pWaitSemaphores,VkSemaphore |
| 209 | std::vector<VkSemaphore> original_pWaitSemaphores = {}; |
| 210 | // signalSemaphoreCount : pSubmits[submitCount]->pSignalSemaphores,VkSemaphore |
| 211 | std::vector<VkSemaphore> original_pSignalSemaphores = {}; |
| 212 | if (pSubmits) { |
| 213 | for (uint32_t index0=0; index0<submitCount; ++index0) { |
| 214 | if (pSubmits[index0].pWaitSemaphores) { |
| 215 | for (uint32_t index1=0; index1<pSubmits[index0].waitSemaphoreCount; ++index1) { |
| 216 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pSubmits[index0].pWaitSemaphores); |
| 217 | original_pWaitSemaphores.push_back(pSubmits[index0].pWaitSemaphores[index1]); |
| 218 | *(ppSemaphore[index1]) = (VkSemaphore)((VkUniqueObject*)pSubmits[index0].pWaitSemaphores[index1])->actualObject; |
| 219 | } |
| 220 | } |
| 221 | if (pSubmits[index0].pSignalSemaphores) { |
| 222 | for (uint32_t index1=0; index1<pSubmits[index0].signalSemaphoreCount; ++index1) { |
| 223 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pSubmits[index0].pSignalSemaphores); |
| 224 | original_pSignalSemaphores.push_back(pSubmits[index0].pSignalSemaphores[index1]); |
| 225 | *(ppSemaphore[index1]) = (VkSemaphore)((VkUniqueObject*)pSubmits[index0].pSignalSemaphores[index1])->actualObject; |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | VkResult result = get_dispatch_table(unique_objects_device_table_map, queue)->QueueSubmit(queue, submitCount, pSubmits, fence); |
| 231 | if (pSubmits) { |
| 232 | for (uint32_t index0=0; index0<submitCount; ++index0) { |
| 233 | if (pSubmits[index0].pWaitSemaphores) { |
| 234 | for (uint32_t index1=0; index1<pSubmits[index0].waitSemaphoreCount; ++index1) { |
| 235 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pSubmits[index0].pWaitSemaphores); |
| 236 | *(ppSemaphore[index1]) = original_pWaitSemaphores[index1]; |
| 237 | } |
| 238 | } |
| 239 | if (pSubmits[index0].pSignalSemaphores) { |
| 240 | for (uint32_t index1=0; index1<pSubmits[index0].signalSemaphoreCount; ++index1) { |
| 241 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pSubmits[index0].pSignalSemaphores); |
| 242 | *(ppSemaphore[index1]) = original_pSignalSemaphores[index1]; |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | return result; |
| 248 | } |
| 249 | |
| 250 | VkResult explicit_QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) |
| 251 | { |
| 252 | // UNWRAP USES: |
| 253 | // 0 : pBindInfo[bindInfoCount]->pBufferBinds[bufferBindCount]->buffer,VkBuffer, pBindInfo[bindInfoCount]->pBufferBinds[bufferBindCount]->pBinds[bindCount]->memory,VkDeviceMemory, pBindInfo[bindInfoCount]->pImageOpaqueBinds[imageOpaqueBindCount]->image,VkImage, pBindInfo[bindInfoCount]->pImageOpaqueBinds[imageOpaqueBindCount]->pBinds[bindCount]->memory,VkDeviceMemory, pBindInfo[bindInfoCount]->pImageBinds[imageBindCount]->image,VkImage, pBindInfo[bindInfoCount]->pImageBinds[imageBindCount]->pBinds[bindCount]->memory,VkDeviceMemory |
| 254 | std::vector<VkBuffer> original_buffer = {}; |
| 255 | std::vector<VkDeviceMemory> original_memory1 = {}; |
| 256 | std::vector<VkImage> original_image1 = {}; |
| 257 | std::vector<VkDeviceMemory> original_memory2 = {}; |
| 258 | std::vector<VkImage> original_image2 = {}; |
| 259 | std::vector<VkDeviceMemory> original_memory3 = {}; |
| 260 | std::vector<VkSemaphore> original_pWaitSemaphores = {}; |
| 261 | std::vector<VkSemaphore> original_pSignalSemaphores = {}; |
| 262 | if (pBindInfo) { |
| 263 | for (uint32_t index0=0; index0<bindInfoCount; ++index0) { |
| 264 | if (pBindInfo[index0].pBufferBinds) { |
| 265 | for (uint32_t index1=0; index1<pBindInfo[index0].bufferBindCount; ++index1) { |
| 266 | if (pBindInfo[index0].pBufferBinds[index1].buffer) { |
| 267 | VkBuffer* pBuffer = (VkBuffer*)&(pBindInfo[index0].pBufferBinds[index1].buffer); |
| 268 | original_buffer.push_back(pBindInfo[index0].pBufferBinds[index1].buffer); |
| 269 | *(pBuffer) = (VkBuffer)((VkUniqueObject*)pBindInfo[index0].pBufferBinds[index1].buffer)->actualObject; |
| 270 | } |
| 271 | if (pBindInfo[index0].pBufferBinds[index1].pBinds) { |
| 272 | for (uint32_t index2=0; index2<pBindInfo[index0].pBufferBinds[index1].bindCount; ++index2) { |
| 273 | if (pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory) { |
| 274 | VkDeviceMemory* pDeviceMemory = (VkDeviceMemory*)&(pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory); |
| 275 | original_memory1.push_back(pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory); |
| 276 | *(pDeviceMemory) = (VkDeviceMemory)((VkUniqueObject*)pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory)->actualObject; |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | if (pBindInfo[index0].pImageOpaqueBinds) { |
| 283 | for (uint32_t index1=0; index1<pBindInfo[index0].imageOpaqueBindCount; ++index1) { |
| 284 | if (pBindInfo[index0].pImageOpaqueBinds[index1].image) { |
| 285 | VkImage* pImage = (VkImage*)&(pBindInfo[index0].pImageOpaqueBinds[index1].image); |
| 286 | original_image1.push_back(pBindInfo[index0].pImageOpaqueBinds[index1].image); |
| 287 | *(pImage) = (VkImage)((VkUniqueObject*)pBindInfo[index0].pImageOpaqueBinds[index1].image)->actualObject; |
| 288 | } |
| 289 | if (pBindInfo[index0].pImageOpaqueBinds[index1].pBinds) { |
| 290 | for (uint32_t index2=0; index2<pBindInfo[index0].pImageOpaqueBinds[index1].bindCount; ++index2) { |
| 291 | if (pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory) { |
| 292 | VkDeviceMemory* pDeviceMemory = (VkDeviceMemory*)&(pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory); |
| 293 | original_memory2.push_back(pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory); |
| 294 | *(pDeviceMemory) = (VkDeviceMemory)((VkUniqueObject*)pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory)->actualObject; |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | if (pBindInfo[index0].pImageBinds) { |
| 301 | for (uint32_t index1=0; index1<pBindInfo[index0].imageBindCount; ++index1) { |
| 302 | if (pBindInfo[index0].pImageBinds[index1].image) { |
| 303 | VkImage* pImage = (VkImage*)&(pBindInfo[index0].pImageBinds[index1].image); |
| 304 | original_image2.push_back(pBindInfo[index0].pImageBinds[index1].image); |
| 305 | *(pImage) = (VkImage)((VkUniqueObject*)pBindInfo[index0].pImageBinds[index1].image)->actualObject; |
| 306 | } |
| 307 | if (pBindInfo[index0].pImageBinds[index1].pBinds) { |
| 308 | for (uint32_t index2=0; index2<pBindInfo[index0].pImageBinds[index1].bindCount; ++index2) { |
| 309 | if (pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory) { |
| 310 | VkDeviceMemory* pDeviceMemory = (VkDeviceMemory*)&(pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory); |
| 311 | original_memory3.push_back(pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory); |
| 312 | *(pDeviceMemory) = (VkDeviceMemory)((VkUniqueObject*)pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory)->actualObject; |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | if (pBindInfo[index0].pWaitSemaphores) { |
| 319 | for (uint32_t index1=0; index1<pBindInfo[index0].waitSemaphoreCount; ++index1) { |
| 320 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pBindInfo[index0].pWaitSemaphores); |
| 321 | original_pWaitSemaphores.push_back(pBindInfo[index0].pWaitSemaphores[index1]); |
| 322 | *(ppSemaphore[index1]) = (VkSemaphore)((VkUniqueObject*)pBindInfo[index0].pWaitSemaphores[index1])->actualObject; |
| 323 | } |
| 324 | } |
| 325 | if (pBindInfo[index0].pSignalSemaphores) { |
| 326 | for (uint32_t index1=0; index1<pBindInfo[index0].signalSemaphoreCount; ++index1) { |
| 327 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pBindInfo[index0].pSignalSemaphores); |
| 328 | original_pSignalSemaphores.push_back(pBindInfo[index0].pSignalSemaphores[index1]); |
| 329 | *(ppSemaphore[index1]) = (VkSemaphore)((VkUniqueObject*)pBindInfo[index0].pSignalSemaphores[index1])->actualObject; |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | if (VK_NULL_HANDLE != fence) { |
| 335 | fence = (VkFence)((VkUniqueObject*)fence)->actualObject; |
| 336 | } |
| 337 | VkResult result = get_dispatch_table(unique_objects_device_table_map, queue)->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
| 338 | if (pBindInfo) { |
| 339 | for (uint32_t index0=0; index0<bindInfoCount; ++index0) { |
| 340 | if (pBindInfo[index0].pBufferBinds) { |
| 341 | for (uint32_t index1=0; index1<pBindInfo[index0].bufferBindCount; ++index1) { |
| 342 | if (pBindInfo[index0].pBufferBinds[index1].buffer) { |
| 343 | VkBuffer* pBuffer = (VkBuffer*)&(pBindInfo[index0].pBufferBinds[index1].buffer); |
| 344 | *(pBuffer) = original_buffer[index1]; |
| 345 | } |
| 346 | if (pBindInfo[index0].pBufferBinds[index1].pBinds) { |
| 347 | for (uint32_t index2=0; index2<pBindInfo[index0].pBufferBinds[index1].bindCount; ++index2) { |
| 348 | if (pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory) { |
| 349 | VkDeviceMemory* pDeviceMemory = (VkDeviceMemory*)&(pBindInfo[index0].pBufferBinds[index1].pBinds[index2].memory); |
| 350 | *(pDeviceMemory) = original_memory1[index2]; |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | if (pBindInfo[index0].pImageOpaqueBinds) { |
| 357 | for (uint32_t index1=0; index1<pBindInfo[index0].imageOpaqueBindCount; ++index1) { |
| 358 | if (pBindInfo[index0].pImageOpaqueBinds[index1].image) { |
| 359 | VkImage* pImage = (VkImage*)&(pBindInfo[index0].pImageOpaqueBinds[index1].image); |
| 360 | *(pImage) = original_image1[index1]; |
| 361 | } |
| 362 | if (pBindInfo[index0].pImageOpaqueBinds[index1].pBinds) { |
| 363 | for (uint32_t index2=0; index2<pBindInfo[index0].pImageOpaqueBinds[index1].bindCount; ++index2) { |
| 364 | if (pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory) { |
| 365 | VkDeviceMemory* pDeviceMemory = (VkDeviceMemory*)&(pBindInfo[index0].pImageOpaqueBinds[index1].pBinds[index2].memory); |
| 366 | *(pDeviceMemory) = original_memory2[index2]; |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | if (pBindInfo[index0].pImageBinds) { |
| 373 | for (uint32_t index1=0; index1<pBindInfo[index0].imageBindCount; ++index1) { |
| 374 | if (pBindInfo[index0].pImageBinds[index1].image) { |
| 375 | VkImage* pImage = (VkImage*)&(pBindInfo[index0].pImageBinds[index1].image); |
| 376 | *(pImage) = original_image2[index1]; |
| 377 | } |
| 378 | if (pBindInfo[index0].pImageBinds[index1].pBinds) { |
| 379 | for (uint32_t index2=0; index2<pBindInfo[index0].pImageBinds[index1].bindCount; ++index2) { |
| 380 | if (pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory) { |
| 381 | VkDeviceMemory* pDeviceMemory = (VkDeviceMemory*)&(pBindInfo[index0].pImageBinds[index1].pBinds[index2].memory); |
| 382 | *(pDeviceMemory) = original_memory3[index2]; |
| 383 | } |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | if (pBindInfo[index0].pWaitSemaphores) { |
| 389 | for (uint32_t index1=0; index1<pBindInfo[index0].waitSemaphoreCount; ++index1) { |
| 390 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pBindInfo[index0].pWaitSemaphores); |
| 391 | *(ppSemaphore[index1]) = original_pWaitSemaphores[index1]; |
| 392 | } |
| 393 | } |
| 394 | if (pBindInfo[index0].pSignalSemaphores) { |
| 395 | for (uint32_t index1=0; index1<pBindInfo[index0].signalSemaphoreCount; ++index1) { |
| 396 | VkSemaphore** ppSemaphore = (VkSemaphore**)&(pBindInfo[index0].pSignalSemaphores); |
| 397 | *(ppSemaphore[index1]) = original_pSignalSemaphores[index1]; |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | return result; |
| 403 | } |
| 404 | |
| 405 | VkResult explicit_CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) |
| 406 | { |
| 407 | // UNWRAP USES: |
| 408 | // 0 : pipelineCache,VkPipelineCache, pCreateInfos[createInfoCount]->stage[0]->module,VkShaderModule, pCreateInfos[createInfoCount]->layout,VkPipelineLayout, pCreateInfos[createInfoCount]->basePipelineHandle,VkPipeline |
| 409 | if (VK_NULL_HANDLE != pipelineCache) { |
| 410 | pipelineCache = (VkPipelineCache)((VkUniqueObject*)pipelineCache)->actualObject; |
| 411 | } |
| 412 | std::vector<VkShaderModule> original_module = {}; |
| 413 | std::vector<VkPipelineLayout> original_layout = {}; |
| 414 | std::vector<VkPipeline> original_basePipelineHandle = {}; |
| 415 | if (pCreateInfos) { |
| 416 | for (uint32_t index0=0; index0<createInfoCount; ++index0) { |
| 417 | if (pCreateInfos[index0].stage.module) { |
| 418 | VkShaderModule* pShaderModule = (VkShaderModule*)&(pCreateInfos[index0].stage.module); |
| 419 | original_module.push_back(pCreateInfos[index0].stage.module); |
| 420 | *(pShaderModule) = (VkShaderModule)((VkUniqueObject*)pCreateInfos[index0].stage.module)->actualObject; |
| 421 | } |
| 422 | if (pCreateInfos[index0].layout) { |
| 423 | VkPipelineLayout* pPipelineLayout = (VkPipelineLayout*)&(pCreateInfos[index0].layout); |
| 424 | original_layout.push_back(pCreateInfos[index0].layout); |
| 425 | *(pPipelineLayout) = (VkPipelineLayout)((VkUniqueObject*)pCreateInfos[index0].layout)->actualObject; |
| 426 | } |
| 427 | if (pCreateInfos[index0].basePipelineHandle) { |
| 428 | VkPipeline* pPipeline = (VkPipeline*)&(pCreateInfos[index0].basePipelineHandle); |
| 429 | original_basePipelineHandle.push_back(pCreateInfos[index0].basePipelineHandle); |
| 430 | *(pPipeline) = (VkPipeline)((VkUniqueObject*)pCreateInfos[index0].basePipelineHandle)->actualObject; |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | VkResult result = get_dispatch_table(unique_objects_device_table_map, device)->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
| 435 | if (pCreateInfos) { |
| 436 | for (uint32_t index0=0; index0<createInfoCount; ++index0) { |
| 437 | if (pCreateInfos[index0].stage.module) { |
| 438 | VkShaderModule* pShaderModule = (VkShaderModule*)&(pCreateInfos[index0].stage.module); |
| 439 | *(pShaderModule) = original_module[index0]; |
| 440 | } |
| 441 | if (pCreateInfos[index0].layout) { |
| 442 | VkPipelineLayout* pPipelineLayout = (VkPipelineLayout*)&(pCreateInfos[index0].layout); |
| 443 | *(pPipelineLayout) = original_layout[index0]; |
| 444 | } |
| 445 | if (pCreateInfos[index0].basePipelineHandle) { |
| 446 | VkPipeline* pPipeline = (VkPipeline*)&(pCreateInfos[index0].basePipelineHandle); |
| 447 | *(pPipeline) = original_basePipelineHandle[index0]; |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | if (VK_SUCCESS == result) { |
| 452 | std::vector<VkUniqueObject*> uniquePipelines = {}; |
| 453 | for (uint32_t i=0; i<createInfoCount; ++i) { |
| 454 | uniquePipelines.push_back(new VkUniqueObject()); |
| 455 | uniquePipelines[i]->actualObject = (uint64_t)pPipelines[i]; |
| 456 | pPipelines[i] = (VkPipeline)uniquePipelines[i]; |
| 457 | } |
| 458 | } |
| 459 | return result; |
| 460 | } |
| 461 | |
| 462 | VkResult explicit_CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) |
| 463 | { |
| 464 | // UNWRAP USES: |
| 465 | // 0 : pipelineCache,VkPipelineCache, pCreateInfos[createInfoCount]->pStages[stageCount]->module,VkShaderModule, pCreateInfos[createInfoCount]->layout,VkPipelineLayout, pCreateInfos[createInfoCount]->renderPass,VkRenderPass, pCreateInfos[createInfoCount]->basePipelineHandle,VkPipeline |
| 466 | if (VK_NULL_HANDLE != pipelineCache) { |
| 467 | pipelineCache = (VkPipelineCache)((VkUniqueObject*)pipelineCache)->actualObject; |
| 468 | } |
| 469 | std::vector<VkShaderModule> original_module = {}; |
| 470 | std::vector<VkPipelineLayout> original_layout = {}; |
| 471 | std::vector<VkRenderPass> original_renderPass = {}; |
| 472 | std::vector<VkPipeline> original_basePipelineHandle = {}; |
| 473 | if (pCreateInfos) { |
| 474 | for (uint32_t index0=0; index0<createInfoCount; ++index0) { |
| 475 | if (pCreateInfos[index0].pStages) { |
| 476 | for (uint32_t index1=0; index1<pCreateInfos[index0].stageCount; ++index1) { |
| 477 | if (pCreateInfos[index0].pStages[index1].module) { |
| 478 | VkShaderModule* pShaderModule = (VkShaderModule*)&(pCreateInfos[index0].pStages[index1].module); |
| 479 | original_module.push_back(pCreateInfos[index0].pStages[index1].module); |
| 480 | *(pShaderModule) = (VkShaderModule)((VkUniqueObject*)pCreateInfos[index0].pStages[index1].module)->actualObject; |
| 481 | } |
| 482 | } |
| 483 | } |
| 484 | if (pCreateInfos[index0].layout) { |
| 485 | VkPipelineLayout* pPipelineLayout = (VkPipelineLayout*)&(pCreateInfos[index0].layout); |
| 486 | original_layout.push_back(pCreateInfos[index0].layout); |
| 487 | *(pPipelineLayout) = (VkPipelineLayout)((VkUniqueObject*)pCreateInfos[index0].layout)->actualObject; |
| 488 | } |
| 489 | if (pCreateInfos[index0].renderPass) { |
| 490 | VkRenderPass* pRenderPass = (VkRenderPass*)&(pCreateInfos[index0].renderPass); |
| 491 | original_renderPass.push_back(pCreateInfos[index0].renderPass); |
| 492 | *(pRenderPass) = (VkRenderPass)((VkUniqueObject*)pCreateInfos[index0].renderPass)->actualObject; |
| 493 | } |
| 494 | if (pCreateInfos[index0].basePipelineHandle) { |
| 495 | VkPipeline* pPipeline = (VkPipeline*)&(pCreateInfos[index0].basePipelineHandle); |
| 496 | original_basePipelineHandle.push_back(pCreateInfos[index0].basePipelineHandle); |
| 497 | *(pPipeline) = (VkPipeline)((VkUniqueObject*)pCreateInfos[index0].basePipelineHandle)->actualObject; |
| 498 | } |
| 499 | } |
| 500 | } |
| 501 | VkResult result = get_dispatch_table(unique_objects_device_table_map, device)->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
| 502 | if (pCreateInfos) { |
| 503 | for (uint32_t index0=0; index0<createInfoCount; ++index0) { |
| 504 | if (pCreateInfos[index0].pStages) { |
| 505 | for (uint32_t index1=0; index1<pCreateInfos[index0].stageCount; ++index1) { |
| 506 | if (pCreateInfos[index0].pStages[index1].module) { |
| 507 | VkShaderModule* pShaderModule = (VkShaderModule*)&(pCreateInfos[index0].pStages[index1].module); |
| 508 | *(pShaderModule) = original_module[index1]; |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | if (pCreateInfos[index0].layout) { |
| 513 | VkPipelineLayout* pPipelineLayout = (VkPipelineLayout*)&(pCreateInfos[index0].layout); |
| 514 | *(pPipelineLayout) = original_layout[index0]; |
| 515 | } |
| 516 | if (pCreateInfos[index0].renderPass) { |
| 517 | VkRenderPass* pRenderPass = (VkRenderPass*)&(pCreateInfos[index0].renderPass); |
| 518 | *(pRenderPass) = original_renderPass[index0]; |
| 519 | } |
| 520 | if (pCreateInfos[index0].basePipelineHandle) { |
| 521 | VkPipeline* pPipeline = (VkPipeline*)&(pCreateInfos[index0].basePipelineHandle); |
| 522 | *(pPipeline) = original_basePipelineHandle[index0]; |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | if (VK_SUCCESS == result) { |
| 527 | std::vector<VkUniqueObject*> uniquePipelines = {}; |
| 528 | for (uint32_t i=0; i<createInfoCount; ++i) { |
| 529 | uniquePipelines.push_back(new VkUniqueObject()); |
| 530 | uniquePipelines[i]->actualObject = (uint64_t)pPipelines[i]; |
| 531 | pPipelines[i] = (VkPipeline)uniquePipelines[i]; |
| 532 | } |
| 533 | } |
| 534 | return result; |
| 535 | } |
| 536 | |
| 537 | void explicit_UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies) |
| 538 | { |
| 539 | // UNWRAP USES: |
| 540 | // 0 : pDescriptorWrites[descriptorWriteCount]->dstSet,VkDescriptorSet, pDescriptorWrites[descriptorWriteCount]->pImageInfo[descriptorCount]->sampler,VkSampler, pDescriptorWrites[descriptorWriteCount]->pImageInfo[descriptorCount]->imageView,VkImageView, pDescriptorWrites[descriptorWriteCount]->pBufferInfo[descriptorCount]->buffer,VkBuffer, pDescriptorCopies[descriptorCopyCount]->srcSet,VkDescriptorSet, pDescriptorCopies[descriptorCopyCount]->dstSet,VkDescriptorSet |
| 541 | std::vector<VkDescriptorSet> original_dstSet1 = {}; |
| 542 | std::vector<VkSampler> original_sampler = {}; |
| 543 | std::vector<VkImageView> original_imageView = {}; |
| 544 | std::vector<VkBuffer> original_buffer = {}; |
| 545 | std::vector<VkDescriptorSet> original_srcSet = {}; |
| 546 | std::vector<VkDescriptorSet> original_dstSet2 = {}; |
| 547 | // descriptorCount : pDescriptorWrites[descriptorWriteCount]->pTexelBufferView,VkBufferView |
| 548 | std::vector<VkBufferView> original_pTexelBufferView = {}; |
| 549 | if (pDescriptorWrites) { |
| 550 | for (uint32_t index0=0; index0<descriptorWriteCount; ++index0) { |
| 551 | if (pDescriptorWrites[index0].dstSet) { |
| 552 | VkDescriptorSet* pDescriptorSet = (VkDescriptorSet*)&(pDescriptorWrites[index0].dstSet); |
| 553 | original_dstSet1.push_back(pDescriptorWrites[index0].dstSet); |
| 554 | *(pDescriptorSet) = (VkDescriptorSet)((VkUniqueObject*)pDescriptorWrites[index0].dstSet)->actualObject; |
| 555 | } |
| 556 | if (pDescriptorWrites[index0].pImageInfo) { |
| 557 | for (uint32_t index1=0; index1<pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 558 | if (pDescriptorWrites[index0].pImageInfo[index1].sampler) { |
| 559 | VkSampler* pSampler = (VkSampler*)&(pDescriptorWrites[index0].pImageInfo[index1].sampler); |
| 560 | original_sampler.push_back(pDescriptorWrites[index0].pImageInfo[index1].sampler); |
| 561 | *(pSampler) = (VkSampler)((VkUniqueObject*)pDescriptorWrites[index0].pImageInfo[index1].sampler)->actualObject; |
| 562 | } |
| 563 | if (pDescriptorWrites[index0].pImageInfo[index1].imageView) { |
| 564 | VkImageView* pImageView = (VkImageView*)&(pDescriptorWrites[index0].pImageInfo[index1].imageView); |
| 565 | original_imageView.push_back(pDescriptorWrites[index0].pImageInfo[index1].imageView); |
| 566 | *(pImageView) = (VkImageView)((VkUniqueObject*)pDescriptorWrites[index0].pImageInfo[index1].imageView)->actualObject; |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | if (pDescriptorWrites[index0].pBufferInfo) { |
| 571 | for (uint32_t index1=0; index1<pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 572 | if (pDescriptorWrites[index0].pBufferInfo[index1].buffer) { |
| 573 | VkBuffer* pBuffer = (VkBuffer*)&(pDescriptorWrites[index0].pBufferInfo[index1].buffer); |
| 574 | original_buffer.push_back(pDescriptorWrites[index0].pBufferInfo[index1].buffer); |
| 575 | *(pBuffer) = (VkBuffer)((VkUniqueObject*)pDescriptorWrites[index0].pBufferInfo[index1].buffer)->actualObject; |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | if (pDescriptorWrites[index0].pTexelBufferView) { |
| 580 | for (uint32_t index1=0; index1<pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 581 | VkBufferView** ppBufferView = (VkBufferView**)&(pDescriptorWrites[index0].pTexelBufferView); |
| 582 | original_pTexelBufferView.push_back(pDescriptorWrites[index0].pTexelBufferView[index1]); |
| 583 | *(ppBufferView[index1]) = (VkBufferView)((VkUniqueObject*)pDescriptorWrites[index0].pTexelBufferView[index1])->actualObject; |
| 584 | } |
| 585 | } |
| 586 | } |
| 587 | } |
| 588 | if (pDescriptorCopies) { |
| 589 | for (uint32_t index0=0; index0<descriptorCopyCount; ++index0) { |
| 590 | if (pDescriptorCopies[index0].srcSet) { |
| 591 | VkDescriptorSet* pDescriptorSet = (VkDescriptorSet*)&(pDescriptorCopies[index0].srcSet); |
| 592 | original_srcSet.push_back(pDescriptorCopies[index0].srcSet); |
| 593 | *(pDescriptorSet) = (VkDescriptorSet)((VkUniqueObject*)pDescriptorCopies[index0].srcSet)->actualObject; |
| 594 | } |
| 595 | if (pDescriptorCopies[index0].dstSet) { |
| 596 | VkDescriptorSet* pDescriptorSet = (VkDescriptorSet*)&(pDescriptorCopies[index0].dstSet); |
| 597 | original_dstSet2.push_back(pDescriptorCopies[index0].dstSet); |
| 598 | *(pDescriptorSet) = (VkDescriptorSet)((VkUniqueObject*)pDescriptorCopies[index0].dstSet)->actualObject; |
| 599 | } |
| 600 | } |
| 601 | } |
| 602 | get_dispatch_table(unique_objects_device_table_map, device)->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
| 603 | if (pDescriptorWrites) { |
| 604 | for (uint32_t index0=0; index0<descriptorWriteCount; ++index0) { |
| 605 | if (pDescriptorWrites[index0].dstSet) { |
| 606 | VkDescriptorSet* pDescriptorSet = (VkDescriptorSet*)&(pDescriptorWrites[index0].dstSet); |
| 607 | *(pDescriptorSet) = original_dstSet1[index0]; |
| 608 | } |
| 609 | if (pDescriptorWrites[index0].pImageInfo) { |
| 610 | for (uint32_t index1=0; index1<pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 611 | if (pDescriptorWrites[index0].pImageInfo[index1].sampler) { |
| 612 | VkSampler* pSampler = (VkSampler*)&(pDescriptorWrites[index0].pImageInfo[index1].sampler); |
| 613 | *(pSampler) = original_sampler[index1]; |
| 614 | } |
| 615 | if (pDescriptorWrites[index0].pImageInfo[index1].imageView) { |
| 616 | VkImageView* pImageView = (VkImageView*)&(pDescriptorWrites[index0].pImageInfo[index1].imageView); |
| 617 | *(pImageView) = original_imageView[index1]; |
| 618 | } |
| 619 | } |
| 620 | } |
| 621 | if (pDescriptorWrites[index0].pBufferInfo) { |
| 622 | for (uint32_t index1=0; index1<pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 623 | if (pDescriptorWrites[index0].pBufferInfo[index1].buffer) { |
| 624 | VkBuffer* pBuffer = (VkBuffer*)&(pDescriptorWrites[index0].pBufferInfo[index1].buffer); |
| 625 | *(pBuffer) = original_buffer[index1]; |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | if (pDescriptorWrites[index0].pTexelBufferView) { |
| 630 | for (uint32_t index1=0; index1<pDescriptorWrites[index0].descriptorCount; ++index1) { |
| 631 | VkBufferView** ppBufferView = (VkBufferView**)&(pDescriptorWrites[index0].pTexelBufferView); |
| 632 | *(ppBufferView[index1]) = original_pTexelBufferView[index1]; |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | if (pDescriptorCopies) { |
| 638 | for (uint32_t index0=0; index0<descriptorCopyCount; ++index0) { |
| 639 | if (pDescriptorCopies[index0].srcSet) { |
| 640 | VkDescriptorSet* pDescriptorSet = (VkDescriptorSet*)&(pDescriptorCopies[index0].srcSet); |
| 641 | *(pDescriptorSet) = original_srcSet[index0]; |
| 642 | } |
| 643 | if (pDescriptorCopies[index0].dstSet) { |
| 644 | VkDescriptorSet* pDescriptorSet = (VkDescriptorSet*)&(pDescriptorCopies[index0].dstSet); |
| 645 | *(pDescriptorSet) = original_dstSet2[index0]; |
| 646 | } |
| 647 | } |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | VkResult explicit_GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) |
| 652 | { |
| 653 | // UNWRAP USES: |
| 654 | // 0 : swapchain,VkSwapchainKHR, pSwapchainImages,VkImage |
| 655 | if (VK_NULL_HANDLE != swapchain) { |
| 656 | swapchain = (VkSwapchainKHR)((VkUniqueObject*)swapchain)->actualObject; |
| 657 | } |
| 658 | VkResult result = get_dispatch_table(unique_objects_device_table_map, device)->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 659 | // TODO : Need to add corresponding code to delete these images |
| 660 | if (VK_SUCCESS == result) { |
| 661 | if ((*pSwapchainImageCount > 0) && pSwapchainImages) { |
| 662 | std::vector<VkUniqueObject*> uniqueImages = {}; |
| 663 | for (uint32_t i=0; i<*pSwapchainImageCount; ++i) { |
| 664 | uniqueImages.push_back(new VkUniqueObject()); |
| 665 | uniqueImages[i]->actualObject = (uint64_t)pSwapchainImages[i]; |
| 666 | pSwapchainImages[i] = (VkImage)uniqueImages[i]; |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | return result; |
| 671 | } |