Subject: [bug#69461] [PATCH mesa-updates v3 12/13] gnu: vulkan-validationlayers: Update to 1.3.280.0.

From: dan <[email-masked]>
Date: Thu, 28 Mar 2024 11:54:54 +0800

* gnu/packages/vulkan.scm (vulkan-validationlayers): Update to 1.3.280.0.
  [source]: Add snippet.
  [inputs]: Add robin-hood-hashing and vulkan-utility-libraries.
  [arguments]: Remove configure-flags, replace check step, and update reason
  why disabling tests.

Change-Id: I80ca002d8dbe71cad57f859ee34ac8f10e175907
---
 gnu/packages/vulkan.scm | 55 ++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 31 deletions(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 6239f7ea4d..1016e9db36 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -47,9 +47,6 @@ (define-module (gnu packages vulkan)
   #:use-module (gnu packages wine)
   #:use-module (gnu packages xorg))
 
-;; Note: Remember to change vulkan-loader version when bumping this.
-(define %vulkan-sdk-version "sdk-1.3.231.1")
-
 (define-public spirv-headers
   (package
     (name "spirv-headers")
@@ -478,51 +475,37 @@ (define-public vkd3d
 (define-public vulkan-validationlayers
   (package
     (name "vulkan-validationlayers")
-    (version %vulkan-sdk-version)
+    (version "1.3.280.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
                     (url
                      "https://github.com/KhronosGroup/Vulkan-ValidationLayers")
-                    (commit version)))
+                    (commit (string-append "vulkan-sdk-" version))))
               (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              ;; We don't build static libraries in SPIRV-Tools.
+              (snippet '(substitute* "tests/CMakeLists.txt"
+                          (("-static")
+                           "")))
               (sha256
                (base32
-                "07djrk6yym4vl2b52wr09r8y649v5lark5hnr5rwvlxwxdmd9g75"))))
+                "1w6fsaicrgnzkj5vz2v86a2gk1n7478q6n66ac2920avnin9a64c"))))
     (build-system cmake-build-system)
     (inputs (list glslang
                   libxrandr
                   mesa
+                  robin-hood-hashing
                   shaderc
                   spirv-tools
                   vulkan-loader
+                  vulkan-utility-libraries
                   wayland))
-    (native-inputs (list pkg-config python spirv-headers vulkan-headers))
+    (native-inputs (list googletest pkg-config python spirv-headers vulkan-headers))
     (arguments
-     (list #:tests? #f ;no tests
+     (list #:tests? #f ; test crashed
            #:configure-flags
-           #~(list "-DUSE_ROBIN_HOOD_HASHING=OFF"
-                   (string-append "-DGLSLANG_INSTALL_DIR="
-                                  (dirname (dirname
-                                            (search-input-directory
-                                             %build-inputs
-                                             "include/glslang"))))
-                   (string-append "-DSPIRV_HEADERS_INSTALL_DIR="
-                                  (dirname (dirname
-                                            (search-input-directory
-                                             %build-inputs
-                                             "include/spirv"))))
-                   (string-append "-DSPIRV_TOOLS_INSTALL_DIR="
-                                  (dirname (dirname
-                                            (search-input-directory
-                                             %build-inputs
-                                             "include/spirv-tools"))))
-                   (string-append "-DVULKAN_HEADERS_INSTALL_DIR="
-                                  (dirname (dirname
-                                            (search-input-directory
-                                             %build-inputs
-                                             "include/vulkan"))))
-                   "-Wno-dev")
+           #~(list "-DBUILD_TESTS=ON")
            #:phases #~(modify-phases %standard-phases
                         (add-after 'install 'set-layer-path-in-manifest
                           (lambda _
@@ -532,7 +515,17 @@ (define-public vulkan-validationlayers
                               (substitute* manifest
                                 (("\"libVkLayer_khronos_validation.so\"")
                                  (string-append "\"" #$output
-                                  "/lib/libVkLayer_khronos_validation.so\"")))))))))
+                                                "/lib/libVkLayer_khronos_validation.so\""))))))
+                        (replace 'check
+                          (lambda* (#:key tests? #:allow-other-keys)
+                            (when tests?
+                              (setenv "VK_LAYER_PATH" (string-append (getcwd) "/layers"))
+                              (setenv "LD_LIBRARY_PATH"
+                                      (string-append #$(this-package-input "vulkan-loader") "/lib"))
+                              (setenv "MESA_SHADER_CACHE_DIR"
+                                      (string-append (getcwd) "/shader-cache"))
+                              (setenv "XDG_RUNTIME_DIR" (getcwd))
+                              (invoke "./tests/vk_layer_validation_tests")))))))
     (home-page "https://github.com/KhronosGroup/Vulkan-ValidationLayers")
     (synopsis "Khronos official validation layers for Vulkan")
     (description
-- 
2.41.0