From 96cad1ac999b7d6e288a681ce53a23044bc23127 Mon Sep 17 00:00:00 2001 From: krypton Date: Sat, 4 Apr 2026 21:37:16 +0800 Subject: feat: add NVIDIA Prime environment variables for Linux hybrid graphics - Inject __NV_PRIME_RENDER_OFFLOAD=1 and __GLX_VENDOR_LIBRARY_NAME=nvidia - Enables discrete GPU usage on Linux systems with hybrid graphics - Only applies on Linux via #[cfg(target_os = "linux")] - Closes #154 --- src-tauri/src/main.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 7f7c4c0..5109182 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -862,6 +862,22 @@ async fn start_game( ); } + // On Linux, inject GPU environment variables for hybrid graphics support + #[cfg(target_os = "linux")] + { + // NVIDIA Prime Render Offload - enables discrete NVIDIA GPU on hybrid systems + command.env("__NV_PRIME_RENDER_OFFLOAD", "1"); + command.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia"); + + // AMD DRI_PRIME - enables discrete AMD GPU on hybrid systems + command.env("DRI_PRIME", "1"); + + emit_log!( + window, + "Injected GPU environment variables for Linux (NVIDIA Prime & AMD DRI_PRIME)".to_string() + ); + } + // Spawn and handle output let mut child = command .spawn() -- cgit v1.2.3-70-g09d2