• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Vulkan
3  *
4  * Copyright (C) 2015 Valve, Inc.
5  * Copyright (C) 2016 Google, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <unordered_map>
23 #include <list>
24 
25 #include "vk_loader_platform.h"
26 #include "vulkan/vk_layer.h"
27 #include "vk_layer_config.h"
28 #include "vk_layer_extension_utils.h"
29 #include "vk_layer_utils.h"
30 #include "vk_enum_validate_helper.h"
31 #include "vk_struct_validate_helper.h"
32 #include "vk_layer_table.h"
33 #include "vk_layer_logging.h"
34 #include "threading.h"
35 #include "vk_dispatch_table_helper.h"
36 #include "vk_struct_string_helper_cpp.h"
37 #include "vk_layer_data.h"
38 #include "vk_layer_utils.h"
39 
40 #include "thread_check.h"
41 
42 namespace threading {
43 
initThreading(layer_data * my_data,const VkAllocationCallbacks * pAllocator)44 static void initThreading(layer_data *my_data, const VkAllocationCallbacks *pAllocator) {
45 
46     layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "google_threading");
47 }
48 
49 VKAPI_ATTR VkResult VKAPI_CALL
CreateInstance(const VkInstanceCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkInstance * pInstance)50 CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
51     VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
52 
53     assert(chain_info->u.pLayerInfo);
54     PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
55     PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance");
56     if (fpCreateInstance == NULL) {
57         return VK_ERROR_INITIALIZATION_FAILED;
58     }
59 
60     // Advance the link info for the next element on the chain
61     chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
62 
63     VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance);
64     if (result != VK_SUCCESS)
65         return result;
66 
67     layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map);
68     my_data->instance = *pInstance;
69     my_data->instance_dispatch_table = new VkLayerInstanceDispatchTable;
70     layer_init_instance_dispatch_table(*pInstance, my_data->instance_dispatch_table, fpGetInstanceProcAddr);
71 
72     my_data->report_data = debug_report_create_instance(my_data->instance_dispatch_table, *pInstance,
73                                                         pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames);
74     initThreading(my_data, pAllocator);
75 
76     // Look for one or more debug report create info structures, and copy the
77     // callback(s) for each one found (for use by vkDestroyInstance)
78     layer_copy_tmp_callbacks(pCreateInfo->pNext, &my_data->num_tmp_callbacks, &my_data->tmp_dbg_create_infos,
79                              &my_data->tmp_callbacks);
80     return result;
81 }
82 
DestroyInstance(VkInstance instance,const VkAllocationCallbacks * pAllocator)83 VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) {
84     dispatch_key key = get_dispatch_key(instance);
85     layer_data *my_data = get_my_data_ptr(key, layer_data_map);
86     VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
87 
88     // Enable the temporary callback(s) here to catch cleanup issues:
89     bool callback_setup = false;
90     if (my_data->num_tmp_callbacks > 0) {
91         if (!layer_enable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_dbg_create_infos,
92                                         my_data->tmp_callbacks)) {
93             callback_setup = true;
94         }
95     }
96 
97     bool threadChecks = startMultiThread();
98     if (threadChecks) {
99         startWriteObject(my_data, instance);
100     }
101     pTable->DestroyInstance(instance, pAllocator);
102     if (threadChecks) {
103         finishWriteObject(my_data, instance);
104     } else {
105         finishMultiThread();
106     }
107 
108     // Disable and cleanup the temporary callback(s):
109     if (callback_setup) {
110         layer_disable_tmp_callbacks(my_data->report_data, my_data->num_tmp_callbacks, my_data->tmp_callbacks);
111     }
112     if (my_data->num_tmp_callbacks > 0) {
113         layer_free_tmp_callbacks(my_data->tmp_dbg_create_infos, my_data->tmp_callbacks);
114         my_data->num_tmp_callbacks = 0;
115     }
116 
117     // Clean up logging callback, if any
118     while (my_data->logging_callback.size() > 0) {
119         VkDebugReportCallbackEXT callback = my_data->logging_callback.back();
120         layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
121         my_data->logging_callback.pop_back();
122     }
123 
124     layer_debug_report_destroy_instance(my_data->report_data);
125     delete my_data->instance_dispatch_table;
126     layer_data_map.erase(key);
127 }
128 
CreateDevice(VkPhysicalDevice gpu,const VkDeviceCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkDevice * pDevice)129 VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo,
130                                             const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
131     layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map);
132     VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
133 
134     assert(chain_info->u.pLayerInfo);
135     PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
136     PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr;
137     PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice");
138     if (fpCreateDevice == NULL) {
139         return VK_ERROR_INITIALIZATION_FAILED;
140     }
141 
142     // Advance the link info for the next element on the chain
143     chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
144 
145     VkResult result = fpCreateDevice(gpu, pCreateInfo, pAllocator, pDevice);
146     if (result != VK_SUCCESS) {
147         return result;
148     }
149 
150     layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map);
151 
152     // Setup device dispatch table
153     my_device_data->device_dispatch_table = new VkLayerDispatchTable;
154     layer_init_device_dispatch_table(*pDevice, my_device_data->device_dispatch_table, fpGetDeviceProcAddr);
155 
156     my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice);
157     return result;
158 }
159 
DestroyDevice(VkDevice device,const VkAllocationCallbacks * pAllocator)160 VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
161     dispatch_key key = get_dispatch_key(device);
162     layer_data *dev_data = get_my_data_ptr(key, layer_data_map);
163     bool threadChecks = startMultiThread();
164     if (threadChecks) {
165         startWriteObject(dev_data, device);
166     }
167     dev_data->device_dispatch_table->DestroyDevice(device, pAllocator);
168     if (threadChecks) {
169         finishWriteObject(dev_data, device);
170     } else {
171         finishMultiThread();
172     }
173     layer_data_map.erase(key);
174 }
175 
176 static const VkExtensionProperties threading_extensions[] = {
177     {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}};
178 
179 static const VkLayerProperties layerProps = {
180     "VK_LAYER_GOOGLE_threading",
181     VK_LAYER_API_VERSION, // specVersion
182     1, "Google Validation Layer",
183 };
184 
layer_intercept_proc(const char * name)185 static inline PFN_vkVoidFunction layer_intercept_proc(const char *name) {
186     for (int i = 0; i < sizeof(procmap) / sizeof(procmap[0]); i++) {
187         if (!strcmp(name, procmap[i].name))
188             return procmap[i].pFunc;
189     }
190     return NULL;
191 }
192 
193 VKAPI_ATTR VkResult VKAPI_CALL
EnumerateInstanceLayerProperties(uint32_t * pCount,VkLayerProperties * pProperties)194 EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) {
195     return util_GetLayerProperties(1, &layerProps, pCount, pProperties);
196 }
197 
198 VKAPI_ATTR VkResult VKAPI_CALL
EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,uint32_t * pCount,VkLayerProperties * pProperties)199 EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) {
200     return util_GetLayerProperties(1, &layerProps, pCount, pProperties);
201 }
202 
203 VKAPI_ATTR VkResult VKAPI_CALL
EnumerateInstanceExtensionProperties(const char * pLayerName,uint32_t * pCount,VkExtensionProperties * pProperties)204 EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) {
205     if (pLayerName && !strcmp(pLayerName, layerProps.layerName))
206         return util_GetExtensionProperties(1, threading_extensions, pCount, pProperties);
207 
208     return VK_ERROR_LAYER_NOT_PRESENT;
209 }
210 
EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,const char * pLayerName,uint32_t * pCount,VkExtensionProperties * pProperties)211 VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
212                                                                   const char *pLayerName, uint32_t *pCount,
213                                                                   VkExtensionProperties *pProperties) {
214     // Threading layer does not have any device extensions
215     if (pLayerName && !strcmp(pLayerName, layerProps.layerName))
216         return util_GetExtensionProperties(0, nullptr, pCount, pProperties);
217 
218     assert(physicalDevice);
219 
220     dispatch_key key = get_dispatch_key(physicalDevice);
221     layer_data *my_data = get_my_data_ptr(key, layer_data_map);
222     return my_data->instance_dispatch_table->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties);
223 }
224 
layer_intercept_instance_proc(const char * name)225 static inline PFN_vkVoidFunction layer_intercept_instance_proc(const char *name) {
226     if (!name || name[0] != 'v' || name[1] != 'k')
227         return NULL;
228 
229     name += 2;
230     if (!strcmp(name, "CreateInstance"))
231         return (PFN_vkVoidFunction)CreateInstance;
232     if (!strcmp(name, "DestroyInstance"))
233         return (PFN_vkVoidFunction)DestroyInstance;
234     if (!strcmp(name, "EnumerateInstanceLayerProperties"))
235         return (PFN_vkVoidFunction)EnumerateInstanceLayerProperties;
236     if (!strcmp(name, "EnumerateInstanceExtensionProperties"))
237         return (PFN_vkVoidFunction)EnumerateInstanceExtensionProperties;
238     if (!strcmp(name, "EnumerateDeviceLayerProperties"))
239         return (PFN_vkVoidFunction)EnumerateDeviceLayerProperties;
240     if (!strcmp(name, "EnumerateDeviceExtensionProperties"))
241         return (PFN_vkVoidFunction)EnumerateDeviceExtensionProperties;
242     if (!strcmp(name, "CreateDevice"))
243         return (PFN_vkVoidFunction)CreateDevice;
244     if (!strcmp(name, "GetInstanceProcAddr"))
245         return (PFN_vkVoidFunction)GetInstanceProcAddr;
246 
247     return NULL;
248 }
249 
GetDeviceProcAddr(VkDevice device,const char * funcName)250 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) {
251     PFN_vkVoidFunction addr;
252     layer_data *dev_data;
253 
254     assert(device);
255 
256     addr = layer_intercept_proc(funcName);
257     if (addr)
258         return addr;
259 
260     dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
261     VkLayerDispatchTable *pTable = dev_data->device_dispatch_table;
262 
263     if (pTable->GetDeviceProcAddr == NULL)
264         return NULL;
265     return pTable->GetDeviceProcAddr(device, funcName);
266 }
267 
GetInstanceProcAddr(VkInstance instance,const char * funcName)268 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) {
269     PFN_vkVoidFunction addr;
270     layer_data *my_data;
271 
272     addr = layer_intercept_instance_proc(funcName);
273     if (!addr)
274         addr = layer_intercept_proc(funcName);
275     if (addr) {
276         return addr;
277     }
278 
279     assert(instance);
280 
281     my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
282     addr = debug_report_get_instance_proc_addr(my_data->report_data, funcName);
283     if (addr) {
284         return addr;
285     }
286 
287     VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
288     if (pTable->GetInstanceProcAddr == NULL) {
289         return NULL;
290     }
291     return pTable->GetInstanceProcAddr(instance, funcName);
292 }
293 
294 VKAPI_ATTR VkResult VKAPI_CALL
CreateDebugReportCallbackEXT(VkInstance instance,const VkDebugReportCallbackCreateInfoEXT * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkDebugReportCallbackEXT * pMsgCallback)295 CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
296                              const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) {
297     layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
298     bool threadChecks = startMultiThread();
299     if (threadChecks) {
300         startReadObject(my_data, instance);
301     }
302     VkResult result =
303         my_data->instance_dispatch_table->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback);
304     if (VK_SUCCESS == result) {
305         result = layer_create_msg_callback(my_data->report_data, false, pCreateInfo, pAllocator, pMsgCallback);
306     }
307     if (threadChecks) {
308         finishReadObject(my_data, instance);
309     } else {
310         finishMultiThread();
311     }
312     return result;
313 }
314 
315 VKAPI_ATTR void VKAPI_CALL
DestroyDebugReportCallbackEXT(VkInstance instance,VkDebugReportCallbackEXT callback,const VkAllocationCallbacks * pAllocator)316 DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator) {
317     layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
318     bool threadChecks = startMultiThread();
319     if (threadChecks) {
320         startReadObject(my_data, instance);
321         startWriteObject(my_data, callback);
322     }
323     my_data->instance_dispatch_table->DestroyDebugReportCallbackEXT(instance, callback, pAllocator);
324     layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
325     if (threadChecks) {
326         finishReadObject(my_data, instance);
327         finishWriteObject(my_data, callback);
328     } else {
329         finishMultiThread();
330     }
331 }
332 
333 VKAPI_ATTR VkResult VKAPI_CALL
AllocateCommandBuffers(VkDevice device,const VkCommandBufferAllocateInfo * pAllocateInfo,VkCommandBuffer * pCommandBuffers)334 AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) {
335     dispatch_key key = get_dispatch_key(device);
336     layer_data *my_data = get_my_data_ptr(key, layer_data_map);
337     VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
338     VkResult result;
339     bool threadChecks = startMultiThread();
340     if (threadChecks) {
341         startReadObject(my_data, device);
342         startWriteObject(my_data, pAllocateInfo->commandPool);
343     }
344 
345     result = pTable->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
346     if (threadChecks) {
347         finishReadObject(my_data, device);
348         finishWriteObject(my_data, pAllocateInfo->commandPool);
349     } else {
350         finishMultiThread();
351     }
352 
353     // Record mapping from command buffer to command pool
354     if (VK_SUCCESS == result) {
355         for (uint32_t index = 0; index < pAllocateInfo->commandBufferCount; index++) {
356             std::lock_guard<std::mutex> lock(command_pool_lock);
357             command_pool_map[pCommandBuffers[index]] = pAllocateInfo->commandPool;
358         }
359     }
360 
361     return result;
362 }
363 
FreeCommandBuffers(VkDevice device,VkCommandPool commandPool,uint32_t commandBufferCount,const VkCommandBuffer * pCommandBuffers)364 VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
365                                               const VkCommandBuffer *pCommandBuffers) {
366     dispatch_key key = get_dispatch_key(device);
367     layer_data *my_data = get_my_data_ptr(key, layer_data_map);
368     VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
369     const bool lockCommandPool = false; // pool is already directly locked
370     bool threadChecks = startMultiThread();
371     if (threadChecks) {
372         startReadObject(my_data, device);
373         startWriteObject(my_data, commandPool);
374         for (uint32_t index = 0; index < commandBufferCount; index++) {
375             startWriteObject(my_data, pCommandBuffers[index], lockCommandPool);
376         }
377         // The driver may immediately reuse command buffers in another thread.
378         // These updates need to be done before calling down to the driver.
379         for (uint32_t index = 0; index < commandBufferCount; index++) {
380             finishWriteObject(my_data, pCommandBuffers[index], lockCommandPool);
381             std::lock_guard<std::mutex> lock(command_pool_lock);
382             command_pool_map.erase(pCommandBuffers[index]);
383         }
384     }
385 
386     pTable->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
387     if (threadChecks) {
388         finishReadObject(my_data, device);
389         finishWriteObject(my_data, commandPool);
390     } else {
391         finishMultiThread();
392     }
393 }
394 
395 } // namespace threading
396 
397 // vk_layer_logging.h expects these to be defined
398 
399 VKAPI_ATTR VkResult VKAPI_CALL
vkCreateDebugReportCallbackEXT(VkInstance instance,const VkDebugReportCallbackCreateInfoEXT * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkDebugReportCallbackEXT * pMsgCallback)400 vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
401                                const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) {
402     return threading::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback);
403 }
404 
vkDestroyDebugReportCallbackEXT(VkInstance instance,VkDebugReportCallbackEXT msgCallback,const VkAllocationCallbacks * pAllocator)405 VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance,
406                                                            VkDebugReportCallbackEXT msgCallback,
407                                                            const VkAllocationCallbacks *pAllocator) {
408     threading::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator);
409 }
410 
411 VKAPI_ATTR void VKAPI_CALL
vkDebugReportMessageEXT(VkInstance instance,VkDebugReportFlagsEXT flags,VkDebugReportObjectTypeEXT objType,uint64_t object,size_t location,int32_t msgCode,const char * pLayerPrefix,const char * pMsg)412 vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t object,
413                         size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) {
414     threading::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
415 }
416 
417 // loader-layer interface v0, just wrappers since there is only a layer
418 
419 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateInstanceExtensionProperties(const char * pLayerName,uint32_t * pCount,VkExtensionProperties * pProperties)420 vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) {
421     return threading::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties);
422 }
423 
424 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateInstanceLayerProperties(uint32_t * pCount,VkLayerProperties * pProperties)425 vkEnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) {
426     return threading::EnumerateInstanceLayerProperties(pCount, pProperties);
427 }
428 
429 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,uint32_t * pCount,VkLayerProperties * pProperties)430 vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) {
431     // the layer command handles VK_NULL_HANDLE just fine internally
432     assert(physicalDevice == VK_NULL_HANDLE);
433     return threading::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties);
434 }
435 
vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,const char * pLayerName,uint32_t * pCount,VkExtensionProperties * pProperties)436 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
437                                                                                     const char *pLayerName, uint32_t *pCount,
438                                                                                     VkExtensionProperties *pProperties) {
439     // the layer command handles VK_NULL_HANDLE just fine internally
440     assert(physicalDevice == VK_NULL_HANDLE);
441     return threading::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties);
442 }
443 
vkGetDeviceProcAddr(VkDevice dev,const char * funcName)444 VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char *funcName) {
445     return threading::GetDeviceProcAddr(dev, funcName);
446 }
447 
vkGetInstanceProcAddr(VkInstance instance,const char * funcName)448 VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) {
449     return threading::GetInstanceProcAddr(instance, funcName);
450 }
451