aboutsummaryrefslogtreecommitdiff
path: root/layers/swapchain.cpp
diff options
context:
space:
mode:
authorIan Elliott <ianelliott@google.com>2016-04-29 13:03:17 -0600
committerTobin Ehlis <tobine@google.com>2016-05-02 13:43:32 -0600
commit33102b40f60a2682451bebd779feaea68edfeecc (patch)
tree5e68c7b63b7fd68a3c25af145fb268d95c62c06e /layers/swapchain.cpp
parent2358e931b55effa0cb99b4e2aaa4691352964f5c (diff)
downloadusermoji-33102b40f60a2682451bebd779feaea68edfeecc.tar.xz
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.
Diffstat (limited to 'layers/swapchain.cpp')
-rw-r--r--layers/swapchain.cpp8
1 files changed, 8 insertions, 0 deletions
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<std::mutex> 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) {