Skip to content

Commit afe5abb

Browse files
committed
fix: add a condition to detect nvidia drivers first
1 parent 8d28601 commit afe5abb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

justfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ build: configure
1414
# Runs the game using the dedicated Nvidia/AMD GPU
1515
[default]
1616
run config="": build
17-
DRI_PRIME=1 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia ./bin/GAME_APPLICATION {{ if config != "" { "-c " + config } else { "" } }}
17+
#!/usr/bin/env bash
18+
if command -v nvidia-smi > /dev/null 2>&1; then
19+
export DRI_PRIME=1
20+
export __NV_PRIME_RENDER_OFFLOAD=1
21+
export __GLX_VENDOR_LIBRARY_NAME=nvidia
22+
elif lsmod | grep -i "amdgpu" > /dev/null 2>&1; then
23+
export DRI_PRIME=1
24+
fi
25+
./bin/GAME_APPLICATION {{ if config != "" { "-c " + config } else { "" } }}
1826
1927
# Run the game/application on the integrated GPU for testing/sanity checks
2028
run-int config="": build

0 commit comments

Comments
 (0)