Vulkan: Handle suboptimal like out-of-date
If out-of-date can recreate the swapchain, so can suboptimal. Do so to
better support window resizing on desktop. Note that on Android this
was already being done.
Bug: angleproject:7615
Change-Id: I3d1ce8ca45b002e5382e31fda003f02753a2c94e
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3859409
Reviewed-by: Steven Noonan <steven@valvesoftware.com>
Reviewed-by: Ian Elliott <ianelliott@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
index fca24f6..7b4db03 100644
--- a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
+++ b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
@@ -1722,26 +1722,12 @@
bool *presentOutOfDate)
{
// If OUT_OF_DATE is returned, it's ok, we just need to recreate the swapchain before
- // continuing.
- // If VK_SUBOPTIMAL_KHR is returned it's because the device orientation changed and we should
- // recreate the swapchain with a new window orientation.
- if (context->getRenderer()->getFeatures().enablePreRotateSurfaces.enabled)
+ // continuing. We do the same when VK_SUBOPTIMAL_KHR is returned to avoid visual degradation
+ // and handle device rotation / screen resize.
+ *presentOutOfDate = result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR;
+ if (!*presentOutOfDate)
{
- // Also check for VK_SUBOPTIMAL_KHR.
- *presentOutOfDate = ((result == VK_ERROR_OUT_OF_DATE_KHR) || (result == VK_SUBOPTIMAL_KHR));
- if (!*presentOutOfDate)
- {
- ANGLE_VK_TRY(context, result);
- }
- }
- else
- {
- // We aren't quite ready for that so just ignore for now.
- *presentOutOfDate = result == VK_ERROR_OUT_OF_DATE_KHR;
- if (!*presentOutOfDate && result != VK_SUBOPTIMAL_KHR)
- {
- ANGLE_VK_TRY(context, result);
- }
+ ANGLE_VK_TRY(context, result);
}
return angle::Result::Continue;
}