From 3605cd7b4275c84e56f9ce67c20dcc969f9d226d Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Wed, 24 Jun 2026 17:33:43 -0700 Subject: [PATCH] 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. --- pkgs/by-name/sp/spirv-headers/package.nix | 6 ++++++ pkgs/by-name/sp/spirv-llvm-translator/package.nix | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/sp/spirv-headers/package.nix b/pkgs/by-name/sp/spirv-headers/package.nix index 3f4c75ed5962..ddb49d7af092 100644 --- a/pkgs/by-name/sp/spirv-headers/package.nix +++ b/pkgs/by-name/sp/spirv-headers/package.nix @@ -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 ]; diff --git a/pkgs/by-name/sp/spirv-llvm-translator/package.nix b/pkgs/by-name/sp/spirv-llvm-translator/package.nix index a32d9481ee9c..b86f3424f750 100644 --- a/pkgs/by-name/sp/spirv-llvm-translator/package.nix +++ b/pkgs/by-name/sp/spirv-llvm-translator/package.nix @@ -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