Skip to content
Snippets Groups Projects

Draft: Add PRIME render offload support (Linux)

Closed Ghost User requested to merge xenhat/feature/prime-run-wrapper into main
@@ -117,20 +117,20 @@ if [[ -z "$AL_NO_OFFLOAD" ]]; then
if command -v lspci >/dev/null 2>&1; then
vga_adapters=$(lspci | grep -i 'vga\|3d\|2d')
adapters_count=$(wc -l <<< "$vga_adapters")
if [[ $adapters_count -gt 1 ]]
then
if [[ $adapters_count -gt 1 ]]; then
echo "Multiple graphics adapters detected, attempting auto-select..."
# TODO: Stuff DRI_PRIME=1 somewhere in there for machines with AMD discrete gpus + integrated graphics
if [[ "${vga_adapters}" =~ "NVIDIA Corporation" ]]; then
if [[ "${vga_adapters}" =~ "Advanced Micro Devices, Inc" ]] || [[ "${vga_adapters}" =~ "Intel" ]]; then
echo "Hybrid graphics detected"
if command -v prime-run > /dev/null 2>&1; then
echo "prime-run available, launching using the NVIDIA gpu"
LL_WRAPPER+=" prime-run "
else
echo "prime-run not available, attempting to use the fallback environment variable"
LL_WRAPPER+=" __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
fi
if [[ "${vga_adapters}" =~ "NVIDIA Corporation" ]] && [[ "${vga_adapters}" =~ "Advanced Micro Devices, Inc" ]]; then
if command -v prime-run > /dev/null 2>&1; then
echo "prime-run available, launching using the NVIDIA gpu"
LL_WRAPPER+=" prime-run "
else
echo "prime-run not available, attempting to use the fallback environment variable"
LL_WRAPPER+=" __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
fi
else
# if [[ "${vga_adapters}" =~ "Intel" ]]; then
echo 'Auto-select does not know what to do with your current configuration.\nPlease send the output of "$(lspci | grep -i '\''vga\|3d\|2d'\'')" to the Alchemy Viewer discord'\''s testing channel.'
fi
fi
fi
Loading