Vulkan: Wait for surface ANI semaphore only if image is used Right now there is a bug that surface's ANI semaphore is added to context when WindowSurfaceVk::getAttachmentRenderTarget get called, which gets called from FramebufferVk::syncState, which is before we end the previous render pass, due to the endRenderpass usually is deferred until next renderPass starts. This caused ANI semaphore gets added to the previous render pass's submission, which does not use surface, and thus a bubble in GPU execution pipeline where the user FBO rendering gets unnecessarily blocked until ANI semaphore is signaled. This lowers GPU utilization and thus GPU frequency gets dropped and frame time increased. This CL stores ANI semaphore to ImageHelper object and when barrier is generated, the ANI semaphore is moved to CommandBuffer. When CommandBuffer gets flushed and submitted, it gets added to the waitSemaphores vector and submitted to vulkan. Since all use of swap chain image must go through barrier code first (you need at least change layout), this ensures ANI semaphore gets waited in exact and robust way. Only the submission that references the swap chain image will be waited. With this CL, professional_baseball_spirits reduces frame time from 3.8 ms to 2.7 ms, achieving parity with native GLES on pixel 7 pro. Bug: b/275624771 Change-Id: Ifa6cacf9e3bc147bfde54eb7def2fca48c50aca0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4400011 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>