Vulkan: Fix transition to FORIEGN and back in same submission Image layout transitions are typically automatically handled. In some cases however, the image layout is specifically "finalized". For foreign images, the relevant cases are all about the point in time when the image is being released. When a foreign image's layout is finalized, a barrier is generated to transition it to the FOREIGN queue on submission. Previously, an incorrect assumption was made that after such a point, the VkImage will no longer be used by any commands. This was incorrect because of EGL Images, which let the same VkImage (and ImageHelper) be shared between multiple textures. The following scenario broke that assumption: - Texture is bound to the (foreign) EGL image - Texture is used and deleted * VkImage's transition back to foreign is cached, but not executed - Another texture is bound to the same EGL image - Texture is used * At this point, the texture is re-acquired from foreign, but it wasn't released in the first place! In this change, a vkQueueSubmit is issued after the foreign image's layout is finalized to make sure the transition back to FOREIGN is applied. Bug: angleproject:42263241 Bug: angleproject:42262454 Bug: angleproject:390443243 Bug: chromium:382527242 Change-Id: Ibe3e6d60f282f9fb0eed1deba3325456017c3617 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6292804 Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>