This guide will remain here as a reference. However, Chaotic-AUR now provides Mesa compiled using LLVM 12, so there is no need for this guide now. Just enable the repo, install mesa-git
, and you should be good to go.
Currently, users of AMD GPUs have two options to get decent performance on yuzu. One could use the Vulkan backend in Windows, however, this comes with poor stability as yuzu’s Vulkan implementation lacks proper memory management. The other option is to use the OpenGL backend in Linux with Mesa’s open-source RadeonSI driver. Decent stability can be achieved on Linux, but the current stable version of Mesa found in most Linux distributions causes unrecoverable crashes in many games on yuzu. Some crashes are caused by an old Mesa version, and many more are caused by the old, stable version of LLVM required by Mesa to compile shaders.
Most crashes are solved upstream on both Mesa and LLVM, so this is a guide about installing the latest LLVM and Mesa versions to an Arch Linux or Manjaro computer.
Preparations
For this guide, either an install of Arch Linux or any distro derived from Arch Linux, such as Manjaro, is necessary to follow along. If you are a beginner with Linux, Manjaro is easier to set up and install to your computer than Arch Linux, and it can be downloaded here. Arch Linux can be found here. General setup of the operating system is outside the scope of this guide, but here is Manjaro’s installation guide, and here is Arch Linux’s installation guide.
Once installed, update your packages with pacman
, the package manager in Arch Linux.
sudo pacman -Syu
There are a few dependencies needed to complete this guide, as well. Run the following command to install the dependencies. If you have already followed yuzu’s Building for Linux guide, then this next step is unnecessary.
sudo pacman -S --needed git base-devel
Using Chaotic-AUR to Install llvm-git
The first step is to add the Chaotic-AUR repository to your machine. This will give us access to a daily build of llvm-git (version 12.0.0 as of writing), which we need for building mesa-git
later. Since it updates periodically, follow their instructions to install the repository on to your system.
Afterwards, update your package lists and packages:
sudo pacman -Syu
LLVM will be installed later automatically when mesa-git
is being built. This section was just setup to make that happen later.
Chaotic-AUR provides access to many packages, including mesa-tkg-git
and mesa-aco-git
. Do not install Mesa from Chaotic-AUR. These packages are updated daily, and while there is nothing wrong with them in their own right, they use LLVM stable (version 10) which is not suitable for yuzu.
Installing mesa-git
The next step is building Mesa from source. Clone the mesa-git
build script from the Arch User Repository:
git clone https://aur.archlinux.org/mesa-git.git
Then change the working directory over to the newly cloned directory:
cd mesa-git
This gives us a PKGBUILD
, a script that helps us build a package (hence the name).
In order to use the daily version of LLVM from Chaotic-AUR, the environment variable MESA_WHICH_LLVM
needs to be set to 3
. Without it, mesa-git
is configured to build with the stable version of LLVM. Run makepkg
from inside the mesa-git
directory to build and install Mesa:
MESA_WHICH_LLVM=3 makepkg -si
makepkg
will run pacman
during the install and require credentials. It will ask to install llvm-git
, llvm-libs-git
, and clang-git
over llvm
, llvm-libs
, and clang
, respectively. Press y
and hit ENTER
to allow it to do so for each package. mesa-git
should take a while to build.
Once it has finished building, it may ask for credentials again. pacman
will ask to replace more packages. Press y
and hit ENTER
to allow it to replace these with mesa-git
. Once pacman
finishes installing it, mesa-git
should be installed. Restart your machine to let all the changes take effect.
Verify the Installation
To verify that the build was successful, install the mesa-demos
package and run glxinfo
in the terminal:
glxinfo | grep "OpenGL renderer"
The command output should be similar to this, adjusted for your own graphics card:
OpenGL renderer string: AMD Radeon (TM) R5 340 (OLAND, DRM 3.37.0, 5.7.12-arch1-1, LLVM 12.0.0)
Of particular note is the LLVM version. If it is greater than or equal to 12.0.0, then the installation was successful.
Updating mesa-git
After a some time has passed, improvements to Mesa will happen upstream and become available. Updating mesa-git
requires ensuring the PKGBUILD
is updated and then running makepkg
again.
Ensure the PKGBUILD
is updated:
cd mesa-git
git pull
Then run makepkg
again:
MESA_WHICH_LLVM=3 makepkg -si
Optional: Prevent pacman
From Updating mesa-git
Automatically
Though mesa-git
is now installed, running sudo pacman -Syu
right now will overwrite the package with one from a repository (likely mesa-aco-git
from Chaotic-AUR). To prevent this, pacman
needs to ignore that package for updates. Edit the IgnorePkg
line in /etc/pacman.conf
:
#IgnorePkg =
Add mesa-git
to this list and remove the comment marker #
if need be:
IgnorePkg = mesa-git
Use commas to separate multiple package names if other packages are already listed there.
It is important to note this will freeze the mesa-git
version. This means if other packages update around it, then the installed mesa-git
version may become incompatible with the rest of the system. Update mesa-git
from time-to-time following the guide above.
Conclusion
Yuzu will be much more stable on an AMD GPU now with the updated Mesa and LLVM versions of the GPU drivers. Some games cannot be helped.