projects/guix·blob ruby-team · refs

802 lines · 31.2 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 (inputs (list spirv-tools))
281 (native-inputs
282 (list pkg-config python-minimal))
283 (home-page "https://github.com/KhronosGroup/glslang")
284 (synopsis "OpenGL and OpenGL ES shader front end and validator")
285 (description
286 "Glslang is the official reference compiler front end for the
287OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
288interpretation of the specifications for these languages.")
289 ;; Modified BSD license. See "copyright" section of
290 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
291 (license (list license:bsd-3
292 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
293 license:asl2.0))))
294
295(define-public vkbasalt
296 (package
297 (name "vkbasalt")
298 (version "0.3.2.10")
299 (source
300 (origin
301 (method git-fetch)
302 (uri (git-reference
303 (url "https://github.com/DadSchoorse/vkBasalt")
304 (commit (string-append "v" version))))
305 (file-name (git-file-name name version))
306 (sha256
307 (base32 "0f3qmcmqnnh8i9qd2sd3p5w0akn8rkzfm5z0hc0wazgci4lqjbhq"))))
308 (build-system meson-build-system)
309 (arguments
310 (list #:configure-flags
311 ;; Needed for giving full path to library.
312 #~(list "-Dappend_libdir_vkbasalt=TRUE")
313 #:phases
314 #~(modify-phases %standard-phases
315 (add-after 'unpack 'fix-libdir
316 (lambda _
317 (substitute* "meson.build"
318 (("\\$LIB") "lib")))))))
319 (native-inputs (list pkg-config
320 ;; for glslangValidator
321 glslang))
322 (inputs (list libx11 spirv-headers vulkan-headers))
323 (home-page "https://github.com/DadSchoorse/vkBasalt")
324 (synopsis "Vulkan post processing layer for GNU/Linux")
325 (description "vkBasalt is a Vulkan post processing layer to enhance the
326visual graphics of games.
327
328Currently, the built-in effects are:
329
330@itemize @bullet
331@item
332Contrast Adaptive Sharpening
333@item
334Denoise Luma Sharpening
335@item
336Fast Approximate Anti-Aliasing
337@item
338Enhanced Subpixel Morphological Anti-Aliasing
339@item
3403D color LookUp Table
341@end itemize")
342 (license (list license:bsd-3 ; src/reshade/LICENSE.md
343 license:zlib)))) ; LICENSE
344
345;; vulkan-headers, but without the path to vulkan-loader patched in.
346(define-public vulkan-headers/no-loader
347 (package
348 (name "vulkan-headers")
349 (version "1.4.335.0")
350 (source
351 (origin
352 (method git-fetch)
353 (uri (git-reference
354 (url "https://github.com/KhronosGroup/Vulkan-Headers")
355 (commit (string-append "vulkan-sdk-" version))))
356 (file-name (git-file-name name version))
357 (sha256
358 (base32
359 "1a2w1g06w06nzr42srrvw06i5p6pzi5n25ldnbd6j8p860pqz1qc"))))
360 (build-system cmake-build-system)
361 (arguments
362 `(#:tests? #f)) ; No tests.
363 (properties '((hidden? . #t)))
364 (home-page
365 "https://github.com/KhronosGroup/Vulkan-Headers")
366 (synopsis "Vulkan Header files and API registry")
367 (description
368 "Vulkan-Headers contains header files and API registry for Vulkan.")
369 (license (list license:asl2.0)))) ;LICENSE.txt
370
371(define-public vulkan-headers
372 (package
373 (inherit vulkan-headers/no-loader)
374 (arguments
375 (substitute-keyword-arguments (package-arguments vulkan-headers/no-loader)
376 ((#:phases phases #~%standard-phases)
377 #~(modify-phases #$phases
378 (add-after 'unpack 'patch-libvulkan-file-name
379 (lambda* (#:key inputs #:allow-other-keys)
380 (substitute* "include/vulkan/vulkan.hpp"
381 (("dlopen\\( \"libvulkan.so")
382 (string-append "dlopen(\""
383 (search-input-file
384 inputs "/lib/libvulkan.so"))))))))))
385 (inputs
386 (modify-inputs (package-inputs vulkan-headers/no-loader)
387 (prepend vulkan-loader)))
388 (properties '())))
389
390(define-public vulkan-loader
391 (package
392 (name "vulkan-loader")
393 (version "1.4.335.0")
394 (source
395 (origin
396 (method git-fetch)
397 (uri (git-reference
398 (url "https://github.com/KhronosGroup/Vulkan-Loader")
399 (commit (string-append "vulkan-sdk-" version))))
400 (file-name (git-file-name name version))
401 (sha256
402 (base32
403 "1xdfqvh9yhybnlfc84qxf65l5snhc8p0a3j6qaryj9m71khd64np"))))
404 (build-system cmake-build-system)
405 (arguments
406 (list
407 ;; As many as 23 tests are expected to fail per architecture.
408 ;; Limit the tests to those architectures tested upstream.
409 #:tests? (and (not (%current-target-system))
410 (target-x86?))
411 #:parallel-tests? #f
412 #:configure-flags
413 #~(list (string-append "-DVULKAN_HEADERS_INSTALL_DIR="
414 (dirname (dirname
415 (search-input-directory
416 %build-inputs "include/vulkan"))))
417 #$@(if (%current-target-system)
418 #~("-DBUILD_TESTS=OFF" "-DUSE_GAS=OFF")
419 #~("-DBUILD_TESTS=ON")))
420 #:phases
421 #~(modify-phases %standard-phases
422 (add-after 'unpack 'fix-pkg-config-file
423 (lambda* (#:key inputs #:allow-other-keys)
424 (let ((vulkan-headers (dirname (search-input-directory
425 inputs "include/vulkan"))))
426 ;; Ensure the pkg-config file refers to vulkan-headers.
427 (substitute* "loader/vulkan.pc.in"
428 (("^includedir=.*")
429 (string-append "includedir=" vulkan-headers "\n"))))))
430 (add-after 'unpack 'use-system-googletest
431 (lambda _
432 (substitute* "tests/CMakeLists.txt"
433 (((string-append
434 "message\\(FATAL_ERROR \"Could not "
435 "find googletest directory. See BUILD.md\"\\)"))
436 "find_package(GTest REQUIRED)"))
437 ;; Use the namespaced variable.
438 (substitute* "tests/framework/CMakeLists.txt"
439 (("PUBLIC gtest ")
440 "PUBLIC GTest::gtest ")))))))
441 (native-inputs
442 (list googletest
443 libxrandr
444 pkg-config
445 python
446 wayland))
447 (inputs
448 (list vulkan-headers/no-loader libxrandr))
449 (native-search-paths
450 (list (search-path-specification
451 (variable "XDG_DATA_DIRS")
452 (files '("share")))))
453 (home-page
454 "https://github.com/KhronosGroup/Vulkan-Loader")
455 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
456 (description
457 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
458supporting one or more devices to be used collectively. The loader is
459responsible for discovering available Vulkan ICDs on the system and inserting
460Vulkan layer libraries, including validation layers between the application
461and the ICD.")
462 ;; This software is mainly Apache 2.0 licensed, but contains some components
463 ;; covered by other licenses. See COPYRIGHT.txt for details.
464 (license (list license:asl2.0 ;LICENSE.txt
465 (license:x11-style "file://COPYRIGHT.txt")
466 license:bsd-3))))
467
468(define-public vulkan-tools
469 (package
470 (name "vulkan-tools")
471 (version "1.4.335.0")
472 (source
473 (origin
474 (method git-fetch)
475 (uri (git-reference
476 (url "https://github.com/KhronosGroup/Vulkan-Tools")
477 (commit (string-append "vulkan-sdk-" version))))
478 (file-name (git-file-name name version))
479 (modules '((guix build utils)))
480 (snippet
481 #~(substitute* "tests/icd/mock_icd_tests.cpp"
482 ;; Disable driver info test since it relies on git branch info
483 (("ASSERT_EQ\\(std::string\\(driver_properties\\.driverInfo\\)")
484 "// ASSERT_EQ(std::string(driver_properties.driverInfo)")))
485 (sha256
486 (base32
487 "07b5jlvp70apmkj0b8l2w086h0vbcfl49n7xr35kmv46p0n37z0b"))))
488 (build-system cmake-build-system)
489 (inputs
490 (list glslang libxrandr vulkan-loader wayland wayland-protocols))
491 (native-inputs
492 (list googletest pkg-config python vulkan-headers))
493 (arguments
494 (list
495 #:configure-flags #~(list "-DBUILD_TESTS=ON")
496 #:phases #~(modify-phases %standard-phases
497 (add-after 'unpack 'patch-libvulkan-file-name
498 (lambda* (#:key inputs #:allow-other-keys)
499 (substitute* '("vulkaninfo/vulkaninfo_functions.h"
500 "cube/cube_functions.h")
501 (("dlopen\\(\"libvulkan.so.1")
502 (string-append "dlopen(\""
503 (search-input-file
504 inputs "/lib/libvulkan.so.1"))))))
505 (replace 'check
506 (lambda* (#:key tests? #:allow-other-keys)
507 (when tests?
508 (invoke "./tests/vulkan_tools_tests")))))))
509 (home-page
510 "https://github.com/KhronosGroup/Vulkan-Tools")
511 (synopsis "Tools and utilities for Vulkan")
512 (description
513 "Vulkan-Tools provides tools and utilities that can assist development by
514enabling developers to verify their applications correct use of the Vulkan
515API.")
516 (license (list license:asl2.0)))) ;LICENSE.txt
517
518(define-public shaderc
519 (package
520 (name "shaderc")
521 ;; shaderc doesn't follow the versioning scheme of vulkan sdk
522 (version "2025.5")
523 (source
524 (origin
525 (method git-fetch)
526 (uri (git-reference
527 (url "https://github.com/google/shaderc")
528 (commit (string-append "v" version))))
529 (file-name (git-file-name name version))
530 (sha256
531 (base32
532 "0i1rwn4xg8galdxw66p72m36q5vx8zx42ypdcmhv15nv6mj92q9y"))))
533 (build-system cmake-build-system)
534 (arguments
535 (list
536 #:tests? #f ; We don't build the tests, see below.
537 ;; FIXME: Skip most of the tests, because enabling system gtest breaks
538 ;; the build: <https://github.com/google/shaderc/issues/470>.
539 #:configure-flags
540 #~(list "-DSHADERC_SKIP_TESTS=ON"
541 ;; The two flags are copied from:
542 ;; https://sdk.lunarg.com/sdk/download/1.3.280.0/linux/config.json
543 "-DSHADERC_ENABLE_SHARED_CRT=ON"
544 "-DSHADERC_SKIP_COPYRIGHT_CHECK=ON"
545 "-DPYTHON_EXECUTABLE=python3"
546 ;; Note: despite the name, this just specifies the headers.
547 (string-append "-Dglslang_SOURCE_DIR="
548 #$(this-package-input "glslang")
549 "/include/glslang"))
550 #:phases
551 #~(modify-phases %standard-phases
552 (add-after 'unpack 'do-not-look-for-bundled-sources
553 (lambda _
554 (substitute* "CMakeLists.txt"
555 (("add_subdirectory\\(third_party\\)")
556 ""))
557 (substitute* "glslc/test/CMakeLists.txt"
558 (("\\$<TARGET_FILE:spirv-dis>")
559 (which "spirv-dis")))
560 ;; Do not attempt to use git to encode version information.
561 (substitute* "glslc/CMakeLists.txt"
562 (("add_dependencies\\(glslc_exe build-version\\)")
563 ""))
564 (call-with-output-file "glslc/src/build-version.inc"
565 (lambda (port)
566 (format port "\"~a\"\n\"~a\"\n\"~a\"~%"
567 #$version
568 #$(package-version spirv-tools)
569 #$(package-version glslang)))))))))
570 (inputs
571 (list glslang spirv-headers spirv-tools))
572 (native-inputs
573 (list pkg-config python))
574 (home-page "https://github.com/google/shaderc")
575 (synopsis "Tools for shader compilation")
576 (description "Shaderc is a collection of tools, libraries, and tests for
577shader compilation.")
578 (license license:asl2.0)))
579
580(define-public sirit
581 (package
582 (name "sirit")
583 (version "1.0.3")
584 (source (origin
585 (method url-fetch)
586 (uri (string-append
587 "https://github.com/eden-emulator/sirit/releases/download/v"
588 version "/sirit-source-" version ".tar.zst"))
589 (sha256
590 (base32 "1crp9663vl2bhr2ml4dm12prxra4w3la0jlz544k12aprzf9n0l7"))))
591 (build-system cmake-build-system)
592 (inputs
593 (list spirv-headers))
594 (synopsis "Runtime SPIR-V assembler")
595 (description "Sirit is a runtime SPIR-V assembler. It allows dynamic
596generation of SPIR-V shader code, handling declaration sorting, type and
597constant management, and opcode emission.")
598 (home-page "https://github.com/eden-emulator/sirit")
599 ;; Dual-licensed on top of being a fork of bsd-3 software.
600 (license (list license:agpl3+ license:gpl3+ license:bsd-3))))
601
602(define-public vkd3d
603 (package
604 (name "vkd3d")
605 (version "1.18")
606 (source
607 (origin
608 (method git-fetch)
609 (uri (git-reference
610 (url "https://gitlab.winehq.org/wine/vkd3d")
611 (commit (string-append "vkd3d-" version))))
612 (sha256
613 (base32
614 "001v4yyis6gzgyw0994ln7fz8254cmflna2dqnkh6sl56lmxdj98"))
615 (file-name (string-append name "-" version "-checkout"))))
616 (build-system gnu-build-system)
617 (arguments
618 (list
619 #:configure-flags #~(list "--with-spirv-tools")))
620 (native-inputs
621 (list autoconf
622 automake
623 bison
624 flex
625 gettext-minimal
626 libtool
627 perl
628 perl-json
629 pkg-config))
630 (inputs
631 (list libx11
632 libxcb
633 spirv-headers
634 spirv-tools
635 vulkan-headers
636 vulkan-loader
637 wine-minimal ; Needed for 'widl'.
638 xcb-util
639 xcb-util-keysyms
640 xcb-util-wm))
641 (home-page "https://gitlab.winehq.org/wine/vkd3d")
642 (synopsis "Direct3D 12 to Vulkan translation library")
643 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
644 (license license:lgpl2.1)))
645
646(define-public vulkan-validationlayers
647 (package
648 (name "vulkan-validationlayers")
649 (version "1.4.335.0")
650 (source (origin
651 (method git-fetch)
652 (uri (git-reference
653 (url
654 "https://github.com/KhronosGroup/Vulkan-ValidationLayers")
655 (commit (string-append "vulkan-sdk-" version))))
656 (file-name (git-file-name name version))
657 (modules '((guix build utils)))
658 ;; We don't build static libraries in SPIRV-Tools.
659 (snippet '(substitute* "tests/CMakeLists.txt"
660 (("-static")
661 "")))
662 (sha256
663 (base32
664 "06kx3769xn6xrk2xjs5k9hpkv8gvmjwn7yvz423yy7d9fzgnn70m"))))
665 (build-system cmake-build-system)
666 (inputs (list glslang
667 libxrandr
668 mesa
669 robin-hood-hashing
670 shaderc
671 spirv-tools-static
672 vulkan-loader
673 vulkan-utility-libraries
674 wayland))
675 (native-inputs
676 (list googletest pkg-config python spirv-headers vulkan-headers))
677 (arguments
678 (list #:tests? #f ; tests crash on some hardware (various upstream issues)
679 #:configure-flags
680 #~(list "-DBUILD_TESTS=ON")
681 #:phases
682 #~(modify-phases %standard-phases
683 (add-after 'install 'set-layer-path-in-manifest
684 (lambda _
685 (let ((manifest
686 (string-append #$output
687 "/share/vulkan/explicit_layer.d"
688 "/VkLayer_khronos_validation.json")))
689 (substitute* manifest
690 (("\"libVkLayer_khronos_validation.so\"")
691 (string-append
692 "\"" #$output
693 "/lib/libVkLayer_khronos_validation.so\""))))))
694 (replace 'check
695 (lambda* (#:key tests? #:allow-other-keys)
696 (when tests?
697 (setenv "VK_LAYER_PATH"
698 (string-append (getcwd) "/layers"))
699 (setenv "LD_LIBRARY_PATH"
700 (string-append #$(this-package-input
701 "vulkan-loader") "/lib"))
702 (setenv "MESA_SHADER_CACHE_DIR"
703 (string-append (getcwd) "/shader-cache"))
704 (setenv "XDG_RUNTIME_DIR" (getcwd))
705 (invoke "./tests/vk_layer_validation_tests")))))))
706 (home-page "https://github.com/KhronosGroup/Vulkan-ValidationLayers")
707 (synopsis "Khronos official validation layers for Vulkan")
708 (description
709 "Vulkan-ValidationLayers provides the Khronos official validation layers
710that can assist development by enabling developers to verify their
711applications correctly use the Vulkan API.")
712 (license license:asl2.0)))
713
714(define-public vulkan-volk
715 (package
716 (name "vulkan-volk")
717 (version "1.4.335.0")
718 (source (origin
719 (method git-fetch)
720 (uri (git-reference
721 (url "https://github.com/zeux/volk")
722 (commit (string-append "vulkan-sdk-" version))))
723 (file-name (git-file-name name version))
724 (sha256
725 (base32
726 "0hqamyr3xdqacgn49hzf966vj7hn54aybzkfg76y3hc9ly2hq0x8"))))
727 (build-system cmake-build-system)
728 (arguments
729 (list
730 #:tests? #f ;no test
731 #:configure-flags #~(list "-DVOLK_INSTALL=ON" "-DVOLK_PULL_IN_VULKAN=ON")
732 #:phases
733 #~(modify-phases %standard-phases
734 (add-after 'unpack 'patch-loader-path
735 (lambda* (#:key inputs #:allow-other-keys)
736 (substitute* "volk.c"
737 (("dlopen\\(\"libvulkan.so")
738 (string-append "dlopen(\""
739 (search-input-file
740 inputs "/lib/libvulkan.so")))))))))
741 (inputs (list vulkan-headers vulkan-loader))
742 (synopsis "Meta loader for Vulkan API")
743 (description
744 "Volk is a meta-loader for Vulkan. It allows you to dynamically load
745entrypoints required to use Vulkan without linking the Vulkan loader.
746Additionally, volk simplifies the use of Vulkan extensions by automatically
747loading all associated entrypoints. Finally, volk enables loading Vulkan
748entrypoints directly from the driver which can increase performance by
749skipping loader dispatch overhead.")
750 (home-page "https://github.com/zeux/volk")
751 (license license:expat)))
752
753(define-public vulkan-memory-allocator
754 (package
755 (name "vulkan-memory-allocator")
756 (version "3.3.0")
757 (source
758 (origin
759 (method git-fetch)
760 (uri
761 (git-reference
762 (url "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator")
763 (commit (string-append "v" version))))
764 (file-name (git-file-name name version))
765 (sha256
766 (base32
767 "1qadyd9nir9ip176fsxvl91w60mnyvk07d5ihjlpqvl7rdbjmwac"))))
768 (build-system cmake-build-system)
769 (arguments (list #:tests? #f)) ;no tests
770 (inputs (list vulkan-loader vulkan-headers))
771 (synopsis "Vulkan memory allocation library")
772 (description
773 "The Vulkan Memory Allocator (VMA) library provides a simple and easy to
774integrate API to help users allocate memory for Vulkan buffer and image
775storage.")
776 (home-page
777 "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator")
778 (license license:expat)))
779
780(define-public vulkan-utility-libraries
781 (package
782 (name "vulkan-utility-libraries")
783 (version "1.4.335.0")
784 (source
785 (origin
786 (method git-fetch)
787 (uri (git-reference
788 (url "https://github.com/KhronosGroup/Vulkan-Utility-Libraries")
789 (commit (string-append "vulkan-sdk-" version))))
790 (sha256
791 (base32 "116agfaayycizafq2infy12n07039rp6azzvfff3wq84ph3v8cwl"))
792 (file-name (git-file-name name version))))
793 (build-system cmake-build-system)
794 (arguments
795 (list
796 #:configure-flags #~(list "-DBUILD_TESTS=ON")))
797 (inputs (list vulkan-headers))
798 (native-inputs (list googletest magic-enum))
799 (home-page "https://github.com/KhronosGroup/Vulkan-Utility-Libraries")
800 (synopsis "Utility libraries for Vulkan developers")
801 (description "Utility libraries for Vulkan developers.")
802 (license license:asl2.0)))