Files
DroidDeck/tools/vkbridge/build-server-android.sh
T
Ahmad Sayed Alsayed EbrahimandClaude Opus 5.5 8c050f43b6 feat(vkbridge): run the bridge server inside the app's process
Android picks the GPU driver (Samsung's updatable one included) while the app
starts, only for the app's process. The server as a separate executable got the
plain /vendor driver: on the Tab S10+ it saw no VK_EXT_robustness2 or
mutable_descriptor_type, which the capability viewer (an app) listed. Winlator's
Vortek runs its server in-process for the same reason.

- libvkbridge_jni.so: the same server built as a JNI library; nativeStart runs
  the self-test once, serves on a thread for the app's life, and points the log
  at each new session's folder (with the self-test summary).
- VkBridgeNative / VkBridgeComponent: in-process first, the executable as the
  fallback; the in-app server's socket is kept between sessions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1U9H1evGNjHRQ3wRUdv5V
2026-10-10 16:47:03 +03:00

31 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Builds the bridge server for the device (bionic, arm64-v8a, API 26) with the NDK's clang:
# tools/vkbridge/build-server-android.sh <ndk-dir> <jniLibs-out-dir>
# The output is an executable named like a library (libvkbridge_server.so) so that Android
# extracts it into the native library directory, the one place an app may exec from.
set -euo pipefail
ndk=$1
out=$2/arm64-v8a
here=$(cd "$(dirname "$0")" && pwd)
srv=$(cd "$here/../../app/src/main/cpp/vkbridge" && pwd)
cc=$(ls -d "$ndk"/toolchains/llvm/prebuilt/*/bin/aarch64-linux-android26-clang | head -1)
[ -x "$cc" ] || { echo "no NDK clang under $ndk" >&2; exit 1; }
mkdir -p "$out"
"$cc" -O2 -g0 -fPIE -pie -Wall -Wno-unused-parameter -Wno-missing-field-initializers \
-I"$here/third_party/Vulkan-Headers-1.4.341/include" -I"$here/common" -I"$here/common/gen" -I"$srv" \
-Wl,-z,max-page-size=16384 -Wl,--build-id=none \
-o "$out/libvkbridge_server.so" \
"$srv"/*.c "$here/common/vkb_wire.c" "$here/common/gen/vkb_gen_structs.c" "$here/common/gen/vkb_gen_server.c" \
-ldl -llog -lm
"$(dirname "$cc")/llvm-strip" --strip-unneeded "$out/libvkbridge_server.so"
# The same server as a JNI library the app loads into its own process (the default): only there
# does Android hand it the driver the app gets (VkBridgeNative, server_main.c).
"$cc" -O2 -g0 -fPIC -shared -DVKB_JNI -Wall -Wno-unused-parameter -Wno-missing-field-initializers \
-I"$here/third_party/Vulkan-Headers-1.4.341/include" -I"$here/common" -I"$here/common/gen" -I"$srv" \
-Wl,-z,max-page-size=16384 -Wl,--build-id=none -Wl,--no-undefined -Wl,-soname,libvkbridge_jni.so \
-o "$out/libvkbridge_jni.so" \
"$srv"/*.c "$here/common/vkb_wire.c" "$here/common/gen/vkb_gen_structs.c" "$here/common/gen/vkb_gen_server.c" \
-ldl -llog -lm
"$(dirname "$cc")/llvm-strip" --strip-unneeded "$out/libvkbridge_jni.so"
echo "built $out/libvkbridge_server.so and libvkbridge_jni.so"