From 1b98fb55250bb02ac55f47288d1fb84990a93bc5 Mon Sep 17 00:00:00 2001 From: cmitu <31816814+cmitu@users.noreply.github.com> Date: Wed, 18 Oct 2023 05:48:53 +0100 Subject: [PATCH] systems: add Vulkan flags for Pi4/Pi5 Added Vulkan as supported renderer for Pi4/Pi5 when running on RaspiOS 12 Bookworm. Technically the support was added in Bullseye for Pi4, but it was only available under X11. Notes: - most emulators include the Vulkan headers, so there's no need to add `libvulkan-dev` as a dependency. - not all emulators will run with Vulkan from KMS/DRM - `ppsspp`/`dolphin` can use it under x11/wayland, while `retroarch` runs with the`vulkan` video driver on KMS/DRM. - switching RetroArch to use the `vulkan` renderer needs to include the installation/configuration of SLANG shaders, which is not handled at the moment. --- scriptmodules/emulators/dolphin.sh | 2 ++ scriptmodules/emulators/ppsspp.sh | 1 + scriptmodules/supplementary/sdl2.sh | 1 + scriptmodules/system.sh | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/scriptmodules/emulators/dolphin.sh b/scriptmodules/emulators/dolphin.sh index 886e14d952..414a32c58f 100644 --- a/scriptmodules/emulators/dolphin.sh +++ b/scriptmodules/emulators/dolphin.sh @@ -54,6 +54,8 @@ function depends_dolphin() { # if using the latest version, add SDL2 as dependency, since it's mandatory [[ "$(_get_commit_dolphin)" == "" ]] && depends+=(libsdl2-dev) + # install Vulkan drivers when needed + isPlatform "vulkan" && depends+=(mesa-vulkan-drivers) getDepends "${depends[@]}" } diff --git a/scriptmodules/emulators/ppsspp.sh b/scriptmodules/emulators/ppsspp.sh index 9999602c07..34cf7907b9 100644 --- a/scriptmodules/emulators/ppsspp.sh +++ b/scriptmodules/emulators/ppsspp.sh @@ -31,6 +31,7 @@ function depends_ppsspp() { isPlatform "videocore" && depends+=(libraspberrypi-dev) isPlatform "mesa" && depends+=(libgles2-mesa-dev) isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc) + isPlatform "vulkan" && depends+=(mesa-vulkan-drivers) getDepends "${depends[@]}" } diff --git a/scriptmodules/supplementary/sdl2.sh b/scriptmodules/supplementary/sdl2.sh index 861977cf12..9b50b823a5 100644 --- a/scriptmodules/supplementary/sdl2.sh +++ b/scriptmodules/supplementary/sdl2.sh @@ -49,6 +49,7 @@ function _list_depends_sdl2() { isPlatform "gl" || isPlatform "rpi" && depends+=(libgl1-mesa-dev libglu1-mesa-dev) isPlatform "kms" || isPlatform "rpi" && depends+=(libdrm-dev libgbm-dev) isPlatform "x11" && depends+=(libpulse-dev libwayland-dev) + isPlatform "vulkan" && depends+=(libvulkan-dev) echo "${depends[@]}" } diff --git a/scriptmodules/system.sh b/scriptmodules/system.sh index 1470ce03f1..41d4f46a88 100644 --- a/scriptmodules/system.sh +++ b/scriptmodules/system.sh @@ -368,6 +368,10 @@ function get_rpi_video() { fi fi [[ "$__has_dispmanx" -eq 1 ]] && __platform_flags+=(dispmanx) + # Pi4/5 have Vulkan working under KMS on Debian 12 (bookworm) or newer + if (isPlatform "rpi4" || isPlatform "rpi5") && [[ "$__os_debian_ver" -ge 12 ]]; then + __platform_flags+=(vulkan) + fi else __platform_flags+=(videocore) if ! isPlatform "aarm64"; then