Fix Win32SurfaceKHR resize issues

* Fixes crash when window is resized.
* Take destination pitch into account when updating the framebuffer, so
we no longer get skewed renders.
* Return VK_ERROR_OUT_OF_DATE_KHR when presenting if the swapchain image
dimensions do not match the window surface's.

Bug: b/139372840
Change-Id: I744adbf222a1d06bc9cc879e299b11b56f6dd7cf
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/37429
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/Vulkan/VkQueue.cpp b/src/Vulkan/VkQueue.cpp
index 8e41bbb..c38b42c 100644
--- a/src/Vulkan/VkQueue.cpp
+++ b/src/Vulkan/VkQueue.cpp
@@ -213,7 +213,7 @@
 }
 
 #ifndef __ANDROID__
-void Queue::present(const VkPresentInfoKHR* presentInfo)
+VkResult Queue::present(const VkPresentInfoKHR* presentInfo)
 {
 	// This is a hack to deal with screen tearing for now.
 	// Need to correctly implement threading using VkSemaphore
@@ -227,8 +227,12 @@
 
 	for(uint32_t i = 0; i < presentInfo->swapchainCount; i++)
 	{
-		vk::Cast(presentInfo->pSwapchains[i])->present(presentInfo->pImageIndices[i]);
+		VkResult result = vk::Cast(presentInfo->pSwapchains[i])->present(presentInfo->pImageIndices[i]);
+		if (result != VK_SUCCESS)
+			return result;
 	}
+
+	return VK_SUCCESS;
 }
 #endif