spirv-headers: backport patch for SPIRV translator w/ LLVM 22

spirv-llvm-translator needs new definitions to compile with LLVM 22,
and there isn't a release containing this patch yet, so we must
backport it.

Additionally, switch spirv-llvm-translator to use `srcOnly` instead
of `.src` so that the new patch is picked up.
This commit is contained in:
Ryan Burns
2026-06-24 18:43:29 -07:00
parent 2ce8cee097
commit 3605cd7b42
2 changed files with 8 additions and 1 deletions
@@ -24,6 +24,12 @@ stdenv.mkDerivation (finalAttrs: {
url = "https://github.com/KhronosGroup/SPIRV-Headers/commit/1a22b167081842915a1c78a0b5b5a353a23284aa.diff";
hash = "sha256-XUHfPHnk7bWK4vnozfW/84vaZN+rbFJUZSa6Og8GUAU=";
})
# Backport new predicated load/store instructions, needed by spirv-llvm-translator
# Not in any tagged releases yet, should exist in the next release after 1.4.350.1.
(fetchpatch {
url = "https://github.com/KhronosGroup/SPIRV-Headers/commit/b8a32968473ce852a809b9de5f04f02a5a9dfa78.patch";
hash = "sha256-59jmN28ifEhAxySXCpuGZ62jo1WVsRPnVosK8X4yrjM=";
})
];
nativeBuildInputs = [ cmake ];
@@ -1,6 +1,7 @@
{
lib,
stdenv,
srcOnly,
fetchFromGitHub,
fetchpatch,
cmake,
@@ -84,7 +85,7 @@ stdenv.mkDerivation {
"-DLLVM_SPIRV_BUILD_EXTERNAL=YES"
# RPATH of binary /nix/store/.../bin/llvm-spirv contains a forbidden reference to /build/
"-DCMAKE_SKIP_BUILD_RPATH=ON"
"-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${spirv-headers.src}"
"-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${srcOnly spirv-headers}"
]
++ lib.optional (
lib.toInt llvmMajor >= 19