From 3a059a6dcf0a5ba3f534c3d0701a428604dd4a4a Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Fri, 19 Jun 2026 16:59:29 -0700 Subject: [PATCH 1/5] fix compilation for 26 --- .github/actions/compile/action.yml | 4 +-- apply_patches.py | 12 +++++++ patches/0002-nak-hardcode-const-offsets.patch | 36 +++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100755 apply_patches.py create mode 100644 patches/0002-nak-hardcode-const-offsets.patch diff --git a/.github/actions/compile/action.yml b/.github/actions/compile/action.yml index 75fa3a7..da99643 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 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..9e82240 --- /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_VER" +mesa_ver = Version(sys.argv[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..c4d5e57 --- /dev/null +++ b/patches/0002-nak-hardcode-const-offsets.patch @@ -0,0 +1,36 @@ +From: Christopher Milan +Date: Fri, 19 Jun 2026 16:27:01 -0700 +Subject: [PATCH] nak: hardcode const offsets +Mesa-Version: >=26 + +NAK doesn't depend on NVK + +--- + src/nouveau/compiler/nak_private.h | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/src/nouveau/compiler/nak_private.h b/src/nouveau/compiler/nak_private.h +index 588eb897eb4..d80dbbb13bf 100644 +--- a/src/nouveau/compiler/nak_private.h ++++ b/src/nouveau/compiler/nak_private.h +@@ -344,14 +344,12 @@ enum nak_fs_out { + + #define NAK_FS_OUT_COLOR(n) (NAK_FS_OUT_COLOR0 + (n) * 16) + ++const struct nak_constant_offset_info nak_const_offsets_base = {}; ++ + 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; +- } ++ return &nak_const_offsets_base; + } + + bool nak_nir_rematerialize_load_const(nir_shader *nir); +-- +2.52.0 + From fcb0ec2b8b004718d8dd96f6e085f5064f327ea9 Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Fri, 19 Jun 2026 17:00:56 -0700 Subject: [PATCH 2/5] retrigger From 1875281cae78ca9cc645dd6ea3e7d486b3d49832 Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Fri, 19 Jun 2026 17:52:18 -0700 Subject: [PATCH 3/5] fix --- .github/actions/compile/action.yml | 2 +- apply_patches.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/compile/action.yml b/.github/actions/compile/action.yml index da99643..7f35ac3 100644 --- a/.github/actions/compile/action.yml +++ b/.github/actions/compile/action.yml @@ -114,7 +114,7 @@ runs: shell: bash run: | cd ${{ github.workspace }}/mesa - ../apply_patches.py + ../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 index 9e82240..cbf3390 100755 --- a/apply_patches.py +++ b/apply_patches.py @@ -3,8 +3,8 @@ from packaging.version import Version from packaging.specifiers import SpecifierSet -assert len(sys.argv) == 2, f"usage: {sys.argv[0]} MESA_VER" -mesa_ver = Version(sys.argv[1]) +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(): From b46f21b11f18970e79011bd12a954161a398e5c3 Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Fri, 19 Jun 2026 17:56:11 -0700 Subject: [PATCH 4/5] oops --- .github/actions/compile/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/compile/action.yml b/.github/actions/compile/action.yml index 7f35ac3..094df77 100644 --- a/.github/actions/compile/action.yml +++ b/.github/actions/compile/action.yml @@ -114,7 +114,7 @@ runs: shell: bash run: | cd ${{ github.workspace }}/mesa - ../apply_patches.py ${{ inputs.mesa_tag }} + ../apply_patches.py ${{ inputs.mesa-tag }} if [[ "${{ runner.os }}" == "macOS" ]]; then eval "$(brew shellenv)" touch include/xf86drm.h From 9e47f3a22aeb8a07f989ae68407c69c4a0b37d9d Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Fri, 19 Jun 2026 18:14:18 -0700 Subject: [PATCH 5/5] fix patch --- patches/0002-nak-hardcode-const-offsets.patch | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/patches/0002-nak-hardcode-const-offsets.patch b/patches/0002-nak-hardcode-const-offsets.patch index c4d5e57..12cb1ec 100644 --- a/patches/0002-nak-hardcode-const-offsets.patch +++ b/patches/0002-nak-hardcode-const-offsets.patch @@ -1,24 +1,19 @@ From: Christopher Milan -Date: Fri, 19 Jun 2026 16:27:01 -0700 +Date: Fri, 19 Jun 2026 18:13:03 -0700 Subject: [PATCH] nak: hardcode const offsets -Mesa-Version: >=26 +Mesa-Version: >=26.1 NAK doesn't depend on NVK --- - src/nouveau/compiler/nak_private.h | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) + 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..d80dbbb13bf 100644 +index 588eb897eb4..dbaf9c340ae 100644 --- a/src/nouveau/compiler/nak_private.h +++ b/src/nouveau/compiler/nak_private.h -@@ -344,14 +344,12 @@ enum nak_fs_out { - - #define NAK_FS_OUT_COLOR(n) (NAK_FS_OUT_COLOR0 + (n) * 16) - -+const struct nak_constant_offset_info nak_const_offsets_base = {}; -+ +@@ -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) { @@ -27,7 +22,8 @@ index 588eb897eb4..d80dbbb13bf 100644 - } else { - return &nak_const_offsets_base; - } -+ return &nak_const_offsets_base; ++ static const struct nak_constant_offset_info base = {}; ++ return &base; } bool nak_nir_rematerialize_load_const(nir_shader *nir);