Mark Lobodzinski | 288e4f7 | 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 | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 5 | * |
Mark Lobodzinski | 288e4f7 | 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 | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 12 | * |
Mark Lobodzinski | 288e4f7 | 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 | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 15 | * |
Mark Lobodzinski | 288e4f7 | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 16 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Mark Lobodzinski | 288e4f7 | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 19 | * |
| 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 21 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 22 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 23 | * USE OR OTHER DEALINGS IN THE MATERIALS |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 24 | * |
| 25 | * Author: Tobin Ehlis <tobine@google.com> |
| 26 | */ |
| 27 | |
Jamie Madill | 6f25bb7 | 2016-04-04 11:54:43 -0400 | [diff] [blame] | 28 | #include "vk_loader_platform.h" |
| 29 | #include "vulkan/vulkan.h" |
| 30 | |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 31 | #include <stdio.h> |
| 32 | #include <stdlib.h> |
| 33 | #include <string.h> |
| 34 | #include <inttypes.h> |
| 35 | |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 36 | #include <unordered_map> |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 37 | #include <vector> |
| 38 | #include <mutex> |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 39 | |
| 40 | #include "vulkan/vk_layer.h" |
| 41 | #include "vk_layer_config.h" |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 42 | #include "vk_layer_table.h" |
| 43 | #include "vk_layer_data.h" |
| 44 | #include "vk_layer_logging.h" |
| 45 | #include "vk_layer_extension_utils.h" |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 46 | #include "vk_safe_struct.h" |
Jon Ashburn | f1ea418 | 2016-03-22 12:57:13 -0600 | [diff] [blame] | 47 | #include "vk_layer_utils.h" |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 48 | |
| 49 | struct layer_data { |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 50 | bool wsi_enabled; |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 51 | uint64_t unique_id; // All increments are guarded by global_lock |
| 52 | std::unordered_map<uint64_t, uint64_t> unique_id_mapping; // Map uniqueID to actual object handle |
| 53 | VkPhysicalDevice gpu; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 54 | |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 55 | layer_data() : wsi_enabled(false), unique_id(1), gpu(VK_NULL_HANDLE){}; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | struct instExts { |
| 59 | bool wsi_enabled; |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 60 | bool xlib_enabled; |
| 61 | bool xcb_enabled; |
| 62 | bool wayland_enabled; |
| 63 | bool mir_enabled; |
| 64 | bool android_enabled; |
| 65 | bool win32_enabled; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 66 | }; |
| 67 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 68 | static std::unordered_map<void *, struct instExts> instanceExtMap; |
| 69 | static std::unordered_map<void *, layer_data *> layer_data_map; |
| 70 | static device_table_map unique_objects_device_table_map; |
| 71 | static instance_table_map unique_objects_instance_table_map; |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 72 | static std::mutex global_lock; // Protect map accesses and unique_id increments |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 73 | |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 74 | // Handle CreateInstance |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 75 | static void createInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) { |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 76 | uint32_t i; |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 77 | VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(unique_objects_instance_table_map, instance); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 78 | PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr; |
Michael Lentine | 90ee20e | 2016-03-02 17:28:55 -0600 | [diff] [blame] | 79 | |
| 80 | pDisp->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)gpa(instance, "vkDestroySurfaceKHR"); |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 81 | pDisp->GetPhysicalDeviceSurfaceSupportKHR = |
| 82 | (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR"); |
| 83 | pDisp->GetPhysicalDeviceSurfaceCapabilitiesKHR = |
| 84 | (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); |
| 85 | pDisp->GetPhysicalDeviceSurfaceFormatsKHR = |
| 86 | (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR"); |
| 87 | pDisp->GetPhysicalDeviceSurfacePresentModesKHR = |
| 88 | (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR"); |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 89 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 90 | pDisp->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(instance, "vkCreateWin32SurfaceKHR"); |
| 91 | pDisp->GetPhysicalDeviceWin32PresentationSupportKHR = |
| 92 | (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 93 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 94 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 95 | pDisp->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(instance, "vkCreateXcbSurfaceKHR"); |
| 96 | pDisp->GetPhysicalDeviceXcbPresentationSupportKHR = |
| 97 | (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 98 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 99 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 100 | pDisp->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(instance, "vkCreateXlibSurfaceKHR"); |
| 101 | pDisp->GetPhysicalDeviceXlibPresentationSupportKHR = |
| 102 | (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 103 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 104 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 105 | pDisp->CreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)gpa(instance, "vkCreateMirSurfaceKHR"); |
| 106 | pDisp->GetPhysicalDeviceMirPresentationSupportKHR = |
| 107 | (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceMirPresentationSupportKHR"); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 108 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 109 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 110 | pDisp->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(instance, "vkCreateWaylandSurfaceKHR"); |
| 111 | pDisp->GetPhysicalDeviceWaylandPresentationSupportKHR = |
| 112 | (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 113 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 114 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 115 | pDisp->CreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)gpa(instance, "vkCreateAndroidSurfaceKHR"); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 116 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 117 | |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 118 | instanceExtMap[pDisp] = {}; |
Jon Ashburn | a4ae48b | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 119 | for (i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 120 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 121 | instanceExtMap[pDisp].wsi_enabled = true; |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 122 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 123 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 124 | instanceExtMap[pDisp].xlib_enabled = true; |
| 125 | #endif |
| 126 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 127 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 128 | instanceExtMap[pDisp].xcb_enabled = true; |
| 129 | #endif |
| 130 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 131 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 132 | instanceExtMap[pDisp].wayland_enabled = true; |
| 133 | #endif |
| 134 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 135 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 136 | instanceExtMap[pDisp].mir_enabled = true; |
| 137 | #endif |
| 138 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 139 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 140 | instanceExtMap[pDisp].android_enabled = true; |
| 141 | #endif |
| 142 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 143 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) |
Tobin Ehlis | 115790b | 2016-01-05 16:34:59 -0700 | [diff] [blame] | 144 | instanceExtMap[pDisp].win32_enabled = true; |
| 145 | #endif |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 146 | } |
| 147 | } |
| 148 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 149 | VkResult explicit_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 150 | VkInstance *pInstance) { |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 151 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 152 | |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 153 | assert(chain_info->u.pLayerInfo); |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 154 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 155 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 156 | if (fpCreateInstance == NULL) { |
| 157 | return VK_ERROR_INITIALIZATION_FAILED; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 158 | } |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 159 | |
| 160 | // Advance the link info for the next element on the chain |
| 161 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 162 | |
| 163 | VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
| 164 | if (result != VK_SUCCESS) { |
| 165 | return result; |
| 166 | } |
| 167 | |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 168 | initInstanceTable(*pInstance, fpGetInstanceProcAddr, unique_objects_instance_table_map); |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 169 | |
| 170 | createInstanceRegisterExtensions(pCreateInfo, *pInstance); |
| 171 | |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 172 | return result; |
| 173 | } |
| 174 | |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 175 | void explicit_DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
| 176 | get_dispatch_table(unique_objects_instance_table_map, instance)->DestroyInstance(instance, pAllocator); |
| 177 | layer_data_map.erase(get_dispatch_key(instance)); |
| 178 | } |
| 179 | |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 180 | // Handle CreateDevice |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 181 | static void createDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) { |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 182 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 183 | VkLayerDispatchTable *pDisp = get_dispatch_table(unique_objects_device_table_map, device); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 184 | PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr; |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 185 | pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR"); |
| 186 | pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR"); |
| 187 | pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)gpa(device, "vkGetSwapchainImagesKHR"); |
| 188 | pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gpa(device, "vkAcquireNextImageKHR"); |
| 189 | pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR)gpa(device, "vkQueuePresentKHR"); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 190 | my_device_data->wsi_enabled = false; |
Jon Ashburn | a4ae48b | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 191 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 192 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 193 | my_device_data->wsi_enabled = true; |
| 194 | } |
| 195 | } |
| 196 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 197 | VkResult explicit_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 198 | VkDevice *pDevice) { |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 199 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 200 | |
| 201 | assert(chain_info->u.pLayerInfo); |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 202 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 203 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 204 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(NULL, "vkCreateDevice"); |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 205 | if (fpCreateDevice == NULL) { |
| 206 | return VK_ERROR_INITIALIZATION_FAILED; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 207 | } |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 208 | |
| 209 | // Advance the link info for the next element on the chain |
| 210 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 211 | |
| 212 | VkResult result = fpCreateDevice(gpu, pCreateInfo, pAllocator, pDevice); |
| 213 | if (result != VK_SUCCESS) { |
| 214 | return result; |
| 215 | } |
| 216 | |
| 217 | // Setup layer's device dispatch table |
Mark Lobodzinski | b838dc0 | 2016-02-03 09:57:14 -0700 | [diff] [blame] | 218 | initDeviceTable(*pDevice, fpGetDeviceProcAddr, unique_objects_device_table_map); |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 219 | |
| 220 | createDeviceRegisterExtensions(pCreateInfo, *pDevice); |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 221 | // Set gpu for this device in order to get at any objects mapped at instance level |
| 222 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); |
| 223 | my_device_data->gpu = gpu; |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 224 | |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 225 | return result; |
| 226 | } |
| 227 | |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 228 | void explicit_DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
| 229 | get_dispatch_table(unique_objects_device_table_map, device)->DestroyDevice(device, pAllocator); |
| 230 | layer_data_map.erase(get_dispatch_key(device)); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 231 | } |
| 232 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 233 | VkResult explicit_CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 234 | const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, |
| 235 | VkPipeline *pPipelines) { |
| 236 | // STRUCT USES:{'pipelineCache': 'VkPipelineCache', 'pCreateInfos[createInfoCount]': {'stage': {'module': 'VkShaderModule'}, |
| 237 | // 'layout': 'VkPipelineLayout', 'basePipelineHandle': 'VkPipeline'}} |
| 238 | // LOCAL DECLS:{'pCreateInfos': 'VkComputePipelineCreateInfo*'} |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 239 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 240 | safe_VkComputePipelineCreateInfo *local_pCreateInfos = NULL; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 241 | if (pCreateInfos) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 242 | std::lock_guard<std::mutex> lock(global_lock); |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 243 | local_pCreateInfos = new safe_VkComputePipelineCreateInfo[createInfoCount]; |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 244 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 245 | local_pCreateInfos[idx0].initialize(&pCreateInfos[idx0]); |
| 246 | if (pCreateInfos[idx0].basePipelineHandle) { |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 247 | local_pCreateInfos[idx0].basePipelineHandle = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 248 | (VkPipeline)my_device_data |
| 249 | ->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].basePipelineHandle)]; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 250 | } |
| 251 | if (pCreateInfos[idx0].layout) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 252 | local_pCreateInfos[idx0].layout = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 253 | (VkPipelineLayout) |
| 254 | my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].layout)]; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 255 | } |
| 256 | if (pCreateInfos[idx0].stage.module) { |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 257 | local_pCreateInfos[idx0].stage.module = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 258 | (VkShaderModule) |
| 259 | my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].stage.module)]; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 260 | } |
| 261 | } |
| 262 | } |
| 263 | if (pipelineCache) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 264 | std::lock_guard<std::mutex> lock(global_lock); |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 265 | pipelineCache = (VkPipelineCache)my_device_data->unique_id_mapping[reinterpret_cast<uint64_t &>(pipelineCache)]; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 266 | } |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 267 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 268 | VkResult result = get_dispatch_table(unique_objects_device_table_map, device) |
| 269 | ->CreateComputePipelines(device, pipelineCache, createInfoCount, |
| 270 | (const VkComputePipelineCreateInfo *)local_pCreateInfos, pAllocator, pPipelines); |
Eric Engestrom | 00a8973 | 2016-02-21 19:58:09 +0000 | [diff] [blame] | 271 | delete[] local_pCreateInfos; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 272 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 273 | uint64_t unique_id = 0; |
| 274 | std::lock_guard<std::mutex> lock(global_lock); |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 275 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 276 | unique_id = my_device_data->unique_id++; |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 277 | my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]); |
| 278 | pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 279 | } |
| 280 | } |
| 281 | return result; |
| 282 | } |
| 283 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 284 | VkResult explicit_CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 285 | const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, |
| 286 | VkPipeline *pPipelines) { |
| 287 | // STRUCT USES:{'pipelineCache': 'VkPipelineCache', 'pCreateInfos[createInfoCount]': {'layout': 'VkPipelineLayout', |
| 288 | // 'pStages[stageCount]': {'module': 'VkShaderModule'}, 'renderPass': 'VkRenderPass', 'basePipelineHandle': 'VkPipeline'}} |
| 289 | // LOCAL DECLS:{'pCreateInfos': 'VkGraphicsPipelineCreateInfo*'} |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 290 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 291 | safe_VkGraphicsPipelineCreateInfo *local_pCreateInfos = NULL; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 292 | if (pCreateInfos) { |
| 293 | local_pCreateInfos = new safe_VkGraphicsPipelineCreateInfo[createInfoCount]; |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 294 | std::lock_guard<std::mutex> lock(global_lock); |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 295 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 296 | local_pCreateInfos[idx0].initialize(&pCreateInfos[idx0]); |
| 297 | if (pCreateInfos[idx0].basePipelineHandle) { |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 298 | local_pCreateInfos[idx0].basePipelineHandle = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 299 | (VkPipeline)my_device_data |
| 300 | ->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].basePipelineHandle)]; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 301 | } |
| 302 | if (pCreateInfos[idx0].layout) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 303 | local_pCreateInfos[idx0].layout = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 304 | (VkPipelineLayout) |
| 305 | my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].layout)]; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 306 | } |
| 307 | if (pCreateInfos[idx0].pStages) { |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 308 | for (uint32_t idx1 = 0; idx1 < pCreateInfos[idx0].stageCount; ++idx1) { |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 309 | if (pCreateInfos[idx0].pStages[idx1].module) { |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 310 | local_pCreateInfos[idx0].pStages[idx1].module = |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 311 | (VkShaderModule)my_device_data |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 312 | ->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].pStages[idx1].module)]; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 313 | } |
| 314 | } |
| 315 | } |
| 316 | if (pCreateInfos[idx0].renderPass) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 317 | local_pCreateInfos[idx0].renderPass = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 318 | (VkRenderPass) |
| 319 | my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].renderPass)]; |
Tobin Ehlis | 9aac555 | 2016-02-10 15:38:45 -0700 | [diff] [blame] | 320 | } |
| 321 | } |
| 322 | } |
| 323 | if (pipelineCache) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 324 | std::lock_guard<std::mutex> lock(global_lock); |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 325 | pipelineCache = (VkPipelineCache)my_device_data->unique_id_mapping[reinterpret_cast<uint64_t &>(pipelineCache)]; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 326 | } |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 327 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 328 | VkResult result = |
| 329 | get_dispatch_table(unique_objects_device_table_map, device) |
| 330 | ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, |
| 331 | (const VkGraphicsPipelineCreateInfo *)local_pCreateInfos, pAllocator, pPipelines); |
Eric Engestrom | 00a8973 | 2016-02-21 19:58:09 +0000 | [diff] [blame] | 332 | delete[] local_pCreateInfos; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 333 | if (VK_SUCCESS == result) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 334 | uint64_t unique_id = 0; |
| 335 | std::lock_guard<std::mutex> lock(global_lock); |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 336 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 337 | unique_id = my_device_data->unique_id++; |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 338 | my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]); |
| 339 | pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 340 | } |
| 341 | } |
| 342 | return result; |
| 343 | } |
| 344 | |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 345 | VkResult explicit_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
| 346 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
| 347 | layer_data *my_map_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 348 | |
| 349 | safe_VkSwapchainCreateInfoKHR *local_pCreateInfo = NULL; |
| 350 | if (pCreateInfo) { |
| 351 | std::lock_guard<std::mutex> lock(global_lock); |
| 352 | local_pCreateInfo = new safe_VkSwapchainCreateInfoKHR(pCreateInfo); |
| 353 | local_pCreateInfo->oldSwapchain = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 354 | (VkSwapchainKHR)my_map_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfo->oldSwapchain)]; |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 355 | // Need to pull surface mapping from the instance-level map |
| 356 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(my_map_data->gpu), layer_data_map); |
| 357 | local_pCreateInfo->surface = |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 358 | (VkSurfaceKHR)instance_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfo->surface)]; |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 359 | } |
| 360 | |
| 361 | VkResult result = get_dispatch_table(unique_objects_device_table_map, device) |
| 362 | ->CreateSwapchainKHR(device, (const VkSwapchainCreateInfoKHR *)local_pCreateInfo, pAllocator, pSwapchain); |
| 363 | if (local_pCreateInfo) |
| 364 | delete local_pCreateInfo; |
| 365 | if (VK_SUCCESS == result) { |
| 366 | std::lock_guard<std::mutex> lock(global_lock); |
| 367 | uint64_t unique_id = my_map_data->unique_id++; |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 368 | my_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(*pSwapchain); |
| 369 | *pSwapchain = reinterpret_cast<VkSwapchainKHR &>(unique_id); |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 370 | } |
| 371 | return result; |
| 372 | } |
| 373 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 374 | VkResult explicit_GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, |
| 375 | VkImage *pSwapchainImages) { |
| 376 | // UNWRAP USES: |
| 377 | // 0 : swapchain,VkSwapchainKHR, pSwapchainImages,VkImage |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 378 | layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 379 | if (VK_NULL_HANDLE != swapchain) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 380 | std::lock_guard<std::mutex> lock(global_lock); |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 381 | swapchain = (VkSwapchainKHR)my_device_data->unique_id_mapping[reinterpret_cast<uint64_t &>(swapchain)]; |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 382 | } |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 383 | VkResult result = get_dispatch_table(unique_objects_device_table_map, device) |
| 384 | ->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 385 | // TODO : Need to add corresponding code to delete these images |
| 386 | if (VK_SUCCESS == result) { |
| 387 | if ((*pSwapchainImageCount > 0) && pSwapchainImages) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 388 | uint64_t unique_id = 0; |
| 389 | std::lock_guard<std::mutex> lock(global_lock); |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 390 | for (uint32_t i = 0; i < *pSwapchainImageCount; ++i) { |
Tobin Ehlis | 2fb0dba | 2016-04-13 12:59:43 -0600 | [diff] [blame] | 391 | unique_id = my_device_data->unique_id++; |
Dustin Graves | 88f2e92 | 2016-04-14 17:29:20 -0600 | [diff] [blame] | 392 | my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pSwapchainImages[i]); |
| 393 | pSwapchainImages[i] = reinterpret_cast<VkImage &>(unique_id); |
Tobin Ehlis | 0b99d03 | 2015-12-08 10:50:10 -0700 | [diff] [blame] | 394 | } |
| 395 | } |
| 396 | } |
| 397 | return result; |
| 398 | } |