26 lines
719 B
Bash
26 lines
719 B
Bash
#!/bin/bash
|
|
#
|
|
# Purpose : Install the Vulkan driver for each Intel or AMD GPU in the machine.
|
|
# NVIDIA's Vulkan driver comes with nvidia-utils (see nvidia.sh).
|
|
|
|
set -e
|
|
|
|
source "$HOME/.local/share/coredesktop/utils.sh"
|
|
|
|
# Read vendor IDs from sysfs: lspci needs pciutils and wakes suspended GPUs
|
|
PACKAGES=()
|
|
for device in /sys/bus/pci/devices/*; do
|
|
[[ $(< "$device/class") == 0x03* ]] || continue
|
|
case "$(< "$device/vendor")" in
|
|
0x8086) PACKAGES+=(vulkan-intel) ;;
|
|
0x1002) PACKAGES+=(vulkan-radeon) ;;
|
|
esac
|
|
done
|
|
|
|
if (( ${#PACKAGES[@]} > 0 )); then
|
|
mapfile -t PACKAGES < <(printf '%s\n' "${PACKAGES[@]}" | sort -u)
|
|
install_packages "${PACKAGES[@]}"
|
|
else
|
|
echo "No Intel or AMD GPU found."
|
|
fi
|