diff --git a/.github/actions/compile/action.yml b/.github/actions/compile/action.yml index 75fa3a7..094df77 100644 --- a/.github/actions/compile/action.yml +++ b/.github/actions/compile/action.yml @@ -114,9 +114,7 @@ runs: shell: bash run: | cd ${{ github.workspace }}/mesa - for patch in ../patches/*.patch; do - patch -p1 --fuzz=3 < "$patch" - done + ../apply_patches.py ${{ inputs.mesa-tag }} if [[ "${{ runner.os }}" == "macOS" ]]; then eval "$(brew shellenv)" touch include/xf86drm.h diff --git a/apply_patches.py b/apply_patches.py new file mode 100755 index 0000000..cbf3390 --- /dev/null +++ b/apply_patches.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import sys, os, pathlib, email.parser +from packaging.version import Version +from packaging.specifiers import SpecifierSet + +assert len(sys.argv) == 2, f"usage: {sys.argv[0]} MESA_TAG" +mesa_ver = Version(sys.argv[1].split('-')[1]) +parser = email.parser.HeaderParser() + +for p in (pathlib.Path(__file__).parent / 'patches').iterdir(): + if mesa_ver in SpecifierSet(parser.parse(p.open()).get('Mesa-Version', '')): + os.system(f"patch -p1 --fuzz=3 -i {p}") diff --git a/patches/0002-nak-hardcode-const-offsets.patch b/patches/0002-nak-hardcode-const-offsets.patch new file mode 100644 index 0000000..12cb1ec --- /dev/null +++ b/patches/0002-nak-hardcode-const-offsets.patch @@ -0,0 +1,32 @@ +From: Christopher Milan +Date: Fri, 19 Jun 2026 18:13:03 -0700 +Subject: [PATCH] nak: hardcode const offsets +Mesa-Version: >=26.1 + +NAK doesn't depend on NVK + +--- + src/nouveau/compiler/nak_private.h | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/src/nouveau/compiler/nak_private.h b/src/nouveau/compiler/nak_private.h +index 588eb897eb4..dbaf9c340ae 100644 +--- a/src/nouveau/compiler/nak_private.h ++++ b/src/nouveau/compiler/nak_private.h +@@ -347,11 +347,8 @@ enum nak_fs_out { + static inline const struct nak_constant_offset_info* + nak_const_offsets(const struct nak_compiler* nak, bool is_graphics) + { +- if (nak->sm >= 75 && is_graphics) { +- return &nak_const_offsets_turing_graphics; +- } else { +- return &nak_const_offsets_base; +- } ++ static const struct nak_constant_offset_info base = {}; ++ return &base; + } + + bool nak_nir_rematerialize_load_const(nir_shader *nir); +-- +2.52.0 +