Skip to content

Instantly share code, notes, and snippets.

@julienbenjamin
Forked from Venemo/mesa-howto.md
Created May 3, 2024 10:22

Revisions

  1. @Venemo Venemo revised this gist Mar 7, 2024. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -70,7 +70,14 @@ ninja -C build64 install
    #### Config with RADV only in debug mode (recommended for bisecting RADV crashes, etc.)

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dllvm=disabled -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
    ninja -C build64radvdebug install
    ```

    #### Config with RADV only in debug mode without LLVM (recommended for bisecting RADV crashes without LLVM)

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dllvm=disabled -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuildtype=debug
    ninja -C build64radvdebug install
    ```

  2. @Venemo Venemo revised this gist Mar 7, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -70,7 +70,7 @@ ninja -C build64 install
    #### Config with RADV only in debug mode (recommended for bisecting RADV crashes, etc.)

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dllvm=disabled -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
    ninja -C build64radvdebug install
    ```

  3. @Venemo Venemo revised this gist Oct 29, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -147,6 +147,8 @@ MESA=$HOME/mesa \
    LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH \
    LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
    VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.x86.json \
    LIBVA_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
    VDPAU_DRIVER_PATH=$MESA/lib64/vdpau \
    D3D_MODULE_PATH=$MESA/lib64/d3d/d3dadapter9.so.1:$MESA/lib/d3d/d3dadapter9.so.1 \
    exec "$@"
    ```
  4. @Venemo Venemo revised this gist Oct 29, 2023. 1 changed file with 17 additions and 7 deletions.
    24 changes: 17 additions & 7 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -41,21 +41,29 @@ git clone https://gitlab.freedesktop.org/mesa/mesa.git
    We're assuming that your distro uses `lib64` for the 64-bit libraries like Fedora. If not, adjust the meson commands below according to your distro.
    The compiled libraries will go into `~/mesa` for the sake of simplicity.

    #### This command will build both Intel and AMD drivers in release mode:
    #### This command will build both Intel and AMD drivers in release mode, including codecs:

    ```
    # Enter the mesa root directory
    cd mesa
    # Configure the build with meson
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
    # Compile with ninja
    ninja -C build64 install
    ```

    #### Config with AMD drivers only in release mode, including codecs:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
    ninja -C build64 install
    ```


    #### Config with AMD drivers only in release mode (recommended for AMD performance testing):

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dbuildtype=release
    ninja -C build64 install
    ```

    @@ -108,18 +116,18 @@ endian='little'

    Now you can use it to build 32-bit mesa libs.

    #### 32-bit config with Intel and AMD drivers only in release mode:
    #### 32-bit config with Intel and AMD drivers only in release mode, including codecs:

    ```
    cd ~/Projects/mesa
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
    ninja -C build32 install
    ```

    #### 32-bit config with AMD drivers only:
    #### 32-bit config with AMD drivers only, including codecs:

    ```
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
    ninja -C build32 install
    ```

    @@ -184,6 +192,8 @@ MESA=$HOME/mesa
    export LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH
    export LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri
    export VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.i686.json
    export LIBVA_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri
    export VDPAU_DRIVER_PATH=$MESA/lib64/vdpau
    export D3D_MODULE_PATH=$MESA/lib64/d3d/d3dadapter9.so.1:$MESA/lib/d3d/d3dadapter9.so.1
    ```

  5. @Venemo Venemo revised this gist Feb 14, 2023. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -47,22 +47,22 @@ The compiled libraries will go into `~/mesa` for the sake of simplicity.
    # Enter the mesa root directory
    cd mesa
    # Configure the build with meson
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    # Compile with ninja
    ninja -C build64 install
    ```

    #### Config with AMD drivers only in release mode (recommended for AMD performance testing):

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build64 install
    ```

    #### Config with RADV only in debug mode (recommended for bisecting RADV crashes, etc.)

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
    ninja -C build64radvdebug install
    ```

    @@ -112,14 +112,14 @@ Now you can use it to build 32-bit mesa libs.

    ```
    cd ~/Projects/mesa
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build32 install
    ```

    #### 32-bit config with AMD drivers only:

    ```
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build32 install
    ```

    @@ -245,7 +245,7 @@ llvm-config = "/home/Timur/mesa/bin/llvm-config"
    Finally, specify this to meson using the `--native-file=my-llvm-x64` argument, for example:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release --native-file=my-llvm-x64
    meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release --native-file=my-llvm-x64
    ninja -C build64 install
    ```

  6. @Venemo Venemo revised this gist Mar 28, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -120,6 +120,7 @@ ninja -C build32 install

    ```
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build32 install
    ```

    Note that you can build both the x86_64 and the i686 libraries together and they can still all go to `~/mesa`, meaning there is no need to configure anything else when you need both 32 and 64-bit. You can use all of that with either 32-bit or 64-bit games.
    @@ -245,5 +246,6 @@ Finally, specify this to meson using the `--native-file=my-llvm-x64` argument, f

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release --native-file=my-llvm-x64
    ninja -C build64 install
    ```

  7. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -162,9 +162,10 @@ Some games have a launcher which is a small app that doesn't do anything useful

    1. Compile mesa as written above
    2. Create the `~/mesa-run.sh` script as above
    3. Open Steam, go to your Library
    4. Right-click the game, click "Properties"
    5. In the "Launch options" type:
    3. First make sure it works correctly with `vkcube` or another simple sample app outside of Steam
    4. Open Steam, go to your Library
    5. Right-click the game, click "Properties"
    6. In the "Launch options" type:
    `~/mesa-run.sh %command%`

    ## Alternative: sourcing a script method
  8. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -68,6 +68,10 @@ ninja -C build64radvdebug install

    You can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.

    #### Note about upgrading to a different version of mesa

    You can use the usual git commands for updating, for example `git pull` etc. You don't need to re-run `meson` but you do need to re-run `ninja` (eg. `ninja -C build64 install`) to compile and install the changes in the new version.

    ### Step 4. 32-bit build on an x86_64 system (skip when only testing a 64-bit game)

    If you don't use Fedora (or another Red Hat family distro), replace `i686-redhat-linux-gnu-pkg-config` with the correct 32-bit `pkg-config` executable for your distro. Also verify the location of `llvm-config-32` which might be different on another distro.
  9. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ Use your distro package manager to install mesa dependencies. If you're on a dif
    This works on Fedora 35:

    ```
    dnf install git meson ninja-build gcc gcc-c++ cmake bison flex vulkan*.x86_64 vulkan*.i686 libdrm-devel.x86_64 libdrm-devel.i686 libvdpau-devel.x86_64 libvdpau-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 zlib-devel.x86_64 zlib-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 wayland*-devel.x86_64 wayland*-devel.i686 wayland-protocols-devel libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libunwind-devel.i686 libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 expat-devel.x86_64 expat-devel.i686 libzstd-devel.x86_64 libzstd-devel.i686 pkgconf-pkg-config.i686 pkgconf-pkg-config.x86_64
    dnf install git meson ninja-build gcc gcc-c++ cmake.i686 cmake.x86_64 glibc-devel.i686 glibc-devel.x86_64 valgrind-devel.i686 valgrind-devel.x86_64 bison flex vulkan*.x86_64 vulkan*.i686 libdrm-devel.x86_64 libdrm-devel.i686 libvdpau-devel.x86_64 libvdpau-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 zlib-devel.x86_64 zlib-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 wayland*-devel.x86_64 wayland*-devel.i686 wayland-protocols-devel libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libunwind-devel.i686 libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 expat-devel.x86_64 expat-devel.i686 libzstd-devel.x86_64 libzstd-devel.i686 pkgconf-pkg-config.i686 pkgconf-pkg-config.x86_64 libffi-devel.i686 libffi-devel.x86_64 libxcb-devel.i686 libxcb-devel.x86_64
    ```

    ### Step 2. Clone the mesa repo
  10. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -102,22 +102,23 @@ cpu='x86'
    endian='little'
    ```

    Now you can use it to build 32-bit mesa libs:
    Now you can use it to build 32-bit mesa libs.

    #### 32-bit config with Intel and AMD drivers only in release mode:

    ```
    cd mesa
    cd ~/Projects/mesa
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build32 install
    ```

    32-bit config with AMD drivers only:
    #### 32-bit config with AMD drivers only:

    ```
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ```

    Note that you can build both the x86_64 and the i686 libraries together and they can all go to `~/mesa`, and then you can use all of that with either 32-bit or 64-bit games.

    Note that you can build both the x86_64 and the i686 libraries together and they can still all go to `~/mesa`, meaning there is no need to configure anything else when you need both 32 and 64-bit. You can use all of that with either 32-bit or 64-bit games.

    # Using the compiled mesa binaries

    @@ -149,6 +150,10 @@ Now you can run your games like:
    ~/mesa-run.sh vkcube
    ```

    ### Note about games with a 32-bit launcher

    Some games have a launcher which is a small app that doesn't do anything useful other than launching the game. These are usually 32-bit, so if you want to run a game that has such a launcher and it doesn't work, you may need to do the 32-bit build to make it work.

    ### Testing a Steam game with your custom built mesa:

    1. Compile mesa as written above
  11. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ Use your distro package manager to install mesa dependencies. If you're on a dif
    This works on Fedora 35:

    ```
    dnf install git meson ninja-build gcc gcc-c++ cmake bison flex vulkan*.x86_64 vulkan*.i686 libdrm-devel.x86_64 libdrm-devel.i686 libvdpau-devel.x86_64 libvdpau-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 zlib-devel.x86_64 zlib-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 wayland*-devel.x86_64 wayland*-devel.i686 wayland-protocols-devel libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libunwind-devel.i686 libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 expat-devel.x86_64 expat-devel.i686 libzstd-devel.x86_64 libzstd-devel.i686
    dnf install git meson ninja-build gcc gcc-c++ cmake bison flex vulkan*.x86_64 vulkan*.i686 libdrm-devel.x86_64 libdrm-devel.i686 libvdpau-devel.x86_64 libvdpau-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 zlib-devel.x86_64 zlib-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 wayland*-devel.x86_64 wayland*-devel.i686 wayland-protocols-devel libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libunwind-devel.i686 libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 expat-devel.x86_64 expat-devel.i686 libzstd-devel.x86_64 libzstd-devel.i686 pkgconf-pkg-config.i686 pkgconf-pkg-config.x86_64
    ```

    ### Step 2. Clone the mesa repo
  12. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -72,6 +72,12 @@ You can compile one with `ninja -C build64radvdebug` and the other with `ninja -

    If you don't use Fedora (or another Red Hat family distro), replace `i686-redhat-linux-gnu-pkg-config` with the correct 32-bit `pkg-config` executable for your distro. Also verify the location of `llvm-config-32` which might be different on another distro.

    Make sure the meson cross directory exists:

    ```
    mkdir -p ~/.local/share/meson/cross
    ```

    Create a meson cross file here: `~/.local/share/meson/cross/gcc-i686` with the following content:

    ```
  13. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ git clone https://gitlab.freedesktop.org/mesa/mesa.git

    ### Step 3. 64-bit build

    We're assuming that your distro uses `lib64` for the 64-bit libraries. If not, adjust the meson commands below.
    We're assuming that your distro uses `lib64` for the 64-bit libraries like Fedora. If not, adjust the meson commands below according to your distro.
    The compiled libraries will go into `~/mesa` for the sake of simplicity.

    #### This command will build both Intel and AMD drivers in release mode:
    @@ -52,14 +52,14 @@ meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-driver
    ninja -C build64 install
    ```

    #### Config with AMD drivers only in release mode (recommended for performance testing):
    #### Config with AMD drivers only in release mode (recommended for AMD performance testing):

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build64 install
    ```

    #### Config with RADV only in debug mode (recommended for bisecting crashes, etc.)
    #### Config with RADV only in debug mode (recommended for bisecting RADV crashes, etc.)

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
  14. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,16 @@ Let's assume that you are using an x86_64 system.

    ## Building mesa

    ### Overview

    Here is what we are going to do:

    * Install all build dependencies for mesa
    * Clone the mesa repo to `~/Projects/mesa`
    * Build mesa
    * Install the mesa version you just built into `~/mesa` (**not** the same as the above directory)
    * Create a script which can tell games / apps to use the libraries from `~/mesa` instead of what is on your system out of the box.

    ### Step 1. Install dependencies

    Use your distro package manager to install mesa dependencies. If you're on a different distro, you will need to substitute with the correct commands for your package manager. The packages are usually named similarly but maybe have a different naming convention (eg. `-dev` vs. `-devel`, etc.).
    @@ -18,6 +28,8 @@ dnf install git meson ninja-build gcc gcc-c++ cmake bison flex vulkan*.x86_64 vu

    ### Step 2. Clone the mesa repo

    I usually put every git repo I work with into a directory such as `~/Projects` - I recommend the same to you.

    ```
    mkdir -p ~/Projects
    cd ~/Projects
  15. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,8 @@ dnf install git meson ninja-build gcc gcc-c++ cmake bison flex vulkan*.x86_64 vu
    ### Step 2. Clone the mesa repo

    ```
    mkdir -p ~/Projects
    cd ~/Projects
    git clone https://gitlab.freedesktop.org/mesa/mesa.git
    ```

  16. @Venemo Venemo revised this gist Nov 8, 2021. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,12 @@ Let's assume that you are using an x86_64 system.

    ### Step 1. Install dependencies

    This is how to install them on Fedora. You can substitute with other distros' package managers, the packages are named similarly but maybe have a different naming convention (eg. `-dev` vs. `-devel`, etc.).
    Use your distro package manager to install mesa dependencies. If you're on a different distro, you will need to substitute with the correct commands for your package manager. The packages are usually named similarly but maybe have a different naming convention (eg. `-dev` vs. `-devel`, etc.).

    This works on Fedora 35:

    ```
    dnf install meson ninja-build cmake bison flex gcc gcc-c++ glslang-devel.x86_64 glslang-devel.i686 libzstd-devel.i686 libzstd-devel.x86_64 libvdpau-devel.x86_64 libvdpau-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 bison-devel.x86_64 bison-devel.i686 valgrind-devel.x86_64 valgrind-devel.i686 wayland-devel.x86_64 wayland-devel.i686 wayland-protocols-devel libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 zlib-devel.x86_64 zlib-devel.i686 pkgconf-pkg-config.x86_64 pkgconf-pkg-config.i686 expat-devel.x86_64 expat-devel.i686 glib-devel.x86_64 glib-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libdrm-devel.x86_64 libdrm-devel.i686 libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libxcb-devel.x86_64 libxcb-devel.i686 binutils-devel.x86_64 libstdc++-static.x86_64 multilib-rpm-config python3-devel.x86_64 python3-recommonmark python3-sphinx libffi-devel.x86_64 libffi-devel.i686
    dnf install git meson ninja-build gcc gcc-c++ cmake bison flex vulkan*.x86_64 vulkan*.i686 libdrm-devel.x86_64 libdrm-devel.i686 libvdpau-devel.x86_64 libvdpau-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 zlib-devel.x86_64 zlib-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 wayland*-devel.x86_64 wayland*-devel.i686 wayland-protocols-devel libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libunwind-devel.i686 libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 expat-devel.x86_64 expat-devel.i686 libzstd-devel.x86_64 libzstd-devel.i686
    ```

    ### Step 2. Clone the mesa repo
  17. @Venemo Venemo revised this gist Nov 3, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -31,22 +31,22 @@ The compiled libraries will go into `~/mesa` for the sake of simplicity.
    # Enter the mesa root directory
    cd mesa
    # Configure the build with meson
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    # Compile with ninja
    ninja -C build64 install
    ```

    #### Config with AMD drivers only in release mode (recommended for performance testing):

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build64 install
    ```

    #### Config with RADV only in debug mode (recommended for bisecting crashes, etc.)

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
    ninja -C build64radvdebug install
    ```

    @@ -84,7 +84,7 @@ Now you can use it to build 32-bit mesa libs:

    ```
    cd mesa
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ninja -C build32 install
    ```

  18. @Venemo Venemo revised this gist Nov 3, 2021. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,13 @@ This is how to install them on Fedora. You can substitute with other distros' pa
    dnf install meson ninja-build cmake bison flex gcc gcc-c++ glslang-devel.x86_64 glslang-devel.i686 libzstd-devel.i686 libzstd-devel.x86_64 libvdpau-devel.x86_64 libvdpau-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 bison-devel.x86_64 bison-devel.i686 valgrind-devel.x86_64 valgrind-devel.i686 wayland-devel.x86_64 wayland-devel.i686 wayland-protocols-devel libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 zlib-devel.x86_64 zlib-devel.i686 pkgconf-pkg-config.x86_64 pkgconf-pkg-config.i686 expat-devel.x86_64 expat-devel.i686 glib-devel.x86_64 glib-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libdrm-devel.x86_64 libdrm-devel.i686 libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libxcb-devel.x86_64 libxcb-devel.i686 binutils-devel.x86_64 libstdc++-static.x86_64 multilib-rpm-config python3-devel.x86_64 python3-recommonmark python3-sphinx libffi-devel.x86_64 libffi-devel.i686
    ```

    ### Step 2. 64-bit build
    ### Step 2. Clone the mesa repo

    ```
    git clone https://gitlab.freedesktop.org/mesa/mesa.git
    ```

    ### Step 3. 64-bit build

    We're assuming that your distro uses `lib64` for the 64-bit libraries. If not, adjust the meson commands below.
    The compiled libraries will go into `~/mesa` for the sake of simplicity.
    @@ -46,7 +52,7 @@ ninja -C build64radvdebug install

    You can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.

    ### Step 3. 32-bit build on an x86_64 system (skip when only testing a 64-bit game)
    ### Step 4. 32-bit build on an x86_64 system (skip when only testing a 64-bit game)

    If you don't use Fedora (or another Red Hat family distro), replace `i686-redhat-linux-gnu-pkg-config` with the correct 32-bit `pkg-config` executable for your distro. Also verify the location of `llvm-config-32` which might be different on another distro.

  19. @Venemo Venemo revised this gist Nov 3, 2021. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Let's assume that you are using an x86_64 system.

    ## Building mesa

    ### 1. Step 1. Install dependencies
    ### Step 1. Install dependencies

    This is how to install them on Fedora. You can substitute with other distros' package managers, the packages are named similarly but maybe have a different naming convention (eg. `-dev` vs. `-devel`, etc.).

    @@ -46,7 +46,7 @@ ninja -C build64radvdebug install

    You can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.

    ### 32-bit build on an x86_64 system (skip when not testing a 32-bit game)
    ### Step 3. 32-bit build on an x86_64 system (skip when only testing a 64-bit game)

    If you don't use Fedora (or another Red Hat family distro), replace `i686-redhat-linux-gnu-pkg-config` with the correct 32-bit `pkg-config` executable for your distro. Also verify the location of `llvm-config-32` which might be different on another distro.

    @@ -132,6 +132,8 @@ Now you can run your games like:

    ## Alternative: sourcing a script method

    Use this when you want all apps you launch from a terminal to use your custom built mesa.

    Create a script at `~/mesa.sh` with the following content.
    If you used a different install prefix or a different lib dir above, you will need to adjust this script accordingly.

  20. @Venemo Venemo revised this gist Nov 3, 2021. 1 changed file with 64 additions and 72 deletions.
    136 changes: 64 additions & 72 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -4,19 +4,23 @@ This explains how to build mesa from source, and how to use the custom built mes

    Let's assume that you are using an x86_64 system.

    ## Install dependencies
    ## Building mesa

    ### 1. Step 1. Install dependencies

    This is how to install them on Fedora. You can substitute with other distros' package managers, the packages are named similarly but maybe have a different naming convention (eg. `-dev` vs. `-devel`, etc.).

    ```
    dnf install meson ninja-build cmake bison flex gcc gcc-c++ glslang-devel.x86_64 glslang-devel.i686 libzstd-devel.i686 libzstd-devel.x86_64 libvdpau-devel.x86_64 libvdpau-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 bison-devel.x86_64 bison-devel.i686 valgrind-devel.x86_64 valgrind-devel.i686 wayland-devel.x86_64 wayland-devel.i686 wayland-protocols-devel libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 zlib-devel.x86_64 zlib-devel.i686 pkgconf-pkg-config.x86_64 pkgconf-pkg-config.i686 expat-devel.x86_64 expat-devel.i686 glib-devel.x86_64 glib-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libdrm-devel.x86_64 libdrm-devel.i686 libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libxcb-devel.x86_64 libxcb-devel.i686 binutils-devel.x86_64 libstdc++-static.x86_64 multilib-rpm-config python3-devel.x86_64 python3-recommonmark python3-sphinx libffi-devel.x86_64 libffi-devel.i686
    ```

    ## 64-bit build
    ### Step 2. 64-bit build

    We're assuming that your distro uses `lib64` for the 64-bit libraries. If not, adjust the meson command below.
    We're assuming that your distro uses `lib64` for the 64-bit libraries. If not, adjust the meson commands below.
    The compiled libraries will go into `~/mesa` for the sake of simplicity.

    #### This command will build both Intel and AMD drivers in release mode:

    ```
    # Enter the mesa root directory
    cd mesa
    @@ -26,28 +30,23 @@ meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-driver
    ninja -C build64 install
    ```

    Config with AMD drivers only:

    #### Config with AMD drivers only in release mode (recommended for performance testing):

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    ninja -C build64 install
    ```

    Config with RADV only:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=release
    ```

    You can also have multiple configurations at the same time, eg. maybe a RADV debug build:
    #### Config with RADV only in debug mode (recommended for bisecting crashes, etc.)

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    ninja -C build64radvdebug install
    ```

    Then you can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.
    You can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.

    ## 32-bit build on an x86_64 system
    ### 32-bit build on an x86_64 system (skip when not testing a 32-bit game)

    If you don't use Fedora (or another Red Hat family distro), replace `i686-redhat-linux-gnu-pkg-config` with the correct 32-bit `pkg-config` executable for your distro. Also verify the location of `llvm-config-32` which might be different on another distro.

    @@ -91,46 +90,50 @@ meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drive

    Note that you can build both the x86_64 and the i686 libraries together and they can all go to `~/mesa`, and then you can use all of that with either 32-bit or 64-bit games.

    # Building LLVM and using it with mesa

    Sometimes you need to test the very latest LLVM and use it without messing up your system packages.
    # Using the compiled mesa binaries

    Here are some useful cmake options:
    ## Running through a script (recommended for testing a single game or app)

    * CMAKE_INSTALL_PREFIX - for simplicity, let's just use the same prefix as used by your mesa build
    * LLVM_LIBDIR_SUFFIX - for distros that use `/usr/lib64` or a similar convention, eg. set this to `64` on Fedora

    Example:
    Create a script file like this, eg. `nano ~/mesa-run.sh`
    If you used a different install prefix or a different lib dir above, you will need to adjust this script accordingly.

    ```
    cd llvm-project/llvm
    mkdir build
    cd build
    cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/mesa -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_TARGETS_TO_BUILD="AMDGPU" -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_INCLUDE_EXAMPLES=OFF
    ninja
    ninja install
    ```
    #!/bin/sh
    After this, you need to rebuild mesa. First, tell mesa's meson to use the LLVM that you just built.
    MESA=$HOME/mesa \
    LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH \
    LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
    VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.x86.json \
    D3D_MODULE_PATH=$MESA/lib64/d3d/d3dadapter9.so.1:$MESA/lib/d3d/d3dadapter9.so.1 \
    exec "$@"
    ```

    Create a meson native file at `$HOME/.local/share/meson/native/my-llvm-x64` with the following content. Substitute `Timur` with your own username.
    Don't forget to add executable permissions to the script:

    ```
    [binaries]
    llvm-config = "/home/Timur/mesa/bin/llvm-config"
    chmod +x ~/mesa-run.sh
    ```

    Finally, specify this to meson using the `--native-file=my-llvm-x64` argument, for example:
    Now you can run your games like:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release --native-file=my-llvm-x64
    ~/mesa-run.sh vkcube
    ```

    # Using the compiled mesa
    ### Testing a Steam game with your custom built mesa:

    1. Compile mesa as written above
    2. Create the `~/mesa-run.sh` script as above
    3. Open Steam, go to your Library
    4. Right-click the game, click "Properties"
    5. In the "Launch options" type:
    `~/mesa-run.sh %command%`

    ## sourcing a script method
    ## Alternative: sourcing a script method

    Create a script at `~/mesa.sh` with the following content:
    Create a script at `~/mesa.sh` with the following content.
    If you used a different install prefix or a different lib dir above, you will need to adjust this script accordingly.

    ```
    #!/bin/sh
    @@ -159,59 +162,48 @@ source ~/mesa.sh
    vulkaninfo
    ```

    ## running through a script method

    This way you don't need to source a script, but rather just run an individual app through a script. Create a script file like this, eg. `nano ~/mesa-run.sh`
    ## Using RADV with RGP

    ```
    #!/bin/sh
    # Run RADV with pipeline tracing enabled, and specify a trigger file
    RADV_THREAD_TRACE_PIPELINE=1 RADV_THREAD_TRACE_TRIGGER=/tmp/trigger ~/mesa-run.sh ./bin/triangle
    MESA=$HOME/mesa \
    LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH \
    LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
    VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.x86.json \
    D3D_MODULE_PATH=$MESA/lib64/d3d/d3dadapter9.so.1:$MESA/lib/d3d/d3dadapter9.so.1 \
    exec "$@"
    # From a different terminal, touch the trigger file. This will make RADV create an RGP capture in /tmp
    touch /tmp/trigger
    ```

    Now you can run your games like:
    # Building LLVM and using it with mesa (skip this unless you know you specifically need it)

    ```
    ~/mesa-run.sh vkcube
    ```
    Sometimes you need to test the very latest LLVM and use it without messing up your system packages.

    ## Using RADV with RGP
    Here are some useful cmake options:

    ```
    source ~/mesa.sh
    * CMAKE_INSTALL_PREFIX - for simplicity, let's just use the same prefix as used by your mesa build
    * LLVM_LIBDIR_SUFFIX - for distros that use `/usr/lib64` or a similar convention, eg. set this to `64` on Fedora

    # Run RADV with pipeline tracing enabled, and specify a trigger file
    RADV_THREAD_TRACE_PIPELINE=1 RADV_THREAD_TRACE_TRIGGER=/tmp/trigger ./bin/triangle
    Example:

    # From a different terminal, touch the trigger file. This will make RADV create an RGP capture in /tmp
    touch /tmp/trigger
    ```
    cd llvm-project/llvm
    mkdir build
    cd build
    cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/mesa -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_TARGETS_TO_BUILD="AMDGPU" -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_INCLUDE_EXAMPLES=OFF
    ninja
    ninja install
    ```

    ## Running Starcraft 2
    After this, you need to rebuild mesa. First, tell mesa's meson to use the LLVM that you just built.

    Assuming that you completed all the steps so far, and you use a Wine prefix `~/.wineSC2` the following will launch SC2 using the specified mesa version:
    Create a meson native file at `$HOME/.local/share/meson/native/my-llvm-x64` with the following content. Substitute `Timur` with your own username.

    ```
    source ~/mesa.sh
    WINEDEBUG=-all NIR_VALIDATE=0 WINEPREFIX=/home/Timur/.wineSC2 wine64 "C:\Program Files (x86)\StarCraft II\Support64\SC2Switcher_x64.exe"
    [binaries]
    llvm-config = "/home/Timur/mesa/bin/llvm-config"
    ```

    If you want to use iris:
    Finally, specify this to meson using the `--native-file=my-llvm-x64` argument, for example:

    ```
    source ~/mesa.sh
    MESA_LOADER_DRIVER_OVERRIDE=iris WINEDEBUG=-all NIR_VALIDATE=0 WINEPREFIX=/home/Timur/.wineSC2 wine64 "C:\Program Files (x86)\StarCraft II\Support64\SC2Switcher_x64.exe"
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release --native-file=my-llvm-x64
    ```

    ## Useful environment variables for debugging

    * `MESA_VK_WSI_PRESENT_MODE=fifo` forces V-sync in Vulkan apps, so that your GPU won't heat up from rendering the demo apps in 5000 fps
    * `RADV_DEBUG=nongg` disables NGG on Navi
    * `RADV_DEBUG=shaders` enables shader debugging on RADV
    * `RADV_DEBUG=nocache`disables caching on RADV

  21. @Venemo Venemo revised this gist Jul 14, 2021. 1 changed file with 23 additions and 0 deletions.
    23 changes: 23 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -128,6 +128,8 @@ meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-driver

    # Using the compiled mesa

    ## sourcing a script method

    Create a script at `~/mesa.sh` with the following content:

    ```
    @@ -157,6 +159,27 @@ source ~/mesa.sh
    vulkaninfo
    ```

    ## running through a script method

    This way you don't need to source a script, but rather just run an individual app through a script. Create a script file like this, eg. `nano ~/mesa-run.sh`

    ```
    #!/bin/sh
    MESA=$HOME/mesa \
    LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH \
    LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
    VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.x86.json \
    D3D_MODULE_PATH=$MESA/lib64/d3d/d3dadapter9.so.1:$MESA/lib/d3d/d3dadapter9.so.1 \
    exec "$@"
    ```

    Now you can run your games like:

    ```
    ~/mesa-run.sh vkcube
    ```

    ## Using RADV with RGP

    ```
  22. @Venemo Venemo revised this gist Jun 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ Let's assume that you are using an x86_64 system.
    This is how to install them on Fedora. You can substitute with other distros' package managers, the packages are named similarly but maybe have a different naming convention (eg. `-dev` vs. `-devel`, etc.).

    ```
    dnf install meson ninja-build cmake bison flex gcc gcc-c++ glslang-devel.x86_64 glslang-devel.i686 libzstd-devel.i686 libzstd-devel.x86_64 libvdpau-devel.x86_64 libvdpau-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 bison-devel.x86_64 bison-devel.i686 valgrind-devel.x86_64 valgrind-devel.i686 wayland-devel.x86_64 wayland-devel.i686 wayland-protocols-devel libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 zlib-devel.x86_64 zlib-devel.i686 pkgconf-pkg-config.x86_64 pkgconf-pkg-config.i686 expat-devel.x86_64 expat-devel.i686 glib-devel.x86_64 glib-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libdrm-devel.x86_64 libdrm-devel.i686 libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libxcb-devel.x86_64 libxcb-devel.i686 binutils-devel.x86_64 libstdc++-static.x86_64 multilib-rpm-config python3-devel.x86_64 python3-recommonmark python3-sphinx
    dnf install meson ninja-build cmake bison flex gcc gcc-c++ glslang-devel.x86_64 glslang-devel.i686 libzstd-devel.i686 libzstd-devel.x86_64 libvdpau-devel.x86_64 libvdpau-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 bison-devel.x86_64 bison-devel.i686 valgrind-devel.x86_64 valgrind-devel.i686 wayland-devel.x86_64 wayland-devel.i686 wayland-protocols-devel libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 zlib-devel.x86_64 zlib-devel.i686 pkgconf-pkg-config.x86_64 pkgconf-pkg-config.i686 expat-devel.x86_64 expat-devel.i686 glib-devel.x86_64 glib-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libdrm-devel.x86_64 libdrm-devel.i686 libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libxcb-devel.x86_64 libxcb-devel.i686 binutils-devel.x86_64 libstdc++-static.x86_64 multilib-rpm-config python3-devel.x86_64 python3-recommonmark python3-sphinx libffi-devel.x86_64 libffi-devel.i686
    ```

    ## 64-bit build
  23. @Venemo Venemo revised this gist Jun 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ Let's assume that you are using an x86_64 system.
    This is how to install them on Fedora. You can substitute with other distros' package managers, the packages are named similarly but maybe have a different naming convention (eg. `-dev` vs. `-devel`, etc.).

    ```
    dnf install meson ninja-build cmake bison flex gcc gcc-c++ glslang-devel.x86_64 glslang-devel.i686 libzstd-devel.i686 libzstd-devel.x86_64 libvdpau-devel.x86_64 libvdpau-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 bison-devel.x86_64 bison-devel.i686 valgrind-devel.x86_64 valgrind-devel.i686 flex-devel.x86_64 flex-devel.i686 wayland-devel.x86_64 wayland-devel.i686 wayland-protocols-devel libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 zlib-devel.x86_64 zlib-devel.i686 pkgconf-pkg-config.x86_64 pkgconf-pkg-config.i686 expat-devel.x86_64 expat-devel.i686 glib-devel.x86_64 glib-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libdrm-devel.x86_64 libdrm-devel.i686 libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libxcb-devel.x86_64 libxcb-devel.i686 binutils-devel.x86_64 libstdc++-static.x86_64 multilib-rpm-config python3-devel.x86_64 python3-recommonmark python3-sphinx
    dnf install meson ninja-build cmake bison flex gcc gcc-c++ glslang-devel.x86_64 glslang-devel.i686 libzstd-devel.i686 libzstd-devel.x86_64 libvdpau-devel.x86_64 libvdpau-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 bison-devel.x86_64 bison-devel.i686 valgrind-devel.x86_64 valgrind-devel.i686 wayland-devel.x86_64 wayland-devel.i686 wayland-protocols-devel libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 zlib-devel.x86_64 zlib-devel.i686 pkgconf-pkg-config.x86_64 pkgconf-pkg-config.i686 expat-devel.x86_64 expat-devel.i686 glib-devel.x86_64 glib-devel.i686 glibc-devel.x86_64 glibc-devel.i686 libdrm-devel.x86_64 libdrm-devel.i686 libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libxcb-devel.x86_64 libxcb-devel.i686 binutils-devel.x86_64 libstdc++-static.x86_64 multilib-rpm-config python3-devel.x86_64 python3-recommonmark python3-sphinx
    ```

    ## 64-bit build
  24. @Venemo Venemo revised this gist May 31, 2021. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -157,6 +157,18 @@ source ~/mesa.sh
    vulkaninfo
    ```

    ## Using RADV with RGP

    ```
    source ~/mesa.sh
    # Run RADV with pipeline tracing enabled, and specify a trigger file
    RADV_THREAD_TRACE_PIPELINE=1 RADV_THREAD_TRACE_TRIGGER=/tmp/trigger ./bin/triangle
    # From a different terminal, touch the trigger file. This will make RADV create an RGP capture in /tmp
    touch /tmp/trigger
    ```

    ## Running Starcraft 2

    Assuming that you completed all the steps so far, and you use a Wine prefix `~/.wineSC2` the following will launch SC2 using the specified mesa version:
  25. @Venemo Venemo revised this gist May 18, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -79,14 +79,14 @@ Now you can use it to build 32-bit mesa libs:

    ```
    cd mesa
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    ninja -C build32 install
    ```

    32-bit config with AMD drivers only:

    ```
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ```

    Note that you can build both the x86_64 and the i686 libraries together and they can all go to `~/mesa`, and then you can use all of that with either 32-bit or 64-bit games.
  26. @Venemo Venemo revised this gist Dec 22, 2020. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ The compiled libraries will go into `~/mesa` for the sake of simplicity.
    # Enter the mesa root directory
    cd mesa
    # Configure the build with meson
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=gallium -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    # Compile with ninja
    ninja -C build64 install
    ```
    @@ -30,7 +30,7 @@ Config with AMD drivers only:


    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=gallium -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    ```

    Config with RADV only:
    @@ -79,14 +79,14 @@ Now you can use it to build 32-bit mesa libs:

    ```
    cd mesa
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=gallium -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=false -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    ninja -C build32 install
    ```

    32-bit config with AMD drivers only:

    ```
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=gallium -Dbuildtype=release
    meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release
    ```

    Note that you can build both the x86_64 and the i686 libraries together and they can all go to `~/mesa`, and then you can use all of that with either 32-bit or 64-bit games.
    @@ -123,7 +123,7 @@ llvm-config = "/home/Timur/mesa/bin/llvm-config"
    Finally, specify this to meson using the `--native-file=my-llvm-x64` argument, for example:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=gallium -Dbuildtype=release --native-file=my-llvm-x64
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release --native-file=my-llvm-x64
    ```

    # Using the compiled mesa
  27. @Venemo Venemo revised this gist Dec 4, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -36,13 +36,13 @@ meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-driver
    Config with RADV only:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=release
    ```

    You can also have multiple configurations at the same time, eg. maybe a RADV debug build:

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    ```

    Then you can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.
  28. @Venemo Venemo revised this gist Dec 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@ meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dvulkan-drivers
    You can also have multiple configurations at the same time, eg. maybe a RADV debug build:

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=zink -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    ```

    Then you can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.
  29. @Venemo Venemo revised this gist Dec 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-driver
    Config with RADV only:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=zink -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=release
    ```

    You can also have multiple configurations at the same time, eg. maybe a RADV debug build:
  30. @Venemo Venemo revised this gist Nov 30, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions mesa-howto.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ The compiled libraries will go into `~/mesa` for the sake of simplicity.
    # Enter the mesa root directory
    cd mesa
    # Configure the build with meson
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=gallium -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dosmesa=gallium -Dtools=nir -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    # Compile with ninja
    ninja -C build64 install
    ```
    @@ -30,19 +30,19 @@ Config with AMD drivers only:


    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=gallium -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=gallium -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuildtype=release
    ```

    Config with RADV only:

    ```
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=release
    meson build64 --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=zink -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=release
    ```

    You can also have multiple configurations at the same time, eg. maybe a RADV debug build:

    ```
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Ddri-drivers= -Dgallium-drivers=zink -Dvulkan-drivers=amd -Dvulkan-device-select-layer=true -Dvulkan-overlay-layer=true -Dbuild-aco-tests=true -Dbuildtype=debug
    ```

    Then you can compile one with `ninja -C build64radvdebug` and the other with `ninja -C build64` - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.