Vulkan: a pass-through

The guest calls Vulkan directly. libvulkan.so is an HLE library whose functions are generated from the Vulkan registry (vk.xml): each one is an adapter that calls the host's Vulkan (volk) with the guest's arguments as they are. Structures, pNext chains, handles and mapped memory pass through, since a guest pointer is a host pointer and the layouts agree. The adapters change only:

The game's window is the SDL window: while the guest owns a swapchain on it, ScarletNX's own renderer (HWUI) stops presenting. It draws its frames into a layer instead, which each of the guest's presents blends over its image, as Android's compositor puts an app's windows over its SurfaceView (HWUI). The guest's device gets the layer's import extension (VK_KHR_external_memory_fd, or VK_KHR_external_memory_win32 on Windows) and its swapchain images COLOR_ATTACHMENT usage for that.

The device that the guest sees is a Mali-G710 (ARM's vendor and driver IDs), with the host's limits and features. An engine can allow Vulkan only on the GPUs of its own list: one game's list holds recent Adreno, Xclipse and Mali GPUs (Mali-G610 and newer), and on any other GPU the game takes GLES, which has no display here. A Mali-G710 is on such lists.


Made from docs/platforms/android-apps/native.md at 69237645142c. GPL-3.0-or-later.