Commit 3e52318cc6eb5db046658c2a8328112ccfa138dd

Igor Nazarov 2025-06-26T10:46:00

Vulkan: Ensure always using resolved Window Surface size `WindowSurfaceVk::getWidth/Height()` methods return cached, previously resolved Surface size. Using these methods while current Window Surface size is unresolved may return stale values, causing undesired behavior. Appropriate ASSERTs were added to these methods to prevent such usage. Added ASSERTs revealed few places with incorrect usage: - In `Context::makeCurrent()` to set initial viewport or for capture. - In `IsPartialBlit()` and `ValidateReadPixelsBase()` validations. - In `SerializeFramebufferAttachment()` during capture. Rest of the code was thoroughly checked if it is possible to call `WindowSurfaceVk::getWidth/Height()` when size is unresolved. All other places always call these methods after framebuffer state synchronization, which acquires swapchain images and resolves the surface size. Added `ensureSizeResolved()` method that is called during validation and in the `SerializeFramebufferAttachment()` method. It is possible to use existing `Framebuffer::syncState()` method as alternative, but this solution was discarded since it may potentially interfere with `State::syncDirtyObjects()` method. The `Surface::getUserSize()` replaces old methods as optimization, to prevent calling relatively expensive method twice from `Context::makeCurrent()` to get width and height of the `drawSurface`. Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeBeforeMakeCurrent/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeBeforeMakeCurrentPostSizeQuery/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeAndReadPixelsRobustANGLE/* Test: angle_trace_tests --gtest_filter=EGLSurfaceTest.ResizeAndBlitFramebufferANGLE/* Bug: angleproject:397848903 Change-Id: I082e13d0b8db5fd7d08ff25b102df1f283e1256d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6792928 Commit-Queue: Igor Nazarov <i.nazarov@samsung.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>