summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Koch <dkoch@nvidia.com> 2016-12-13 18:45:13 -0500
committer Jesse Hall <jessehall@google.com> 2016-12-15 14:39:50 -0800
commitc556562471e8ed27360adae57e17fc4bfa2cfa6c (patch)
treea35f260a0ed81123807bb55202461e4a53f54cfc
parenta9cc65f753b15339e70a2376c6878604e2b16377 (diff)
libvulkan: add NULL check to DestroySwapchainKHR
vkDestroySwapchainKHR is required to silently ignore NULL handles that are provided to it to destroy. This adds an early return if swapchain_handle is NULL. Test: dEQP-VK.wsi.android.swapchain.destroy.null_handle (VK 1.0.2 CTS) Change-Id: Ic230f114a680210cb0e0de931b17e4d70fb27f44 (cherry picked from commit d78c2e8a0807ff45db4cb643cc2ef38eafd22551)
-rw-r--r--vulkan/libvulkan/swapchain.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index adc7d5cf1c..03d37fa895 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -719,6 +719,8 @@ void DestroySwapchainKHR(VkDevice device,
const VkAllocationCallbacks* allocator) {
const auto& dispatch = GetData(device).driver;
Swapchain* swapchain = SwapchainFromHandle(swapchain_handle);
+ if (!swapchain)
+ return;
bool active = swapchain->surface.swapchain_handle == swapchain_handle;
ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr;