libvulkan: Slightly better handling of swapchain re-creation
Previously we would fail vkCreateSwapchainKHR if
VkSwapchainCreateInfo::oldSwapchain was used, because we were unable
to dequeue all buffers for the new swapchain from an already-used
native window.
Now we disconnect and re-connect to the native window in order to
fully reset state, and allow us to dequeue all buffers. Additionally,
we tag the old swapchain as out-of-date, so future image acquires and
presents will fail with VK_ERROR_OUT_OF_DATE_KHR on that swapchain.
This is less than ideal, but better than what we had, and the best we
have time to do for N.
Bug: 26927424
Change-Id: Ifaa5048376f72a63ecb1dca3d1ff85dbee2c24d0
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index eabbf1f..2555272 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -124,7 +124,7 @@
Hal Hal::hal_;
bool Hal::Open() {
- ALOG_ASSERT(!dev_, "OpenHAL called more than once");
+ ALOG_ASSERT(!hal_.dev_, "OpenHAL called more than once");
// Use a stub device unless we successfully open a real HAL device.
hal_.dev_ = &stubhal::kDevice;
@@ -797,6 +797,7 @@
return VK_ERROR_INCOMPATIBLE_DRIVER;
}
+ data->driver_device = dev;
*pDevice = dev;