From 33102b40f60a2682451bebd779feaea68edfeecc Mon Sep 17 00:00:00 2001 From: Ian Elliott Date: Fri, 29 Apr 2016 13:03:17 -0600 Subject: layers: Add extension-enabled check to vkDestroySurfaceKHR(). Because the WSI functions are statically exported (i.e. no need to call gpa() functions), the swapchain layer is supposed to issue an error if any WSI function is called without its corresponding extension being enabled. For example, the VK_KHR_swapchain extension must be enabled before the vkCreateSwapchainKHR() function is called. --- layers/swapchain.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'layers/swapchain.cpp') diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp index b999d666..a91674b0 100644 --- a/layers/swapchain.cpp +++ b/layers/swapchain.cpp @@ -859,6 +859,14 @@ vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocatio layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); std::unique_lock lock(global_lock); SwpSurface *pSurface = &my_data->surfaceMap[surface]; + SwpInstance *pInstance = &(my_data->instanceMap[instance]); + + // Validate that the platform extension was enabled: + if (pInstance && !pInstance->surfaceExtensionEnabled) { + skipCall |= LOG_ERROR(VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, pInstance, "VkInstance", SWAPCHAIN_EXT_NOT_ENABLED_BUT_USED, + "%s() called even though the %s extension was not enabled for this VkInstance.", __FUNCTION__, + VK_KHR_SURFACE_EXTENSION_NAME); + } // Regardless of skipCall value, do some internal cleanup: if (pSurface) { -- cgit v1.2.3