Present should return OUT_OF_DATE if the window size outdated

This is the correct behavior according to the spec. This CL modifies
MetalSurface, XcbSurfaceKHR and XlibSurfaceKHR.

Bug: swiftshader: 140
Change-Id: I3f1829506a9d95c11c07f6a3a9ea1e7557e78725
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38648
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Jonah Ryan-Davis <jonahr@google.com>
diff --git a/src/WSI/XlibSurfaceKHR.cpp b/src/WSI/XlibSurfaceKHR.cpp
index d40088a..b3a0275 100644
--- a/src/WSI/XlibSurfaceKHR.cpp
+++ b/src/WSI/XlibSurfaceKHR.cpp
@@ -91,7 +91,16 @@
 
 		if(xImage->data)
 		{
+			XWindowAttributes attr;
+			libX11->XGetWindowAttributes(pDisplay, window, &attr);
+			VkExtent2D windowExtent = {static_cast<uint32_t>(attr.width), static_cast<uint32_t>(attr.height)};
 			VkExtent3D extent = image->getImage()->getMipLevelExtent(VK_IMAGE_ASPECT_COLOR_BIT, 0);
+
+			if (windowExtent.width != extent.width || windowExtent.height != extent.height)
+			{
+				return VK_ERROR_OUT_OF_DATE_KHR;
+			}
+
 			libX11->XPutImage(pDisplay, window, gc, xImage, 0, 0, 0, 0, extent.width, extent.height);
 		}
 	}