aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Schuchardt <mikes@lunarg.com>2017-03-10 14:59:10 -0700
committerMike Schuchardt <mikes@lunarg.com>2017-03-21 08:45:04 -0600
commit453507b43fd2949984cbb07935a760b62f2af8c0 (patch)
tree07f6d8248468c83a707b0a2691ccc2559b062684
parent0fe455ef3b14f90a3be14167d68dda1e945642fe (diff)
downloadusermoji-453507b43fd2949984cbb07935a760b62f2af8c0.tar.xz
layers: swapchain post call record refactor
Change-Id: Id4063c82d9e592f982c59fb12c6d9f06a9e7b35a
-rw-r--r--layers/swapchain.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index 112a3333..15a8e4b0 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -249,33 +249,38 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati
layer_data_map.erase(key);
}
-VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,
- uint32_t *pQueueFamilyPropertyCount,
- VkQueueFamilyProperties *pQueueFamilyProperties) {
- layer_data *my_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map);
-
- // Call down the call chain:
- my_data->instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount,
- pQueueFamilyProperties);
-
+static void PostCallRecordGetPhysicalDeviceQueueFamilyProperties(layer_data *dev_data, VkPhysicalDevice physical_device,
+ uint32_t *qfp_count, VkQueueFamilyProperties *qfp) {
// Record the result of this query:
std::lock_guard<std::mutex> lock(global_lock);
- SwpPhysicalDevice *pPhysicalDevice = NULL;
+ SwpPhysicalDevice *phy_data = NULL;
{
- auto it = my_data->physicalDeviceMap.find(physicalDevice);
- pPhysicalDevice = (it == my_data->physicalDeviceMap.end()) ? NULL : &it->second;
+ auto it = dev_data->physicalDeviceMap.find(physical_device);
+ phy_data = (it == dev_data->physicalDeviceMap.end()) ? NULL : &it->second;
}
// Note: for poorly-written applications (e.g. that don't call this command
// twice, the first time with pQueueFamilyProperties set to NULL, and the
// second time with a non-NULL pQueueFamilyProperties and with the same
// count as returned the first time), record the count when
- // pQueueFamilyProperties is non-NULL:
- if (pPhysicalDevice && pQueueFamilyPropertyCount && pQueueFamilyProperties) {
- pPhysicalDevice->gotQueueFamilyPropertyCount = true;
- pPhysicalDevice->numOfQueueFamilies = *pQueueFamilyPropertyCount;
+ // queue family property data pointer is non-NULL:
+ if (phy_data && qfp && qfp_count) {
+ phy_data->gotQueueFamilyPropertyCount = true;
+ phy_data->numOfQueueFamilies = *qfp_count;
}
}
+VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,
+ uint32_t *pQueueFamilyPropertyCount,
+ VkQueueFamilyProperties *pQueueFamilyProperties) {
+ layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(physicalDevice), layer_data_map);
+
+ // Call down the call chain:
+ dev_data->instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount,
+ pQueueFamilyProperties);
+ PostCallRecordGetPhysicalDeviceQueueFamilyProperties(dev_data, physicalDevice, pQueueFamilyPropertyCount,
+ pQueueFamilyProperties);
+}
+
#ifdef VK_USE_PLATFORM_ANDROID_KHR
VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {