Treat VK_SUBOPTIMAL_KHR as a valid return value of vkQueuePresentKHR
vkQueuePresentKHR() may return VK_SUBOPTIMAL_KHR when "a swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully", so it can also be treated as a valid return value that indicates vkQueuePresentKHR() has returned successfully. This patch fixes the crash when we run the dawn_end2end_test SwapChainTests.ResizingWindowOnly on the latest Intel Vulkan Windows driver. BUG=dawn:269 TEST=dawn_end2end_tests Change-Id: I571ee74ea75b7a7f6fa59c7eebeed87a2429180d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30842 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
8180c71a35
commit
ebdbc03b77
|
@ -463,11 +463,15 @@ namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case VK_SUCCESS:
|
case VK_SUCCESS:
|
||||||
|
// VK_SUBOPTIMAL_KHR means "a swapchain no longer matches the surface properties
|
||||||
|
// exactly, but can still be used to present to the surface successfully", so we
|
||||||
|
// can also treat it as a "success" error code of vkQueuePresentKHR().
|
||||||
|
case VK_SUBOPTIMAL_KHR:
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
// This present cannot be recovered. Re-initialize the VkSwapchain so that future
|
||||||
|
// presents work..
|
||||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||||
// This present cannot be recovered. Re-initialize the VkSwapchain so that future
|
|
||||||
// presents work..
|
|
||||||
return Initialize(this);
|
return Initialize(this);
|
||||||
|
|
||||||
// TODO(cwallez@chromium.org): Allow losing the surface at Dawn's API level?
|
// TODO(cwallez@chromium.org): Allow losing the surface at Dawn's API level?
|
||||||
|
|
Loading…
Reference in New Issue