projects/guix·blob java-team · refs

804 lines · 31.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017, 2018, 2019 Rutger Helling <[email protected]>
3;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2018, 2023-2025 Efraim Flashner <[email protected]>
5;;; Copyright © 2020, 2023 Marius Bakke <[email protected]>
6;;; Copyright © 2021 Mathieu Othacehe <[email protected]>
7;;; Copyright © 2022 Kaelyn Takata <[email protected]>
8;;; Copyright © 2022, 2024 dan <[email protected]>
9;;; Copyright © 2023, 2024 Zheng Junjie <[email protected]>
10;;; Copyright © 2024 James Smith <[email protected]>
11;;; Copyright © 2025 John Kehayias <[email protected]>
12;;; Copyright © 2025 Maxim Cournoyer <[email protected]>
13;;; Copyright © 2025 Cayetano Santos <[email protected]>
14;;; Copyright © 2026 Justin Veilleux <[email protected]>
15;;;
16;;; This file is part of GNU Guix.
17;;;
18;;; GNU Guix is free software; you can redistribute it and/or modify it
19;;; under the terms of the GNU General Public License as published by
20;;; the Free Software Foundation; either version 3 of the License, or (at
21;;; your option) any later version.
22;;;
23;;; GNU Guix is distributed in the hope that it will be useful, but
24;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26;;; GNU General Public License for more details.
27;;;
28;;; You should have received a copy of the GNU General Public License
29;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31(define-module (gnu packages vulkan)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix git-download)
36 #:use-module (guix utils)
37 #:use-module (guix gexp)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system meson)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages bison)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages cmake)
46 #:use-module (gnu packages cpp)
47 #:use-module (gnu packages compiler-tools)
48 #:use-module (gnu packages freedesktop)
49 #:use-module (gnu packages gettext)
50 #:use-module (gnu packages gl)
51 #:use-module (gnu packages libffi)
52 #:use-module (gnu packages llvm)
53 #:use-module (gnu packages perl)
54 #:use-module (gnu packages pkg-config)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages wine)
57 #:use-module (gnu packages xorg))
58
59(define-public spirv-headers
60 (package
61 (name "spirv-headers")
62 (version "1.4.335.0")
63 (source
64 (origin
65 (method git-fetch)
66 (uri (git-reference
67 (url "https://github.com/KhronosGroup/SPIRV-Headers")
68 (commit (string-append "vulkan-sdk-" version))))
69 (sha256
70 (base32
71 "16p1g33hw89hl2ldpqck2fggqxiwfgn735j35pwqpbckx8r66chy"))
72 (file-name (git-file-name name version))))
73 (build-system cmake-build-system)
74 (arguments
75 `(#:tests? #f)) ;no tests
76 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
77 (synopsis "Machine-readable files from the SPIR-V Registry")
78 (description
79 "SPIRV-Headers is a repository containing machine-readable files from
80the SPIR-V Registry. This includes:
81@itemize
82@item Header files for various languages.
83@item JSON files describing the grammar for the SPIR-V core instruction set,
84and for the GLSL.std.450 extended instruction set.
85@item The XML registry file.
86@end itemize\n")
87 (license (license:x11-style
88 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
89 version "/LICENSE")))))
90
91(define-public spirv-tools
92 (package
93 (name "spirv-tools")
94 (version "1.4.335.0")
95 (source
96 (origin
97 (method git-fetch)
98 (uri (git-reference
99 (url "https://github.com/KhronosGroup/SPIRV-Tools")
100 (commit (string-append "vulkan-sdk-" version))))
101 (sha256
102 (base32 "05rwpjnfaqn6yy10gn8c9xd0172ri5vgbqrjb7hfa1qjgrj7psqz"))
103 (file-name (git-file-name name version))))
104 (build-system cmake-build-system)
105 (arguments
106 (list
107 #:configure-flags
108 #~(list "-DBUILD_SHARED_LIBS=ON"
109 ;; Some packages like mpv fail to link
110 ;; when the static libraries are built.
111 "-DSPIRV_TOOLS_BUILD_STATIC=OFF"
112 (string-append
113 "-DSPIRV-Headers_SOURCE_DIR="
114 (assoc-ref %build-inputs "spirv-headers")))))
115 (inputs (list spirv-headers))
116 (native-inputs (list pkg-config python-minimal))
117 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
118 (synopsis "API and commands for processing SPIR-V modules")
119 (description
120 "The SPIR-V Tools project provides an API and commands for processing
121SPIR-V modules. The project includes an assembler, binary module
122parser,disassembler, validator, and optimizer for SPIR-V.")
123 (license license:asl2.0)))
124
125(define-public spirv-tools-static
126 (package/inherit spirv-tools
127 (name "spirv-tools-static")
128 (arguments
129 (substitute-keyword-arguments (package-arguments spirv-tools)
130 ((#:configure-flags flags)
131 #~(cons* "-DSPIRV_TOOLS_BUILD_STATIC=ON"
132 (delete "-DSPIRV_TOOLS_BUILD_STATIC=OFF" #$flags)))))))
133
134(define-public spirv-cross
135 (package
136 (name "spirv-cross")
137 (version "1.4.335.0")
138 (source
139 (origin
140 (method git-fetch)
141 (uri (git-reference
142 (url "https://github.com/KhronosGroup/SPIRV-Cross")
143 (commit (string-append "vulkan-sdk-" version))))
144 (sha256
145 (base32 "04z7kcg0z4mfnsvfxw1bxzfyq1678zwf1d79j2hyvhkvd2c8fr86"))
146 (file-name (git-file-name name version))))
147 (build-system cmake-build-system)
148 (arguments
149 (list
150 ;; Disable tests for now due to upstream issue hit when running
151 ;; update-reference-shaders phase:
152 ;; <https://github.com/KhronosGroup/SPIRV-Tools/issues/5980>.
153 #:tests? #f
154 #:configure-flags
155 #~(list "-DSPIRV_CROSS_SHARED=YES")
156 #:phases
157 #~(modify-phases %standard-phases
158 (add-after 'unpack 'fix-tests-to-find-deps
159 (lambda* (#:key inputs #:allow-other-keys)
160 (substitute* "CMakeLists.txt"
161 (("\\$\\{CMAKE_(.*)_DIR\\}/external/glslang(.*)/bin")
162 (string-append (assoc-ref inputs "glslang") "/bin")))
163 (substitute* "CMakeLists.txt"
164 (("\\$\\{CMAKE_(.*)_DIR\\}/external/spirv-tools(.*)/bin")
165 (string-append (assoc-ref inputs "spirv-tools") "/bin")))))
166 (add-before 'check 'update-reference-shaders
167 (lambda* (#:key tests? #:allow-other-keys)
168 (when tests?
169 (with-directory-excursion "../source"
170 (invoke "./update_test_shaders.sh"))))))))
171 (inputs
172 (list glslang spirv-headers spirv-tools))
173 (native-inputs (list python-minimal))
174 (home-page "https://github.com/KhronosGroup/SPIRV-Cross")
175 (synopsis "Parser for and converter of SPIR-V to other shader languages")
176 (description
177 "SPIRV-Cross tries hard to emit readable and clean output from the
178SPIR-V, aiming to emit GLSL or MSL that looks like human-written code.")
179 (license license:asl2.0)))
180
181;; WARNING: This package is a dependency of mesa.
182(define-public spirv-llvm-translator
183 (package
184 (name "spirv-llvm-translator")
185 (version "18.1.10")
186 (source
187 (origin
188 (method git-fetch)
189 (uri (git-reference
190 (url "https://github.com/KhronosGroup/SPIRV-LLVM-Translator")
191 (commit (string-append "v" version))))
192 (file-name (git-file-name name version))
193 (sha256
194 (base32 "11gmb1kw6j90hwcf6wxjz4pki653lyd8v8kphk7jq67gvw8dkiwy"))))
195 (build-system cmake-build-system)
196 (arguments
197 ;; The test suite is known to fail on several architectures:
198 ;; https://github.com/llvm/llvm-project/issues/59637
199 (list
200 #:tests? (and (not (%current-target-system))
201 (target-x86-64?))
202 #:configure-flags
203 #~(list (string-append "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR="
204 #+(this-package-native-input "spirv-headers"))
205 (string-append "-DLLVM_EXTERNAL_LIT="
206 #+(this-package-native-input "python-lit")
207 "/bin/lit")
208 (string-append "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath="
209 #$output "/lib")
210 "-DBUILD_SHARED_LIBS=ON"
211 "-DLLVM_SPIRV_INCLUDE_TESTS=ON")
212 #:modules '((guix build cmake-build-system)
213 ((guix build gnu-build-system) #:prefix gnu:)
214 (guix build utils))
215 #:phases
216 #~(modify-phases %standard-phases
217 (replace 'check
218 (lambda* (#:rest args)
219 (apply (assoc-ref gnu:%standard-phases 'check)
220 #:test-target "test" args))))))
221 (inputs (list llvm-18))
222 (native-inputs
223 (list
224 clang-18
225 libffi
226 llvm-18
227 pkg-config
228 python-lit
229 spirv-headers))
230 (home-page "https://github.com/KhronosGroup/SPIRV-LLVM-Translator")
231 (synopsis "Bi-directional translation between SPIR-V and LLVM IR")
232 (description
233 "The LLVM/SPIR-V Bi-Directional Translator is a library and tool for
234translation between LLVM IR and SPIR-V.")
235 (license license:asl2.0)))
236
237(define-public glslang
238 (package
239 (name "glslang")
240 (version "1.4.335.0")
241 (source
242 (origin
243 (method git-fetch)
244 (uri (git-reference
245 (url "https://github.com/KhronosGroup/glslang")
246 (commit (string-append "vulkan-sdk-" version))))
247 (sha256
248 (base32
249 "0z5zabmjiqgxr935wbk9pr649bxk404nkjkvkavdwj904sg48i3h"))
250 (file-name (git-file-name name version))))
251 (build-system cmake-build-system)
252 (arguments
253 (list
254 #:configure-flags
255 #~(list "-DBUILD_SHARED_LIBS=ON"
256 "-DALLOW_EXTERNAL_SPIRV_TOOLS=ON"
257 #$@(if (target-riscv64?)
258 `("-DCMAKE_EXE_LINKER_FLAGS=-latomic")
259 '()))
260 #:phases
261 #~(modify-phases %standard-phases
262 #$@(cond
263 ((target-arm32?)
264 `((add-after 'unpack 'skip-failing-test
265 (lambda _
266 ;; TODO: Figure out why this test fails.
267 (substitute* "Test/runtests"
268 ((".*(single|multi)Thread" all)
269 (string-append "echo " all)))))))
270 (#t '()))
271 (replace 'check
272 (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
273 (when tests?
274 (invoke "ctest"
275 "-j" (if parallel-tests?
276 (number->string (parallel-job-count))
277 "1")
278 "--rerun-failed"
279 "--output-on-failure")))))))
280 ;; Propagate spirv-tools as its CMake module is a dependency of glslang's
281 ;; own CMake module.
282 (propagated-inputs (list spirv-tools))
283 (native-inputs
284 (list pkg-config python-minimal))
285 (home-page "https://github.com/KhronosGroup/glslang")
286 (synopsis "OpenGL and OpenGL ES shader front end and validator")
287 (description
288 "Glslang is the official reference compiler front end for the
289OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
290interpretation of the specifications for these languages.")
291 ;; Modified BSD license. See "copyright" section of
292 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
293 (license (list license:bsd-3
294 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
295 license:asl2.0))))
296
297(define-public vkbasalt
298 (package
299 (name "vkbasalt")
300 (version "0.3.2.10")
301 (source
302 (origin
303 (method git-fetch)
304 (uri (git-reference
305 (url "https://github.com/DadSchoorse/vkBasalt")
306 (commit (string-append "v" version))))
307 (file-name (git-file-name name version))
308 (sha256
309 (base32 "0f3qmcmqnnh8i9qd2sd3p5w0akn8rkzfm5z0hc0wazgci4lqjbhq"))))
310 (build-system meson-build-system)
311 (arguments
312 (list #:configure-flags
313 ;; Needed for giving full path to library.
314 #~(list "-Dappend_libdir_vkbasalt=TRUE")
315 #:phases
316 #~(modify-phases %standard-phases
317 (add-after 'unpack 'fix-libdir
318 (lambda _
319 (substitute* "meson.build"
320 (("\\$LIB") "lib")))))))
321 (native-inputs (list pkg-config
322 ;; for glslangValidator
323 glslang))
324 (inputs (list libx11 spirv-headers vulkan-headers))
325 (home-page "https://github.com/DadSchoorse/vkBasalt")
326 (synopsis "Vulkan post processing layer for GNU/Linux")
327 (description "vkBasalt is a Vulkan post processing layer to enhance the
328visual graphics of games.
329
330Currently, the built-in effects are:
331
332@itemize @bullet
333@item
334Contrast Adaptive Sharpening
335@item
336Denoise Luma Sharpening
337@item
338Fast Approximate Anti-Aliasing
339@item
340Enhanced Subpixel Morphological Anti-Aliasing
341@item
3423D color LookUp Table
343@end itemize")
344 (license (list license:bsd-3 ; src/reshade/LICENSE.md
345 license:zlib)))) ; LICENSE
346
347;; vulkan-headers, but without the path to vulkan-loader patched in.
348(define-public vulkan-headers/no-loader
349 (package
350 (name "vulkan-headers")
351 (version "1.4.335.0")
352 (source
353 (origin
354 (method git-fetch)
355 (uri (git-reference
356 (url "https://github.com/KhronosGroup/Vulkan-Headers")
357 (commit (string-append "vulkan-sdk-" version))))
358 (file-name (git-file-name name version))
359 (sha256
360 (base32
361 "1a2w1g06w06nzr42srrvw06i5p6pzi5n25ldnbd6j8p860pqz1qc"))))
362 (build-system cmake-build-system)
363 (arguments
364 `(#:tests? #f)) ; No tests.
365 (properties '((hidden? . #t)))
366 (home-page
367 "https://github.com/KhronosGroup/Vulkan-Headers")
368 (synopsis "Vulkan Header files and API registry")
369 (description
370 "Vulkan-Headers contains header files and API registry for Vulkan.")
371 (license (list license:asl2.0)))) ;LICENSE.txt
372
373(define-public vulkan-headers
374 (package
375 (inherit vulkan-headers/no-loader)
376 (arguments
377 (substitute-keyword-arguments (package-arguments vulkan-headers/no-loader)
378 ((#:phases phases #~%standard-phases)
379 #~(modify-phases #$phases
380 (add-after 'unpack 'patch-libvulkan-file-name
381 (lambda* (#:key inputs #:allow-other-keys)
382 (substitute* "include/vulkan/vulkan.hpp"
383 (("dlopen\\( \"libvulkan.so")
384 (string-append "dlopen(\""
385 (search-input-file
386 inputs "/lib/libvulkan.so"))))))))))
387 (inputs
388 (modify-inputs (package-inputs vulkan-headers/no-loader)
389 (prepend vulkan-loader)))
390 (properties '())))
391
392(define-public vulkan-loader
393 (package
394 (name "vulkan-loader")
395 (version "1.4.335.0")
396 (source
397 (origin
398 (method git-fetch)
399 (uri (git-reference
400 (url "https://github.com/KhronosGroup/Vulkan-Loader")
401 (commit (string-append "vulkan-sdk-" version))))
402 (file-name (git-file-name name version))
403 (sha256
404 (base32
405 "1xdfqvh9yhybnlfc84qxf65l5snhc8p0a3j6qaryj9m71khd64np"))))
406 (build-system cmake-build-system)
407 (arguments
408 (list
409 ;; As many as 23 tests are expected to fail per architecture.
410 ;; Limit the tests to those architectures tested upstream.
411 #:tests? (and (not (%current-target-system))
412 (target-x86?))
413 #:parallel-tests? #f
414 #:configure-flags
415 #~(list (string-append "-DVULKAN_HEADERS_INSTALL_DIR="
416 (dirname (dirname
417 (search-input-directory
418 %build-inputs "include/vulkan"))))
419 #$@(if (%current-target-system)
420 #~("-DBUILD_TESTS=OFF" "-DUSE_GAS=OFF")
421 #~("-DBUILD_TESTS=ON")))
422 #:phases
423 #~(modify-phases %standard-phases
424 (add-after 'unpack 'fix-pkg-config-file
425 (lambda* (#:key inputs #:allow-other-keys)
426 (let ((vulkan-headers (dirname (search-input-directory
427 inputs "include/vulkan"))))
428 ;; Ensure the pkg-config file refers to vulkan-headers.
429 (substitute* "loader/vulkan.pc.in"
430 (("^includedir=.*")
431 (string-append "includedir=" vulkan-headers "\n"))))))
432 (add-after 'unpack 'use-system-googletest
433 (lambda _
434 (substitute* "tests/CMakeLists.txt"
435 (((string-append
436 "message\\(FATAL_ERROR \"Could not "
437 "find googletest directory. See BUILD.md\"\\)"))
438 "find_package(GTest REQUIRED)"))
439 ;; Use the namespaced variable.
440 (substitute* "tests/framework/CMakeLists.txt"
441 (("PUBLIC gtest ")
442 "PUBLIC GTest::gtest ")))))))
443 (native-inputs
444 (list googletest
445 libxrandr
446 pkg-config
447 python
448 wayland))
449 (inputs
450 (list vulkan-headers/no-loader libxrandr))
451 (native-search-paths
452 (list (search-path-specification
453 (variable "XDG_DATA_DIRS")
454 (files '("share")))))
455 (home-page
456 "https://github.com/KhronosGroup/Vulkan-Loader")
457 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
458 (description
459 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
460supporting one or more devices to be used collectively. The loader is
461responsible for discovering available Vulkan ICDs on the system and inserting
462Vulkan layer libraries, including validation layers between the application
463and the ICD.")
464 ;; This software is mainly Apache 2.0 licensed, but contains some components
465 ;; covered by other licenses. See COPYRIGHT.txt for details.
466 (license (list license:asl2.0 ;LICENSE.txt
467 (license:x11-style "file://COPYRIGHT.txt")
468 license:bsd-3))))
469
470(define-public vulkan-tools
471 (package
472 (name "vulkan-tools")
473 (version "1.4.335.0")
474 (source
475 (origin
476 (method git-fetch)
477 (uri (git-reference
478 (url "https://github.com/KhronosGroup/Vulkan-Tools")
479 (commit (string-append "vulkan-sdk-" version))))
480 (file-name (git-file-name name version))
481 (modules '((guix build utils)))
482 (snippet
483 #~(substitute* "tests/icd/mock_icd_tests.cpp"
484 ;; Disable driver info test since it relies on git branch info
485 (("ASSERT_EQ\\(std::string\\(driver_properties\\.driverInfo\\)")
486 "// ASSERT_EQ(std::string(driver_properties.driverInfo)")))
487 (sha256
488 (base32
489 "07b5jlvp70apmkj0b8l2w086h0vbcfl49n7xr35kmv46p0n37z0b"))))
490 (build-system cmake-build-system)
491 (inputs
492 (list glslang libxrandr vulkan-loader wayland wayland-protocols))
493 (native-inputs
494 (list googletest pkg-config python vulkan-headers))
495 (arguments
496 (list
497 #:configure-flags #~(list "-DBUILD_TESTS=ON")
498 #:phases #~(modify-phases %standard-phases
499 (add-after 'unpack 'patch-libvulkan-file-name
500 (lambda* (#:key inputs #:allow-other-keys)
501 (substitute* '("vulkaninfo/vulkaninfo_functions.h"
502 "cube/cube_functions.h")
503 (("dlopen\\(\"libvulkan.so.1")
504 (string-append "dlopen(\""
505 (search-input-file
506 inputs "/lib/libvulkan.so.1"))))))
507 (replace 'check
508 (lambda* (#:key tests? #:allow-other-keys)
509 (when tests?
510 (invoke "./tests/vulkan_tools_tests")))))))
511 (home-page
512 "https://github.com/KhronosGroup/Vulkan-Tools")
513 (synopsis "Tools and utilities for Vulkan")
514 (description
515 "Vulkan-Tools provides tools and utilities that can assist development by
516enabling developers to verify their applications correct use of the Vulkan
517API.")
518 (license (list license:asl2.0)))) ;LICENSE.txt
519
520(define-public shaderc
521 (package
522 (name "shaderc")
523 ;; shaderc doesn't follow the versioning scheme of vulkan sdk
524 (version "2025.5")
525 (source
526 (origin
527 (method git-fetch)
528 (uri (git-reference
529 (url "https://github.com/google/shaderc")
530 (commit (string-append "v" version))))
531 (file-name (git-file-name name version))
532 (sha256
533 (base32
534 "0i1rwn4xg8galdxw66p72m36q5vx8zx42ypdcmhv15nv6mj92q9y"))))
535 (build-system cmake-build-system)
536 (arguments
537 (list
538 #:tests? #f ; We don't build the tests, see below.
539 ;; FIXME: Skip most of the tests, because enabling system gtest breaks
540 ;; the build: <https://github.com/google/shaderc/issues/470>.
541 #:configure-flags
542 #~(list "-DSHADERC_SKIP_TESTS=ON"
543 ;; The two flags are copied from:
544 ;; https://sdk.lunarg.com/sdk/download/1.3.280.0/linux/config.json
545 "-DSHADERC_ENABLE_SHARED_CRT=ON"
546 "-DSHADERC_SKIP_COPYRIGHT_CHECK=ON"
547 "-DPYTHON_EXECUTABLE=python3"
548 ;; Note: despite the name, this just specifies the headers.
549 (string-append "-Dglslang_SOURCE_DIR="
550 #$(this-package-input "glslang")
551 "/include/glslang"))
552 #:phases
553 #~(modify-phases %standard-phases
554 (add-after 'unpack 'do-not-look-for-bundled-sources
555 (lambda _
556 (substitute* "CMakeLists.txt"
557 (("add_subdirectory\\(third_party\\)")
558 ""))
559 (substitute* "glslc/test/CMakeLists.txt"
560 (("\\$<TARGET_FILE:spirv-dis>")
561 (which "spirv-dis")))
562 ;; Do not attempt to use git to encode version information.
563 (substitute* "glslc/CMakeLists.txt"
564 (("add_dependencies\\(glslc_exe build-version\\)")
565 ""))
566 (call-with-output-file "glslc/src/build-version.inc"
567 (lambda (port)
568 (format port "\"~a\"\n\"~a\"\n\"~a\"~%"
569 #$version
570 #$(package-version spirv-tools)
571 #$(package-version glslang)))))))))
572 (inputs
573 (list glslang spirv-headers spirv-tools))
574 (native-inputs
575 (list pkg-config python))
576 (home-page "https://github.com/google/shaderc")
577 (synopsis "Tools for shader compilation")
578 (description "Shaderc is a collection of tools, libraries, and tests for
579shader compilation.")
580 (license license:asl2.0)))
581
582(define-public sirit
583 (package
584 (name "sirit")
585 (version "1.0.3")
586 (source (origin
587 (method url-fetch)
588 (uri (string-append
589 "https://github.com/eden-emulator/sirit/releases/download/v"
590 version "/sirit-source-" version ".tar.zst"))
591 (sha256
592 (base32 "1crp9663vl2bhr2ml4dm12prxra4w3la0jlz544k12aprzf9n0l7"))))
593 (build-system cmake-build-system)
594 (inputs
595 (list spirv-headers))
596 (synopsis "Runtime SPIR-V assembler")
597 (description "Sirit is a runtime SPIR-V assembler. It allows dynamic
598generation of SPIR-V shader code, handling declaration sorting, type and
599constant management, and opcode emission.")
600 (home-page "https://github.com/eden-emulator/sirit")
601 ;; Dual-licensed on top of being a fork of bsd-3 software.
602 (license (list license:agpl3+ license:gpl3+ license:bsd-3))))
603
604(define-public vkd3d
605 (package
606 (name "vkd3d")
607 (version "1.18")
608 (source
609 (origin
610 (method git-fetch)
611 (uri (git-reference
612 (url "https://gitlab.winehq.org/wine/vkd3d")
613 (commit (string-append "vkd3d-" version))))
614 (sha256
615 (base32
616 "001v4yyis6gzgyw0994ln7fz8254cmflna2dqnkh6sl56lmxdj98"))
617 (file-name (string-append name "-" version "-checkout"))))
618 (build-system gnu-build-system)
619 (arguments
620 (list
621 #:configure-flags #~(list "--with-spirv-tools")))
622 (native-inputs
623 (list autoconf
624 automake
625 bison
626 flex
627 gettext-minimal
628 libtool
629 perl
630 perl-json
631 pkg-config))
632 (inputs
633 (list libx11
634 libxcb
635 spirv-headers
636 spirv-tools
637 vulkan-headers
638 vulkan-loader
639 wine-minimal ; Needed for 'widl'.
640 xcb-util
641 xcb-util-keysyms
642 xcb-util-wm))
643 (home-page "https://gitlab.winehq.org/wine/vkd3d")
644 (synopsis "Direct3D 12 to Vulkan translation library")
645 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
646 (license license:lgpl2.1)))
647
648(define-public vulkan-validationlayers
649 (package
650 (name "vulkan-validationlayers")
651 (version "1.4.335.0")
652 (source (origin
653 (method git-fetch)
654 (uri (git-reference
655 (url
656 "https://github.com/KhronosGroup/Vulkan-ValidationLayers")
657 (commit (string-append "vulkan-sdk-" version))))
658 (file-name (git-file-name name version))
659 (modules '((guix build utils)))
660 ;; We don't build static libraries in SPIRV-Tools.
661 (snippet '(substitute* "tests/CMakeLists.txt"
662 (("-static")
663 "")))
664 (sha256
665 (base32
666 "06kx3769xn6xrk2xjs5k9hpkv8gvmjwn7yvz423yy7d9fzgnn70m"))))
667 (build-system cmake-build-system)
668 (inputs (list glslang
669 libxrandr
670 mesa
671 robin-hood-hashing
672 shaderc
673 spirv-tools-static
674 vulkan-loader
675 vulkan-utility-libraries
676 wayland))
677 (native-inputs
678 (list googletest pkg-config python spirv-headers vulkan-headers))
679 (arguments
680 (list #:tests? #f ; tests crash on some hardware (various upstream issues)
681 #:configure-flags
682 #~(list "-DBUILD_TESTS=ON")
683 #:phases
684 #~(modify-phases %standard-phases
685 (add-after 'install 'set-layer-path-in-manifest
686 (lambda _
687 (let ((manifest
688 (string-append #$output
689 "/share/vulkan/explicit_layer.d"
690 "/VkLayer_khronos_validation.json")))
691 (substitute* manifest
692 (("\"libVkLayer_khronos_validation.so\"")
693 (string-append
694 "\"" #$output
695 "/lib/libVkLayer_khronos_validation.so\""))))))
696 (replace 'check
697 (lambda* (#:key tests? #:allow-other-keys)
698 (when tests?
699 (setenv "VK_LAYER_PATH"
700 (string-append (getcwd) "/layers"))
701 (setenv "LD_LIBRARY_PATH"
702 (string-append #$(this-package-input
703 "vulkan-loader") "/lib"))
704 (setenv "MESA_SHADER_CACHE_DIR"
705 (string-append (getcwd) "/shader-cache"))
706 (setenv "XDG_RUNTIME_DIR" (getcwd))
707 (invoke "./tests/vk_layer_validation_tests")))))))
708 (home-page "https://github.com/KhronosGroup/Vulkan-ValidationLayers")
709 (synopsis "Khronos official validation layers for Vulkan")
710 (description
711 "Vulkan-ValidationLayers provides the Khronos official validation layers
712that can assist development by enabling developers to verify their
713applications correctly use the Vulkan API.")
714 (license license:asl2.0)))
715
716(define-public vulkan-volk
717 (package
718 (name "vulkan-volk")
719 (version "1.4.335.0")
720 (source (origin
721 (method git-fetch)
722 (uri (git-reference
723 (url "https://github.com/zeux/volk")
724 (commit (string-append "vulkan-sdk-" version))))
725 (file-name (git-file-name name version))
726 (sha256
727 (base32
728 "0hqamyr3xdqacgn49hzf966vj7hn54aybzkfg76y3hc9ly2hq0x8"))))
729 (build-system cmake-build-system)
730 (arguments
731 (list
732 #:tests? #f ;no test
733 #:configure-flags #~(list "-DVOLK_INSTALL=ON" "-DVOLK_PULL_IN_VULKAN=ON")
734 #:phases
735 #~(modify-phases %standard-phases
736 (add-after 'unpack 'patch-loader-path
737 (lambda* (#:key inputs #:allow-other-keys)
738 (substitute* "volk.c"
739 (("dlopen\\(\"libvulkan.so")
740 (string-append "dlopen(\""
741 (search-input-file
742 inputs "/lib/libvulkan.so")))))))))
743 (inputs (list vulkan-headers vulkan-loader))
744 (synopsis "Meta loader for Vulkan API")
745 (description
746 "Volk is a meta-loader for Vulkan. It allows you to dynamically load
747entrypoints required to use Vulkan without linking the Vulkan loader.
748Additionally, volk simplifies the use of Vulkan extensions by automatically
749loading all associated entrypoints. Finally, volk enables loading Vulkan
750entrypoints directly from the driver which can increase performance by
751skipping loader dispatch overhead.")
752 (home-page "https://github.com/zeux/volk")
753 (license license:expat)))
754
755(define-public vulkan-memory-allocator
756 (package
757 (name "vulkan-memory-allocator")
758 (version "3.3.0")
759 (source
760 (origin
761 (method git-fetch)
762 (uri
763 (git-reference
764 (url "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator")
765 (commit (string-append "v" version))))
766 (file-name (git-file-name name version))
767 (sha256
768 (base32
769 "1qadyd9nir9ip176fsxvl91w60mnyvk07d5ihjlpqvl7rdbjmwac"))))
770 (build-system cmake-build-system)
771 (arguments (list #:tests? #f)) ;no tests
772 (inputs (list vulkan-loader vulkan-headers))
773 (synopsis "Vulkan memory allocation library")
774 (description
775 "The Vulkan Memory Allocator (VMA) library provides a simple and easy to
776integrate API to help users allocate memory for Vulkan buffer and image
777storage.")
778 (home-page
779 "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator")
780 (license license:expat)))
781
782(define-public vulkan-utility-libraries
783 (package
784 (name "vulkan-utility-libraries")
785 (version "1.4.335.0")
786 (source
787 (origin
788 (method git-fetch)
789 (uri (git-reference
790 (url "https://github.com/KhronosGroup/Vulkan-Utility-Libraries")
791 (commit (string-append "vulkan-sdk-" version))))
792 (sha256
793 (base32 "116agfaayycizafq2infy12n07039rp6azzvfff3wq84ph3v8cwl"))
794 (file-name (git-file-name name version))))
795 (build-system cmake-build-system)
796 (arguments
797 (list
798 #:configure-flags #~(list "-DBUILD_TESTS=ON")))
799 (inputs (list vulkan-headers))
800 (native-inputs (list googletest magic-enum))
801 (home-page "https://github.com/KhronosGroup/Vulkan-Utility-Libraries")
802 (synopsis "Utility libraries for Vulkan developers")
803 (description "Utility libraries for Vulkan developers.")
804 (license license:asl2.0)))