diff options
author | Mike Schuchardt <mikes@lunarg.com> | 2017-03-10 14:12:35 -0700 |
---|---|---|
committer | Mike Schuchardt <mikes@lunarg.com> | 2017-03-21 08:45:04 -0600 |
commit | 572ea7954fb7798ae84b8e9e202d1da10be8bb8e (patch) | |
tree | ce9a15a984bf99ca48dd16cd58939e22e7e6c395 | |
parent | db383e411ed6e5636a1620cce421106e6c6bf4b4 (diff) |
layers: swapchain queue family count tracking
Add vkGetPhysicalDeviceQueueFamilyProperties2KHR as an alternate way get
queue family count.
Change-Id: Ie0efee916a1bf091eb34c8610eec3c73943db846
-rw-r--r-- | layers/swapchain.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp index 15a8e4b0..ab1f9601 100644 --- a/layers/swapchain.cpp +++ b/layers/swapchain.cpp @@ -250,7 +250,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati } static void PostCallRecordGetPhysicalDeviceQueueFamilyProperties(layer_data *dev_data, VkPhysicalDevice physical_device, - uint32_t *qfp_count, VkQueueFamilyProperties *qfp) { + uint32_t *qfp_count, bool qfp_is_null) { // Record the result of this query: std::lock_guard<std::mutex> lock(global_lock); SwpPhysicalDevice *phy_data = NULL; @@ -263,7 +263,7 @@ static void PostCallRecordGetPhysicalDeviceQueueFamilyProperties(layer_data *dev // second time with a non-NULL pQueueFamilyProperties and with the same // count as returned the first time), record the count when // queue family property data pointer is non-NULL: - if (phy_data && qfp && qfp_count) { + if (phy_data && qfp_count && !qfp_is_null) { phy_data->gotQueueFamilyPropertyCount = true; phy_data->numOfQueueFamilies = *qfp_count; } @@ -278,7 +278,17 @@ VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevi dev_data->instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); PostCallRecordGetPhysicalDeviceQueueFamilyProperties(dev_data, physicalDevice, pQueueFamilyPropertyCount, - pQueueFamilyProperties); + pQueueFamilyProperties == NULL); +} + +VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, + uint32_t *pQueueFamilyPropertyCount, + VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { + auto dev_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map); + dev_data->instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, + pQueueFamilyProperties); + PostCallRecordGetPhysicalDeviceQueueFamilyProperties(dev_data, physicalDevice, pQueueFamilyPropertyCount, + pQueueFamilyProperties == NULL); } #ifdef VK_USE_PLATFORM_ANDROID_KHR @@ -1315,6 +1325,8 @@ static PFN_vkVoidFunction intercept_core_instance_command(const char *name); static PFN_vkVoidFunction intercept_khr_surface_command(const char *name, VkInstance instance); +static PFN_vkVoidFunction intercept_extension_instance_commands(const char *name); + static PFN_vkVoidFunction intercept_core_device_command(const char *name); static PFN_vkVoidFunction intercept_khr_swapchain_command(const char *name, VkDevice dev); @@ -1351,6 +1363,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance proc = debug_report_get_instance_proc_addr(my_data->report_data, funcName); if (!proc) proc = intercept_khr_surface_command(funcName, instance); + if (!proc) proc = intercept_extension_instance_commands(funcName); if (proc) return proc; if (pTable->GetInstanceProcAddr == NULL) return NULL; @@ -1444,6 +1457,23 @@ static PFN_vkVoidFunction intercept_khr_surface_command(const char *name, VkInst return nullptr; } +static PFN_vkVoidFunction intercept_extension_instance_commands(const char *name) { + static const struct { + const char *name; + PFN_vkVoidFunction proc; + } instance_extension_commands[] = { + {"vkGetPhysicalDeviceQueueFamilyProperties2KHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceQueueFamilyProperties2KHR)}, + }; + + for (size_t i = 0; i < ARRAY_SIZE(instance_extension_commands); i++) { + if (!strcmp(instance_extension_commands[i].name, name)) { + return instance_extension_commands[i].proc; + } + } + return nullptr; +} + static PFN_vkVoidFunction intercept_core_device_command(const char *name) { static const struct { const char *name; |