A game draws into its SurfaceView's surface with its own device and swapchain on the window (the Vulkan
pass-through, Native bridge). On Android, the surface is below the app's window: the SurfaceView clears its
area of the window to transparent, and the compositor shows the window's views and dialogs over the game. The
same happens here:
SurfaceView draws its area with drawColor(0, CLEAR). Each frame is every window's last recording, the first
one attached at the bottom (snx.android.ui.Host), so that a dialog shows over the activity.render_yield). It then draws its frames into
a ring of three layer images, cleared to transparent, with the same pipelines.VK_KHR_external_memory_fd with an opaque fd on Linux and FreeBSD, an opaque
Win32 handle on Windows), with a dedicated allocation. The game's device imports each one (hle_vulkan.c) when its
physical device's deviceUUID and driverUUID are the renderer's. macOS has no such handle here (MoltenVK), so
there is no layer.LOAD_OP_LOAD), and signals a semaphore of its own, which the present waits for. --shot copies the image
after the blend: from then on the shots are of the game's presents, and the renderer saves none of its own.SurfaceView's
hole) takes away the bounds inside it. What it cannot follow counts as visible.The two devices share no semaphore. The renderer's thread draws into an image that is not the one shown and that no
blend still reads (the game's side tells it, from the fences of its blends). It releases the image to
VK_QUEUE_FAMILY_EXTERNAL in layout GENERAL, then submits a fence on its queue after the frame. A present
blends the newest image whose fence is signaled, and the older one until then. So a present never waits for the
renderer, and the renderer waits for the game only when the game's blends still read every other image.
The blend is in the encoding of the swapchain: a UNORM swapchain blends the layer's bytes as they are. An sRGB swapchain reads the layer through an sRGB view, so that its edges of partial alpha are a little different from Android's.
Made from docs/platforms/android-apps/hwui.md at 69237645142c. GPL-3.0-or-later.