gnu: Add amtk.
[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>
8696fbba 3;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5983b783 4;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
0df77274
RH
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages vulkan)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
794d740e 24 #:use-module (guix download)
0df77274
RH
25 #:use-module (guix git-download)
26 #:use-module (guix build-system cmake)
85c7f29a 27 #:use-module (guix build-system gnu)
5b69baf0 28 #:use-module (guix build-system meson)
794d740e 29 #:use-module (gnu packages)
85c7f29a 30 #:use-module (gnu packages autotools)
6a11d5f1 31 #:use-module (gnu packages bison)
7f540654 32 #:use-module (gnu packages check)
5b69baf0 33 #:use-module (gnu packages cmake)
9286e0ec 34 #:use-module (gnu packages freedesktop)
85c7f29a 35 #:use-module (gnu packages gettext)
9286e0ec 36 #:use-module (gnu packages gl)
794d740e 37 #:use-module (gnu packages pkg-config)
9286e0ec 38 #:use-module (gnu packages python)
85c7f29a 39 #:use-module (gnu packages wine)
9286e0ec 40 #:use-module (gnu packages xorg))
0df77274
RH
41
42(define-public spirv-headers
93c5c6d1
RH
43 (package
44 (name "spirv-headers")
45 (version "1.3.7")
46 (source
47 (origin
48 (method git-fetch)
49 (uri (git-reference
50 (url "https://github.com/KhronosGroup/SPIRV-Headers")
51 (commit version)))
52 (sha256
53 (base32
54 "0m56smanfcczjfif4yfcqhjj4d4sc088kwg6dgia8fwdsjavdm4d"))
55 (file-name (string-append name "-" version "-checkout"))))
56 (build-system cmake-build-system)
57 (arguments
58 `(#:tests? #f ;; No tests
59 #:phases (modify-phases %standard-phases
60 (replace 'install
61 (lambda* (#:key outputs #:allow-other-keys)
62 (invoke "cmake" "-E" "copy_directory"
63 "../source/include/spirv"
64 (string-append (assoc-ref outputs "out")
65 "/include/spirv")))))))
66 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
67 (synopsis "Machine-readable files from the SPIR-V Registry")
68 (description
69 "SPIRV-Headers is a repository containing machine-readable files from
0df77274
RH
70the SPIR-V Registry. This includes:
71@itemize
72@item Header files for various languages.
73@item JSON files describing the grammar for the SPIR-V core instruction set,
74and for the GLSL.std.450 extended instruction set.
75@item The XML registry file.
76@end itemize\n")
93c5c6d1
RH
77 (license (license:x11-style
78 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
79 version "/LICENSE")))))
794d740e
RH
80
81(define-public spirv-tools
264c803b
RH
82 (package
83 (name "spirv-tools")
84 (version "2019.1")
85 (source
86 (origin
87 (method git-fetch)
88 (uri (git-reference
89 (url "https://github.com/KhronosGroup/SPIRV-Tools")
90 (commit (string-append "v" version))))
91 (sha256
92 (base32
93 "0vddjzhkrhrm3l3i57nxmq2smv3r1s0ka5ff2kziaahr4hqb479r"))
94 (file-name (string-append name "-" version "-checkout"))))
95 (build-system cmake-build-system)
96 (arguments
97 `(#:tests? #f ; FIXME: Tests fail.
264c803b
RH
98 #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR="
99 (assoc-ref %build-inputs "spirv-headers")))))
100 (inputs `(("spirv-headers" ,spirv-headers)))
9f74ec98 101 (native-inputs `(("pkg-config" ,pkg-config)
264c803b
RH
102 ("python" ,python)))
103 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
104 (synopsis "API and commands for processing SPIR-V modules")
105 (description
106 "The SPIR-V Tools project provides an API and commands for processing
107SPIR-V modules. The project includes an assembler, binary module
108parser,disassembler, validator, and optimizer for SPIR-V.")
109 (license license:asl2.0)))
6a11d5f1
RH
110
111(define-public glslang
3113ecfa
RH
112 (package
113 (name "glslang")
72110730 114 (version "7.11.3214")
3113ecfa
RH
115 (source
116 (origin
a9342820
RH
117 (method git-fetch)
118 (uri (git-reference
3113ecfa
RH
119 (url "https://github.com/KhronosGroup/glslang")
120 (commit version)))
794d740e
RH
121 (sha256
122 (base32
72110730 123 "0dqjga0lcza006fhac26zp2plbq4gx8a6nsmrwkqlzji6lw1jins"))
a9342820 124 (file-name (string-append name "-" version "-checkout"))))
3113ecfa
RH
125 (build-system cmake-build-system)
126 (arguments
127 `(#:tests? #f ;; No tests
128 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
129 ;; offending line.
130 #:phases (modify-phases %standard-phases
131 (add-after 'patch-source-shebangs 'fix-cmakelists
132 (lambda _
133 (substitute* "CMakeLists.txt"
134 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
135 #t)))))
136 (native-inputs `(("bison" ,bison)
137 ("pkg-config" ,pkg-config)))
138 (home-page "https://github.com/KhronosGroup/glslang")
139 (synopsis "OpenGL and OpenGL ES shader front end and validator")
140 (description
141 "Glslang is the official reference compiler front end for the
6a11d5f1
RH
142OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
143interpretation of the specifications for these languages.")
3113ecfa
RH
144 ;; Modified BSD license. See "copyright" section of
145 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
146 (license (list license:bsd-3
147 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
148 license:asl2.0))))
9286e0ec 149
cf09bed4
RH
150(define-public vulkan-headers
151 (package
152 (name "vulkan-headers")
c24b8963 153 (version "1.1.112")
cf09bed4
RH
154 (source
155 (origin
67ff2bdf
RH
156 (method git-fetch)
157 (uri (git-reference
158 (url "https://github.com/KhronosGroup/Vulkan-Headers")
159 (commit (string-append "v" version))))
b8f9e97d 160 (file-name (git-file-name name version))
cf09bed4
RH
161 (sha256
162 (base32
c24b8963 163 "0iia2wlq38hvxwip6r3k5946ylrlk42fw50mhf0pdjxjh02p8zn5"))))
cf09bed4
RH
164 (build-system cmake-build-system)
165 (arguments
67ff2bdf 166 `(#:tests? #f)) ; No tests.
cf09bed4
RH
167 (home-page
168 "https://github.com/KhronosGroup/Vulkan-Headers")
169 (synopsis "Vulkan Header files and API registry")
170 (description
171 "Vulkan-Headers contains header files and API registry for Vulkan.")
172 (license (list license:asl2.0)))) ;LICENSE.txt
173
e6fcf903 174(define-public vulkan-loader
9286e0ec 175 (package
e6fcf903 176 (name "vulkan-loader")
0eb01ff5 177 (version (package-version vulkan-headers))
9286e0ec
RH
178 (source
179 (origin
67ff2bdf
RH
180 (method git-fetch)
181 (uri (git-reference
182 (url "https://github.com/KhronosGroup/Vulkan-Loader")
183 (commit (string-append "v" version))))
b8f9e97d 184 (file-name (git-file-name name version))
9286e0ec
RH
185 (sha256
186 (base32
c24b8963 187 "1819bgmpjlikcc25bkmwwb7mp1rlyrq2v74wybg1g40ix70v0m0d"))))
9286e0ec
RH
188 (build-system cmake-build-system)
189 (arguments
190 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
a512246c
RH
191 #:phases
192 (modify-phases %standard-phases
193 (add-after 'unpack 'remove-spirv-tools-commit-id
194 (lambda* (#:key inputs #:allow-other-keys)
195 ;; Remove lines trying to build in a git commit id.
196 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
6edbf8de
RH
197 #t))
198 ;; Make sure that the files needed for Mesa's Vulkan overlay are availabe.
199 (add-after 'unpack 'copy-headers1
200 (lambda* (#:key outputs #:allow-other-keys)
201 (install-file "tests/layers/vk_layer_data.h"
202 (string-append (assoc-ref %outputs "out")
203 "/include/vulkan"))
204 (install-file "tests/layers/vk_layer_extension_utils.h"
205 (string-append (assoc-ref %outputs "out")
206 "/include/vulkan"))
207 (install-file "loader/vk_loader_platform.h"
208 (string-append (assoc-ref %outputs "out")
209 "/include/vulkan"))
210 #t))
211 (add-after 'build 'copy-headers2
212 (lambda* (#:key outputs #:allow-other-keys)
213 (install-file "vk_layer_dispatch_table.h"
214 (string-append (assoc-ref %outputs "out")
215 "/include/vulkan"))
216 (install-file "vk_dispatch_table_helper.h"
217 (string-append (assoc-ref %outputs "out")
218 "/include/vulkan"))
a512246c
RH
219 #t)))
220 #:configure-flags (list
076fcab1 221 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
a512246c 222 (string-append "-DCMAKE_INSTALL_LIBDIR="
67ff2bdf 223 (assoc-ref %outputs "out") "/lib"))))
ebfe592f
RH
224 (native-inputs `(("libxrandr" ,libxrandr)
225 ("pkg-config" ,pkg-config)
226 ("python" ,python)
227 ("vulkan-headers" ,vulkan-headers)
228 ("wayland" ,wayland)))
9286e0ec 229 (home-page
b1eb1ba9 230 "https://github.com/KhronosGroup/Vulkan-Loader")
9286e0ec
RH
231 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
232 (description
233 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
234supporting one or more devices to be used collectively. The loader is
235responsible for discovering available Vulkan ICDs on the system and inserting
236Vulkan layer libraries, including validation layers between the application
237and the ICD.")
238 ;; This software is mainly Apache 2.0 licensed, but contains some components
239 ;; covered by other licenses. See COPYRIGHT.txt for details.
240 (license (list license:asl2.0 ;LICENSE.txt
241 (license:x11-style "file://COPYRIGHT.txt")
242 license:bsd-3))))
5b69baf0 243
8ec91940
RH
244(define-public vulkan-icd-loader
245 (deprecated-package "vulkan-icd-loader" vulkan-loader))
246
bee7e46a
RH
247(define-public vulkan-tools
248 (package
249 (name "vulkan-tools")
05bb85fd 250 (version (package-version vulkan-headers))
bee7e46a
RH
251 (source
252 (origin
67ff2bdf
RH
253 (method git-fetch)
254 (uri (git-reference
255 (url "https://github.com/KhronosGroup/Vulkan-Tools")
b8f9e97d
RH
256 (commit (string-append "v" version))))
257 (file-name (git-file-name name version))
bee7e46a
RH
258 (sha256
259 (base32
c24b8963 260 "0an9hqvvpfmfld2pkszzwi7ccb9g2ijjqqzlj24dqg9kqnmcr3x4"))))
bee7e46a
RH
261 (build-system cmake-build-system)
262 (inputs
263 `(("glslang" ,glslang)
264 ("libxrandr" ,libxrandr)
bee7e46a
RH
265 ("vulkan-loader" ,vulkan-loader)
266 ("wayland" ,wayland)))
267 (native-inputs
268 `(("pkg-config" ,pkg-config)
1661f09a
RH
269 ("python" ,python)
270 ("vulkan-headers" ,vulkan-headers)))
bee7e46a 271 (arguments
e21bd8df 272 `(#:tests? #f ; No tests.
97764172 273 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
e21bd8df 274 (assoc-ref %build-inputs "glslang")))))
bee7e46a
RH
275 (home-page
276 "https://github.com/KhronosGroup/Vulkan-Tools")
277 (synopsis "Tools and utilities for Vulkan")
278 (description
279 "Vulkan-Tools provides tools and utilities that can assist development by
280enabling developers to verify their applications correct use of the Vulkan
281API.")
282 (license (list license:asl2.0)))) ;LICENSE.txt
283
5b69baf0 284(define-public shaderc
d9eada79
RH
285 (package
286 (name "shaderc")
2d906800 287 (version "2019.0")
d9eada79
RH
288 (source
289 (origin
290 (method git-fetch)
291 (uri (git-reference
292 (url "https://github.com/google/shaderc")
293 (commit (string-append "v" version))))
294 (file-name (git-file-name name version))
295 (sha256
296 (base32
2d906800 297 "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2"))))
d9eada79
RH
298 (build-system meson-build-system)
299 (arguments
300 `(#:tests? #f ; FIXME: Tests fail.
301 #:phases
302 (modify-phases %standard-phases
303 (replace 'configure
304 (lambda* (#:key outputs #:allow-other-keys)
305 (let ((out (assoc-ref outputs "out")))
306 ;; Remove various lines and touch build-version.inc or
307 ;; configuring won't work.
308 (invoke "touch" "glslc/src/build-version.inc")
309 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
310 (substitute* "CMakeLists.txt"
311 ((".*update_build_version.py..*") ""))
312 (substitute* "CMakeLists.txt"
313 ((".*add_custom_target.build-version.*") ""))
314 (substitute* "CMakeLists.txt"
315 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
316 ""))
317 (substitute* "CMakeLists.txt"
318 ((".*Update build-version.inc.*") ""))
319 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
320 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
321 "\"1\""))
322 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
323 "-DSHADERC_SKIP_TESTS=ON"
324 "-DCMAKE_INSTALL_LIBDIR=lib"
325 (string-append "-DCMAKE_INSTALL_PREFIX="
326 out)))))
327 (add-after 'unpack 'unpack-sources
328 (lambda* (#:key inputs #:allow-other-keys)
329 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
330 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
331 (glslang-source (assoc-ref inputs "glslang-source")))
332 (copy-recursively spirv-tools-source "third_party/spirv-tools")
333 (copy-recursively spirv-headers-source
334 (string-append "third_party/spirv-tools"
335 "/external/spirv-headers"))
336 (copy-recursively glslang-source "third_party/glslang")
337 #t))))))
338 (inputs
339 `(("googletest" ,googletest)
340 ("python" ,python)))
341 (native-inputs
c69959f0 342 `(("cmake" ,cmake-minimal)
d9eada79
RH
343 ("glslang-source" ,(package-source glslang))
344 ("pkg-config" ,pkg-config)
345 ("spirv-headers-source" ,(package-source spirv-headers))
346 ("spirv-tools-source" ,(package-source spirv-tools))))
347 (home-page "https://github.com/google/shaderc")
348 (synopsis "Tools for shader compilation")
349 (description "Shaderc is a collection of tools, libraries, and tests for
5b69baf0 350shader compilation.")
d9eada79 351 (license license:asl2.0)))
85c7f29a
RH
352
353(define-public vkd3d
006a1d59 354 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
85c7f29a
RH
355 (package
356 (name "vkd3d")
006a1d59 357 (version "1.1")
85c7f29a
RH
358 (source
359 (origin
360 (method git-fetch)
361 (uri (git-reference
362 (url "https://source.winehq.org/git/vkd3d.git")
363 (commit commit)))
364 (sha256
365 (base32
006a1d59 366 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
85c7f29a
RH
367 (file-name (string-append name "-" version "-checkout"))))
368 (build-system gnu-build-system)
369 (arguments
370 `(#:configure-flags '("--with-spirv-tools")))
371 (native-inputs
372 `(("autoconf" ,autoconf)
373 ("automake" ,automake)
374 ("gettext" ,gnu-gettext)
375 ("libtool" ,libtool)
376 ("pkg-config" ,pkg-config)))
377 (inputs
378 `(("libx11" ,libx11)
379 ("libxcb" ,libxcb)
380 ("spirv-headers" ,spirv-headers)
381 ("spirv-tools" ,spirv-tools)
4786f515 382 ("vulkan-headers" ,vulkan-headers)
85c7f29a 383 ("vulkan-loader" ,vulkan-loader)
dcf6df43 384 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
85c7f29a
RH
385 ("xcb-util" ,xcb-util)
386 ("xcb-util-keysyms" ,xcb-util-keysyms)
387 ("xcb-util-wm" ,xcb-util-wm)))
388 (home-page "https://source.winehq.org/git/vkd3d.git/")
389 (synopsis "Direct3D 12 to Vulkan translation library")
390 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
391 (license license:lgpl2.1))))