implicit Vulkan frame generation layer for linux x86/x86-64/arm64/android
The Vulkan layer is enabled with BIONIC_FG_ENABLE=1 and reads a TOML config file.
The config path defaults to $HOME/.config/bionic-fg/conf.toml and can be overridden with BIONIC_FG_CONFIG.
BIONIC_FG_ENABLE=1
BIONIC_FG_CONFIG=/path/to/conf.toml # optional
VK_LAYER_PATH=/path/to/implicit_layer.dversion = 1
[global]
enabled = true
multiplier = 2 # 0=off, or 2..4
flow_scale = 0.8 # 0.2..1.0
model = 0 # 0 or 1BIONIC_FG_MULTIPLIER, BIONIC_FG_FLOW_SCALE, and
BIONIC_FG_MODEL are accepted when the TOML file is missing. If the TOML
file exists, it wins.
The layer polls the config file timestamp during presentation.
flow_scalehot-reloads in place.multiplierandmodelhot-reload by rebuilding the internal framegen context against the already-provisioned AHB outputs and swapchain image pool. Settingmultiplier = 0turns frame generation off without recreating the app swapchain.- On Android/Bionic and glibc builds,
enabledhot-reloads in place by creating or destroying the framegen context against the swapchain resources provisioned at swapchain creation. Other targets use a one-timeVK_ERROR_OUT_OF_DATE_KHRfallback when the swapchain was not provisioned for hot reload.
Install layout expected by the manifest:
.local/lib/libbionic_fg.so
.local/lib/i386-linux-gnu/libbionic_fg.so
.local/share/vulkan/implicit_layer.d/VkLayer_BIONIC_framegen.json
.local/share/vulkan/implicit_layer.d/VkLayer_BIONIC_framegen_i386.json
The 64-bit manifest uses ../../../lib/libbionic_fg.so and the 32-bit
compatibility manifest uses ../../../lib/i386-linux-gnu/libbionic_fg.so,
relative to implicit_layer.d. Both manifests advertise the same layer name;
the Vulkan loader selects the one matching the application process width.
cmake -S . -B build/android-arm64 \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-26 \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
cmake --build build/android-arm64 -jThe glibc target omits the Android JNI and AHardwareBuffer entry points and uses the layer's single-device path with device-local Vulkan images. It still uses the same embedded shader graph and implicit-layer interception points.
On an x86_64 Linux system with a C++17 compiler, Vulkan headers/loader, CMake, and pthreads installed:
./build-linux-x86_64.shThe output is staged at dist/linux-x86_64/:
libbionic_fg.so
VkLayer_BIONIC_framegen.json
The i386 build lets 32-bit Proton/Wine and native Linux Vulkan applications
use the same layer. It requires a 32-bit C++ toolchain and Vulkan development
library; on Debian/Ubuntu these are g++-multilib and libvulkan-dev:i386.
dpkg --add-architecture i386
apt install build-essential cmake g++-multilib libvulkan-dev:i386
./build-linux-i386.shThe output is staged at dist/linux-i386/:
libbionic_fg.so
VkLayer_BIONIC_framegen_i386.json
The manifest is intended for:
~/.local/lib/libbionic_fg.so
~/.local/share/vulkan/implicit_layer.d/VkLayer_BIONIC_framegen.json
On x86_64 Linux, install both the x86_64 and i386 artifacts above. The
library_arch fields in the manifests prevent the loader from attempting to
load a 64-bit library into a 32-bit process (or vice versa).
Enable the layer for a test process with BIONIC_FG_ENABLE=1 and point
BIONIC_FG_CONFIG at a compatible conf.toml as described above.
GPL-3.0. See LICENSE.