Vulkan: Remove surface caps query from createSwapChain This is mainly a refactoring with minor bug fixes. The `createSwapChain()` is called at initialize and at swapchain recreate. Before recreate there is always `queryAndAdjustSurfaceCaps()` call, which queries current surface sizes and min image count. However, surface capabilities may be queried again from `createSwapChain()` to get compatible present modes and the min image count. Problem is that surface caps `currentExtent` may change after the second query in the `createSwapChain()`, while the `extents` parameter is already calculated. Such situation will violate the specification. To eliminate the possibility of the above problem and to simplify the code, query of compatible present modes is moved to the `queryAndAdjustSurfaceCaps()`. To save performance, `mCompatiblePresentModes` is only updated if swapchain is already invalid (recreate is imminent). Function is now also handles `mEmulatedPreTransform` to further simplify the code. The `mSurfaceCaps` member was replaced with local variable. The `mIsSurfaceSizedBySwapchain` boolean is added instead to check it in the `getUserWidth()`/`getUserHeight()` methods. This also fixes a possible bug (anglebug.com/168327817) on Fuchsia when this expression could be false: mSurfaceCaps.currentExtent.width == kSurfaceSizedBySwapchain This is because previously `queryAndAdjustSurfaceCaps()` updated `mSurfaceCaps` with the values from `getCurrentWindowSize()`. It seems that the bug never happened on practice, otherwise the ASSERT in the same function would fail. The `prepareForAcquireNextSwapchainImage()` is used at initialize instead of `createSwapChain()` to remove code duplication. Fixed (anglebug.com/168327817) checking `mPreTransform` without enabled "enablePreRotateSurfaces" feature. Bug: angleproject:397848903 Bug: angleproject:168327817 Change-Id: I02e8e3b815b30350e12476853d8dcffed3fe7c38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6298736 Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>