Don't override vkQueuePresentKHR() failure codes with VK_SUBOPTIMAL_KHR VK_SUBOPTIMAL_KHR is a success code so it should not override failure codes, but should not get replaced by a VK_SUCCESS result itself. Bug: b/144766511 Change-Id: Ie7721fb3afc36f0b15579deff79dc9bdc9146cd0 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40308 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkQueue.cpp b/src/Vulkan/VkQueue.cpp index f4703e9..136eafd 100644 --- a/src/Vulkan/VkQueue.cpp +++ b/src/Vulkan/VkQueue.cpp
@@ -235,9 +235,14 @@ presentInfo->pResults[i] = perSwapchainResult; } + // Keep track of the worst result code. VK_SUBOPTIMAL_KHR is a success code so it should + // not override failure codes, but should not get replaced by a VK_SUCCESS result itself. if(perSwapchainResult != VK_SUCCESS) { - commandResult = perSwapchainResult; + if(commandResult == VK_SUCCESS || commandResult == VK_SUBOPTIMAL_KHR) + { + commandResult = perSwapchainResult; + } } }