gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / vulkan.scm
CommitLineData
0df77274 1;;; GNU Guix --- Functional package management for GNU
67ff2bdf 2;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
3b149747 3;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5983b783 4;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
936b7906 5;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
0df77274
RH
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages vulkan)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
794d740e 25 #:use-module (guix download)
0df77274
RH
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
85c7f29a 28 #:use-module (guix build-system gnu)
5b69baf0 29 #:use-module (guix build-system meson)
794d740e 30 #:use-module (gnu packages)
85c7f29a 31 #:use-module (gnu packages autotools)
6a11d5f1 32 #:use-module (gnu packages bison)
7f540654 33 #:use-module (gnu packages check)
5b69baf0 34 #:use-module (gnu packages cmake)
9286e0ec 35 #:use-module (gnu packages freedesktop)
85c7f29a 36 #:use-module (gnu packages gettext)
9286e0ec 37 #:use-module (gnu packages gl)
794d740e 38 #:use-module (gnu packages pkg-config)
9286e0ec 39 #:use-module (gnu packages python)
85c7f29a 40 #:use-module (gnu packages wine)
9286e0ec 41 #:use-module (gnu packages xorg))
0df77274
RH
42
43(define-public spirv-headers
93c5c6d1
RH
44 (package
45 (name "spirv-headers")
936b7906 46 (version "1.5.3")
93c5c6d1
RH
47 (source
48 (origin
49 (method git-fetch)
50 (uri (git-reference
51 (url "https://github.com/KhronosGroup/SPIRV-Headers")
52 (commit version)))
53 (sha256
54 (base32
936b7906
MB
55 "069sivqajp7z4p44lmrz23lvf237xpkjxd4lzrg27836pwqcz9bj"))
56 (file-name (git-file-name name version))))
93c5c6d1
RH
57 (build-system cmake-build-system)
58 (arguments
936b7906 59 `(#:tests? #f)) ;no tests
93c5c6d1
RH
60 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
61 (synopsis "Machine-readable files from the SPIR-V Registry")
62 (description
63 "SPIRV-Headers is a repository containing machine-readable files from
0df77274
RH
64the SPIR-V Registry. This includes:
65@itemize
66@item Header files for various languages.
67@item JSON files describing the grammar for the SPIR-V core instruction set,
68and for the GLSL.std.450 extended instruction set.
69@item The XML registry file.
70@end itemize\n")
93c5c6d1
RH
71 (license (license:x11-style
72 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
73 version "/LICENSE")))))
794d740e
RH
74
75(define-public spirv-tools
264c803b
RH
76 (package
77 (name "spirv-tools")
cce94247 78 (version "2020.2")
264c803b
RH
79 (source
80 (origin
81 (method git-fetch)
82 (uri (git-reference
83 (url "https://github.com/KhronosGroup/SPIRV-Tools")
84 (commit (string-append "v" version))))
85 (sha256
cce94247 86 (base32 "00b7xgyrcb2qq63pp3cnw5q1xqx2d9rfn65lai6n6r89s1vh3vg6"))
d7a7d255 87 (file-name (git-file-name name version))))
264c803b
RH
88 (build-system cmake-build-system)
89 (arguments
8a37a214
MB
90 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
91 (string-append
92 "-DSPIRV-Headers_SOURCE_DIR="
93 (assoc-ref %build-inputs "spirv-headers")))))
264c803b 94 (inputs `(("spirv-headers" ,spirv-headers)))
9f74ec98 95 (native-inputs `(("pkg-config" ,pkg-config)
264c803b
RH
96 ("python" ,python)))
97 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
98 (synopsis "API and commands for processing SPIR-V modules")
99 (description
100 "The SPIR-V Tools project provides an API and commands for processing
101SPIR-V modules. The project includes an assembler, binary module
102parser,disassembler, validator, and optimizer for SPIR-V.")
103 (license license:asl2.0)))
6a11d5f1 104
0bc6a579
LP
105(define-public spirv-cross
106 (package
107 (name "spirv-cross")
108 (version "2020-05-19")
109 (source
110 (origin
111 (method git-fetch)
112 (uri (git-reference
113 (url "https://github.com/KhronosGroup/SPIRV-Cross")
114 (commit version)))
115 (sha256
116 (base32 "0zyijp9zx9wbd4i5lwjap7n793iz6yjkf27la60dsffxl75yy9pd"))
117 (file-name (git-file-name name version))))
118 (build-system cmake-build-system)
119 (arguments
120 `(#:configure-flags
121 (list "-DSPIRV_CROSS_SHARED=YES")
122 ;; FIXME: The following tests fail:
123 ;; 15 - spirv-cross-test-opt
124 ;; 16 - spirv-cross-test-metal-opt
125 ;; 17 - spirv-cross-test-hlsl-opt
126 #:tests? #f
127 #:phases
128 (modify-phases %standard-phases
129 (add-after 'unpack 'fix-tests-to-find-deps
130 (lambda* (#:key inputs #:allow-other-keys)
131 (substitute* "CMakeLists.txt"
132 (("\\$\\{CMAKE_(.*)_DIR\\}/external/glslang(.*)/bin")
133 (string-append (assoc-ref inputs "glslang") "/bin")))
134 (substitute* "CMakeLists.txt"
135 (("\\$\\{CMAKE_(.*)_DIR\\}/external/spirv-tools(.*)/bin")
136 (string-append (assoc-ref inputs "spirv-tools") "/bin")))
137 #t)))))
138 (inputs
139 `(("glslang" ,glslang)
140 ("spirv-headers" ,spirv-headers)
141 ("spirv-tools" ,spirv-tools)))
142 (native-inputs `(("python" ,python)))
143 (home-page "https://github.com/KhronosGroup/SPIRV-Cross")
144 (synopsis "Parser for and converter of SPIR-V to other shader languages")
145 (description
146 "SPIRV-Cross tries hard to emit readable and clean output from the
7ff99f4a 147SPIR-V, aiming to emit GLSL or MSL that looks like human-written code.")
0bc6a579
LP
148 (license license:asl2.0)))
149
6a11d5f1 150(define-public glslang
3113ecfa
RH
151 (package
152 (name "glslang")
f3406019 153 (version "10-11.0.0")
3113ecfa
RH
154 (source
155 (origin
a9342820
RH
156 (method git-fetch)
157 (uri (git-reference
3113ecfa 158 (url "https://github.com/KhronosGroup/glslang")
baec2a08
BH
159 ;; Tag "10-11.0.0" was moved to "11.0.0".
160 ;; FIXME: Use (commit version) on next update.
161 (commit "11.0.0")))
794d740e
RH
162 (sha256
163 (base32
f3406019 164 "14mn2awswl022ls75mfpsnpsl0ai0jgfbqj3sxcsqawyj5f432py"))
a9342820 165 (file-name (string-append name "-" version "-checkout"))))
3113ecfa
RH
166 (build-system cmake-build-system)
167 (arguments
1c5b9c3d
MB
168 '(#:tests? #f ;FIXME: requires bundled SPIRV-Tools
169 #:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
f3d3726e
MB
170 (native-inputs
171 `(("pkg-config" ,pkg-config)
172 ("python" ,python)))
3113ecfa
RH
173 (home-page "https://github.com/KhronosGroup/glslang")
174 (synopsis "OpenGL and OpenGL ES shader front end and validator")
175 (description
176 "Glslang is the official reference compiler front end for the
6a11d5f1
RH
177OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
178interpretation of the specifications for these languages.")
3113ecfa
RH
179 ;; Modified BSD license. See "copyright" section of
180 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
181 (license (list license:bsd-3
182 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
183 license:asl2.0))))
9286e0ec 184
cf09bed4
RH
185(define-public vulkan-headers
186 (package
187 (name "vulkan-headers")
3a72e26b 188 (version "1.2.164")
cf09bed4
RH
189 (source
190 (origin
67ff2bdf
RH
191 (method git-fetch)
192 (uri (git-reference
193 (url "https://github.com/KhronosGroup/Vulkan-Headers")
194 (commit (string-append "v" version))))
b8f9e97d 195 (file-name (git-file-name name version))
cf09bed4
RH
196 (sha256
197 (base32
3a72e26b 198 "11wzxvwim4jna1yssbmprl211dhmz8vmrd498zww3bghzlj7bljv"))))
cf09bed4
RH
199 (build-system cmake-build-system)
200 (arguments
67ff2bdf 201 `(#:tests? #f)) ; No tests.
cf09bed4
RH
202 (home-page
203 "https://github.com/KhronosGroup/Vulkan-Headers")
204 (synopsis "Vulkan Header files and API registry")
205 (description
206 "Vulkan-Headers contains header files and API registry for Vulkan.")
207 (license (list license:asl2.0)))) ;LICENSE.txt
208
e6fcf903 209(define-public vulkan-loader
9286e0ec 210 (package
e6fcf903 211 (name "vulkan-loader")
85ab862a 212 (version "1.2.162")
9286e0ec
RH
213 (source
214 (origin
67ff2bdf
RH
215 (method git-fetch)
216 (uri (git-reference
217 (url "https://github.com/KhronosGroup/Vulkan-Loader")
218 (commit (string-append "v" version))))
b8f9e97d 219 (file-name (git-file-name name version))
9286e0ec
RH
220 (sha256
221 (base32
85ab862a 222 "15gx9ab6w1sjq9hkpbas7z2f8f47j6mlln6p3w26qmydjj8gfjjv"))))
9286e0ec
RH
223 (build-system cmake-build-system)
224 (arguments
6a8fca14
MB
225 `(#:phases (modify-phases %standard-phases
226 (add-after 'unpack 'unpack-googletest
227 (lambda* (#:key inputs #:allow-other-keys)
228 (let ((gtest (assoc-ref inputs "googletest:source")))
229 (when gtest
230 (copy-recursively gtest "external/googletest"))
231 #t)))
232 (add-after 'unpack 'disable-loader-tests
233 (lambda _
234 ;; Many tests require a Vulkan driver. Skip those.
235 (substitute* "tests/loader_validation_tests.cpp"
236 ((".*= vkCreateInstance.*" all)
237 (string-append "GTEST_SKIP();\n" all))
238 (("TEST_F.*InstanceExtensionEnumerated.*" all)
239 (string-append all "\nGTEST_SKIP();\n")))
240 #t)))))
241 (native-inputs
242 `(("googletest:source" ,(package-source googletest))
243 ("libxrandr" ,libxrandr)
244 ("pkg-config" ,pkg-config)
245 ("python" ,python)
246 ("vulkan-headers" ,vulkan-headers)
247 ("wayland" ,wayland)))
9286e0ec 248 (home-page
b1eb1ba9 249 "https://github.com/KhronosGroup/Vulkan-Loader")
9286e0ec
RH
250 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
251 (description
252 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
253supporting one or more devices to be used collectively. The loader is
254responsible for discovering available Vulkan ICDs on the system and inserting
255Vulkan layer libraries, including validation layers between the application
256and the ICD.")
257 ;; This software is mainly Apache 2.0 licensed, but contains some components
258 ;; covered by other licenses. See COPYRIGHT.txt for details.
259 (license (list license:asl2.0 ;LICENSE.txt
260 (license:x11-style "file://COPYRIGHT.txt")
261 license:bsd-3))))
5b69baf0 262
bee7e46a
RH
263(define-public vulkan-tools
264 (package
265 (name "vulkan-tools")
9045b3bb 266 (version "1.2.162")
bee7e46a
RH
267 (source
268 (origin
67ff2bdf
RH
269 (method git-fetch)
270 (uri (git-reference
271 (url "https://github.com/KhronosGroup/Vulkan-Tools")
b8f9e97d
RH
272 (commit (string-append "v" version))))
273 (file-name (git-file-name name version))
bee7e46a
RH
274 (sha256
275 (base32
9045b3bb 276 "129wzk7xj3vn3c8b4p7fzkd0npl58118s2i1d88gsfnlix54nagq"))))
bee7e46a
RH
277 (build-system cmake-build-system)
278 (inputs
279 `(("glslang" ,glslang)
280 ("libxrandr" ,libxrandr)
bee7e46a
RH
281 ("vulkan-loader" ,vulkan-loader)
282 ("wayland" ,wayland)))
283 (native-inputs
284 `(("pkg-config" ,pkg-config)
1661f09a
RH
285 ("python" ,python)
286 ("vulkan-headers" ,vulkan-headers)))
bee7e46a 287 (arguments
f26bceb4 288 `(#:tests? #f ;no tests
97764172 289 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
e21bd8df 290 (assoc-ref %build-inputs "glslang")))))
bee7e46a
RH
291 (home-page
292 "https://github.com/KhronosGroup/Vulkan-Tools")
293 (synopsis "Tools and utilities for Vulkan")
294 (description
295 "Vulkan-Tools provides tools and utilities that can assist development by
296enabling developers to verify their applications correct use of the Vulkan
297API.")
298 (license (list license:asl2.0)))) ;LICENSE.txt
299
5b69baf0 300(define-public shaderc
d9eada79
RH
301 (package
302 (name "shaderc")
8f8185b9 303 (version "2020.4")
d9eada79
RH
304 (source
305 (origin
306 (method git-fetch)
307 (uri (git-reference
308 (url "https://github.com/google/shaderc")
309 (commit (string-append "v" version))))
310 (file-name (git-file-name name version))
311 (sha256
312 (base32
8f8185b9 313 "07h78nd964h2bdm4drzws8i1gvyal8a3wlhbcm5qxqk6vknv8hrk"))))
4c5e45eb 314 (build-system cmake-build-system)
d9eada79 315 (arguments
18ac4836
MB
316 `(;; FIXME: Skip most of the tests, because enabling system gtest breaks
317 ;; the build: <https://github.com/google/shaderc/issues/470>.
8f8185b9
MB
318 #:configure-flags
319 (list "-DSHADERC_SKIP_TESTS=ON"
320 ;; Note: despite the name, this just specifies the headers.
321 (string-append "-Dglslang_SOURCE_DIR="
322 (assoc-ref %build-inputs "glslang") "/include/glslang"))
d9eada79
RH
323 #:phases
324 (modify-phases %standard-phases
4c5e45eb
MB
325 (add-after 'unpack 'do-not-look-for-bundled-sources
326 (lambda _
327 (substitute* "CMakeLists.txt"
328 (("add_subdirectory\\(third_party\\)")
329 ""))
330
18ac4836
MB
331 (substitute* "glslc/test/CMakeLists.txt"
332 (("\\$<TARGET_FILE:spirv-dis>")
333 (which "spirv-dis")))
334
4c5e45eb
MB
335 ;; Do not attempt to use git to encode version information.
336 (substitute* "glslc/CMakeLists.txt"
337 (("add_dependencies\\(glslc_exe build-version\\)")
338 ""))
339 (call-with-output-file "glslc/src/build-version.inc"
340 (lambda (port)
341 (format port "\"~a\"\n\"~a\"\n\"~a\"~%"
342 ,version
343 ,(package-version spirv-tools)
344 ,(package-version glslang))))
345 #t)))))
d9eada79 346 (inputs
4c5e45eb
MB
347 `(("glslang" ,glslang)
348 ("python" ,python)
349 ("spirv-headers" ,spirv-headers)
350 ("spirv-tools" ,spirv-tools)))
d9eada79 351 (native-inputs
4c5e45eb 352 `(("pkg-config" ,pkg-config)))
d9eada79
RH
353 (home-page "https://github.com/google/shaderc")
354 (synopsis "Tools for shader compilation")
355 (description "Shaderc is a collection of tools, libraries, and tests for
5b69baf0 356shader compilation.")
d9eada79 357 (license license:asl2.0)))
85c7f29a
RH
358
359(define-public vkd3d
cd1ed880 360 (let ((commit "56cd4a94d541707959ce7677af6d1a34739e5579")) ; Release 1.2.
85c7f29a
RH
361 (package
362 (name "vkd3d")
cd1ed880 363 (version "1.2")
85c7f29a
RH
364 (source
365 (origin
366 (method git-fetch)
367 (uri (git-reference
368 (url "https://source.winehq.org/git/vkd3d.git")
369 (commit commit)))
370 (sha256
371 (base32
cd1ed880 372 "1n4a622drgnprvz5hjxzyzcsg2lp5rlf1sajki2vzf5gsx6fdpk8"))
85c7f29a
RH
373 (file-name (string-append name "-" version "-checkout"))))
374 (build-system gnu-build-system)
375 (arguments
d92f9d34
MB
376 `(#:configure-flags '("--with-spirv-tools")
377 #:phases (modify-phases %standard-phases
378 (add-after 'unpack 'patch-for-new-vulkan
379 (lambda _
380 ;; Mimic upstream commit 8e7bf8a5c3e0047 for
381 ;; compatibility with newer vulkan-headers.
382 (substitute* "libs/vkd3d/vkd3d_private.h"
383 (("VK_PIPELINE_BIND_POINT_RANGE_SIZE")
384 "2u"))
385 #t)))))
85c7f29a
RH
386 (native-inputs
387 `(("autoconf" ,autoconf)
388 ("automake" ,automake)
f2d97d57 389 ("gettext" ,gettext-minimal)
85c7f29a
RH
390 ("libtool" ,libtool)
391 ("pkg-config" ,pkg-config)))
392 (inputs
393 `(("libx11" ,libx11)
394 ("libxcb" ,libxcb)
395 ("spirv-headers" ,spirv-headers)
396 ("spirv-tools" ,spirv-tools)
4786f515 397 ("vulkan-headers" ,vulkan-headers)
85c7f29a 398 ("vulkan-loader" ,vulkan-loader)
dcf6df43 399 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
85c7f29a
RH
400 ("xcb-util" ,xcb-util)
401 ("xcb-util-keysyms" ,xcb-util-keysyms)
402 ("xcb-util-wm" ,xcb-util-wm)))
403 (home-page "https://source.winehq.org/git/vkd3d.git/")
404 (synopsis "Direct3D 12 to Vulkan translation library")
405 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
406 (license license:lgpl2.1))))