vulkan: return OUT_OF_DATE from GetSwapchainStatus if not current
We don't yet have good ways to detect other ways in which the swapchain
may have gone bad, but it's easy to detect the case where the swapchain
is not current for the surface it targets.
Test: build
Change-Id: Id882a4a699d65f323e8a5e181f0e25e903039f21
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index af56650..3636db9 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -1314,9 +1314,14 @@
VKAPI_ATTR
VkResult GetSwapchainStatusKHR(
VkDevice,
- VkSwapchainKHR) {
+ VkSwapchainKHR swapchain_handle) {
+ Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle);
VkResult result = VK_SUCCESS;
+ if (swapchain.surface.swapchain_handle != swapchain_handle) {
+ return VK_ERROR_OUT_OF_DATE_KHR;
+ }
+
// TODO(chrisforbes): Implement this function properly
return result;