Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2016 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2016 Valve Corporation |
| 3 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2016 Google Inc. |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 5 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and/or associated documentation files (the "Materials"), to |
| 8 | * deal in the Materials without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Materials, and to permit persons to whom the Materials |
| 11 | * are furnished to do so, subject to the following conditions: |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 12 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 13 | * The above copyright notice(s) and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Materials. |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 15 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 16 | * The Materials are Confidential Information as defined by the Khronos |
| 17 | * Membership Agreement until designated non-confidential by Khronos, at which |
| 18 | * point this condition clause shall be removed. |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 19 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 23 | * |
| 24 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 25 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 26 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 27 | * USE OR OTHER DEALINGS IN THE MATERIALS |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 28 | * |
| 29 | * Author: Tobin Ehlis <tobine@google.com> |
| 30 | */ |
| 31 | |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 32 | #include <stdio.h> |
| 33 | #include <stdlib.h> |
| 34 | #include <string.h> |
| 35 | #include <inttypes.h> |
| 36 | |
| 37 | #include "vulkan/vulkan.h" |
| 38 | #include "vk_loader_platform.h" |
| 39 | |
| 40 | #include <vector> |
| 41 | #include <unordered_map> |
| 42 | |
| 43 | #include "vulkan/vk_layer.h" |
| 44 | #include "vk_layer_config.h" |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 45 | #include "vk_layer_table.h" |
| 46 | #include "vk_layer_data.h" |
| 47 | #include "vk_layer_logging.h" |
| 48 | #include "vk_layer_extension_utils.h" |
| 49 | |
| 50 | struct layer_data { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 51 | bool wsi_enabled; |
| 52 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 53 | layer_data() : wsi_enabled(false){}; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | struct instExts { |
| 57 | bool wsi_enabled; |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 58 | bool xlib_enabled; |
| 59 | bool xcb_enabled; |
| 60 | bool wayland_enabled; |
| 61 | bool mir_enabled; |
| 62 | bool android_enabled; |
| 63 | bool win32_enabled; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 64 | }; |
| 65 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 66 | static std::unordered_map<void *, struct instExts> instanceExtMap; |
| 67 | static std::unordered_map<void *, layer_data *> layer_data_map; |
| 68 | static device_table_map unique_objects_device_table_map; |
| 69 | static instance_table_map unique_objects_instance_table_map; |
| 70 | // Structure to wrap returned non-dispatchable objects to guarantee they have |
| 71 | // unique handles |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 72 | // address of struct will be used as the unique handle |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 73 | struct VkUniqueObject { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 74 | uint64_t actualObject; |
| 75 | }; |
| 76 | |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 77 | // Handle CreateInstance |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 78 | static void |
| 79 | createInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, |
| 80 | VkInstance instance) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 81 | uint32_t i; |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 82 | VkLayerInstanceDispatchTable *pDisp = |
| 83 | get_dispatch_table(unique_objects_instance_table_map, instance); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 84 | PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr; |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 85 | pDisp->GetPhysicalDeviceSurfaceSupportKHR = |
| 86 | (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa( |
| 87 | instance, "vkGetPhysicalDeviceSurfaceSupportKHR"); |
| 88 | pDisp->GetPhysicalDeviceSurfaceCapabilitiesKHR = |
| 89 | (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa( |
| 90 | instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); |
| 91 | pDisp->GetPhysicalDeviceSurfaceFormatsKHR = |
| 92 | (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa( |
| 93 | instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"); |
| 94 | pDisp->GetPhysicalDeviceSurfacePresentModesKHR = |
| 95 | (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa( |
| 96 | instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"); |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 97 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 98 | pDisp->CreateWin32SurfaceKHR = |
| 99 | (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR"); |
| 100 | pDisp->GetPhysicalDeviceWin32PresentationSupportKHR = |
| 101 | (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa( |
| 102 | instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 103 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 104 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 105 | pDisp->CreateXcbSurfaceKHR = |
| 106 | (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR"); |
| 107 | pDisp->GetPhysicalDeviceXcbPresentationSupportKHR = |
| 108 | (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa( |
| 109 | instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 110 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 111 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 112 | pDisp->CreateXlibSurfaceKHR = |
| 113 | (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR"); |
| 114 | pDisp->GetPhysicalDeviceXlibPresentationSupportKHR = |
| 115 | (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa( |
| 116 | instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 117 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 118 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 119 | pDisp->CreateMirSurfaceKHR = |
| 120 | (PFN_vkCreateMirSurfaceKHR)gpa(instance, "vkCreateMirSurfaceKHR"); |
| 121 | pDisp->GetPhysicalDeviceMirPresentationSupportKHR = |
| 122 | (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa( |
| 123 | instance, "vkGetPhysicalDeviceMirPresentationSupportKHR"); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 124 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 125 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 126 | pDisp->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa( |
| 127 | instance, "vkCreateWaylandSurfaceKHR"); |
| 128 | pDisp->GetPhysicalDeviceWaylandPresentationSupportKHR = |
| 129 | (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa( |
| 130 | instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 131 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 132 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 133 | pDisp->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa( |
| 134 | instance, "vkCreateAndroidSurfaceKHR"); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 135 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 136 | |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 137 | instanceExtMap[pDisp] = {}; |
Jon Ashburn | f19916e | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 138 | for (i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 139 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 140 | VK_KHR_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 141 | instanceExtMap[pDisp].wsi_enabled = true; |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 142 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 143 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 144 | VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 145 | instanceExtMap[pDisp].xlib_enabled = true; |
| 146 | #endif |
| 147 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 148 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 149 | VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 150 | instanceExtMap[pDisp].xcb_enabled = true; |
| 151 | #endif |
| 152 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 153 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 154 | VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 155 | instanceExtMap[pDisp].wayland_enabled = true; |
| 156 | #endif |
| 157 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 158 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 159 | VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 160 | instanceExtMap[pDisp].mir_enabled = true; |
| 161 | #endif |
| 162 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 163 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 164 | VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 165 | instanceExtMap[pDisp].android_enabled = true; |
| 166 | #endif |
| 167 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 168 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 169 | VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 170 | instanceExtMap[pDisp].win32_enabled = true; |
| 171 | #endif |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 172 | } |
| 173 | } |
| 174 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 175 | VkResult explicit_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
| 176 | const VkAllocationCallbacks *pAllocator, |
| 177 | VkInstance *pInstance) { |
| 178 | VkLayerInstanceCreateInfo *chain_info = |
| 179 | get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 180 | |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 181 | assert(chain_info->u.pLayerInfo); |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 182 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = |
| 183 | chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 184 | PFN_vkCreateInstance fpCreateInstance = |
| 185 | (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 186 | if (fpCreateInstance == NULL) { |
| 187 | return VK_ERROR_INITIALIZATION_FAILED; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 188 | } |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 189 | |
| 190 | // Advance the link info for the next element on the chain |
| 191 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 192 | |
| 193 | VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
| 194 | if (result != VK_SUCCESS) { |
| 195 | return result; |
| 196 | } |
| 197 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 198 | initInstanceTable(*pInstance, fpGetInstanceProcAddr, |
| 199 | unique_objects_instance_table_map); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 200 | |
| 201 | createInstanceRegisterExtensions(pCreateInfo, *pInstance); |
| 202 | |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 203 | return result; |
| 204 | } |
| 205 | |
| 206 | // Handle CreateDevice |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 207 | static void |
| 208 | createDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, |
| 209 | VkDevice device) { |
| 210 | layer_data *my_device_data = |
| 211 | get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 212 | VkLayerDispatchTable *pDisp = |
| 213 | get_dispatch_table(unique_objects_device_table_map, device); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 214 | PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr; |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 215 | pDisp->CreateSwapchainKHR = |
| 216 | (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR"); |
| 217 | pDisp->DestroySwapchainKHR = |
| 218 | (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR"); |
| 219 | pDisp->GetSwapchainImagesKHR = |
| 220 | (PFN_vkGetSwapchainImagesKHR)gpa(device, "vkGetSwapchainImagesKHR"); |
| 221 | pDisp->AcquireNextImageKHR = |
| 222 | (PFN_vkAcquireNextImageKHR)gpa(device, "vkAcquireNextImageKHR"); |
| 223 | pDisp->QueuePresentKHR = |
| 224 | (PFN_vkQueuePresentKHR)gpa(device, "vkQueuePresentKHR"); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 225 | my_device_data->wsi_enabled = false; |
Jon Ashburn | f19916e | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 226 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 227 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], |
| 228 | VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 229 | my_device_data->wsi_enabled = true; |
| 230 | } |
| 231 | } |
| 232 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 233 | VkResult explicit_CreateDevice(VkPhysicalDevice gpu, |
| 234 | const VkDeviceCreateInfo *pCreateInfo, |
| 235 | const VkAllocationCallbacks *pAllocator, |
| 236 | VkDevice *pDevice) { |
| 237 | VkLayerDeviceCreateInfo *chain_info = |
| 238 | get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 239 | |
| 240 | assert(chain_info->u.pLayerInfo); |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 241 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = |
| 242 | chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 243 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = |
| 244 | chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
| 245 | PFN_vkCreateDevice fpCreateDevice = |
| 246 | (PFN_vkCreateDevice)fpGetInstanceProcAddr(NULL, "vkCreateDevice"); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 247 | if (fpCreateDevice == NULL) { |
| 248 | return VK_ERROR_INITIALIZATION_FAILED; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 249 | } |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 250 | |
| 251 | // Advance the link info for the next element on the chain |
| 252 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 253 | |
| 254 | VkResult result = fpCreateDevice(gpu, pCreateInfo, pAllocator, pDevice); |
| 255 | if (result != VK_SUCCESS) { |
| 256 | return result; |
| 257 | } |
| 258 | |
| 259 | // Setup layer's device dispatch table |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 260 | initDeviceTable(*pDevice, fpGetDeviceProcAddr, |
| 261 | unique_objects_device_table_map); |
Courtney Goeltzenleuchter | 00150eb | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 262 | |
| 263 | createDeviceRegisterExtensions(pCreateInfo, *pDevice); |
| 264 | |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 265 | return result; |
| 266 | } |
| 267 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 268 | VkResult explicit_QueueSubmit(VkQueue queue, uint32_t submitCount, |
| 269 | const VkSubmitInfo *pSubmits, VkFence fence) { |
| 270 | // UNWRAP USES: |
| 271 | // 0 : fence,VkFence |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 272 | if (VK_NULL_HANDLE != fence) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 273 | fence = (VkFence)((VkUniqueObject *)fence)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 274 | } |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 275 | // waitSemaphoreCount : pSubmits[submitCount]->pWaitSemaphores,VkSemaphore |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 276 | std::vector<VkSemaphore> original_pWaitSemaphores = {}; |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 277 | // signalSemaphoreCount : |
| 278 | // pSubmits[submitCount]->pSignalSemaphores,VkSemaphore |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 279 | std::vector<VkSemaphore> original_pSignalSemaphores = {}; |
| 280 | if (pSubmits) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 281 | for (uint32_t index0 = 0; index0 < submitCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 282 | if (pSubmits[index0].pWaitSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 283 | for (uint32_t index1 = 0; |
| 284 | index1 < pSubmits[index0].waitSemaphoreCount; ++index1) { |
| 285 | VkSemaphore **ppSemaphore = |
| 286 | (VkSemaphore **)&(pSubmits[index0].pWaitSemaphores); |
| 287 | original_pWaitSemaphores.push_back( |
| 288 | pSubmits[index0].pWaitSemaphores[index1]); |
| 289 | *(ppSemaphore[index1]) = |
| 290 | (VkSemaphore)((VkUniqueObject *) |
| 291 | pSubmits[index0].pWaitSemaphores[index1]) |
| 292 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 293 | } |
| 294 | } |
| 295 | if (pSubmits[index0].pSignalSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 296 | for (uint32_t index1 = 0; |
| 297 | index1 < pSubmits[index0].signalSemaphoreCount; ++index1) { |
| 298 | VkSemaphore **ppSemaphore = |
| 299 | (VkSemaphore **)&(pSubmits[index0].pSignalSemaphores); |
| 300 | original_pSignalSemaphores.push_back( |
| 301 | pSubmits[index0].pSignalSemaphores[index1]); |
| 302 | *(ppSemaphore[index1]) = |
| 303 | (VkSemaphore)((VkUniqueObject *)pSubmits[index0] |
| 304 | .pSignalSemaphores[index1]) |
| 305 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 306 | } |
| 307 | } |
| 308 | } |
| 309 | } |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 310 | VkResult result = get_dispatch_table(unique_objects_device_table_map, queue) |
| 311 | ->QueueSubmit(queue, submitCount, pSubmits, fence); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 312 | if (pSubmits) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 313 | for (uint32_t index0 = 0; index0 < submitCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 314 | if (pSubmits[index0].pWaitSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 315 | for (uint32_t index1 = 0; |
| 316 | index1 < pSubmits[index0].waitSemaphoreCount; ++index1) { |
| 317 | VkSemaphore **ppSemaphore = |
| 318 | (VkSemaphore **)&(pSubmits[index0].pWaitSemaphores); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 319 | *(ppSemaphore[index1]) = original_pWaitSemaphores[index1]; |
| 320 | } |
| 321 | } |
| 322 | if (pSubmits[index0].pSignalSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 323 | for (uint32_t index1 = 0; |
| 324 | index1 < pSubmits[index0].signalSemaphoreCount; ++index1) { |
| 325 | VkSemaphore **ppSemaphore = |
| 326 | (VkSemaphore **)&(pSubmits[index0].pSignalSemaphores); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 327 | *(ppSemaphore[index1]) = original_pSignalSemaphores[index1]; |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | return result; |
| 333 | } |
| 334 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 335 | VkResult explicit_QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, |
| 336 | const VkBindSparseInfo *pBindInfo, |
| 337 | VkFence fence) { |
| 338 | // UNWRAP USES: |
| 339 | // 0 : |
| 340 | // pBindInfo[bindInfoCount]->pBufferBinds[bufferBindCount]->buffer,VkBuffer, |
| 341 | // pBindInfo[bindInfoCount]->pBufferBinds[bufferBindCount]->pBinds[bindCount]->memory,VkDeviceMemory, |
| 342 | // pBindInfo[bindInfoCount]->pImageOpaqueBinds[imageOpaqueBindCount]->image,VkImage, |
| 343 | // pBindInfo[bindInfoCount]->pImageOpaqueBinds[imageOpaqueBindCount]->pBinds[bindCount]->memory,VkDeviceMemory, |
| 344 | // pBindInfo[bindInfoCount]->pImageBinds[imageBindCount]->image,VkImage, |
| 345 | // pBindInfo[bindInfoCount]->pImageBinds[imageBindCount]->pBinds[bindCount]->memory,VkDeviceMemory |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 346 | std::vector<VkBuffer> original_buffer = {}; |
| 347 | std::vector<VkDeviceMemory> original_memory1 = {}; |
| 348 | std::vector<VkImage> original_image1 = {}; |
| 349 | std::vector<VkDeviceMemory> original_memory2 = {}; |
| 350 | std::vector<VkImage> original_image2 = {}; |
| 351 | std::vector<VkDeviceMemory> original_memory3 = {}; |
| 352 | std::vector<VkSemaphore> original_pWaitSemaphores = {}; |
| 353 | std::vector<VkSemaphore> original_pSignalSemaphores = {}; |
| 354 | if (pBindInfo) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 355 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 356 | if (pBindInfo[index0].pBufferBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 357 | for (uint32_t index1 = 0; |
| 358 | index1 < pBindInfo[index0].bufferBindCount; ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 359 | if (pBindInfo[index0].pBufferBinds[index1].buffer) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 360 | VkBuffer *pBuffer = (VkBuffer *)&( |
| 361 | pBindInfo[index0].pBufferBinds[index1].buffer); |
| 362 | original_buffer.push_back( |
| 363 | pBindInfo[index0].pBufferBinds[index1].buffer); |
| 364 | *(pBuffer) = |
| 365 | (VkBuffer)((VkUniqueObject *)pBindInfo[index0] |
| 366 | .pBufferBinds[index1] |
| 367 | .buffer)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 368 | } |
| 369 | if (pBindInfo[index0].pBufferBinds[index1].pBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 370 | for (uint32_t index2 = 0; |
| 371 | index2 < pBindInfo[index0] |
| 372 | .pBufferBinds[index1] |
| 373 | .bindCount; |
| 374 | ++index2) { |
| 375 | if (pBindInfo[index0] |
| 376 | .pBufferBinds[index1] |
| 377 | .pBinds[index2] |
| 378 | .memory) { |
| 379 | VkDeviceMemory *pDeviceMemory = |
| 380 | (VkDeviceMemory *)&( |
| 381 | pBindInfo[index0] |
| 382 | .pBufferBinds[index1] |
| 383 | .pBinds[index2] |
| 384 | .memory); |
| 385 | original_memory1.push_back( |
| 386 | pBindInfo[index0] |
| 387 | .pBufferBinds[index1] |
| 388 | .pBinds[index2] |
| 389 | .memory); |
| 390 | *(pDeviceMemory) = |
| 391 | (VkDeviceMemory)( |
| 392 | (VkUniqueObject *)pBindInfo[index0] |
| 393 | .pBufferBinds[index1] |
| 394 | .pBinds[index2] |
| 395 | .memory)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 396 | } |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | if (pBindInfo[index0].pImageOpaqueBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 402 | for (uint32_t index1 = 0; |
| 403 | index1 < pBindInfo[index0].imageOpaqueBindCount; |
| 404 | ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 405 | if (pBindInfo[index0].pImageOpaqueBinds[index1].image) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 406 | VkImage *pImage = (VkImage *)&( |
| 407 | pBindInfo[index0].pImageOpaqueBinds[index1].image); |
| 408 | original_image1.push_back( |
| 409 | pBindInfo[index0].pImageOpaqueBinds[index1].image); |
| 410 | *(pImage) = |
| 411 | (VkImage)((VkUniqueObject *)pBindInfo[index0] |
| 412 | .pImageOpaqueBinds[index1] |
| 413 | .image)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 414 | } |
| 415 | if (pBindInfo[index0].pImageOpaqueBinds[index1].pBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 416 | for (uint32_t index2 = 0; |
| 417 | index2 < pBindInfo[index0] |
| 418 | .pImageOpaqueBinds[index1] |
| 419 | .bindCount; |
| 420 | ++index2) { |
| 421 | if (pBindInfo[index0] |
| 422 | .pImageOpaqueBinds[index1] |
| 423 | .pBinds[index2] |
| 424 | .memory) { |
| 425 | VkDeviceMemory *pDeviceMemory = |
| 426 | (VkDeviceMemory *)&( |
| 427 | pBindInfo[index0] |
| 428 | .pImageOpaqueBinds[index1] |
| 429 | .pBinds[index2] |
| 430 | .memory); |
| 431 | original_memory2.push_back( |
| 432 | pBindInfo[index0] |
| 433 | .pImageOpaqueBinds[index1] |
| 434 | .pBinds[index2] |
| 435 | .memory); |
| 436 | *(pDeviceMemory) = |
| 437 | (VkDeviceMemory)( |
| 438 | (VkUniqueObject *)pBindInfo[index0] |
| 439 | .pImageOpaqueBinds[index1] |
| 440 | .pBinds[index2] |
| 441 | .memory)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 442 | } |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | if (pBindInfo[index0].pImageBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 448 | for (uint32_t index1 = 0; |
| 449 | index1 < pBindInfo[index0].imageBindCount; ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 450 | if (pBindInfo[index0].pImageBinds[index1].image) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 451 | VkImage *pImage = (VkImage *)&( |
| 452 | pBindInfo[index0].pImageBinds[index1].image); |
| 453 | original_image2.push_back( |
| 454 | pBindInfo[index0].pImageBinds[index1].image); |
| 455 | *(pImage) = |
| 456 | (VkImage)((VkUniqueObject *)pBindInfo[index0] |
| 457 | .pImageBinds[index1] |
| 458 | .image)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 459 | } |
| 460 | if (pBindInfo[index0].pImageBinds[index1].pBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 461 | for ( |
| 462 | uint32_t index2 = 0; |
| 463 | index2 < |
| 464 | pBindInfo[index0].pImageBinds[index1].bindCount; |
| 465 | ++index2) { |
| 466 | if (pBindInfo[index0] |
| 467 | .pImageBinds[index1] |
| 468 | .pBinds[index2] |
| 469 | .memory) { |
| 470 | VkDeviceMemory *pDeviceMemory = |
| 471 | (VkDeviceMemory *)&(pBindInfo[index0] |
| 472 | .pImageBinds[index1] |
| 473 | .pBinds[index2] |
| 474 | .memory); |
| 475 | original_memory3.push_back( |
| 476 | pBindInfo[index0] |
| 477 | .pImageBinds[index1] |
| 478 | .pBinds[index2] |
| 479 | .memory); |
| 480 | *(pDeviceMemory) = |
| 481 | (VkDeviceMemory)( |
| 482 | (VkUniqueObject *)pBindInfo[index0] |
| 483 | .pImageBinds[index1] |
| 484 | .pBinds[index2] |
| 485 | .memory)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 486 | } |
| 487 | } |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | if (pBindInfo[index0].pWaitSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 492 | for (uint32_t index1 = 0; |
| 493 | index1 < pBindInfo[index0].waitSemaphoreCount; ++index1) { |
| 494 | VkSemaphore **ppSemaphore = |
| 495 | (VkSemaphore **)&(pBindInfo[index0].pWaitSemaphores); |
| 496 | original_pWaitSemaphores.push_back( |
| 497 | pBindInfo[index0].pWaitSemaphores[index1]); |
| 498 | *(ppSemaphore[index1]) = |
| 499 | (VkSemaphore)((VkUniqueObject *) |
| 500 | pBindInfo[index0].pWaitSemaphores[index1]) |
| 501 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 502 | } |
| 503 | } |
| 504 | if (pBindInfo[index0].pSignalSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 505 | for (uint32_t index1 = 0; |
| 506 | index1 < pBindInfo[index0].signalSemaphoreCount; |
| 507 | ++index1) { |
| 508 | VkSemaphore **ppSemaphore = |
| 509 | (VkSemaphore **)&(pBindInfo[index0].pSignalSemaphores); |
| 510 | original_pSignalSemaphores.push_back( |
| 511 | pBindInfo[index0].pSignalSemaphores[index1]); |
| 512 | *(ppSemaphore[index1]) = |
| 513 | (VkSemaphore)((VkUniqueObject *)pBindInfo[index0] |
| 514 | .pSignalSemaphores[index1]) |
| 515 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 516 | } |
| 517 | } |
| 518 | } |
| 519 | } |
| 520 | if (VK_NULL_HANDLE != fence) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 521 | fence = (VkFence)((VkUniqueObject *)fence)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 522 | } |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 523 | VkResult result = |
| 524 | get_dispatch_table(unique_objects_device_table_map, queue) |
| 525 | ->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 526 | if (pBindInfo) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 527 | for (uint32_t index0 = 0; index0 < bindInfoCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 528 | if (pBindInfo[index0].pBufferBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 529 | for (uint32_t index1 = 0; |
| 530 | index1 < pBindInfo[index0].bufferBindCount; ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 531 | if (pBindInfo[index0].pBufferBinds[index1].buffer) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 532 | VkBuffer *pBuffer = (VkBuffer *)&( |
| 533 | pBindInfo[index0].pBufferBinds[index1].buffer); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 534 | *(pBuffer) = original_buffer[index1]; |
| 535 | } |
| 536 | if (pBindInfo[index0].pBufferBinds[index1].pBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 537 | for (uint32_t index2 = 0; |
| 538 | index2 < pBindInfo[index0] |
| 539 | .pBufferBinds[index1] |
| 540 | .bindCount; |
| 541 | ++index2) { |
| 542 | if (pBindInfo[index0] |
| 543 | .pBufferBinds[index1] |
| 544 | .pBinds[index2] |
| 545 | .memory) { |
| 546 | VkDeviceMemory *pDeviceMemory = |
| 547 | (VkDeviceMemory *)&( |
| 548 | pBindInfo[index0] |
| 549 | .pBufferBinds[index1] |
| 550 | .pBinds[index2] |
| 551 | .memory); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 552 | *(pDeviceMemory) = original_memory1[index2]; |
| 553 | } |
| 554 | } |
| 555 | } |
| 556 | } |
| 557 | } |
| 558 | if (pBindInfo[index0].pImageOpaqueBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 559 | for (uint32_t index1 = 0; |
| 560 | index1 < pBindInfo[index0].imageOpaqueBindCount; |
| 561 | ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 562 | if (pBindInfo[index0].pImageOpaqueBinds[index1].image) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 563 | VkImage *pImage = (VkImage *)&( |
| 564 | pBindInfo[index0].pImageOpaqueBinds[index1].image); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 565 | *(pImage) = original_image1[index1]; |
| 566 | } |
| 567 | if (pBindInfo[index0].pImageOpaqueBinds[index1].pBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 568 | for (uint32_t index2 = 0; |
| 569 | index2 < pBindInfo[index0] |
| 570 | .pImageOpaqueBinds[index1] |
| 571 | .bindCount; |
| 572 | ++index2) { |
| 573 | if (pBindInfo[index0] |
| 574 | .pImageOpaqueBinds[index1] |
| 575 | .pBinds[index2] |
| 576 | .memory) { |
| 577 | VkDeviceMemory *pDeviceMemory = |
| 578 | (VkDeviceMemory *)&( |
| 579 | pBindInfo[index0] |
| 580 | .pImageOpaqueBinds[index1] |
| 581 | .pBinds[index2] |
| 582 | .memory); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 583 | *(pDeviceMemory) = original_memory2[index2]; |
| 584 | } |
| 585 | } |
| 586 | } |
| 587 | } |
| 588 | } |
| 589 | if (pBindInfo[index0].pImageBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 590 | for (uint32_t index1 = 0; |
| 591 | index1 < pBindInfo[index0].imageBindCount; ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 592 | if (pBindInfo[index0].pImageBinds[index1].image) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 593 | VkImage *pImage = (VkImage *)&( |
| 594 | pBindInfo[index0].pImageBinds[index1].image); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 595 | *(pImage) = original_image2[index1]; |
| 596 | } |
| 597 | if (pBindInfo[index0].pImageBinds[index1].pBinds) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 598 | for ( |
| 599 | uint32_t index2 = 0; |
| 600 | index2 < |
| 601 | pBindInfo[index0].pImageBinds[index1].bindCount; |
| 602 | ++index2) { |
| 603 | if (pBindInfo[index0] |
| 604 | .pImageBinds[index1] |
| 605 | .pBinds[index2] |
| 606 | .memory) { |
| 607 | VkDeviceMemory *pDeviceMemory = |
| 608 | (VkDeviceMemory *)&(pBindInfo[index0] |
| 609 | .pImageBinds[index1] |
| 610 | .pBinds[index2] |
| 611 | .memory); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 612 | *(pDeviceMemory) = original_memory3[index2]; |
| 613 | } |
| 614 | } |
| 615 | } |
| 616 | } |
| 617 | } |
| 618 | if (pBindInfo[index0].pWaitSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 619 | for (uint32_t index1 = 0; |
| 620 | index1 < pBindInfo[index0].waitSemaphoreCount; ++index1) { |
| 621 | VkSemaphore **ppSemaphore = |
| 622 | (VkSemaphore **)&(pBindInfo[index0].pWaitSemaphores); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 623 | *(ppSemaphore[index1]) = original_pWaitSemaphores[index1]; |
| 624 | } |
| 625 | } |
| 626 | if (pBindInfo[index0].pSignalSemaphores) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 627 | for (uint32_t index1 = 0; |
| 628 | index1 < pBindInfo[index0].signalSemaphoreCount; |
| 629 | ++index1) { |
| 630 | VkSemaphore **ppSemaphore = |
| 631 | (VkSemaphore **)&(pBindInfo[index0].pSignalSemaphores); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 632 | *(ppSemaphore[index1]) = original_pSignalSemaphores[index1]; |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | return result; |
| 638 | } |
| 639 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 640 | VkResult explicit_CreateComputePipelines( |
| 641 | VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 642 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 643 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
| 644 | // UNWRAP USES: |
| 645 | // 0 : pipelineCache,VkPipelineCache, |
| 646 | // pCreateInfos[createInfoCount]->stage[0]->module,VkShaderModule, |
| 647 | // pCreateInfos[createInfoCount]->layout,VkPipelineLayout, |
| 648 | // pCreateInfos[createInfoCount]->basePipelineHandle,VkPipeline |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 649 | if (VK_NULL_HANDLE != pipelineCache) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 650 | pipelineCache = |
| 651 | (VkPipelineCache)((VkUniqueObject *)pipelineCache)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 652 | } |
| 653 | std::vector<VkShaderModule> original_module = {}; |
| 654 | std::vector<VkPipelineLayout> original_layout = {}; |
| 655 | std::vector<VkPipeline> original_basePipelineHandle = {}; |
| 656 | if (pCreateInfos) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 657 | for (uint32_t index0 = 0; index0 < createInfoCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 658 | if (pCreateInfos[index0].stage.module) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 659 | VkShaderModule *pShaderModule = |
| 660 | (VkShaderModule *)&(pCreateInfos[index0].stage.module); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 661 | original_module.push_back(pCreateInfos[index0].stage.module); |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 662 | *(pShaderModule) = |
| 663 | (VkShaderModule)( |
| 664 | (VkUniqueObject *)pCreateInfos[index0].stage.module) |
| 665 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 666 | } |
| 667 | if (pCreateInfos[index0].layout) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 668 | VkPipelineLayout *pPipelineLayout = |
| 669 | (VkPipelineLayout *)&(pCreateInfos[index0].layout); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 670 | original_layout.push_back(pCreateInfos[index0].layout); |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 671 | *(pPipelineLayout) = |
| 672 | (VkPipelineLayout)( |
| 673 | (VkUniqueObject *)pCreateInfos[index0].layout) |
| 674 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 675 | } |
| 676 | if (pCreateInfos[index0].basePipelineHandle) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 677 | VkPipeline *pPipeline = |
| 678 | (VkPipeline *)&(pCreateInfos[index0].basePipelineHandle); |
| 679 | original_basePipelineHandle.push_back( |
| 680 | pCreateInfos[index0].basePipelineHandle); |
| 681 | *(pPipeline) = |
| 682 | (VkPipeline)((VkUniqueObject *)pCreateInfos[index0] |
| 683 | .basePipelineHandle)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 684 | } |
| 685 | } |
| 686 | } |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 687 | VkResult result = |
| 688 | get_dispatch_table(unique_objects_device_table_map, device) |
| 689 | ->CreateComputePipelines(device, pipelineCache, createInfoCount, |
| 690 | pCreateInfos, pAllocator, pPipelines); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 691 | if (pCreateInfos) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 692 | for (uint32_t index0 = 0; index0 < createInfoCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 693 | if (pCreateInfos[index0].stage.module) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 694 | VkShaderModule *pShaderModule = |
| 695 | (VkShaderModule *)&(pCreateInfos[index0].stage.module); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 696 | *(pShaderModule) = original_module[index0]; |
| 697 | } |
| 698 | if (pCreateInfos[index0].layout) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 699 | VkPipelineLayout *pPipelineLayout = |
| 700 | (VkPipelineLayout *)&(pCreateInfos[index0].layout); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 701 | *(pPipelineLayout) = original_layout[index0]; |
| 702 | } |
| 703 | if (pCreateInfos[index0].basePipelineHandle) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 704 | VkPipeline *pPipeline = |
| 705 | (VkPipeline *)&(pCreateInfos[index0].basePipelineHandle); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 706 | *(pPipeline) = original_basePipelineHandle[index0]; |
| 707 | } |
| 708 | } |
| 709 | } |
| 710 | if (VK_SUCCESS == result) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 711 | VkUniqueObject *pUO = NULL; |
| 712 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 713 | pUO = new VkUniqueObject(); |
| 714 | pUO->actualObject = (uint64_t)pPipelines[i]; |
| 715 | pPipelines[i] = (VkPipeline)pUO; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 716 | } |
| 717 | } |
| 718 | return result; |
| 719 | } |
| 720 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 721 | VkResult explicit_CreateGraphicsPipelines( |
| 722 | VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 723 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 724 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
| 725 | // UNWRAP USES: |
| 726 | // 0 : pipelineCache,VkPipelineCache, |
| 727 | // pCreateInfos[createInfoCount]->pStages[stageCount]->module,VkShaderModule, |
| 728 | // pCreateInfos[createInfoCount]->layout,VkPipelineLayout, |
| 729 | // pCreateInfos[createInfoCount]->renderPass,VkRenderPass, |
| 730 | // pCreateInfos[createInfoCount]->basePipelineHandle,VkPipeline |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 731 | if (VK_NULL_HANDLE != pipelineCache) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 732 | pipelineCache = |
| 733 | (VkPipelineCache)((VkUniqueObject *)pipelineCache)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 734 | } |
| 735 | std::vector<VkShaderModule> original_module = {}; |
| 736 | std::vector<VkPipelineLayout> original_layout = {}; |
| 737 | std::vector<VkRenderPass> original_renderPass = {}; |
| 738 | std::vector<VkPipeline> original_basePipelineHandle = {}; |
| 739 | if (pCreateInfos) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 740 | for (uint32_t index0 = 0; index0 < createInfoCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 741 | if (pCreateInfos[index0].pStages) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 742 | for (uint32_t index1 = 0; |
| 743 | index1 < pCreateInfos[index0].stageCount; ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 744 | if (pCreateInfos[index0].pStages[index1].module) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 745 | VkShaderModule *pShaderModule = (VkShaderModule *)&( |
| 746 | pCreateInfos[index0].pStages[index1].module); |
| 747 | original_module.push_back( |
| 748 | pCreateInfos[index0].pStages[index1].module); |
| 749 | *(pShaderModule) = |
| 750 | (VkShaderModule)( |
| 751 | (VkUniqueObject *)pCreateInfos[index0] |
| 752 | .pStages[index1] |
| 753 | .module)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 754 | } |
| 755 | } |
| 756 | } |
| 757 | if (pCreateInfos[index0].layout) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 758 | VkPipelineLayout *pPipelineLayout = |
| 759 | (VkPipelineLayout *)&(pCreateInfos[index0].layout); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 760 | original_layout.push_back(pCreateInfos[index0].layout); |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 761 | *(pPipelineLayout) = |
| 762 | (VkPipelineLayout)( |
| 763 | (VkUniqueObject *)pCreateInfos[index0].layout) |
| 764 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 765 | } |
| 766 | if (pCreateInfos[index0].renderPass) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 767 | VkRenderPass *pRenderPass = |
| 768 | (VkRenderPass *)&(pCreateInfos[index0].renderPass); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 769 | original_renderPass.push_back(pCreateInfos[index0].renderPass); |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 770 | *(pRenderPass) = |
| 771 | (VkRenderPass)( |
| 772 | (VkUniqueObject *)pCreateInfos[index0].renderPass) |
| 773 | ->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 774 | } |
| 775 | if (pCreateInfos[index0].basePipelineHandle) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 776 | VkPipeline *pPipeline = |
| 777 | (VkPipeline *)&(pCreateInfos[index0].basePipelineHandle); |
| 778 | original_basePipelineHandle.push_back( |
| 779 | pCreateInfos[index0].basePipelineHandle); |
| 780 | *(pPipeline) = |
| 781 | (VkPipeline)((VkUniqueObject *)pCreateInfos[index0] |
| 782 | .basePipelineHandle)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 783 | } |
| 784 | } |
| 785 | } |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 786 | VkResult result = |
| 787 | get_dispatch_table(unique_objects_device_table_map, device) |
| 788 | ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, |
| 789 | pCreateInfos, pAllocator, pPipelines); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 790 | if (pCreateInfos) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 791 | for (uint32_t index0 = 0; index0 < createInfoCount; ++index0) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 792 | if (pCreateInfos[index0].pStages) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 793 | for (uint32_t index1 = 0; |
| 794 | index1 < pCreateInfos[index0].stageCount; ++index1) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 795 | if (pCreateInfos[index0].pStages[index1].module) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 796 | VkShaderModule *pShaderModule = (VkShaderModule *)&( |
| 797 | pCreateInfos[index0].pStages[index1].module); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 798 | *(pShaderModule) = original_module[index1]; |
| 799 | } |
| 800 | } |
| 801 | } |
| 802 | if (pCreateInfos[index0].layout) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 803 | VkPipelineLayout *pPipelineLayout = |
| 804 | (VkPipelineLayout *)&(pCreateInfos[index0].layout); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 805 | *(pPipelineLayout) = original_layout[index0]; |
| 806 | } |
| 807 | if (pCreateInfos[index0].renderPass) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 808 | VkRenderPass *pRenderPass = |
| 809 | (VkRenderPass *)&(pCreateInfos[index0].renderPass); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 810 | *(pRenderPass) = original_renderPass[index0]; |
| 811 | } |
| 812 | if (pCreateInfos[index0].basePipelineHandle) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 813 | VkPipeline *pPipeline = |
| 814 | (VkPipeline *)&(pCreateInfos[index0].basePipelineHandle); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 815 | *(pPipeline) = original_basePipelineHandle[index0]; |
| 816 | } |
| 817 | } |
| 818 | } |
| 819 | if (VK_SUCCESS == result) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 820 | VkUniqueObject *pUO = NULL; |
| 821 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
Tobin Ehlis | a39c26a | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 822 | pUO = new VkUniqueObject(); |
| 823 | pUO->actualObject = (uint64_t)pPipelines[i]; |
| 824 | pPipelines[i] = (VkPipeline)pUO; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 825 | } |
| 826 | } |
| 827 | return result; |
| 828 | } |
| 829 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 830 | VkResult explicit_GetSwapchainImagesKHR(VkDevice device, |
| 831 | VkSwapchainKHR swapchain, |
| 832 | uint32_t *pSwapchainImageCount, |
| 833 | VkImage *pSwapchainImages) { |
| 834 | // UNWRAP USES: |
| 835 | // 0 : swapchain,VkSwapchainKHR, pSwapchainImages,VkImage |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 836 | if (VK_NULL_HANDLE != swapchain) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 837 | swapchain = (VkSwapchainKHR)((VkUniqueObject *)swapchain)->actualObject; |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 838 | } |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 839 | VkResult result = |
| 840 | get_dispatch_table(unique_objects_device_table_map, device) |
| 841 | ->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, |
| 842 | pSwapchainImages); |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 843 | // TODO : Need to add corresponding code to delete these images |
| 844 | if (VK_SUCCESS == result) { |
| 845 | if ((*pSwapchainImageCount > 0) && pSwapchainImages) { |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame] | 846 | std::vector<VkUniqueObject *> uniqueImages = {}; |
| 847 | for (uint32_t i = 0; i < *pSwapchainImageCount; ++i) { |
Tobin Ehlis | d34a4c5 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 848 | uniqueImages.push_back(new VkUniqueObject()); |
| 849 | uniqueImages[i]->actualObject = (uint64_t)pSwapchainImages[i]; |
| 850 | pSwapchainImages[i] = (VkImage)uniqueImages[i]; |
| 851 | } |
| 852 | } |
| 853 | } |
| 854 | return result; |
| 855 | } |