diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2016-08-08 14:41:55 -0600 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2016-08-16 14:19:55 -0600 |
| commit | 32ec12e1cc25b0d6e484d9c68a89b70ca18be9fc (patch) | |
| tree | d7b15271ed6b31434c6e674f88a00567a9ce559e /layers | |
| parent | f3101e2febd5f1bb1b00343b425fed6409017104 (diff) | |
| download | usermoji-32ec12e1cc25b0d6e484d9c68a89b70ca18be9fc.tar.xz | |
layers: Run swapchain source through clang-format
Change-Id: Iaebe81e34e76d4760d1097da23d52d7ca2ef4273
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/swapchain.cpp | 897 |
1 files changed, 460 insertions, 437 deletions
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp index 63eca416..77448698 100644 --- a/layers/swapchain.cpp +++ b/layers/swapchain.cpp @@ -42,8 +42,7 @@ static const VkLayerProperties swapchain_layer = { "VK_LAYER_LUNARG_swapchain", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer", }; -static void checkDeviceRegisterExtensions(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, - VkDevice device) { +static void checkDeviceRegisterExtensions(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, VkDevice device) { uint32_t i; layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -192,16 +191,17 @@ static bool ValidateQueueFamilyIndex(layer_data *my_data, uint32_t queue_family_ bool skip_call = false; if (queue_family_index >= queue_family_count) { skip_call = log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - reinterpret_cast<uint64_t>(physical_device), __LINE__, SWAPCHAIN_QUEUE_FAMILY_INDEX_TOO_LARGE, swapchain_layer_name, - "%s() called with a queueFamilyIndex that is too large (i.e. %d). The maximum value (returned by " - "vkGetPhysicalDeviceQueueFamilyProperties) is only %d.", - function, queue_family_index, queue_family_count); + reinterpret_cast<uint64_t>(physical_device), __LINE__, SWAPCHAIN_QUEUE_FAMILY_INDEX_TOO_LARGE, + swapchain_layer_name, + "%s() called with a queueFamilyIndex that is too large (i.e. %d). The maximum value (returned by " + "vkGetPhysicalDeviceQueueFamilyProperties) is only %d.", + function, queue_family_index, queue_family_count); } return skip_call; } -VKAPI_ATTR VkResult VKAPI_CALL -CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { +VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, + VkInstance *pInstance) { VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); assert(chain_info->u.pLayerInfo); @@ -268,8 +268,8 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati if (pPhysicalDevice) { if (pPhysicalDevice->pDevice) { log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pDevice->device), __LINE__, SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, - swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->pDevice->device), __LINE__, + SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, swapchain_layer_name, "VkDestroyInstance() called before all of its associated VkDevices were destroyed."); } free(pPhysicalDevice->pSurfaceFormats); @@ -286,7 +286,8 @@ VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocati SwpSurface *pSurface = it->second; if (pSurface) { log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pInstance->instance), __LINE__, SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, swapchain_layer_name, + reinterpret_cast<uint64_t>(pInstance->instance), __LINE__, SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, + swapchain_layer_name, "VkDestroyInstance() called before all of its associated VkSurfaceKHRs were destroyed."); } } @@ -314,9 +315,9 @@ 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) { +VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, + uint32_t *pQueueFamilyPropertyCount, + VkQueueFamilyProperties *pQueueFamilyProperties) { layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); // Call down the call chain: @@ -337,9 +338,8 @@ GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t } #ifdef VK_USE_PLATFORM_ANDROID_KHR -VKAPI_ATTR VkResult VKAPI_CALL -CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -352,10 +352,11 @@ CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR // Validate that the platform extension was enabled: if (pInstance && !pInstance->androidSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkCreateAndroidSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkCreateAndroidSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); } lock.unlock(); @@ -388,9 +389,8 @@ CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR #endif // VK_USE_PLATFORM_ANDROID_KHR #ifdef VK_USE_PLATFORM_MIR_KHR -VKAPI_ATTR VkResult VKAPI_CALL -CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -403,10 +403,11 @@ CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreat // Validate that the platform extension was enabled: if (pInstance && !pInstance->mirSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkCreateMirSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_MIR_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkCreateMirSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_MIR_SURFACE_EXTENSION_NAME); } lock.unlock(); @@ -438,8 +439,7 @@ CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreat } VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - MirConnection *connection) { + uint32_t queueFamilyIndex, MirConnection *connection) { VkBool32 result = VK_FALSE; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -452,15 +452,16 @@ VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhys // Validate that the platform extension was enabled: if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->mirSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, "vkGetPhysicalDeviceMirPresentationSupportKHR() called even though the %s " - "extension was not enabled for this VkInstance.", - VK_KHR_MIR_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceMirPresentationSupportKHR() called even though the %s " + "extension was not enabled for this VkInstance.", + VK_KHR_MIR_SURFACE_EXTENSION_NAME); } if (pPhysicalDevice->gotQueueFamilyPropertyCount) { skip_call |= ValidateQueueFamilyIndex(my_data, queueFamilyIndex, pPhysicalDevice->numOfQueueFamilies, - pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceMirPresentationSupportKHR"); + pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceMirPresentationSupportKHR"); } lock.unlock(); @@ -474,9 +475,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhys #endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR -VKAPI_ATTR VkResult VKAPI_CALL -CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -489,10 +489,11 @@ CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR // Validate that the platform extension was enabled: if (pInstance && !pInstance->waylandSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkCreateWaylandSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkCreateWaylandSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); } lock.unlock(); @@ -538,15 +539,16 @@ VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(Vk // Validate that the platform extension was enabled: if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->waylandSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, "vkGetPhysicalDeviceWaylandPresentationSupportKHR() called even though the %s " - "extension was not enabled for this VkInstance.", - VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceWaylandPresentationSupportKHR() called even though the %s " + "extension was not enabled for this VkInstance.", + VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); } if (pPhysicalDevice->gotQueueFamilyPropertyCount) { skip_call |= ValidateQueueFamilyIndex(my_data, queueFamilyIndex, pPhysicalDevice->numOfQueueFamilies, - pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); + pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); } lock.unlock(); @@ -560,9 +562,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(Vk #endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_WIN32_KHR -VKAPI_ATTR VkResult VKAPI_CALL -CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -575,10 +576,11 @@ CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pC // Validate that the platform extension was enabled: if (pInstance && !pInstance->win32SurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkCreateWin32SurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_WIN32_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkCreateWin32SurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_WIN32_SURFACE_EXTENSION_NAME); } lock.unlock(); @@ -609,8 +611,8 @@ CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pC return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkBool32 VKAPI_CALL -GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex) { +VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex) { VkBool32 result = VK_FALSE; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -623,15 +625,16 @@ GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, ui // Validate that the platform extension was enabled: if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->win32SurfaceExtensionEnabled) { - skip_call |= log_msg( - my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkGetPhysicalDeviceWin32PresentationSupportKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_WIN32_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceWin32PresentationSupportKHR() called even though the %s extension " + "was not enabled for this VkInstance.", + VK_KHR_WIN32_SURFACE_EXTENSION_NAME); } if (pPhysicalDevice->gotQueueFamilyPropertyCount) { skip_call |= ValidateQueueFamilyIndex(my_data, queueFamilyIndex, pPhysicalDevice->numOfQueueFamilies, - pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); + pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); } lock.unlock(); @@ -644,9 +647,8 @@ GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, ui #endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_XCB_KHR -VKAPI_ATTR VkResult VKAPI_CALL -CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -659,10 +661,11 @@ CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreat // Validate that the platform extension was enabled: if (pInstance && !pInstance->xcbSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkCreateXcbSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_XCB_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkCreateXcbSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_XCB_SURFACE_EXTENSION_NAME); } lock.unlock(); @@ -693,9 +696,9 @@ CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreat return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkBool32 VKAPI_CALL -GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - xcb_connection_t *connection, xcb_visualid_t visual_id) { +VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, xcb_connection_t *connection, + xcb_visualid_t visual_id) { VkBool32 result = VK_FALSE; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -708,15 +711,16 @@ GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint // Validate that the platform extension was enabled: if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->xcbSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, "vkGetPhysicalDeviceXcbPresentationSupportKHR() called even though the %s " - "extension was not enabled for this VkInstance.", - VK_KHR_XCB_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceXcbPresentationSupportKHR() called even though the %s " + "extension was not enabled for this VkInstance.", + VK_KHR_XCB_SURFACE_EXTENSION_NAME); } if (pPhysicalDevice->gotQueueFamilyPropertyCount) { skip_call |= ValidateQueueFamilyIndex(my_data, queueFamilyIndex, pPhysicalDevice->numOfQueueFamilies, - pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); + pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); } lock.unlock(); @@ -730,9 +734,8 @@ GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint #endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR -VKAPI_ATTR VkResult VKAPI_CALL -CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -745,10 +748,11 @@ CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCre // Validate that the platform extension was enabled: if (pInstance && !pInstance->xlibSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkCreateXlibSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_XLIB_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkCreateXlibSurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_XLIB_SURFACE_EXTENSION_NAME); } lock.unlock(); @@ -780,8 +784,8 @@ CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCre } VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - Display *dpy, VisualID visualID) { + uint32_t queueFamilyIndex, Display *dpy, + VisualID visualID) { VkBool32 result = VK_FALSE; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -794,15 +798,16 @@ VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhy // Validate that the platform extension was enabled: if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->xlibSurfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, "vkGetPhysicalDeviceXlibPresentationSupportKHR() called even though the %s " - "extension was not enabled for this VkInstance.", - VK_KHR_XLIB_SURFACE_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceXlibPresentationSupportKHR() called even though the %s " + "extension was not enabled for this VkInstance.", + VK_KHR_XLIB_SURFACE_EXTENSION_NAME); } if (pPhysicalDevice->gotQueueFamilyPropertyCount) { skip_call |= ValidateQueueFamilyIndex(my_data, queueFamilyIndex, pPhysicalDevice->numOfQueueFamilies, - pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); + pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); } lock.unlock(); @@ -815,8 +820,8 @@ VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhy } #endif // VK_USE_PLATFORM_XLIB_KHR -VKAPI_ATTR VkResult VKAPI_CALL -GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPropertiesKHR *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, + VkDisplayPropertiesKHR *pProperties) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -828,23 +833,25 @@ GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t } if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->displayExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, "vkGetPhysicalDeviceDisplayPropertiesKHR() called even though the %s " - "extension was not enabled for this VkInstance.", - VK_KHR_DISPLAY_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceDisplayPropertiesKHR() called even though the %s " + "extension was not enabled for this VkInstance.", + VK_KHR_DISPLAY_EXTENSION_NAME); } lock.unlock(); if (!skip_call) { - result = my_data->instance_dispatch_table->GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); + result = + my_data->instance_dispatch_table->GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); return result; } return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPlanePropertiesKHR *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, + VkDisplayPlanePropertiesKHR *pProperties) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -856,24 +863,25 @@ GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint } if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->displayExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR() called even though the %s " - "extension was not enabled for this VkInstance.", - VK_KHR_DISPLAY_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR() called even though the %s " + "extension was not enabled for this VkInstance.", + VK_KHR_DISPLAY_EXTENSION_NAME); } lock.unlock(); if (!skip_call) { - result = my_data->instance_dispatch_table->GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, pProperties); + result = my_data->instance_dispatch_table->GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, + pProperties); lock.lock(); - if (!pPhysicalDevice->gotDisplayPlanePropertyCount) - { + if (!pPhysicalDevice->gotDisplayPlanePropertyCount) { pPhysicalDevice->displayPlanePropertyCount = *pPropertyCount; pPhysicalDevice->gotDisplayPlanePropertyCount = true; } - // TODO store the properties for later checks + // TODO store the properties for later checks lock.unlock(); return result; @@ -881,8 +889,8 @@ GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays) { +VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, + uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -894,27 +902,27 @@ GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t pl } if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->displayExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, "vkGetDisplayPlaneSupportedDisplaysKHR() called even though the %s " - "extension was not enabled for this VkInstance.", - VK_KHR_DISPLAY_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetDisplayPlaneSupportedDisplaysKHR() called even though the %s " + "extension was not enabled for this VkInstance.", + VK_KHR_DISPLAY_EXTENSION_NAME); } - if (!pPhysicalDevice->gotDisplayPlanePropertyCount) - { - skip_call |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_GET_SUPPORTED_DISPLAYS_WITHOUT_QUERY, - swapchain_layer_name, "Potential problem with calling vkGetDisplayPlaneSupportedDisplaysKHR() without first " - "querying vkGetPhysicalDeviceDisplayPlanePropertiesKHR."); + if (!pPhysicalDevice->gotDisplayPlanePropertyCount) { + skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, + SWAPCHAIN_GET_SUPPORTED_DISPLAYS_WITHOUT_QUERY, swapchain_layer_name, + "Potential problem with calling vkGetDisplayPlaneSupportedDisplaysKHR() without first " + "querying vkGetPhysicalDeviceDisplayPlanePropertiesKHR."); } - if (pPhysicalDevice->gotDisplayPlanePropertyCount && planeIndex >= pPhysicalDevice->displayPlanePropertyCount) - { + if (pPhysicalDevice->gotDisplayPlanePropertyCount && planeIndex >= pPhysicalDevice->displayPlanePropertyCount) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_PLANE_INDEX_TOO_LARGE, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_PLANE_INDEX_TOO_LARGE, + swapchain_layer_name, "vkGetDisplayPlaneSupportedDisplaysKHR(): planeIndex must be in the range [0, %d] that was returned by " "vkGetPhysicalDeviceDisplayPlanePropertiesKHR. Do you have the plane index hardcoded?", pPhysicalDevice->displayPlanePropertyCount - 1); @@ -922,7 +930,8 @@ GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t pl lock.unlock(); if (!skip_call) { - result = my_data->instance_dispatch_table->GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays); + result = my_data->instance_dispatch_table->GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, + pDisplays); return result; } @@ -930,8 +939,8 @@ GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t pl return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -943,26 +952,28 @@ GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR displa } if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->displayExtensionEnabled) { - skip_call |= log_msg( - my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkGetDisplayModePropertiesKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_DISPLAY_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, + "vkGetDisplayModePropertiesKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_DISPLAY_EXTENSION_NAME); } - lock.unlock(); if (!skip_call) { - result = my_data->instance_dispatch_table->GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); + result = + my_data->instance_dispatch_table->GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); return result; } // TODO store the displayMode for later checking return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode) { +VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -975,10 +986,10 @@ CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, cons if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->displayExtensionEnabled) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, - swapchain_layer_name, - "vkCreateDisplayModeKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_DISPLAY_EXTENSION_NAME); + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, + SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkCreateDisplayModeKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_DISPLAY_EXTENSION_NAME); } lock.unlock(); @@ -988,12 +999,12 @@ CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, cons result = my_data->instance_dispatch_table->CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); return result; } - + return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities) { +VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, + uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR *pCapabilities) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -1005,30 +1016,29 @@ GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR } if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->displayExtensionEnabled) { - skip_call |= log_msg( - my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkGetDisplayPlaneCapabilitiesKHR) called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_DISPLAY_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, + "vkGetDisplayPlaneCapabilitiesKHR) called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_DISPLAY_EXTENSION_NAME); } - if (!pPhysicalDevice->gotDisplayPlanePropertyCount) - { - skip_call |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_GET_SUPPORTED_DISPLAYS_WITHOUT_QUERY, - swapchain_layer_name, "Potential problem with calling vkGetDisplayPlaneCapabilitiesKHR() without first " - "querying vkGetPhysicalDeviceDisplayPlanePropertiesKHR."); + if (!pPhysicalDevice->gotDisplayPlanePropertyCount) { + skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, + SWAPCHAIN_GET_SUPPORTED_DISPLAYS_WITHOUT_QUERY, swapchain_layer_name, + "Potential problem with calling vkGetDisplayPlaneCapabilitiesKHR() without first " + "querying vkGetPhysicalDeviceDisplayPlanePropertiesKHR."); } - if (pPhysicalDevice->gotDisplayPlanePropertyCount && planeIndex >= pPhysicalDevice->displayPlanePropertyCount) - { - skip_call |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_PLANE_INDEX_TOO_LARGE, swapchain_layer_name, - "vkGetDisplayPlaneCapabilitiesKHR(): planeIndex must be in the range [0, %d] that was returned by " - "vkGetPhysicalDeviceDisplayPlanePropertiesKHR. Do you have the plane index hardcoded?", - pPhysicalDevice->displayPlanePropertyCount - 1); + if (pPhysicalDevice->gotDisplayPlanePropertyCount && planeIndex >= pPhysicalDevice->displayPlanePropertyCount) { + skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, + SWAPCHAIN_PLANE_INDEX_TOO_LARGE, swapchain_layer_name, + "vkGetDisplayPlaneCapabilitiesKHR(): planeIndex must be in the range [0, %d] that was returned by " + "vkGetPhysicalDeviceDisplayPlanePropertiesKHR. Do you have the plane index hardcoded?", + pPhysicalDevice->displayPlanePropertyCount - 1); } lock.unlock(); @@ -1041,9 +1051,8 @@ GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -CreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -1084,8 +1093,7 @@ CreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateIn return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR void VKAPI_CALL -DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) { bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); std::unique_lock<std::mutex> lock(global_lock); @@ -1102,10 +1110,11 @@ DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationC // Validate that the platform extension was enabled: if (pInstance && !pInstance->surfaceExtensionEnabled) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkDestroySurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", - VK_KHR_DISPLAY_EXTENSION_NAME); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkDestroySurfaceKHR() called even though the %s extension was not enabled for this VkInstance.", + VK_KHR_DISPLAY_EXTENSION_NAME); } // Regardless of skip_call value, do some internal cleanup: @@ -1115,9 +1124,10 @@ DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationC pSurface->pInstance->surfaces.erase(surface); } if (!pSurface->swapchains.empty()) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, swapchain_layer_name, - "vkDestroySurfaceKHR() called before all of its associated VkSwapchainKHRs were destroyed."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, swapchain_layer_name, + "vkDestroySurfaceKHR() called before all of its associated VkSwapchainKHRs were destroyed."); // Empty and then delete all SwpSwapchains for (auto it = pSurface->swapchains.begin(); it != pSurface->swapchains.end(); it++) { @@ -1134,9 +1144,10 @@ DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationC pSurface->swapchains.clear(); } if ((pAllocator != NULL) != pSurface->usedAllocatorToCreate) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_INCOMPATIBLE_ALLOCATOR, swapchain_layer_name, - "vkDestroySurfaceKHR() called with incompatible pAllocator from when the object was created."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, + reinterpret_cast<uint64_t>(instance), __LINE__, SWAPCHAIN_INCOMPATIBLE_ALLOCATOR, swapchain_layer_name, + "vkDestroySurfaceKHR() called with incompatible pAllocator from when the object was created."); } my_data->surfaceMap.erase(surface); } @@ -1148,8 +1159,8 @@ DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationC } } -VKAPI_ATTR VkResult VKAPI_CALL -EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) { +VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, + VkPhysicalDevice *pPhysicalDevices) { VkResult result = VK_SUCCESS; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); @@ -1183,8 +1194,7 @@ EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, Vk return result; } -VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, - const VkDeviceCreateInfo *pCreateInfo, +VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); @@ -1238,8 +1248,8 @@ VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCall pDevice->pPhysicalDevice->pDevice = NULL; } if (!pDevice->swapchains.empty()) { - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, reinterpret_cast<uint64_t>(device), - __LINE__, SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, swapchain_layer_name, + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_DEL_OBJECT_BEFORE_CHILDREN, swapchain_layer_name, "vkDestroyDevice() called before all of its associated VkSwapchainKHRs were destroyed."); // Empty and then delete all SwpSwapchain's @@ -1262,9 +1272,8 @@ VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCall layer_data_map.erase(key); } -VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, VkSurfaceKHR surface, - VkBool32 *pSupported) { +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, + VkSurfaceKHR surface, VkBool32 *pSupported) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -1279,18 +1288,20 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevi if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->surfaceExtensionEnabled) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceSurfaceSupportKHR() called even though the %s extension was not enabled for this VkInstance.", VK_KHR_SURFACE_EXTENSION_NAME); } if (!pPhysicalDevice->gotQueueFamilyPropertyCount) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_DID_NOT_QUERY_QUEUE_FAMILIES, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_DID_NOT_QUERY_QUEUE_FAMILIES, + swapchain_layer_name, "vkGetPhysicalDeviceSurfaceSupportKHR() called before calling the vkGetPhysicalDeviceQueueFamilyProperties function."); } else if (pPhysicalDevice->gotQueueFamilyPropertyCount) { skip_call |= ValidateQueueFamilyIndex(my_data, queueFamilyIndex, pPhysicalDevice->numOfQueueFamilies, - pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceSurfaceSupportKHR"); + pPhysicalDevice->physicalDevice, "vkGetPhysicalDeviceSurfaceSupportKHR"); } lock.unlock(); @@ -1333,9 +1344,8 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevi return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, + VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -1350,7 +1360,8 @@ GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfa if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->surfaceExtensionEnabled) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR() called even though the %s extension was not enabled for this VkInstance.", VK_KHR_DISPLAY_EXTENSION_NAME); } @@ -1380,9 +1391,9 @@ GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfa return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, - VkSurfaceFormatKHR *pSurfaceFormats) { +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, + uint32_t *pSurfaceFormatCount, + VkSurfaceFormatKHR *pSurfaceFormats) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -1397,7 +1408,8 @@ GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->surfaceExtensionEnabled) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceSurfaceFormatsKHR() called even though the %s extension was not enabled for this VkInstance.", VK_KHR_DISPLAY_EXTENSION_NAME); } @@ -1406,15 +1418,16 @@ GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR if (pPhysicalDevice->surfaceFormatCount == 0) { // Since we haven't recorded a preliminary value of *pSurfaceFormatCount, that likely means that the application didn't // previously call this function with a NULL value of pSurfaceFormats: - skip_call |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_PRIOR_COUNT, swapchain_layer_name, - "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount; but no prior positive " - "value has been seen for pSurfaceFormats."); + skip_call |= log_msg( + my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_PRIOR_COUNT, swapchain_layer_name, + "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount; but no prior positive " + "value has been seen for pSurfaceFormats."); } else if (*pSurfaceFormatCount > pPhysicalDevice->surfaceFormatCount) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_INVALID_COUNT, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_INVALID_COUNT, + swapchain_layer_name, "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount, and with pSurfaceFormats set to " "a value (%d) that is greater than the value (%d) that was returned when pSurfaceFormatCount was NULL.", *pSurfaceFormatCount, pPhysicalDevice->surfaceFormatCount); @@ -1436,8 +1449,7 @@ GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR if ((result == VK_SUCCESS) && pPhysicalDevice && !pSurfaceFormats && pSurfaceFormatCount) { // Record the result of this preliminary query: pPhysicalDevice->surfaceFormatCount = *pSurfaceFormatCount; - } else if ((result == VK_SUCCESS) && pPhysicalDevice && - pSurfaceFormats && pSurfaceFormatCount && + } else if ((result == VK_SUCCESS) && pPhysicalDevice && pSurfaceFormats && pSurfaceFormatCount && (*pSurfaceFormatCount > 0)) { // Record the result of this query: pPhysicalDevice->surfaceFormatCount = *pSurfaceFormatCount; @@ -1457,9 +1469,9 @@ GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR VkResult VKAPI_CALL -GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, - VkPresentModeKHR *pPresentModes) { +VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, + uint32_t *pPresentModeCount, + VkPresentModeKHR *pPresentModes) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); @@ -1474,7 +1486,8 @@ GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfa if (pPhysicalDevice && pPhysicalDevice->pInstance && !pPhysicalDevice->pInstance->surfaceExtensionEnabled) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->pInstance->instance), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + swapchain_layer_name, "vkGetPhysicalDeviceSurfacePresentModesKHR() called even though the %s extension was not enabled for this VkInstance.", VK_KHR_DISPLAY_EXTENSION_NAME); } @@ -1483,15 +1496,16 @@ GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfa if (pPhysicalDevice->presentModeCount == 0) { // Since we haven't recorded a preliminary value of *pPresentModeCount, that likely means that the application didn't // previously call this function with a NULL value of pPresentModes: - skip_call |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_PRIOR_COUNT, swapchain_layer_name, - "vkGetPhysicalDeviceSurfacePresentModesKHR() called with non-NULL pPresentModeCount; but no prior positive " - "value has been seen for pPresentModes."); + skip_call |= log_msg( + my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, + reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_PRIOR_COUNT, swapchain_layer_name, + "vkGetPhysicalDeviceSurfacePresentModesKHR() called with non-NULL pPresentModeCount; but no prior positive " + "value has been seen for pPresentModes."); } else if (*pPresentModeCount > pPhysicalDevice->presentModeCount) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_INVALID_COUNT, swapchain_layer_name, + reinterpret_cast<uint64_t>(pPhysicalDevice->physicalDevice), __LINE__, SWAPCHAIN_INVALID_COUNT, + swapchain_layer_name, "vkGetPhysicalDeviceSurfacePresentModesKHR() called with non-NULL pPresentModeCount, and with pPresentModes set to " "a value (%d) that is greater than the value (%d) that was returned when pPresentModeCount was NULL.", *pPresentModeCount, pPhysicalDevice->presentModeCount); @@ -1513,9 +1527,7 @@ GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfa if ((result == VK_SUCCESS) && pPhysicalDevice && !pPresentModes && pPresentModeCount) { // Record the result of this preliminary query: pPhysicalDevice->presentModeCount = *pPresentModeCount; - } else if ((result == VK_SUCCESS) && pPhysicalDevice && - pPresentModes && pPresentModeCount && - (*pPresentModeCount > 0)) { + } else if ((result == VK_SUCCESS) && pPhysicalDevice && pPresentModes && pPresentModeCount && (*pPresentModeCount > 0)) { // Record the result of this query: pPhysicalDevice->presentModeCount = *pPresentModeCount; pPhysicalDevice->pPresentModes = (VkPresentModeKHR *)malloc(*pPresentModeCount * sizeof(VkPresentModeKHR)); @@ -1565,27 +1577,29 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI if (pPhysicalDevice && pPhysicalDevice->gotQueueFamilyPropertyCount) { for (uint32_t i = 0; i < pCreateInfo->queueFamilyIndexCount; i++) { skip_call |= ValidateQueueFamilyIndex(my_data, pCreateInfo->pQueueFamilyIndices[i], pPhysicalDevice->numOfQueueFamilies, - pPhysicalDevice->physicalDevice, "vkCreateSwapchainKHR"); + pPhysicalDevice->physicalDevice, "vkCreateSwapchainKHR"); } } // Validate pCreateInfo values with the results of // vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): if (!pPhysicalDevice || !pPhysicalDevice->gotSurfaceCapabilities) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, swapchain_layer_name, - "vkCreateSwapchainKHR() called before calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR()."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, swapchain_layer_name, + "vkCreateSwapchainKHR() called before calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR()."); } else if (pCreateInfo) { // Validate pCreateInfo->surface to make sure that // vkGetPhysicalDeviceSurfaceSupportKHR() reported this as a supported // surface: SwpSurface *pSurface = ((pPhysicalDevice) ? pPhysicalDevice->supportedSurfaces[pCreateInfo->surface] : NULL); if (!pSurface) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_UNSUPPORTED_SURFACE, swapchain_layer_name, - "The surface in pCreateInfo->surface, that was given to vkCreateSwapchainKHR(), must be a surface " - "that is supported by the device as determined by vkGetPhysicalDeviceSurfaceSupportKHR(). " - "However, vkGetPhysicalDeviceSurfaceSupportKHR() was never called with this surface."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_UNSUPPORTED_SURFACE, swapchain_layer_name, + "The surface in pCreateInfo->surface, that was given to vkCreateSwapchainKHR(), must be a surface " + "that is supported by the device as determined by vkGetPhysicalDeviceSurfaceSupportKHR(). " + "However, vkGetPhysicalDeviceSurfaceSupportKHR() was never called with this surface."); } // Validate pCreateInfo->minImageCount against @@ -1607,25 +1621,26 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI (pCreateInfo->imageExtent.width > pCapabilities->maxImageExtent.width) || (pCreateInfo->imageExtent.height < pCapabilities->minImageExtent.height) || (pCreateInfo->imageExtent.height > pCapabilities->maxImageExtent.height))) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_OUT_OF_BOUNDS_EXTENTS, swapchain_layer_name, - "vkCreateSwapchainKHR() called with pCreateInfo->imageExtent = (%d,%d), which is outside the " - "bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (%d,%d), " - "minImageExtent = (%d,%d), maxImageExtent = (%d,%d).", - pCreateInfo->imageExtent.width, pCreateInfo->imageExtent.height, pCapabilities->currentExtent.width, - pCapabilities->currentExtent.height, pCapabilities->minImageExtent.width, - pCapabilities->minImageExtent.height, pCapabilities->maxImageExtent.width, - pCapabilities->maxImageExtent.height); + skip_call |= log_msg( + my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_OUT_OF_BOUNDS_EXTENTS, swapchain_layer_name, + "vkCreateSwapchainKHR() called with pCreateInfo->imageExtent = (%d,%d), which is outside the " + "bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (%d,%d), " + "minImageExtent = (%d,%d), maxImageExtent = (%d,%d).", + pCreateInfo->imageExtent.width, pCreateInfo->imageExtent.height, pCapabilities->currentExtent.width, + pCapabilities->currentExtent.height, pCapabilities->minImageExtent.width, pCapabilities->minImageExtent.height, + pCapabilities->maxImageExtent.width, pCapabilities->maxImageExtent.height); } if ((pCapabilities->currentExtent.width != -1) && ((pCreateInfo->imageExtent.width != pCapabilities->currentExtent.width) || (pCreateInfo->imageExtent.height != pCapabilities->currentExtent.height))) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_EXTENTS_NO_MATCH_WIN, swapchain_layer_name, - "vkCreateSwapchainKHR() called with pCreateInfo->imageExtent = (%d,%d), which is not equal to the " - "currentExtent = (%d,%d) returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR().", - pCreateInfo->imageExtent.width, pCreateInfo->imageExtent.height, pCapabilities->currentExtent.width, - pCapabilities->currentExtent.height); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_EXTENTS_NO_MATCH_WIN, + swapchain_layer_name, + "vkCreateSwapchainKHR() called with pCreateInfo->imageExtent = (%d,%d), which is not equal to the " + "currentExtent = (%d,%d) returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR().", + pCreateInfo->imageExtent.width, pCreateInfo->imageExtent.height, + pCapabilities->currentExtent.width, pCapabilities->currentExtent.height); } // Validate pCreateInfo->preTransform has one bit set (1st two // lines of if-statement), which bit is also set in @@ -1653,8 +1668,8 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI } // Log the message that we've built up: skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t &>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_PRE_TRANSFORM, LAYER_NAME, - "%s", errorString.c_str()); + reinterpret_cast<uint64_t &>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_PRE_TRANSFORM, + LAYER_NAME, "%s", errorString.c_str()); } // Validate pCreateInfo->compositeAlpha has one bit set (1st two // lines of if-statement), which bit is also set in @@ -1682,35 +1697,38 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI } // Log the message that we've built up: skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t &>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_COMPOSITE_ALPHA, - LAYER_NAME, "%s", errorString.c_str()); + reinterpret_cast<uint64_t &>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_COMPOSITE_ALPHA, + LAYER_NAME, "%s", errorString.c_str()); } // Validate pCreateInfo->imageArrayLayers against // VkSurfaceCapabilitiesKHR::maxImageArrayLayers: if ((pCreateInfo->imageArrayLayers < 1) || (pCreateInfo->imageArrayLayers > pCapabilities->maxImageArrayLayers)) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_ARRAY_LAYERS, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageArrayLayers (i.e. %d). " - "Minimum value is 1, maximum value is %d.", - pCreateInfo->imageArrayLayers, pCapabilities->maxImageArrayLayers); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_ARRAY_LAYERS, + swapchain_layer_name, + "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageArrayLayers (i.e. %d). " + "Minimum value is 1, maximum value is %d.", + pCreateInfo->imageArrayLayers, pCapabilities->maxImageArrayLayers); } // Validate pCreateInfo->imageUsage against // VkSurfaceCapabilitiesKHR::supportedUsageFlags: if (pCreateInfo->imageUsage != (pCreateInfo->imageUsage & pCapabilities->supportedUsageFlags)) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_USAGE_FLAGS, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageUsage (i.e. 0x%08x). " - "Supported flag bits are 0x%08x.", - pCreateInfo->imageUsage, pCapabilities->supportedUsageFlags); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_USAGE_FLAGS, + swapchain_layer_name, + "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageUsage (i.e. 0x%08x). " + "Supported flag bits are 0x%08x.", + pCreateInfo->imageUsage, pCapabilities->supportedUsageFlags); } } // Validate pCreateInfo values with the results of // vkGetPhysicalDeviceSurfaceFormatsKHR(): if (!pPhysicalDevice || !pPhysicalDevice->surfaceFormatCount) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, swapchain_layer_name, - "vkCreateSwapchainKHR() called before calling vkGetPhysicalDeviceSurfaceFormatsKHR()."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, swapchain_layer_name, + "vkCreateSwapchainKHR() called before calling vkGetPhysicalDeviceSurfaceFormatsKHR()."); } else if (pCreateInfo) { // Validate pCreateInfo->imageFormat against // VkSurfaceFormatKHR::format: @@ -1735,25 +1753,26 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI if (!foundMatch) { if (!foundFormat) { if (!foundColorSpace) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_FMT_CLR_SP, swapchain_layer_name, - "vkCreateSwapchainKHR() called with neither a supported pCreateInfo->imageFormat " - "(i.e. %d) nor a supported " - "pCreateInfo->imageColorSpace (i.e. %d).", - pCreateInfo->imageFormat, pCreateInfo->imageColorSpace); + skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, reinterpret_cast<uint64_t>(device), __LINE__, + SWAPCHAIN_CREATE_SWAP_BAD_IMG_FMT_CLR_SP, swapchain_layer_name, + "vkCreateSwapchainKHR() called with neither a supported pCreateInfo->imageFormat " + "(i.e. %d) nor a supported " + "pCreateInfo->imageColorSpace (i.e. %d).", + pCreateInfo->imageFormat, pCreateInfo->imageColorSpace); } else { - skip_call |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_FORMAT, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageFormat (i.e. %d)", - pCreateInfo->imageFormat); + skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, reinterpret_cast<uint64_t>(device), __LINE__, + SWAPCHAIN_CREATE_SWAP_BAD_IMG_FORMAT, swapchain_layer_name, + "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageFormat (i.e. %d)", + pCreateInfo->imageFormat); } } else if (!foundColorSpace) { - skip_call |= - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_COLOR_SPACE, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageColorSpace (i.e. %d).", - pCreateInfo->imageColorSpace); + skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_IMG_COLOR_SPACE, + swapchain_layer_name, + "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageColorSpace (i.e. %d).", + pCreateInfo->imageColorSpace); } } } @@ -1763,9 +1782,9 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI if (!pPhysicalDevice || !pPhysicalDevice->presentModeCount) { if (!pCreateInfo || (pCreateInfo->presentMode != VK_PRESENT_MODE_FIFO_KHR)) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, swapchain_layer_name, - "vkCreateSwapchainKHR() called before calling " - "vkGetPhysicalDeviceSurfacePresentModesKHR()."); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, + swapchain_layer_name, "vkCreateSwapchainKHR() called before calling " + "vkGetPhysicalDeviceSurfacePresentModesKHR()."); } } else if (pCreateInfo) { // Validate pCreateInfo->presentMode against @@ -1778,10 +1797,11 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI } } if (!foundMatch) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_PRESENT_MODE, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->presentMode (i.e. %s).", - presentModeStr(pCreateInfo->presentMode)); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_PRESENT_MODE, swapchain_layer_name, + "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->presentMode (i.e. %s).", + presentModeStr(pCreateInfo->presentMode)); } } @@ -1789,45 +1809,48 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI if (pCreateInfo->imageSharingMode == VK_SHARING_MODE_CONCURRENT) { if ((pCreateInfo->queueFamilyIndexCount <= 1) || !pCreateInfo->pQueueFamilyIndices) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_SHARING_VALUES, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a supported pCreateInfo->sharingMode of (i.e. %s), but with a " - "bad value(s) for pCreateInfo->queueFamilyIndexCount or pCreateInfo->pQueueFamilyIndices).", - sharingModeStr(pCreateInfo->imageSharingMode)); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_SHARING_VALUES, + swapchain_layer_name, + "vkCreateSwapchainKHR() called with a supported pCreateInfo->sharingMode of (i.e. %s), but with a " + "bad value(s) for pCreateInfo->queueFamilyIndexCount or pCreateInfo->pQueueFamilyIndices).", + sharingModeStr(pCreateInfo->imageSharingMode)); } } else if (pCreateInfo->imageSharingMode != VK_SHARING_MODE_EXCLUSIVE) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_SHARING_MODE, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageSharingMode (i.e. %s).", - sharingModeStr(pCreateInfo->imageSharingMode)); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_BAD_SHARING_MODE, swapchain_layer_name, + "vkCreateSwapchainKHR() called with a non-supported pCreateInfo->imageSharingMode (i.e. %s).", + sharingModeStr(pCreateInfo->imageSharingMode)); } // Validate pCreateInfo->clipped: if (pCreateInfo && (pCreateInfo->clipped != VK_FALSE) && (pCreateInfo->clipped != VK_TRUE)) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_BAD_BOOL, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a VkBool32 value that is neither VK_TRUE nor VK_FALSE, but " - "has the numeric value of %d.", - pCreateInfo->clipped); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_BAD_BOOL, swapchain_layer_name, + "vkCreateSwapchainKHR() called with a VkBool32 value that is neither VK_TRUE nor VK_FALSE, but " + "has the numeric value of %d.", + pCreateInfo->clipped); } // Validate pCreateInfo->oldSwapchain: if (pCreateInfo && pCreateInfo->oldSwapchain) { SwpSwapchain *pOldSwapchain = NULL; { - auto it = my_data->swapchainMap.find(pCreateInfo->oldSwapchain); - pOldSwapchain = (it == my_data->swapchainMap.end()) ? NULL : &it->second; + auto it = my_data->swapchainMap.find(pCreateInfo->oldSwapchain); + pOldSwapchain = (it == my_data->swapchainMap.end()) ? NULL : &it->second; } if (pOldSwapchain) { if (device != pOldSwapchain->pDevice->device) { - skip_call |= log_msg( - my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, reinterpret_cast<uint64_t>(device), - __LINE__, SWAPCHAIN_DESTROY_SWAP_DIFF_DEVICE, swapchain_layer_name, - "vkCreateSwapchainKHR() called with a different VkDevice than the VkSwapchainKHR was created with."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_DESTROY_SWAP_DIFF_DEVICE, swapchain_layer_name, + "vkCreateSwapchainKHR() called with a different VkDevice than the VkSwapchainKHR was created with."); } if (pCreateInfo->surface != pOldSwapchain->pSurface->surface) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_DIFF_SURFACE, swapchain_layer_name, - "vkCreateSwapchainKHR() called with pCreateInfo->oldSwapchain pCreateInfo->surface."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_DIFF_SURFACE, swapchain_layer_name, + "vkCreateSwapchainKHR() called with pCreateInfo->oldSwapchain pCreateInfo->surface."); } } } @@ -1836,8 +1859,7 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI } VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSwapchainKHR *pSwapchain) { + const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { VkResult result = VK_SUCCESS; layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); std::unique_lock<std::mutex> lock(global_lock); @@ -1882,8 +1904,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapc return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR void VKAPI_CALL -DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { // TODOs: // // - Implement a check for validity language that reads: All uses of @@ -1901,9 +1922,9 @@ DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocatio // Validate that the swapchain extension was enabled: if (pDevice && !pDevice->swapchainExtensionEnabled) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkDestroySwapchainKHR() called even though the %s extension was not enabled for this VkDevice.", - VK_KHR_SWAPCHAIN_EXTENSION_NAME); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkDestroySwapchainKHR() called even though the %s extension was not enabled for this VkDevice.", + VK_KHR_SWAPCHAIN_EXTENSION_NAME); } // Regardless of skip_call value, do some internal cleanup: @@ -1930,9 +1951,10 @@ DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocatio pSwapchain->images.clear(); } if ((pAllocator != NULL) != pSwapchain->usedAllocatorToCreate) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_INCOMPATIBLE_ALLOCATOR, swapchain_layer_name, - "vkDestroySwapchainKHR() called with incompatible pAllocator from when the object was created."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_INCOMPATIBLE_ALLOCATOR, swapchain_layer_name, + "vkDestroySwapchainKHR() called with incompatible pAllocator from when the object was created."); } my_data->swapchainMap.erase(swapchain); } @@ -1944,8 +1966,8 @@ DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocatio } } -VKAPI_ATTR VkResult VKAPI_CALL -GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) { +VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, + VkImage *pSwapchainImages) { VkResult result = VK_SUCCESS; bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); @@ -1959,9 +1981,9 @@ GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwap // Validate that the swapchain extension was enabled: if (pDevice && !pDevice->swapchainExtensionEnabled) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkGetSwapchainImagesKHR() called even though the %s extension was not enabled for this VkDevice.", - VK_KHR_SWAPCHAIN_EXTENSION_NAME); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkGetSwapchainImagesKHR() called even though the %s extension was not enabled for this VkDevice.", + VK_KHR_SWAPCHAIN_EXTENSION_NAME); } SwpSwapchain *pSwapchain = NULL; { @@ -1974,16 +1996,16 @@ GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwap // Since we haven't recorded a preliminary value of *pSwapchainImageCount, that likely means that the application didn't // previously call this function with a NULL value of pSwapchainImages: skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_PRIOR_COUNT, swapchain_layer_name, - "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount; but no prior positive " - "value has been seen for pSwapchainImages."); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_PRIOR_COUNT, swapchain_layer_name, + "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount; but no prior positive " + "value has been seen for pSwapchainImages."); } else if (*pSwapchainImageCount > pSwapchain->imageCount) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_INVALID_COUNT, swapchain_layer_name, - "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount, and with " - "pSwapchainImages set to a value (%d) that is greater than the value (%d) that was returned when " - "pSwapchainImageCount was NULL.", - *pSwapchainImageCount, pSwapchain->imageCount); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_INVALID_COUNT, swapchain_layer_name, + "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount, and with " + "pSwapchainImages set to a value (%d) that is greater than the value (%d) that was returned when " + "pSwapchainImageCount was NULL.", + *pSwapchainImageCount, pSwapchain->imageCount); } } lock.unlock(); @@ -2001,8 +2023,8 @@ GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwap if ((result == VK_SUCCESS) && pSwapchain && !pSwapchainImages && pSwapchainImageCount) { // Record the result of this preliminary query: pSwapchain->imageCount = *pSwapchainImageCount; - } else if ((result == VK_SUCCESS) && pSwapchain && pSwapchainImages && - pSwapchainImageCount && (*pSwapchainImageCount > 0)) { + } else if ((result == VK_SUCCESS) && pSwapchain && pSwapchainImages && pSwapchainImageCount && + (*pSwapchainImageCount > 0)) { // Record the images and their state: pSwapchain->imageCount = *pSwapchainImageCount; for (uint32_t i = 0; i < *pSwapchainImageCount; i++) { @@ -2045,15 +2067,16 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK // Validate that the swapchain extension was enabled: if (pDevice && !pDevice->swapchainExtensionEnabled) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, - "vkAcquireNextImageKHR() called even though the %s extension was not enabled for this VkDevice.", - VK_KHR_SWAPCHAIN_EXTENSION_NAME); + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, swapchain_layer_name, + "vkAcquireNextImageKHR() called even though the %s extension was not enabled for this VkDevice.", + VK_KHR_SWAPCHAIN_EXTENSION_NAME); } if ((semaphore == VK_NULL_HANDLE) && (fence == VK_NULL_HANDLE)) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, - reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, swapchain_layer_name, - "vkAcquireNextImageKHR() called with both the semaphore and fence parameters set to VK_NULL_HANDLE (at " - "least one should be used)."); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, swapchain_layer_name, + "vkAcquireNextImageKHR() called with both the semaphore and fence parameters set to VK_NULL_HANDLE (at " + "least one should be used)."); } SwpSwapchain *pSwapchain = NULL; { @@ -2074,9 +2097,10 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK } if (imagesAcquiredByApp > (pSwapchain->imageCount - minImageCount)) { skip_call |= log_msg( - my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, reinterpret_cast<uint64_t>(device), - __LINE__, SWAPCHAIN_APP_ACQUIRES_TOO_MANY_IMAGES, swapchain_layer_name, - "vkAcquireNextImageKHR() called when it cannot succeed. The application has acquired %d image(s) that have not yet " + my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_APP_ACQUIRES_TOO_MANY_IMAGES, swapchain_layer_name, + "vkAcquireNextImageKHR() called when it cannot succeed. The application has acquired %d image(s) that have not " + "yet " "been presented. The maximum number of images that the application can simultaneously acquire from this swapchain " "(including this call to vkCreateSwapchainKHR()) is %d. That value is derived by subtracting " "VkSurfaceCapabilitiesKHR::minImageCount (%d) from the number of images in the swapchain (%d) and adding 1.", @@ -2140,7 +2164,8 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf if (index >= pSwapchain->imageCount) { skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, - reinterpret_cast<const uint64_t &>(pPresentInfo->pSwapchains[i]), __LINE__, SWAPCHAIN_INDEX_TOO_LARGE, swapchain_layer_name, + reinterpret_cast<const uint64_t &>(pPresentInfo->pSwapchains[i]), __LINE__, SWAPCHAIN_INDEX_TOO_LARGE, + swapchain_layer_name, "vkQueuePresentKHR() called for an index that is too large (i.e. %d). There are only %d images in " "this VkSwapchainKHR.", index, pSwapchain->imageCount); @@ -2148,7 +2173,8 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf if (!pSwapchain->images[index].acquiredByApp) { skip_call |= log_msg( my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, - reinterpret_cast<const uint64_t &>(pPresentInfo->pSwapchains[i]), __LINE__, SWAPCHAIN_INDEX_NOT_IN_USE, swapchain_layer_name, + reinterpret_cast<const uint64_t &>(pPresentInfo->pSwapchains[i]), __LINE__, SWAPCHAIN_INDEX_NOT_IN_USE, + swapchain_layer_name, "vkQueuePresentKHR() returned an index (i.e. %d) for an image that is not acquired by the application.", index); } @@ -2205,8 +2231,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf return VK_ERROR_VALIDATION_FAILED_EXT; } -VKAPI_ATTR void VKAPI_CALL -GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { +VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { bool skip_call = false; layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); @@ -2230,9 +2255,10 @@ GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, } } -VKAPI_ATTR VkResult VKAPI_CALL -CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) { +VKAPI_ATTR VkResult VKAPI_CALL CreateDebugReportCallbackEXT(VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDebugReportCallbackEXT *pMsgCallback) { layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); VkResult result = my_data->instance_dispatch_table->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); @@ -2243,8 +2269,7 @@ CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCre return result; } -VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance, - VkDebugReportCallbackEXT msgCallback, +VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, const VkAllocationCallbacks *pAllocator) { layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); my_data->instance_dispatch_table->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); @@ -2252,35 +2277,33 @@ VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance, layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator); } -VKAPI_ATTR void VKAPI_CALL -DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t object, - size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { +VKAPI_ATTR void VKAPI_CALL DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, + int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); my_data->instance_dispatch_table->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); } -VKAPI_ATTR VkResult VKAPI_CALL -EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { return util_GetLayerProperties(1, &swapchain_layer, pCount, pProperties); } -VKAPI_ATTR VkResult VKAPI_CALL -EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, + VkLayerProperties *pProperties) { return util_GetLayerProperties(1, &swapchain_layer, pCount, pProperties); } -VKAPI_ATTR VkResult VKAPI_CALL -EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, + VkExtensionProperties *pProperties) { if (pLayerName && !strcmp(pLayerName, swapchain_layer.layerName)) return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); return VK_ERROR_LAYER_NOT_PRESENT; } -VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, - const char *pLayerName, uint32_t *pCount, - VkExtensionProperties *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, + uint32_t *pCount, VkExtensionProperties *pProperties) { if (pLayerName && !strcmp(pLayerName, swapchain_layer.layerName)) return util_GetExtensionProperties(0, nullptr, pCount, pProperties); @@ -2291,17 +2314,13 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevi return my_data->instance_dispatch_table->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); } -static PFN_vkVoidFunction -intercept_core_instance_command(const char *name); +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_khr_surface_command(const char *name, VkInstance instance); -static PFN_vkVoidFunction -intercept_core_device_command(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); +static PFN_vkVoidFunction intercept_khr_swapchain_command(const char *name, VkDevice dev); VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) { PFN_vkVoidFunction proc = intercept_core_device_command(funcName); @@ -2313,7 +2332,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, cons layer_data *my_data; my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - VkLayerDispatchTable *pDisp = my_data->device_dispatch_table; + VkLayerDispatchTable *pDisp = my_data->device_dispatch_table; proc = intercept_khr_swapchain_command(funcName, device); if (proc) @@ -2350,22 +2369,21 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance return pTable->GetInstanceProcAddr(instance, funcName); } -static PFN_vkVoidFunction -intercept_core_instance_command(const char *name) { +static PFN_vkVoidFunction intercept_core_instance_command(const char *name) { static const struct { const char *name; PFN_vkVoidFunction proc; } core_instance_commands[] = { - { "vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr) }, - { "vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(CreateInstance) }, - { "vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance) }, - { "vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice) }, - { "vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(EnumeratePhysicalDevices) }, - { "vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceLayerProperties) }, - { "vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceLayerProperties) }, - { "vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceExtensionProperties) }, - { "vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties) }, - { "vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceQueueFamilyProperties) }, + {"vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr)}, + {"vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(CreateInstance)}, + {"vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance)}, + {"vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice)}, + {"vkEnumeratePhysicalDevices", reinterpret_cast<PFN_vkVoidFunction>(EnumeratePhysicalDevices)}, + {"vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceLayerProperties)}, + {"vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceLayerProperties)}, + {"vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceExtensionProperties)}, + {"vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties)}, + {"vkGetPhysicalDeviceQueueFamilyProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceQueueFamilyProperties)}, }; for (size_t i = 0; i < ARRAY_SIZE(core_instance_commands); i++) { @@ -2376,47 +2394,54 @@ intercept_core_instance_command(const char *name) { return nullptr; } -static PFN_vkVoidFunction -intercept_khr_surface_command(const char *name, VkInstance instance) { +static PFN_vkVoidFunction intercept_khr_surface_command(const char *name, VkInstance instance) { static const struct { const char *name; PFN_vkVoidFunction proc; } khr_surface_commands[] = { #ifdef VK_USE_PLATFORM_ANDROID_KHR - { "vkCreateAndroidSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateAndroidSurfaceKHR) }, + {"vkCreateAndroidSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateAndroidSurfaceKHR)}, #endif // VK_USE_PLATFORM_ANDROID_KHR #ifdef VK_USE_PLATFORM_MIR_KHR - { "vkCreateMirSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateMirSurfaceKHR) }, - { "vkGetPhysicalDeviceMirPresentationSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMirPresentationSupportKHR) }, + {"vkCreateMirSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateMirSurfaceKHR)}, + {"vkGetPhysicalDeviceMirPresentationSupportKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMirPresentationSupportKHR)}, #endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR - { "vkCreateWaylandSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateWaylandSurfaceKHR) }, - { "vkGetPhysicalDeviceWaylandPresentationSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWaylandPresentationSupportKHR) }, + {"vkCreateWaylandSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateWaylandSurfaceKHR)}, + {"vkGetPhysicalDeviceWaylandPresentationSupportKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWaylandPresentationSupportKHR)}, #endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_WIN32_KHR - { "vkCreateWin32SurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateWin32SurfaceKHR) }, - { "vkGetPhysicalDeviceWin32PresentationSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWin32PresentationSupportKHR) }, + {"vkCreateWin32SurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateWin32SurfaceKHR)}, + {"vkGetPhysicalDeviceWin32PresentationSupportKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWin32PresentationSupportKHR)}, #endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_XCB_KHR - { "vkCreateXcbSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateXcbSurfaceKHR) }, - { "vkGetPhysicalDeviceXcbPresentationSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXcbPresentationSupportKHR) }, + {"vkCreateXcbSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateXcbSurfaceKHR)}, + {"vkGetPhysicalDeviceXcbPresentationSupportKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXcbPresentationSupportKHR)}, #endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR - { "vkCreateXlibSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateXlibSurfaceKHR) }, - { "vkGetPhysicalDeviceXlibPresentationSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXlibPresentationSupportKHR) }, + {"vkCreateXlibSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateXlibSurfaceKHR)}, + {"vkGetPhysicalDeviceXlibPresentationSupportKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXlibPresentationSupportKHR)}, #endif // VK_USE_PLATFORM_XLIB_KHR - { "vkDestroySurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(DestroySurfaceKHR) }, - { "vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceSupportKHR) }, - { "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceCapabilitiesKHR) }, - { "vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceFormatsKHR) }, - { "vkGetPhysicalDeviceSurfacePresentModesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfacePresentModesKHR) }, - { "vkGetPhysicalDeviceDisplayPropertiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPropertiesKHR) }, - { "vkGetPhysicalDeviceDisplayPlanePropertiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPlanePropertiesKHR) }, - { "vkGetDisplayPlaneSupportedDisplaysKHR", reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneSupportedDisplaysKHR) }, - { "vkGetDisplayModePropertiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetDisplayModePropertiesKHR) }, - { "vkCreateDisplayModeKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayModeKHR) }, - { "vkGetDisplayPlaneCapabilitiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneCapabilitiesKHR) }, - { "vkCreateDisplayPlaneSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayPlaneSurfaceKHR) }, + {"vkDestroySurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(DestroySurfaceKHR)}, + {"vkGetPhysicalDeviceSurfaceSupportKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceSupportKHR)}, + {"vkGetPhysicalDeviceSurfaceCapabilitiesKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceCapabilitiesKHR)}, + {"vkGetPhysicalDeviceSurfaceFormatsKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceFormatsKHR)}, + {"vkGetPhysicalDeviceSurfacePresentModesKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfacePresentModesKHR)}, + {"vkGetPhysicalDeviceDisplayPropertiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPropertiesKHR)}, + {"vkGetPhysicalDeviceDisplayPlanePropertiesKHR", + reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceDisplayPlanePropertiesKHR)}, + {"vkGetDisplayPlaneSupportedDisplaysKHR", reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneSupportedDisplaysKHR)}, + {"vkGetDisplayModePropertiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetDisplayModePropertiesKHR)}, + {"vkCreateDisplayModeKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayModeKHR)}, + {"vkGetDisplayPlaneCapabilitiesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetDisplayPlaneCapabilitiesKHR)}, + {"vkCreateDisplayPlaneSurfaceKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateDisplayPlaneSurfaceKHR)}, }; // do not check if VK_KHR_*_surface is enabled (why?) @@ -2429,15 +2454,14 @@ intercept_khr_surface_command(const char *name, VkInstance instance) { return nullptr; } -static PFN_vkVoidFunction -intercept_core_device_command(const char *name) { +static PFN_vkVoidFunction intercept_core_device_command(const char *name) { static const struct { const char *name; PFN_vkVoidFunction proc; } core_device_commands[] = { - { "vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr) }, - { "vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice) }, - { "vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceQueue) }, + {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr)}, + {"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice)}, + {"vkGetDeviceQueue", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceQueue)}, }; for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) { @@ -2448,17 +2472,16 @@ intercept_core_device_command(const char *name) { return nullptr; } -static PFN_vkVoidFunction -intercept_khr_swapchain_command(const char *name, VkDevice dev) { +static PFN_vkVoidFunction intercept_khr_swapchain_command(const char *name, VkDevice dev) { static const struct { const char *name; PFN_vkVoidFunction proc; } khr_swapchain_commands[] = { - { "vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateSwapchainKHR) }, - { "vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(DestroySwapchainKHR) }, - { "vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR) }, - { "vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(AcquireNextImageKHR) }, - { "vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(QueuePresentKHR) }, + {"vkCreateSwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(CreateSwapchainKHR)}, + {"vkDestroySwapchainKHR", reinterpret_cast<PFN_vkVoidFunction>(DestroySwapchainKHR)}, + {"vkGetSwapchainImagesKHR", reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR)}, + {"vkAcquireNextImageKHR", reinterpret_cast<PFN_vkVoidFunction>(AcquireNextImageKHR)}, + {"vkQueuePresentKHR", reinterpret_cast<PFN_vkVoidFunction>(QueuePresentKHR)}, }; // do not check if VK_KHR_swapchain is enabled (why?) @@ -2475,38 +2498,38 @@ intercept_khr_swapchain_command(const char *name, VkDevice dev) { // vk_layer_logging.h expects these to be defined -VKAPI_ATTR VkResult VKAPI_CALL -vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) { +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDebugReportCallbackEXT *pMsgCallback) { return swapchain::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); } -VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, - VkDebugReportCallbackEXT msgCallback, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, + const VkAllocationCallbacks *pAllocator) { swapchain::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); } -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) { +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) { swapchain::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); } // loader-layer interface v0, just wrappers since there is only a layer -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) { +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, + VkExtensionProperties *pProperties) { return swapchain::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); } -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, + VkLayerProperties *pProperties) { return swapchain::EnumerateInstanceLayerProperties(pCount, pProperties); } -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) { +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, + VkLayerProperties *pProperties) { // the layer command handles VK_NULL_HANDLE just fine internally assert(physicalDevice == VK_NULL_HANDLE); return swapchain::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties); |
