How do I apply this patch on mesa-git for installation?

I am trying to play RE8 on Manjaro. The game loads but the filtering looks messed up which according to this tkg patch (Release Proton-tkg 6.7.r17.g50d26744 for RE8 · Frogging-Family/wine-tkg-git · GitHub) is corrected by this patch (nir/opt_access: fix getting variables in presence of similar bindings/desc (!10692) · Merge requests · Mesa / mesa · GitLab). I am on a radeon 6900XT using RADV drivers so it sounds like this applies to my case. I’m not familiar with applying patches however. How would I apply this patch to mesa-git and install in this situation?

Hello @flyhigh :wink:

Well, if you need it now, then clone this PKGBUILD:

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mesa-git

exchange

source=('mesa::git+https://gitlab.freedesktop.org/mesa/mesa.git'
        'LICENSE')

with

source=('mesa::git+https://gitlab.freedesktop.org/hakzsam/mesa.git#branch=nir_opt_access_fix_binding'
        'LICENSE')

and see if it works:

makepkg -si
1 Like

Thank you for the guide!

Would I be able to apply this patch on the stable Mesa drivers as well? I will install Mesa-git if I need to for this game but I (as the name suggests) experience more stability when using the stable manjaro Mesa packages that are default installed by the package manager.

For a quick and dirty solution, you could do something similar to what is described below. (Instead of “povray”, do it with “mesa”)
That way you don’t need to create a patch file and add to the build instructions.

git clone -b packages/mesa --single-branch https://github.com/archlinux/svntogit-packages.git mesa
cd mesa/trunk/
makepkg -o

Then you edit src/mesa-21.1.0/src/compiler/nir/nir_opt_access.c and apply the changes from the commit: nir/opt_access: fix getting variables in presence of similar bindings/desc (!10692) · Merge requests · Mesa / mesa · GitLab

And then compile and install the package with makepkg -ei

@moson I’m not following what you typed here too well. But if anything it sounds like one quick and dirty approach would be download the latest stable source here (git clone svntogit-packages/trunk at packages/mesa · archlinux/svntogit-packages · GitHub), change the nir_opt_access.c file via any text editor and then makepkg to install. What is the difference between makepkg -ei vs. makepkg -si in this situation? I’m used to installing package with makepkg -si but is -ei for modified packages or something?

The git clone will not download the mesa source files, only the PKGBUILD with the build instructions.

You do makepkg -o to download and extract all (mesa) source files, but not yet build the package.
(Because you want to modify the source before the build)

makepkg -ei Will build the package with the existing source files (which you have modified) and then install the package. See makepkg --help

btw. In case you want to build mesa 21.0.3-3 rather than 21.1.0 you can do

git checkout db92b6b3fc82f9e474f5663b782a2f990bdbf1b1

just before the makepkg -o command

@moson and @megavolt I went through each of the attempts (for both mesa-git and regular mesa) and couldn’t get a successful compile. How do I log the terminal output to put on here?

Simply copy / paste the text from the terminal into the post (with three backticks ``` before and after it for the formatting) ?

https://lmgtfy.app/?q=how+to+write+terminal+output+to+a+file+linux

@moson alright all of the compilations failed but I would like to try troubleshooting the compilation of mesa 21.1.0 with the patch. What I did was I downloaded this nir_opt_access.c file (/* * Copyright © 2019 Valve Corporation * * Permission is hereby granted, - Pastebin.com). Here is the terminal output when I typed makepkg -ei after makepkg -o 'ing the mesa package mentioned (==>(B Making package: mesa 21.1.0-1 (2021年05月12日 08時31分09秒)(B - Pastebin.com)

==> Leaving fakeroot environment.
==> Finished making: mesa 21.1.0-1 (Mi 12 Mai 2021 09:17:10 CEST)

Don’t know. It compiles fine on my machine.

internal compiler error: Segmentation fault

Almost sounds like some hardware error to me. :man_shrugging:

@moson didn’t get the internal compiler error this time as I tuned down some of my OC settings. Still failed to compile with this being my terminal output: (==> Making package: mesa 21.1.0-1 (2021年05月12日 19時03分31秒)==> Checking runtime - Pastebin.com)

Could you share the modified source files that you were able to compile with the modified nir_opt c file and maybe I’d be able to compile it successfully?

ok I was able to successfully modify mesa with the patched c file, install it, and the textures on resident evil 8 are corrected. Path to success was downloading the PKGBUILD and LICENSE files for mesa 21.0.1 here (svntogit-packages/trunk at packages/mesa · archlinux/svntogit-packages · GitHub). Then I downloaded the modified nir_opt_access.c file here (nir/opt_access:). From there I open terminal and navigate it to the source directory to make everything and makepkg -o to download the unmodified mesa 21.0.1 files. Then I replaced the original nir_opt_access.c file in [src/compiler/nir/nir_opt_access.c] with the modified one from the patch fix. From there I entered makepkg -ei to install the existing files. My initial issue with that my overclock on my CPU was unstable and caused compilation errors. Thank you @moson and @megavolt for the assists.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.