diff options
| author | 2026-04-04 21:37:16 +0800 | |
|---|---|---|
| committer | 2026-04-04 21:37:16 +0800 | |
| commit | 96cad1ac999b7d6e288a681ce53a23044bc23127 (patch) | |
| tree | 6db700b1dc931a5ac446bd241e9b75ce96f90a55 /src-tauri | |
| parent | e5f94912615e69c32c353fd6a63790e9b16685e4 (diff) | |
| download | DropOut-96cad1ac999b7d6e288a681ce53a23044bc23127.tar.gz DropOut-96cad1ac999b7d6e288a681ce53a23044bc23127.zip | |
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
Diffstat (limited to 'src-tauri')
| -rw-r--r-- | src-tauri/src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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() |