Skip to content

Instantly share code, notes, and snippets.

@shmerl
Last active Aug 8, 2021
Embed
What would you like to do?
For launching programs with custom Mesa
#!/bin/bash
# Assumes Mesa libraries are installed in /opt/${mesa_dir}/<arch_dir>
# For explicit switching off of the override
mesa_run_off=${mesa_run_off:-false}
if $mesa_run_off; then
"$@" &
disown -h %+
sleep 1
exit 0
fi
export mesa_dir=${mesa_dir:-"mesa-main"}
mesa_arch=${mesa_arch:-"x86_64"}
if [[ "$mesa_arch" == "x86_64" ]]; then
vulkan_icd=radeon_icd.x86_64.json
elif [[ "$mesa_arch" == "x86" ]]; then
vulkan_icd=radeon_icd.i686.json
else
echo "Invalid Mesa arch ${mesa_arch} specified!"
exit 1
fi
mesa_env="LD_LIBRARY_PATH=/opt/${mesa_dir}/${mesa_arch}:${LD_LIBRARY_PATH} \
LIBGL_DRIVERS_PATH=/opt/${mesa_dir}/${mesa_arch} \
EGL_DRIVERS_PATH=/opt/${mesa_dir}/${mesa_arch} \
VK_ICD_FILENAMES=/opt/${mesa_dir}/share/vulkan/icd.d/${vulkan_icd}"
# TODO: figure out how to add layers path without resetting it...
#export VK_LAYER_PATH=/opt/${mesa_dir}/share/vulkan/explicit_layer.d:${VK_LAYER_PATH}
export $mesa_env
echo "Mesa env:"
echo "${mesa_env}"
echo "==========================================="
"$@" &
disown -h %+
sleep 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment