blob: d721b187f77468af7c4eba447ad91b194b523ed6 [file] [log] [blame]
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -07001/* 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 Ehlisd34a4c52015-12-08 10:50:10 -07005 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -06006 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
Tobin Ehlisd34a4c52015-12-08 10:50:10 -07009 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060010 * http://www.apache.org/licenses/LICENSE-2.0
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070011 *
Jon Ashburn3ebf1252016-04-19 11:30:31 -060012 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070017 *
18 * Author: Tobin Ehlis <tobine@google.com>
19 */
20
Jamie Madilldf5d5732016-04-04 11:54:43 -040021#include "vk_loader_platform.h"
22#include "vulkan/vulkan.h"
23
Dustin Graves176f9df2016-07-14 17:28:11 -060024#include <cinttypes>
25#include <memory>
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070026#include <stdio.h>
27#include <stdlib.h>
28#include <string.h>
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070029
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070030#include <unordered_map>
Tobin Ehlis10ba1de2016-04-13 12:59:43 -060031#include <vector>
32#include <mutex>
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070033
34#include "vulkan/vk_layer.h"
35#include "vk_layer_config.h"
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070036#include "vk_layer_table.h"
37#include "vk_layer_data.h"
38#include "vk_layer_logging.h"
39#include "vk_layer_extension_utils.h"
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -070040#include "vk_safe_struct.h"
Jon Ashburndc9111c2016-03-22 12:57:13 -060041#include "vk_layer_utils.h"
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070042
Chia-I Wucdb70962016-05-13 14:07:36 +080043namespace unique_objects {
44
Mark Lobodzinskifdf8f472016-04-28 16:36:58 -060045// All increments must be guarded by global_lock
46static uint64_t global_unique_id = 1;
47
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070048struct layer_data {
Chia-I Wu16570472016-05-17 07:57:15 +080049 VkInstance instance;
50
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -060051 debug_report_data *report_data;
52 std::vector<VkDebugReportCallbackEXT> logging_callback;
53
54 // The following are for keeping track of the temporary callbacks that can
55 // be used in vkCreateInstance and vkDestroyInstance:
56 uint32_t num_tmp_callbacks;
57 VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos;
58 VkDebugReportCallbackEXT *tmp_callbacks;
59
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070060 bool wsi_enabled;
Tobin Ehlis10ba1de2016-04-13 12:59:43 -060061 std::unordered_map<uint64_t, uint64_t> unique_id_mapping; // Map uniqueID to actual object handle
62 VkPhysicalDevice gpu;
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070063
Mark Lobodzinskifdf8f472016-04-28 16:36:58 -060064 layer_data() : wsi_enabled(false), gpu(VK_NULL_HANDLE){};
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070065};
66
Mark Lobodzinskife1f0662016-06-24 09:57:32 -060067struct instance_extension_enables {
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070068 bool wsi_enabled;
Tobin Ehlisa39c26a2016-01-05 16:34:59 -070069 bool xlib_enabled;
70 bool xcb_enabled;
71 bool wayland_enabled;
72 bool mir_enabled;
73 bool android_enabled;
74 bool win32_enabled;
Jon Ashburn5e026df2016-06-15 08:19:07 -060075 bool display_enabled;
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070076};
77
Mark Lobodzinskife1f0662016-06-24 09:57:32 -060078static std::unordered_map<void *, struct instance_extension_enables> instanceExtMap;
Jon Ashburn5484e0c2016-03-08 17:48:44 -070079static std::unordered_map<void *, layer_data *> layer_data_map;
80static device_table_map unique_objects_device_table_map;
81static instance_table_map unique_objects_instance_table_map;
Tobin Ehlis10ba1de2016-04-13 12:59:43 -060082static std::mutex global_lock; // Protect map accesses and unique_id increments
Tobin Ehlisd34a4c52015-12-08 10:50:10 -070083
Dustin Graves176f9df2016-07-14 17:28:11 -060084struct GenericHeader {
85 VkStructureType sType;
86 void *pNext;
87};
88
89template <typename T> bool ContainsExtStruct(const T *target, VkStructureType ext_type) {
90 assert(target != nullptr);
91
92 const GenericHeader *ext_struct = reinterpret_cast<const GenericHeader *>(target->pNext);
93
94 while (ext_struct != nullptr) {
95 if (ext_struct->sType == ext_type) {
96 return true;
97 }
98
99 ext_struct = reinterpret_cast<const GenericHeader *>(ext_struct->pNext);
100 }
101
102 return false;
103}
104
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600105static void init_unique_objects(layer_data *my_data, const VkAllocationCallbacks *pAllocator) {
106 layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "google_unique_objects");
107}
108
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700109// Handle CreateInstance
Mark Youngaa1aa3a2016-07-05 16:41:50 -0600110static void checkInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) {
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700111 uint32_t i;
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700112 VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(unique_objects_instance_table_map, instance);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700113
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700114 instanceExtMap[pDisp] = {};
Mark Lobodzinskife1f0662016-06-24 09:57:32 -0600115
Jon Ashburnf19916e2016-01-11 13:12:43 -0700116 for (i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700117 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0)
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700118 instanceExtMap[pDisp].wsi_enabled = true;
Jon Ashburn5e026df2016-06-15 08:19:07 -0600119 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_EXTENSION_NAME) == 0)
120 instanceExtMap[pDisp].display_enabled = true;
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700121#ifdef VK_USE_PLATFORM_XLIB_KHR
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700122 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0)
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700123 instanceExtMap[pDisp].xlib_enabled = true;
124#endif
125#ifdef VK_USE_PLATFORM_XCB_KHR
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700126 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0)
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700127 instanceExtMap[pDisp].xcb_enabled = true;
128#endif
129#ifdef VK_USE_PLATFORM_WAYLAND_KHR
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700130 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0)
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700131 instanceExtMap[pDisp].wayland_enabled = true;
132#endif
133#ifdef VK_USE_PLATFORM_MIR_KHR
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700134 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0)
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700135 instanceExtMap[pDisp].mir_enabled = true;
136#endif
137#ifdef VK_USE_PLATFORM_ANDROID_KHR
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700138 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0)
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700139 instanceExtMap[pDisp].android_enabled = true;
140#endif
141#ifdef VK_USE_PLATFORM_WIN32_KHR
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700142 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0)
Tobin Ehlisa39c26a2016-01-05 16:34:59 -0700143 instanceExtMap[pDisp].win32_enabled = true;
144#endif
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700145 }
146}
147
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700148VkResult explicit_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
149 VkInstance *pInstance) {
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700150 VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700151
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700152 assert(chain_info->u.pLayerInfo);
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700153 PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700154 PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance");
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700155 if (fpCreateInstance == NULL) {
156 return VK_ERROR_INITIALIZATION_FAILED;
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700157 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700158
159 // Advance the link info for the next element on the chain
160 chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
161
162 VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance);
163 if (result != VK_SUCCESS) {
164 return result;
165 }
166
Chia-I Wu16570472016-05-17 07:57:15 +0800167 layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map);
168 my_data->instance = *pInstance;
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600169 VkLayerInstanceDispatchTable *pTable = initInstanceTable(*pInstance, fpGetInstanceProcAddr, unique_objects_instance_table_map);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700170
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600171 my_data->instance = *pInstance;
172 my_data->report_data = debug_report_create_instance(pTable, *pInstance, pCreateInfo->enabledExtensionCount,
173 pCreateInfo->ppEnabledExtensionNames);
174
175 // Set up temporary debug callbacks to output messages at CreateInstance-time
176 if (!layer_copy_tmp_callbacks(pCreateInfo->pNext, &my_data->num_tmp_callbacks, &my_data->tmp_dbg_create_infos,
177 &my_data->tmp_callbacks)) {
178 if (my_data->num_tmp_callbacks > 0) {
179 if (layer_enable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_dbg_create_infos,
180 my_data->tmp_callbacks)) {
181 layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos, my_data->tmp_callbacks);
182 my_data->num_tmp_callbacks = 0;
183 }
184 }
185 }
186
187 init_unique_objects(my_data, pAllocator);
Mark Youngaa1aa3a2016-07-05 16:41:50 -0600188 checkInstanceRegisterExtensions(pCreateInfo, *pInstance);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700189
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600190 // Disable and free tmp callbacks, no longer necessary
191 if (my_data->num_tmp_callbacks > 0) {
192 layer_disable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_callbacks);
193 layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos, my_data->tmp_callbacks);
194 my_data->num_tmp_callbacks = 0;
195 }
196
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700197 return result;
198}
199
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600200void explicit_DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) {
Dustin Graves7b098da2016-04-29 11:55:43 -0600201 dispatch_key key = get_dispatch_key(instance);
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600202 layer_data *my_data = get_my_data_ptr(key, layer_data_map);
Jon Ashburn5e026df2016-06-15 08:19:07 -0600203 VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(unique_objects_instance_table_map, instance);
204 instanceExtMap.erase(pDisp);
Cody Northrop48968b42016-07-12 11:43:32 -0600205 pDisp->DestroyInstance(instance, pAllocator);
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600206
207 // Clean up logging callback, if any
208 while (my_data->logging_callback.size() > 0) {
209 VkDebugReportCallbackEXT callback = my_data->logging_callback.back();
210 layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
211 my_data->logging_callback.pop_back();
212 }
213
214 layer_debug_report_destroy_instance(my_data->report_data);
Cody Northrop48968b42016-07-12 11:43:32 -0600215 layer_data_map.erase(key);
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600216}
217
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700218// Handle CreateDevice
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700219static void createDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) {
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700220 layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
221 VkLayerDispatchTable *pDisp = get_dispatch_table(unique_objects_device_table_map, device);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700222 PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700223 pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(device, "vkCreateSwapchainKHR");
224 pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(device, "vkDestroySwapchainKHR");
225 pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)gpa(device, "vkGetSwapchainImagesKHR");
226 pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gpa(device, "vkAcquireNextImageKHR");
227 pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR)gpa(device, "vkQueuePresentKHR");
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700228 my_device_data->wsi_enabled = false;
Jon Ashburnf19916e2016-01-11 13:12:43 -0700229 for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700230 if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700231 my_device_data->wsi_enabled = true;
232 }
233}
234
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700235VkResult explicit_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
236 VkDevice *pDevice) {
Chia-I Wu16570472016-05-17 07:57:15 +0800237 layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map);
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700238 VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700239
240 assert(chain_info->u.pLayerInfo);
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700241 PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
242 PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr;
Chia-I Wu16570472016-05-17 07:57:15 +0800243 PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice");
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700244 if (fpCreateDevice == NULL) {
245 return VK_ERROR_INITIALIZATION_FAILED;
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700246 }
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700247
248 // Advance the link info for the next element on the chain
249 chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
250
251 VkResult result = fpCreateDevice(gpu, pCreateInfo, pAllocator, pDevice);
252 if (result != VK_SUCCESS) {
253 return result;
254 }
255
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600256 layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map);
257 my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice);
258
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700259 // Setup layer's device dispatch table
Mark Lobodzinski1ed594e2016-02-03 09:57:14 -0700260 initDeviceTable(*pDevice, fpGetDeviceProcAddr, unique_objects_device_table_map);
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700261
262 createDeviceRegisterExtensions(pCreateInfo, *pDevice);
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600263 // Set gpu for this device in order to get at any objects mapped at instance level
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600264
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600265 my_device_data->gpu = gpu;
Courtney Goeltzenleuchter00150eb2016-01-08 12:18:43 -0700266
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700267 return result;
268}
269
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600270void explicit_DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
Dustin Graves7b098da2016-04-29 11:55:43 -0600271 dispatch_key key = get_dispatch_key(device);
Mark Lobodzinski8a2305d2016-08-25 14:49:38 -0600272 layer_debug_report_destroy_device(device);
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600273 get_dispatch_table(unique_objects_device_table_map, device)->DestroyDevice(device, pAllocator);
Dustin Graves7b098da2016-04-29 11:55:43 -0600274 layer_data_map.erase(key);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700275}
276
Dustin Graves176f9df2016-07-14 17:28:11 -0600277VkResult explicit_AllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
278 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) {
279 const VkMemoryAllocateInfo *input_allocate_info = pAllocateInfo;
280 std::unique_ptr<safe_VkMemoryAllocateInfo> safe_allocate_info;
281 std::unique_ptr<safe_VkDedicatedAllocationMemoryAllocateInfoNV> safe_dedicated_allocate_info;
282 layer_data *my_map_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
283
284 if ((pAllocateInfo != nullptr) &&
285 ContainsExtStruct(pAllocateInfo, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV)) {
286 // Assuming there is only one extension struct of this type in the list for now
287 safe_dedicated_allocate_info =
288 std::unique_ptr<safe_VkDedicatedAllocationMemoryAllocateInfoNV>(new safe_VkDedicatedAllocationMemoryAllocateInfoNV);
289 safe_allocate_info = std::unique_ptr<safe_VkMemoryAllocateInfo>(new safe_VkMemoryAllocateInfo);
290
291 safe_allocate_info->initialize(pAllocateInfo);
292 input_allocate_info = reinterpret_cast<const VkMemoryAllocateInfo *>(safe_allocate_info.get());
293
294 const GenericHeader *orig_pnext = reinterpret_cast<const GenericHeader *>(pAllocateInfo->pNext);
295 GenericHeader *input_pnext = reinterpret_cast<GenericHeader *>(safe_allocate_info.get());
296 while (orig_pnext != nullptr) {
297 if (orig_pnext->sType == VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV) {
298 safe_dedicated_allocate_info->initialize(
299 reinterpret_cast<const VkDedicatedAllocationMemoryAllocateInfoNV *>(orig_pnext));
300
301 std::unique_lock<std::mutex> lock(global_lock);
302
303 if (safe_dedicated_allocate_info->buffer != VK_NULL_HANDLE) {
304 uint64_t local_buffer = reinterpret_cast<uint64_t &>(safe_dedicated_allocate_info->buffer);
305 safe_dedicated_allocate_info->buffer =
306 reinterpret_cast<VkBuffer &>(my_map_data->unique_id_mapping[local_buffer]);
307 }
308
309 if (safe_dedicated_allocate_info->image != VK_NULL_HANDLE) {
310 uint64_t local_image = reinterpret_cast<uint64_t &>(safe_dedicated_allocate_info->image);
311 safe_dedicated_allocate_info->image = reinterpret_cast<VkImage &>(my_map_data->unique_id_mapping[local_image]);
312 }
313
314 lock.unlock();
315
316 input_pnext->pNext = reinterpret_cast<GenericHeader *>(safe_dedicated_allocate_info.get());
317 input_pnext = reinterpret_cast<GenericHeader *>(input_pnext->pNext);
318 } else {
319 // TODO: generic handling of pNext copies
320 }
321
322 orig_pnext = reinterpret_cast<const GenericHeader *>(orig_pnext->pNext);
323 }
324 }
325
326 VkResult result = get_dispatch_table(unique_objects_device_table_map, device)
327 ->AllocateMemory(device, input_allocate_info, pAllocator, pMemory);
328
329 if (VK_SUCCESS == result) {
330 std::lock_guard<std::mutex> lock(global_lock);
331 uint64_t unique_id = global_unique_id++;
332 my_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(*pMemory);
333 *pMemory = reinterpret_cast<VkDeviceMemory &>(unique_id);
334 }
335
336 return result;
337}
338
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700339VkResult explicit_CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
340 const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator,
341 VkPipeline *pPipelines) {
342 // STRUCT USES:{'pipelineCache': 'VkPipelineCache', 'pCreateInfos[createInfoCount]': {'stage': {'module': 'VkShaderModule'},
343 // 'layout': 'VkPipelineLayout', 'basePipelineHandle': 'VkPipeline'}}
344 // LOCAL DECLS:{'pCreateInfos': 'VkComputePipelineCreateInfo*'}
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600345 layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700346 safe_VkComputePipelineCreateInfo *local_pCreateInfos = NULL;
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700347 if (pCreateInfos) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600348 std::lock_guard<std::mutex> lock(global_lock);
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700349 local_pCreateInfos = new safe_VkComputePipelineCreateInfo[createInfoCount];
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700350 for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) {
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700351 local_pCreateInfos[idx0].initialize(&pCreateInfos[idx0]);
352 if (pCreateInfos[idx0].basePipelineHandle) {
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700353 local_pCreateInfos[idx0].basePipelineHandle =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600354 (VkPipeline)my_device_data
355 ->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].basePipelineHandle)];
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700356 }
357 if (pCreateInfos[idx0].layout) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600358 local_pCreateInfos[idx0].layout =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600359 (VkPipelineLayout)
360 my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].layout)];
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700361 }
362 if (pCreateInfos[idx0].stage.module) {
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700363 local_pCreateInfos[idx0].stage.module =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600364 (VkShaderModule)
365 my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].stage.module)];
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700366 }
367 }
368 }
369 if (pipelineCache) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600370 std::lock_guard<std::mutex> lock(global_lock);
Dustin Gravesa7622d82016-04-14 17:29:20 -0600371 pipelineCache = (VkPipelineCache)my_device_data->unique_id_mapping[reinterpret_cast<uint64_t &>(pipelineCache)];
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700372 }
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600373
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700374 VkResult result = get_dispatch_table(unique_objects_device_table_map, device)
375 ->CreateComputePipelines(device, pipelineCache, createInfoCount,
376 (const VkComputePipelineCreateInfo *)local_pCreateInfos, pAllocator, pPipelines);
Eric Engestrom53b513f2016-02-21 19:58:09 +0000377 delete[] local_pCreateInfos;
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700378 if (VK_SUCCESS == result) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600379 uint64_t unique_id = 0;
380 std::lock_guard<std::mutex> lock(global_lock);
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700381 for (uint32_t i = 0; i < createInfoCount; ++i) {
Mark Lobodzinskifdf8f472016-04-28 16:36:58 -0600382 unique_id = global_unique_id++;
Dustin Gravesa7622d82016-04-14 17:29:20 -0600383 my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
384 pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700385 }
386 }
387 return result;
388}
389
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700390VkResult explicit_CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
391 const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator,
392 VkPipeline *pPipelines) {
393 // STRUCT USES:{'pipelineCache': 'VkPipelineCache', 'pCreateInfos[createInfoCount]': {'layout': 'VkPipelineLayout',
394 // 'pStages[stageCount]': {'module': 'VkShaderModule'}, 'renderPass': 'VkRenderPass', 'basePipelineHandle': 'VkPipeline'}}
395 // LOCAL DECLS:{'pCreateInfos': 'VkGraphicsPipelineCreateInfo*'}
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600396 layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700397 safe_VkGraphicsPipelineCreateInfo *local_pCreateInfos = NULL;
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700398 if (pCreateInfos) {
399 local_pCreateInfos = new safe_VkGraphicsPipelineCreateInfo[createInfoCount];
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600400 std::lock_guard<std::mutex> lock(global_lock);
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700401 for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) {
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700402 local_pCreateInfos[idx0].initialize(&pCreateInfos[idx0]);
403 if (pCreateInfos[idx0].basePipelineHandle) {
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700404 local_pCreateInfos[idx0].basePipelineHandle =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600405 (VkPipeline)my_device_data
406 ->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].basePipelineHandle)];
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700407 }
408 if (pCreateInfos[idx0].layout) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600409 local_pCreateInfos[idx0].layout =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600410 (VkPipelineLayout)
411 my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].layout)];
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700412 }
413 if (pCreateInfos[idx0].pStages) {
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700414 for (uint32_t idx1 = 0; idx1 < pCreateInfos[idx0].stageCount; ++idx1) {
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700415 if (pCreateInfos[idx0].pStages[idx1].module) {
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700416 local_pCreateInfos[idx0].pStages[idx1].module =
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600417 (VkShaderModule)my_device_data
Dustin Gravesa7622d82016-04-14 17:29:20 -0600418 ->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].pStages[idx1].module)];
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700419 }
420 }
421 }
422 if (pCreateInfos[idx0].renderPass) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600423 local_pCreateInfos[idx0].renderPass =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600424 (VkRenderPass)
425 my_device_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfos[idx0].renderPass)];
Tobin Ehlis8bb7c2f2016-02-10 15:38:45 -0700426 }
427 }
428 }
429 if (pipelineCache) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600430 std::lock_guard<std::mutex> lock(global_lock);
Dustin Gravesa7622d82016-04-14 17:29:20 -0600431 pipelineCache = (VkPipelineCache)my_device_data->unique_id_mapping[reinterpret_cast<uint64_t &>(pipelineCache)];
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700432 }
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600433
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700434 VkResult result =
435 get_dispatch_table(unique_objects_device_table_map, device)
436 ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount,
437 (const VkGraphicsPipelineCreateInfo *)local_pCreateInfos, pAllocator, pPipelines);
Eric Engestrom53b513f2016-02-21 19:58:09 +0000438 delete[] local_pCreateInfos;
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700439 if (VK_SUCCESS == result) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600440 uint64_t unique_id = 0;
441 std::lock_guard<std::mutex> lock(global_lock);
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700442 for (uint32_t i = 0; i < createInfoCount; ++i) {
Mark Lobodzinskifdf8f472016-04-28 16:36:58 -0600443 unique_id = global_unique_id++;
Dustin Gravesa7622d82016-04-14 17:29:20 -0600444 my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
445 pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700446 }
447 }
448 return result;
449}
450
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600451VkResult explicit_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
452 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) {
453 layer_data *my_map_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
454
455 safe_VkSwapchainCreateInfoKHR *local_pCreateInfo = NULL;
456 if (pCreateInfo) {
457 std::lock_guard<std::mutex> lock(global_lock);
458 local_pCreateInfo = new safe_VkSwapchainCreateInfoKHR(pCreateInfo);
459 local_pCreateInfo->oldSwapchain =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600460 (VkSwapchainKHR)my_map_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfo->oldSwapchain)];
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600461 // Need to pull surface mapping from the instance-level map
462 layer_data *instance_data = get_my_data_ptr(get_dispatch_key(my_map_data->gpu), layer_data_map);
463 local_pCreateInfo->surface =
Dustin Gravesa7622d82016-04-14 17:29:20 -0600464 (VkSurfaceKHR)instance_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pCreateInfo->surface)];
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600465 }
466
467 VkResult result = get_dispatch_table(unique_objects_device_table_map, device)
468 ->CreateSwapchainKHR(device, (const VkSwapchainCreateInfoKHR *)local_pCreateInfo, pAllocator, pSwapchain);
469 if (local_pCreateInfo)
470 delete local_pCreateInfo;
471 if (VK_SUCCESS == result) {
472 std::lock_guard<std::mutex> lock(global_lock);
Mark Lobodzinskifdf8f472016-04-28 16:36:58 -0600473 uint64_t unique_id =global_unique_id++;
Dustin Gravesa7622d82016-04-14 17:29:20 -0600474 my_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(*pSwapchain);
475 *pSwapchain = reinterpret_cast<VkSwapchainKHR &>(unique_id);
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600476 }
477 return result;
478}
479
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700480VkResult explicit_GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount,
481 VkImage *pSwapchainImages) {
482 // UNWRAP USES:
483 // 0 : swapchain,VkSwapchainKHR, pSwapchainImages,VkImage
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600484 layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700485 if (VK_NULL_HANDLE != swapchain) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600486 std::lock_guard<std::mutex> lock(global_lock);
Dustin Gravesa7622d82016-04-14 17:29:20 -0600487 swapchain = (VkSwapchainKHR)my_device_data->unique_id_mapping[reinterpret_cast<uint64_t &>(swapchain)];
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700488 }
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700489 VkResult result = get_dispatch_table(unique_objects_device_table_map, device)
490 ->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700491 // TODO : Need to add corresponding code to delete these images
492 if (VK_SUCCESS == result) {
493 if ((*pSwapchainImageCount > 0) && pSwapchainImages) {
Tobin Ehlis10ba1de2016-04-13 12:59:43 -0600494 uint64_t unique_id = 0;
495 std::lock_guard<std::mutex> lock(global_lock);
Jon Ashburn5484e0c2016-03-08 17:48:44 -0700496 for (uint32_t i = 0; i < *pSwapchainImageCount; ++i) {
Mark Lobodzinskifdf8f472016-04-28 16:36:58 -0600497 unique_id = global_unique_id++;
Dustin Gravesa7622d82016-04-14 17:29:20 -0600498 my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pSwapchainImages[i]);
499 pSwapchainImages[i] = reinterpret_cast<VkImage &>(unique_id);
Tobin Ehlisd34a4c52015-12-08 10:50:10 -0700500 }
501 }
502 }
503 return result;
504}
Chia-I Wucdb70962016-05-13 14:07:36 +0800505
Jon Ashburnbd846452016-06-30 10:21:55 -0600506 #ifndef __ANDROID__
Jon Ashburn73a34352016-06-29 16:12:51 -0600507VkResult explicit_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties)
508{
509 layer_data *my_map_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
510 safe_VkDisplayPropertiesKHR* local_pProperties = NULL;
511 {
512 std::lock_guard<std::mutex> lock(global_lock);
513 if (pProperties) {
514 local_pProperties = new safe_VkDisplayPropertiesKHR[*pPropertyCount];
515 for (uint32_t idx0=0; idx0<*pPropertyCount; ++idx0) {
516 local_pProperties[idx0].initialize(&pProperties[idx0]);
517 if (pProperties[idx0].display) {
518 local_pProperties[idx0].display = (VkDisplayKHR)my_map_data->unique_id_mapping[reinterpret_cast<const uint64_t &>(pProperties[idx0].display)];
519 }
520 }
521 }
522 }
523
524 VkResult result = get_dispatch_table(unique_objects_instance_table_map, physicalDevice)->GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, ( VkDisplayPropertiesKHR*)local_pProperties);
525 if (result == VK_SUCCESS && pProperties)
526 {
527 for (uint32_t idx0=0; idx0<*pPropertyCount; ++idx0) {
528 std::lock_guard<std::mutex> lock(global_lock);
529
530 uint64_t unique_id = global_unique_id++;
531 my_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(local_pProperties[idx0].display);
532 pProperties[idx0].display = reinterpret_cast<VkDisplayKHR&>(unique_id);
533 pProperties[idx0].displayName = local_pProperties[idx0].displayName;
534 pProperties[idx0].physicalDimensions = local_pProperties[idx0].physicalDimensions;
535 pProperties[idx0].physicalResolution = local_pProperties[idx0].physicalResolution;
536 pProperties[idx0].supportedTransforms = local_pProperties[idx0].supportedTransforms;
537 pProperties[idx0].planeReorderPossible = local_pProperties[idx0].planeReorderPossible;
538 pProperties[idx0].persistentContent = local_pProperties[idx0].persistentContent;
539 }
540 }
541 if (local_pProperties)
542 delete[] local_pProperties;
543 return result;
544}
545
Jon Ashburn5e026df2016-06-15 08:19:07 -0600546VkResult explicit_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays)
547{
548 layer_data *my_map_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
549 VkResult result = get_dispatch_table(unique_objects_instance_table_map, physicalDevice)->GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays);
550 if (VK_SUCCESS == result) {
551 if ((*pDisplayCount > 0) && pDisplays) {
552 std::lock_guard<std::mutex> lock(global_lock);
Jon Ashburn5e026df2016-06-15 08:19:07 -0600553 for (uint32_t i = 0; i < *pDisplayCount; i++) {
Jon Ashburnbd846452016-06-30 10:21:55 -0600554 auto it = my_map_data->unique_id_mapping.find(reinterpret_cast<const uint64_t &> (pDisplays[i]));
Jon Ashburn73a34352016-06-29 16:12:51 -0600555 assert (it != my_map_data->unique_id_mapping.end());
Jon Ashburnbd846452016-06-30 10:21:55 -0600556 pDisplays[i] = reinterpret_cast<VkDisplayKHR&> (it->second);
Jon Ashburn5e026df2016-06-15 08:19:07 -0600557 }
558 }
559 }
560 return result;
561}
Jon Ashburn32e042d2016-06-28 14:46:12 -0600562
563
564VkResult explicit_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties)
565{
566 layer_data *my_map_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
567 safe_VkDisplayModePropertiesKHR* local_pProperties = NULL;
568 {
569 std::lock_guard<std::mutex> lock(global_lock);
570 display = (VkDisplayKHR)my_map_data->unique_id_mapping[reinterpret_cast<uint64_t &>(display)];
571 if (pProperties) {
572 local_pProperties = new safe_VkDisplayModePropertiesKHR[*pPropertyCount];
573 for (uint32_t idx0=0; idx0<*pPropertyCount; ++idx0) {
574 local_pProperties[idx0].initialize(&pProperties[idx0]);
575 }
576 }
577 }
578
579 VkResult result = get_dispatch_table(unique_objects_instance_table_map, physicalDevice)->GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, ( VkDisplayModePropertiesKHR*)local_pProperties);
580 if (result == VK_SUCCESS && pProperties)
581 {
582 for (uint32_t idx0=0; idx0<*pPropertyCount; ++idx0) {
583 std::lock_guard<std::mutex> lock(global_lock);
584
585 uint64_t unique_id = global_unique_id++;
586 my_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(local_pProperties[idx0].displayMode);
587 pProperties[idx0].displayMode = reinterpret_cast<VkDisplayModeKHR&>(unique_id);
588 pProperties[idx0].parameters.visibleRegion.width = local_pProperties[idx0].parameters.visibleRegion.width;
589 pProperties[idx0].parameters.visibleRegion.height = local_pProperties[idx0].parameters.visibleRegion.height;
590 pProperties[idx0].parameters.refreshRate = local_pProperties[idx0].parameters.refreshRate;
591 }
592 }
593 if (local_pProperties)
594 delete[] local_pProperties;
595 return result;
596}
Jon Ashburnbd846452016-06-30 10:21:55 -0600597#endif
Chia-I Wucdb70962016-05-13 14:07:36 +0800598} // namespace unique_objects