Discern between per-swapchain and vkQueuePresent command results
Bug: b/144766511
Change-Id: I83da9b20422ef546fcc8fa27cd8d17399b275345
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40290
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 ba08340..f4703e9 100644
--- a/src/Vulkan/VkQueue.cpp
+++ b/src/Vulkan/VkQueue.cpp
@@ -218,24 +218,30 @@
// Need to correctly implement threading using VkSemaphore
// to get rid of it. b/132458423
waitIdle();
- VkResult result = VK_SUCCESS;
+
for(uint32_t i = 0; i < presentInfo->waitSemaphoreCount; i++)
{
vk::Cast(presentInfo->pWaitSemaphores[i])->wait();
}
+ VkResult commandResult = VK_SUCCESS;
+
for(uint32_t i = 0; i < presentInfo->swapchainCount; i++)
{
- VkResult res = vk::Cast(presentInfo->pSwapchains[i])->present(presentInfo->pImageIndices[i]);
- if(presentInfo->pResults != nullptr)
+ VkResult perSwapchainResult = vk::Cast(presentInfo->pSwapchains[i])->present(presentInfo->pImageIndices[i]);
+
+ if(presentInfo->pResults)
{
- presentInfo->pResults[i] = res;
+ presentInfo->pResults[i] = perSwapchainResult;
}
- if(res != VK_SUCCESS)
- result = res;
+
+ if(perSwapchainResult != VK_SUCCESS)
+ {
+ commandResult = perSwapchainResult;
+ }
}
- return result;
+ return commandResult;
}
#endif