unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#29625] [PATCH core-updates] Vulkan patch series.
@ 2017-12-09 13:54 Rutger Helling
  2017-12-10 10:41 ` Rutger Helling
  2017-12-13 18:30 ` Marius Bakke
  0 siblings, 2 replies; 8+ messages in thread
From: Rutger Helling @ 2017-12-09 13:54 UTC (permalink / raw)
  To: 29625

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

Hey Guix,

this patch series adds Vulkan support for mesa on x86_64-linux and adds 
a few new packages.
Since a rebuild of mesa is necessary I'm sending it in for core-updates.

Here's a short explanation of all the patches:
#1: Add Vulkan support to mesa on x86_64-linux. On i686-linux mesa 
didn't build unfortunately.
I haven't tried other architectures.
#2: Add vulkan.scm to gnu/local.mk.
#3: Create vulkan.scm and add spirv-headers.
#4: Add spirv-tools to vulkan.scm.
#5: Add glslang to vulkan.scm.
#6: Add vulkan-icd-loader to vulkan.scm.
This provides the 'vulkaninfo' tool that you can use to query if your 
system is Vulkan-capable.

I tested it out after a full rebuild on a Vulkan-capable system.
'vulkaninfo' showed Vulkan was available on that system.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-mesa-Enable-Vulkan-drivers-for-Intel-and-Radeon-.patch --]
[-- Type: text/x-diff; name=0001-gnu-mesa-Enable-Vulkan-drivers-for-Intel-and-Radeon-.patch, Size: 2061 bytes --]

From cb4266a1a21f4e16d4d32bbca683b5aae938986d Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Sat, 9 Dec 2017 00:28:36 +0100
Subject: [PATCH] gnu: mesa: Enable Vulkan drivers for Intel and Radeon on
 x86-64.

* gnu/packages/gl.scm (mesa)[arguments]: Add
"--with-vulkan-drivers=intel,radeon" to configure-flags for
x86_64-linux. [synopsis]: Mention Vulkan. [description]: Mention Vulkan.
---
 gnu/packages/gl.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 005b49b86..b18861eb7 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -296,6 +296,13 @@ also known as DXTn or DXTC) for Mesa.")
          ;; are stuck at OpenGL 2.1 instead of OpenGL 3.0+.
          "--enable-texture-float"
 
+         ;; Enable Vulkan on x86-64.
+         ,@(match (%current-system)
+             ((or "x86_64-linux")
+                '("--with-vulkan-drivers=intel,radeon"))
+             (_
+              '("")))
+
          ;; Also enable the tests.
          "--enable-gallium-tests"
 
@@ -343,11 +350,11 @@ also known as DXTn or DXTC) for Mesa.")
                   (string-append "\"" out "/lib/dri/gbm_dri.so")))
                #t))))))
     (home-page "https://mesa3d.org/")
-    (synopsis "OpenGL implementation")
-    (description "Mesa is a free implementation of the OpenGL specification -
-a system for rendering interactive 3D graphics.  A variety of device drivers
-allows Mesa to be used in many different environments ranging from software
-emulation to complete hardware acceleration for modern GPUs.")
+    (synopsis "OpenGL and Vulkan implementations")
+    (description "Mesa is a free implementation of the OpenGL and Vulkan
+specifications - systems for rendering interactive 3D graphics.  A variety of
+device drivers allows Mesa to be used in many different environments ranging
+from software emulation to complete hardware acceleration for modern GPUs.")
     (license license:x11)))
 
 (define-public mesa-headers
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-local.mk-Add-vulkan.scm.patch --]
[-- Type: text/x-diff; name=0002-gnu-local.mk-Add-vulkan.scm.patch, Size: 677 bytes --]

From 35b07f1e24c8597bdd504ae9f986abed486cb8df Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 13:39:16 +0100
Subject: [PATCH] gnu: local.mk: Add vulkan.scm.

* gnu/local.mk: Add vulkan.scm.
---
 gnu/local.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index a0e3f6ebe..51876487d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -418,6 +418,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/vim.scm				\
   %D%/packages/virtualization.scm		\
   %D%/packages/vpn.scm				\
+  %D%/packages/vulkan.scm				\
   %D%/packages/w3m.scm				\
   %D%/packages/wdiff.scm			\
   %D%/packages/web.scm				\
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-vulkan-Add-spirv-headers.patch --]
[-- Type: text/x-diff; name=0003-gnu-vulkan-Add-spirv-headers.patch, Size: 3194 bytes --]

From 043a4adbcf2023cb5b610bb9cb6529aca76c2922 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 14:10:36 +0100
Subject: [PATCH] gnu: vulkan: Add spirv-headers.

* gnu/packages/vulkan.scm: Create file. (spirv-headers): New variable.
---
 gnu/packages/vulkan.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 gnu/packages/vulkan.scm

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
new file mode 100644
index 000000000..2079b8e0a
--- /dev/null
+++ b/gnu/packages/vulkan.scm
@@ -0,0 +1,59 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages vulkan)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
+  #:use-module (gnu packages))
+
+(define-public spirv-headers
+  (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
+        (revision "1"))
+    (package
+     (name "spirv-headers")
+     (version (string-append "0.0-" revision "." (string-take commit 9)))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/SPIRV-Headers")
+             (commit commit)))
+       (sha256
+        (base32
+         "15bknwkv3xwmjs3lmkp282a1wrp0da1b4lp45i4yiav04zmqygj2"))
+       (file-name (string-append name "-" version "-checkout"))))
+     (build-system cmake-build-system)
+     (arguments
+      `(#:tests? #f ;; No tests
+        #:phases (modify-phases %standard-phases
+                   (replace 'install
+                     (lambda*
+                       (#:key outputs #:allow-other-keys)
+                         (system* "cmake" "-E" "copy_directory"
+                                  "../source/include/spirv" (string-append
+                                  (assoc-ref outputs "out")
+                                  "/include/spirv")))))))
+     (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
+     (synopsis "Machine-readable files from the SPIR-V Registry")
+     (description "SPIRV-Headers is a repository containing machine-readable
+files from the SPIR-V Registry.")
+     (license license:x11-style)))) ;; Custom license. See
+     ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
+     ;; details.
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-vulkan-Add-spirv-tools.patch --]
[-- Type: text/x-diff; name=0004-gnu-vulkan-Add-spirv-tools.patch, Size: 2525 bytes --]

From 80e82f1f92823e04893e8400dc82b69e890c7276 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 14:56:36 +0100
Subject: [PATCH] gnu: vulkan: Add spirv-tools.

* gnu/packages/vulkan.scm (spirv-tools): New variable.
---
 gnu/packages/vulkan.scm | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 2079b8e0a..248dc206c 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -19,9 +19,12 @@
 (define-module (gnu packages vulkan)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
-  #:use-module (gnu packages))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python))
 
 (define-public spirv-headers
   (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
@@ -57,3 +60,33 @@ files from the SPIR-V Registry.")
      (license license:x11-style)))) ;; Custom license. See
      ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
      ;; details.
+
+(define-public spirv-tools
+  (package
+   (name "spirv-tools")
+   (version "2017.1")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (string-append "https://github.com/KhronosGroup/SPIRV-Tools/archive/v"
+           version ".tar.gz"))
+     (sha256
+      (base32
+       "009vflaa71a7xhvmm23f4sdbcgdkl1k4facqkwsg6djha2sdpsqq"))
+     (file-name (string-append name "-" version ".tar.gz"))))
+   (build-system cmake-build-system)
+   (arguments
+    `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
+                                             (assoc-ref %outputs "out")
+                                             "/lib")
+                              (string-append "-DSPIRV-Headers_SOURCE_DIR="
+                                             (assoc-ref %build-inputs
+                                                        "spirv-headers")))))
+   (inputs `(("python" ,python)
+             ("spirv-headers" ,spirv-headers)))
+   (native-inputs `(("pkg-config", pkg-config)))
+   (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
+   (synopsis "API and commands for processing SPIR-V modules")
+   (description "The SPIR-V Tools project provides an API and commands for
+processing SPIR-V modules.")
+   (license license:asl2.0)))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-vulkan-Add-glslang.patch --]
[-- Type: text/x-diff; name=0005-gnu-vulkan-Add-glslang.patch, Size: 2577 bytes --]

From dd17b03c487b64212fae77a406075fc83514a369 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 15:56:34 +0100
Subject: [PATCH] gnu: vulkan: Add glslang.

* gnu/packages/vulkan.scm (glslang): New variable.
---
 gnu/packages/vulkan.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 248dc206c..03562e45d 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -23,6 +23,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python))
 
@@ -90,3 +91,41 @@ files from the SPIR-V Registry.")
    (description "The SPIR-V Tools project provides an API and commands for
 processing SPIR-V modules.")
    (license license:asl2.0)))
+
+(define-public glslang
+  ;; Version 3.0 is too old for vulkan-icd-loader. Use a recent git commit
+  ;; until the next stable version.
+  (let ((commit "471bfed0621162a7513fc24a51e8a1ccc2e640ff")
+        (revision "1"))
+    (package
+     (name "glslang")
+     (version (string-append "0.0-" revision "." (string-take commit 9)))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/glslang")
+             (commit commit)))
+       (sha256
+        (base32
+         "0m2vljmrqppp80ghbbwfnayqw2canxlcjhgy6jw9xjdssln0d3pd"))
+       (file-name (string-append name "-" version "-checkout"))))
+     (build-system cmake-build-system)
+     (arguments
+      `(#:tests? #f ;; No tests
+        ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
+        ;; offending line.
+        #:phases (modify-phases %standard-phases
+                   (add-after 'patch-source-shebangs 'fix-cmakelists
+                     (lambda _
+                       (substitute* "CMakeLists.txt"
+                                    (("set.*CMAKE_INSTALL_PREFIX.*") "")))))))
+   (inputs `(("bison" ,bison)))
+   (native-inputs `(("pkg-config" ,pkg-config)))
+   (home-page "https://github.com/KhronosGroup/glslang")
+   (synopsis "OpenGL and OpenGL ES shader front end and validator")
+   (description "glslang is a OpenGL and OpenGL ES shader front end and
+validator.")
+   ;; Modified BSD license. See "copyright" section of
+   ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
+   (license license:bsd-3))))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-vulkan-Add-vulkan-icd-loader.patch --]
[-- Type: text/x-diff; name=0006-gnu-vulkan-Add-vulkan-icd-loader.patch, Size: 2506 bytes --]

From 0172d3cb7cbdae03f143a4c7966c4694e69eea15 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 16:06:05 +0100
Subject: [PATCH] gnu: vulkan: Add vulkan-icd-loader.

* gnu/packages/vulkan.scm (vulkan-icd-loader): New variable.
---
 gnu/packages/vulkan.scm | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 03562e45d..d8fa616f2 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -24,8 +24,11 @@
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages pkg-config)
-  #:use-module (gnu packages python))
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages xorg))
 
 (define-public spirv-headers
   (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
@@ -129,3 +132,37 @@ validator.")
    ;; Modified BSD license. See "copyright" section of
    ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
    (license license:bsd-3))))
+
+(define-public vulkan-icd-loader
+  (package
+   (name "vulkan-icd-loader")
+   (version "1.0.61.1")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (string-append
+           "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/"
+           "archive/sdk-" version ".tar.gz"))
+     (sha256
+      (base32
+       "05g60hk30sbc4rwkh7nrgqdk6hfsi4hwxs54yrysrzr18xpfb8j7"))))
+   (build-system cmake-build-system)
+   (arguments
+    `(#:tests? #f ;; No tests
+      #:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
+                                (assoc-ref %outputs "out") "/lib"))))
+   (inputs `(("glslang" ,glslang)
+             ("libxcb" ,libxcb)
+             ("libx11" ,libx11)
+             ("libxrandr" ,libxrandr)
+             ("mesa" ,mesa)
+             ("python" ,python)
+             ("spirv-tools" ,spirv-tools)
+             ("wayland" ,wayland)))
+   (native-inputs `(("pkg-config", pkg-config)))
+   (home-page (string-append "https://github.com/"
+              "KhronosGroup/Vulkan-LoaderAndValidationLayers"))
+   (synopsis "Khronos official ICD loader for Vulkan")
+   (description "Vulkan-ICD-Loader provides Khronos official ICD loader and
+validation layers for Vulkan developers on GNU/Linux.")
+   (license license:asl2.0)))
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#29625] [PATCH core-updates] Vulkan patch series.
  2017-12-09 13:54 [bug#29625] [PATCH core-updates] Vulkan patch series Rutger Helling
@ 2017-12-10 10:41 ` Rutger Helling
  2017-12-13 18:30 ` Marius Bakke
  1 sibling, 0 replies; 8+ messages in thread
From: Rutger Helling @ 2017-12-10 10:41 UTC (permalink / raw)
  To: 29625


[-- Attachment #1.1: Type: text/plain, Size: 1052 bytes --]

I'm sending in one additional patch for this series that enables Vulkan
on retroarch (#7).
I tested the Vulkan video backend and it works. 

For convenience I've re-sent the other six patches in this mail too. 

On 2017-12-09 14:54, Rutger Helling wrote:

> Hey Guix,
> 
> this patch series adds Vulkan support for mesa on x86_64-linux and adds a few new packages.
> Since a rebuild of mesa is necessary I'm sending it in for core-updates.
> 
> Here's a short explanation of all the patches:
> #1: Add Vulkan support to mesa on x86_64-linux. On i686-linux mesa didn't build unfortunately.
> I haven't tried other architectures.
> #2: Add vulkan.scm to gnu/local.mk.
> #3: Create vulkan.scm and add spirv-headers.
> #4: Add spirv-tools to vulkan.scm.
> #5: Add glslang to vulkan.scm.
> #6: Add vulkan-icd-loader to vulkan.scm.
> This provides the 'vulkaninfo' tool that you can use to query if your system is Vulkan-capable.
> 
> I tested it out after a full rebuild on a Vulkan-capable system.
> 'vulkaninfo' showed Vulkan was available on that system.

[-- Attachment #1.2: Type: text/html, Size: 2359 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0007-gnu-retroarch-Enable-Vulkan-support.patch --]
[-- Type: text/x-diff; name=0007-gnu-retroarch-Enable-Vulkan-support.patch, Size: 1880 bytes --]

From 3b45c0ea6d35a0fa7895344fe53758fb4b64d00f Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Sun, 10 Dec 2017 11:15:03 +0100
Subject: [PATCH] gnu: retroarch: Enable Vulkan support.

* gnu/packages/games.scm (retroarch)[arguments]: Hard-code the path to
libvulkan.so. [native-inputs]: Add vulkan-icd-loader.
---
 gnu/packages/games.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 524572b99..2c86c6b78 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -134,6 +134,7 @@
   #:use-module (gnu packages gnuzilla)
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages vulkan)
   #:use-module (gnu packages web)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
@@ -1446,6 +1447,10 @@ either by Infocom or created using the Inform compiler.")
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (etc (string-append out "/etc")))
+               ;; Hard-code the path to libvulkan.so.
+               (substitute* "gfx/common/vulkan_common.c"
+                 (("libvulkan.so") (string-append (assoc-ref %build-inputs
+                  "vulkan-icd-loader") "/lib/libvulkan.so")))
                (substitute* "qb/qb.libs.sh"
                  (("/bin/true") (which "true")))
                ;; The configure script does not yet accept the extra arguments
@@ -1472,6 +1477,7 @@ either by Infocom or created using the Inform compiler.")
        ("zlib" ,zlib)))
     (native-inputs
      `(("pkg-config" ,pkg-config)
+       ("vulkan-icd-loader" ,vulkan-icd-loader)
        ("which" ,which)))
     (home-page "https://www.libretro.com/")
     (synopsis "Reference frontend for the libretro API")
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-gnu-mesa-Enable-Vulkan-drivers-for-Intel-and-Radeon-.patch --]
[-- Type: text/x-diff; name=0001-gnu-mesa-Enable-Vulkan-drivers-for-Intel-and-Radeon-.patch, Size: 2061 bytes --]

From cb4266a1a21f4e16d4d32bbca683b5aae938986d Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Sat, 9 Dec 2017 00:28:36 +0100
Subject: [PATCH] gnu: mesa: Enable Vulkan drivers for Intel and Radeon on
 x86-64.

* gnu/packages/gl.scm (mesa)[arguments]: Add
"--with-vulkan-drivers=intel,radeon" to configure-flags for
x86_64-linux. [synopsis]: Mention Vulkan. [description]: Mention Vulkan.
---
 gnu/packages/gl.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 005b49b86..b18861eb7 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -296,6 +296,13 @@ also known as DXTn or DXTC) for Mesa.")
          ;; are stuck at OpenGL 2.1 instead of OpenGL 3.0+.
          "--enable-texture-float"
 
+         ;; Enable Vulkan on x86-64.
+         ,@(match (%current-system)
+             ((or "x86_64-linux")
+                '("--with-vulkan-drivers=intel,radeon"))
+             (_
+              '("")))
+
          ;; Also enable the tests.
          "--enable-gallium-tests"
 
@@ -343,11 +350,11 @@ also known as DXTn or DXTC) for Mesa.")
                   (string-append "\"" out "/lib/dri/gbm_dri.so")))
                #t))))))
     (home-page "https://mesa3d.org/")
-    (synopsis "OpenGL implementation")
-    (description "Mesa is a free implementation of the OpenGL specification -
-a system for rendering interactive 3D graphics.  A variety of device drivers
-allows Mesa to be used in many different environments ranging from software
-emulation to complete hardware acceleration for modern GPUs.")
+    (synopsis "OpenGL and Vulkan implementations")
+    (description "Mesa is a free implementation of the OpenGL and Vulkan
+specifications - systems for rendering interactive 3D graphics.  A variety of
+device drivers allows Mesa to be used in many different environments ranging
+from software emulation to complete hardware acceleration for modern GPUs.")
     (license license:x11)))
 
 (define-public mesa-headers
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0002-gnu-local.mk-Add-vulkan.scm.patch --]
[-- Type: text/x-diff; name=0002-gnu-local.mk-Add-vulkan.scm.patch, Size: 677 bytes --]

From 35b07f1e24c8597bdd504ae9f986abed486cb8df Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 13:39:16 +0100
Subject: [PATCH] gnu: local.mk: Add vulkan.scm.

* gnu/local.mk: Add vulkan.scm.
---
 gnu/local.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index a0e3f6ebe..51876487d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -418,6 +418,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/vim.scm				\
   %D%/packages/virtualization.scm		\
   %D%/packages/vpn.scm				\
+  %D%/packages/vulkan.scm				\
   %D%/packages/w3m.scm				\
   %D%/packages/wdiff.scm			\
   %D%/packages/web.scm				\
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0003-gnu-vulkan-Add-spirv-headers.patch --]
[-- Type: text/x-diff; name=0003-gnu-vulkan-Add-spirv-headers.patch, Size: 3194 bytes --]

From 043a4adbcf2023cb5b610bb9cb6529aca76c2922 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 14:10:36 +0100
Subject: [PATCH] gnu: vulkan: Add spirv-headers.

* gnu/packages/vulkan.scm: Create file. (spirv-headers): New variable.
---
 gnu/packages/vulkan.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 gnu/packages/vulkan.scm

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
new file mode 100644
index 000000000..2079b8e0a
--- /dev/null
+++ b/gnu/packages/vulkan.scm
@@ -0,0 +1,59 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages vulkan)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
+  #:use-module (gnu packages))
+
+(define-public spirv-headers
+  (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
+        (revision "1"))
+    (package
+     (name "spirv-headers")
+     (version (string-append "0.0-" revision "." (string-take commit 9)))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/SPIRV-Headers")
+             (commit commit)))
+       (sha256
+        (base32
+         "15bknwkv3xwmjs3lmkp282a1wrp0da1b4lp45i4yiav04zmqygj2"))
+       (file-name (string-append name "-" version "-checkout"))))
+     (build-system cmake-build-system)
+     (arguments
+      `(#:tests? #f ;; No tests
+        #:phases (modify-phases %standard-phases
+                   (replace 'install
+                     (lambda*
+                       (#:key outputs #:allow-other-keys)
+                         (system* "cmake" "-E" "copy_directory"
+                                  "../source/include/spirv" (string-append
+                                  (assoc-ref outputs "out")
+                                  "/include/spirv")))))))
+     (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
+     (synopsis "Machine-readable files from the SPIR-V Registry")
+     (description "SPIRV-Headers is a repository containing machine-readable
+files from the SPIR-V Registry.")
+     (license license:x11-style)))) ;; Custom license. See
+     ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
+     ;; details.
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0004-gnu-vulkan-Add-spirv-tools.patch --]
[-- Type: text/x-diff; name=0004-gnu-vulkan-Add-spirv-tools.patch, Size: 2525 bytes --]

From 80e82f1f92823e04893e8400dc82b69e890c7276 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 14:56:36 +0100
Subject: [PATCH] gnu: vulkan: Add spirv-tools.

* gnu/packages/vulkan.scm (spirv-tools): New variable.
---
 gnu/packages/vulkan.scm | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 2079b8e0a..248dc206c 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -19,9 +19,12 @@
 (define-module (gnu packages vulkan)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
-  #:use-module (gnu packages))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python))
 
 (define-public spirv-headers
   (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
@@ -57,3 +60,33 @@ files from the SPIR-V Registry.")
      (license license:x11-style)))) ;; Custom license. See
      ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
      ;; details.
+
+(define-public spirv-tools
+  (package
+   (name "spirv-tools")
+   (version "2017.1")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (string-append "https://github.com/KhronosGroup/SPIRV-Tools/archive/v"
+           version ".tar.gz"))
+     (sha256
+      (base32
+       "009vflaa71a7xhvmm23f4sdbcgdkl1k4facqkwsg6djha2sdpsqq"))
+     (file-name (string-append name "-" version ".tar.gz"))))
+   (build-system cmake-build-system)
+   (arguments
+    `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
+                                             (assoc-ref %outputs "out")
+                                             "/lib")
+                              (string-append "-DSPIRV-Headers_SOURCE_DIR="
+                                             (assoc-ref %build-inputs
+                                                        "spirv-headers")))))
+   (inputs `(("python" ,python)
+             ("spirv-headers" ,spirv-headers)))
+   (native-inputs `(("pkg-config", pkg-config)))
+   (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
+   (synopsis "API and commands for processing SPIR-V modules")
+   (description "The SPIR-V Tools project provides an API and commands for
+processing SPIR-V modules.")
+   (license license:asl2.0)))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0005-gnu-vulkan-Add-glslang.patch --]
[-- Type: text/x-diff; name=0005-gnu-vulkan-Add-glslang.patch, Size: 2577 bytes --]

From dd17b03c487b64212fae77a406075fc83514a369 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 15:56:34 +0100
Subject: [PATCH] gnu: vulkan: Add glslang.

* gnu/packages/vulkan.scm (glslang): New variable.
---
 gnu/packages/vulkan.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 248dc206c..03562e45d 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -23,6 +23,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python))
 
@@ -90,3 +91,41 @@ files from the SPIR-V Registry.")
    (description "The SPIR-V Tools project provides an API and commands for
 processing SPIR-V modules.")
    (license license:asl2.0)))
+
+(define-public glslang
+  ;; Version 3.0 is too old for vulkan-icd-loader. Use a recent git commit
+  ;; until the next stable version.
+  (let ((commit "471bfed0621162a7513fc24a51e8a1ccc2e640ff")
+        (revision "1"))
+    (package
+     (name "glslang")
+     (version (string-append "0.0-" revision "." (string-take commit 9)))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/glslang")
+             (commit commit)))
+       (sha256
+        (base32
+         "0m2vljmrqppp80ghbbwfnayqw2canxlcjhgy6jw9xjdssln0d3pd"))
+       (file-name (string-append name "-" version "-checkout"))))
+     (build-system cmake-build-system)
+     (arguments
+      `(#:tests? #f ;; No tests
+        ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
+        ;; offending line.
+        #:phases (modify-phases %standard-phases
+                   (add-after 'patch-source-shebangs 'fix-cmakelists
+                     (lambda _
+                       (substitute* "CMakeLists.txt"
+                                    (("set.*CMAKE_INSTALL_PREFIX.*") "")))))))
+   (inputs `(("bison" ,bison)))
+   (native-inputs `(("pkg-config" ,pkg-config)))
+   (home-page "https://github.com/KhronosGroup/glslang")
+   (synopsis "OpenGL and OpenGL ES shader front end and validator")
+   (description "glslang is a OpenGL and OpenGL ES shader front end and
+validator.")
+   ;; Modified BSD license. See "copyright" section of
+   ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
+   (license license:bsd-3))))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0006-gnu-vulkan-Add-vulkan-icd-loader.patch --]
[-- Type: text/x-diff; name=0006-gnu-vulkan-Add-vulkan-icd-loader.patch, Size: 2506 bytes --]

From 0172d3cb7cbdae03f143a4c7966c4694e69eea15 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 16:06:05 +0100
Subject: [PATCH] gnu: vulkan: Add vulkan-icd-loader.

* gnu/packages/vulkan.scm (vulkan-icd-loader): New variable.
---
 gnu/packages/vulkan.scm | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 03562e45d..d8fa616f2 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -24,8 +24,11 @@
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages pkg-config)
-  #:use-module (gnu packages python))
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages xorg))
 
 (define-public spirv-headers
   (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
@@ -129,3 +132,37 @@ validator.")
    ;; Modified BSD license. See "copyright" section of
    ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
    (license license:bsd-3))))
+
+(define-public vulkan-icd-loader
+  (package
+   (name "vulkan-icd-loader")
+   (version "1.0.61.1")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (string-append
+           "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/"
+           "archive/sdk-" version ".tar.gz"))
+     (sha256
+      (base32
+       "05g60hk30sbc4rwkh7nrgqdk6hfsi4hwxs54yrysrzr18xpfb8j7"))))
+   (build-system cmake-build-system)
+   (arguments
+    `(#:tests? #f ;; No tests
+      #:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
+                                (assoc-ref %outputs "out") "/lib"))))
+   (inputs `(("glslang" ,glslang)
+             ("libxcb" ,libxcb)
+             ("libx11" ,libx11)
+             ("libxrandr" ,libxrandr)
+             ("mesa" ,mesa)
+             ("python" ,python)
+             ("spirv-tools" ,spirv-tools)
+             ("wayland" ,wayland)))
+   (native-inputs `(("pkg-config", pkg-config)))
+   (home-page (string-append "https://github.com/"
+              "KhronosGroup/Vulkan-LoaderAndValidationLayers"))
+   (synopsis "Khronos official ICD loader for Vulkan")
+   (description "Vulkan-ICD-Loader provides Khronos official ICD loader and
+validation layers for Vulkan developers on GNU/Linux.")
+   (license license:asl2.0)))
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#29625] [PATCH core-updates] Vulkan patch series.
  2017-12-09 13:54 [bug#29625] [PATCH core-updates] Vulkan patch series Rutger Helling
  2017-12-10 10:41 ` Rutger Helling
@ 2017-12-13 18:30 ` Marius Bakke
  2017-12-14 22:26   ` Rutger Helling
  1 sibling, 1 reply; 8+ messages in thread
From: Marius Bakke @ 2017-12-13 18:30 UTC (permalink / raw)
  To: Rutger Helling, 29625

[-- Attachment #1: Type: text/plain, Size: 12875 bytes --]

Hi Rutger,

Rutger Helling <rhelling@mykolab.com> writes:

> Hey Guix,
>
> this patch series adds Vulkan support for mesa on x86_64-linux and adds 
> a few new packages.
> Since a rebuild of mesa is necessary I'm sending it in for core-updates.

That is excellent, thank you!

> Here's a short explanation of all the patches:
> #1: Add Vulkan support to mesa on x86_64-linux. On i686-linux mesa 
> didn't build unfortunately.
> I haven't tried other architectures.
> #2: Add vulkan.scm to gnu/local.mk.
> #3: Create vulkan.scm and add spirv-headers.
> #4: Add spirv-tools to vulkan.scm.
> #5: Add glslang to vulkan.scm.
> #6: Add vulkan-icd-loader to vulkan.scm.
> This provides the 'vulkaninfo' tool that you can use to query if your 
> system is Vulkan-capable.
>
> I tested it out after a full rebuild on a Vulkan-capable system.
> 'vulkaninfo' showed Vulkan was available on that system.

Great!  Unfortunately the mesa patch did not apply for me, can you
rebase this series on current 'core-updates'?  We've had some trouble
getting Hydra started on it, so we can probably squeeze this in.

Some comments..

> From cb4266a1a21f4e16d4d32bbca683b5aae938986d Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Sat, 9 Dec 2017 00:28:36 +0100
> Subject: [PATCH] gnu: mesa: Enable Vulkan drivers for Intel and Radeon on
>  x86-64.
>
> * gnu/packages/gl.scm (mesa)[arguments]: Add
> "--with-vulkan-drivers=intel,radeon" to configure-flags for
> x86_64-linux. [synopsis]: Mention Vulkan. [description]: Mention Vulkan.

Please add line breaks between the various commit message "fields".

> ---
>  gnu/packages/gl.scm | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
> index 005b49b86..b18861eb7 100644
> --- a/gnu/packages/gl.scm
> +++ b/gnu/packages/gl.scm
> @@ -296,6 +296,13 @@ also known as DXTn or DXTC) for Mesa.")
>           ;; are stuck at OpenGL 2.1 instead of OpenGL 3.0+.
>           "--enable-texture-float"
>  
> +         ;; Enable Vulkan on x86-64.
> +         ,@(match (%current-system)
> +             ((or "x86_64-linux")
> +                '("--with-vulkan-drivers=intel,radeon"))
> +             (_
> +              '("")))
> +
>           ;; Also enable the tests.
>           "--enable-gallium-tests"
>  
> @@ -343,11 +350,11 @@ also known as DXTn or DXTC) for Mesa.")
>                    (string-append "\"" out "/lib/dri/gbm_dri.so")))
>                 #t))))))
>      (home-page "https://mesa3d.org/")
> -    (synopsis "OpenGL implementation")
> -    (description "Mesa is a free implementation of the OpenGL specification -
> -a system for rendering interactive 3D graphics.  A variety of device drivers
> -allows Mesa to be used in many different environments ranging from software
> -emulation to complete hardware acceleration for modern GPUs.")
> +    (synopsis "OpenGL and Vulkan implementations")
> +    (description "Mesa is a free implementation of the OpenGL and Vulkan
> +specifications - systems for rendering interactive 3D graphics.  A variety of
> +device drivers allows Mesa to be used in many different environments ranging
> +from software emulation to complete hardware acceleration for modern GPUs.")
>      (license license:x11)))
>  
>  (define-public mesa-headers
> -- 
> 2.15.1
>
> From 35b07f1e24c8597bdd504ae9f986abed486cb8df Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Fri, 8 Dec 2017 13:39:16 +0100
> Subject: [PATCH] gnu: local.mk: Add vulkan.scm.
>
> * gnu/local.mk: Add vulkan.scm.
> ---
>  gnu/local.mk | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index a0e3f6ebe..51876487d 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -418,6 +418,7 @@ GNU_SYSTEM_MODULES =				\
>    %D%/packages/vim.scm				\
>    %D%/packages/virtualization.scm		\
>    %D%/packages/vpn.scm				\
> +  %D%/packages/vulkan.scm				\
>    %D%/packages/w3m.scm				\
>    %D%/packages/wdiff.scm			\
>    %D%/packages/web.scm				\
> -- 
> 2.15.1
>
> From 043a4adbcf2023cb5b610bb9cb6529aca76c2922 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Fri, 8 Dec 2017 14:10:36 +0100
> Subject: [PATCH] gnu: vulkan: Add spirv-headers.
>
> * gnu/packages/vulkan.scm: Create file. (spirv-headers): New variable.
> ---
>  gnu/packages/vulkan.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 59 insertions(+)
>  create mode 100644 gnu/packages/vulkan.scm
>
> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
> new file mode 100644
> index 000000000..2079b8e0a
> --- /dev/null
> +++ b/gnu/packages/vulkan.scm
> @@ -0,0 +1,59 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages vulkan)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix packages)
> +  #:use-module (guix git-download)
> +  #:use-module (guix build-system cmake)
> +  #:use-module (gnu packages))
> +
> +(define-public spirv-headers
> +  (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
> +        (revision "1"))
> +    (package
> +     (name "spirv-headers")
> +     (version (string-append "0.0-" revision "." (string-take commit 9)))
> +     (source
> +      (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/KhronosGroup/SPIRV-Headers")
> +             (commit commit)))
> +       (sha256
> +        (base32
> +         "15bknwkv3xwmjs3lmkp282a1wrp0da1b4lp45i4yiav04zmqygj2"))
> +       (file-name (string-append name "-" version "-checkout"))))
> +     (build-system cmake-build-system)
> +     (arguments
> +      `(#:tests? #f ;; No tests
> +        #:phases (modify-phases %standard-phases
> +                   (replace 'install
> +                     (lambda*
> +                       (#:key outputs #:allow-other-keys)
> +                         (system* "cmake" "-E" "copy_directory"
> +                                  "../source/include/spirv" (string-append
> +                                  (assoc-ref outputs "out")
> +                                  "/include/spirv")))))))

Please use (zero? (system* ...)) here so the return value is checked.

> +     (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
> +     (synopsis "Machine-readable files from the SPIR-V Registry")
> +     (description "SPIRV-Headers is a repository containing machine-readable
> +files from the SPIR-V Registry.")
> +     (license license:x11-style)))) ;; Custom license. See
> +     ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
> +     ;; details.

You can use the 'non-copyleft' procedure here.

> -- 
> 2.15.1
>
> From 80e82f1f92823e04893e8400dc82b69e890c7276 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Fri, 8 Dec 2017 14:56:36 +0100
> Subject: [PATCH] gnu: vulkan: Add spirv-tools.
>
> * gnu/packages/vulkan.scm (spirv-tools): New variable.
> ---
>  gnu/packages/vulkan.scm | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
> index 2079b8e0a..248dc206c 100644
> --- a/gnu/packages/vulkan.scm
> +++ b/gnu/packages/vulkan.scm
> @@ -19,9 +19,12 @@
>  (define-module (gnu packages vulkan)
>    #:use-module ((guix licenses) #:prefix license:)
>    #:use-module (guix packages)
> +  #:use-module (guix download)
>    #:use-module (guix git-download)
>    #:use-module (guix build-system cmake)
> -  #:use-module (gnu packages))
> +  #:use-module (gnu packages)
> +  #:use-module (gnu packages pkg-config)
> +  #:use-module (gnu packages python))
>  
>  (define-public spirv-headers
>    (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
> @@ -57,3 +60,33 @@ files from the SPIR-V Registry.")
>       (license license:x11-style)))) ;; Custom license. See
>       ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
>       ;; details.
> +
> +(define-public spirv-tools
> +  (package
> +   (name "spirv-tools")
> +   (version "2017.1")
> +   (source
> +    (origin
> +     (method url-fetch)
> +     (uri (string-append "https://github.com/KhronosGroup/SPIRV-Tools/archive/v"
> +           version ".tar.gz"))
> +     (sha256
> +      (base32
> +       "009vflaa71a7xhvmm23f4sdbcgdkl1k4facqkwsg6djha2sdpsqq"))
> +     (file-name (string-append name "-" version ".tar.gz"))))
> +   (build-system cmake-build-system)
> +   (arguments
> +    `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
> +                                             (assoc-ref %outputs "out")
> +                                             "/lib")
> +                              (string-append "-DSPIRV-Headers_SOURCE_DIR="
> +                                             (assoc-ref %build-inputs
> +                                                        "spirv-headers")))))
> +   (inputs `(("python" ,python)
> +             ("spirv-headers" ,spirv-headers)))
> +   (native-inputs `(("pkg-config", pkg-config)))
> +   (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
> +   (synopsis "API and commands for processing SPIR-V modules")
> +   (description "The SPIR-V Tools project provides an API and commands for
> +processing SPIR-V modules.")
> +   (license license:asl2.0)))
> -- 
> 2.15.1
>
> From dd17b03c487b64212fae77a406075fc83514a369 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Fri, 8 Dec 2017 15:56:34 +0100
> Subject: [PATCH] gnu: vulkan: Add glslang.
>
> * gnu/packages/vulkan.scm (glslang): New variable.
> ---
>  gnu/packages/vulkan.scm | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>
> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
> index 248dc206c..03562e45d 100644
> --- a/gnu/packages/vulkan.scm
> +++ b/gnu/packages/vulkan.scm
> @@ -23,6 +23,7 @@
>    #:use-module (guix git-download)
>    #:use-module (guix build-system cmake)
>    #:use-module (gnu packages)
> +  #:use-module (gnu packages bison)
>    #:use-module (gnu packages pkg-config)
>    #:use-module (gnu packages python))
>  
> @@ -90,3 +91,41 @@ files from the SPIR-V Registry.")
>     (description "The SPIR-V Tools project provides an API and commands for
>  processing SPIR-V modules.")
>     (license license:asl2.0)))
> +
> +(define-public glslang
> +  ;; Version 3.0 is too old for vulkan-icd-loader. Use a recent git commit
> +  ;; until the next stable version.
> +  (let ((commit "471bfed0621162a7513fc24a51e8a1ccc2e640ff")
> +        (revision "1"))
> +    (package
> +     (name "glslang")
> +     (version (string-append "0.0-" revision "." (string-take commit 9)))
> +     (source
> +      (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/KhronosGroup/glslang")
> +             (commit commit)))
> +       (sha256
> +        (base32
> +         "0m2vljmrqppp80ghbbwfnayqw2canxlcjhgy6jw9xjdssln0d3pd"))
> +       (file-name (string-append name "-" version "-checkout"))))
> +     (build-system cmake-build-system)
> +     (arguments
> +      `(#:tests? #f ;; No tests
> +        ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
> +        ;; offending line.
> +        #:phases (modify-phases %standard-phases
> +                   (add-after 'patch-source-shebangs 'fix-cmakelists
> +                     (lambda _
> +                       (substitute* "CMakeLists.txt"
> +                                    (("set.*CMAKE_INSTALL_PREFIX.*") "")))))))

Return #t here since (substitute* ...) has an undefined return value.

The rest LGTM at a cursory glance.  Can you send updated patches?

TIA!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#29625] [PATCH core-updates] Vulkan patch series.
  2017-12-13 18:30 ` Marius Bakke
@ 2017-12-14 22:26   ` Rutger Helling
  2017-12-18  0:26     ` bug#29625: " Marius Bakke
  0 siblings, 1 reply; 8+ messages in thread
From: Rutger Helling @ 2017-12-14 22:26 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 29625


[-- Attachment #1.1: Type: text/plain, Size: 12994 bytes --]

Hey Marius, 

thanks for the feedback!
I've changed the patches and made sure they work on the latest
core-updates commit. 

On 2017-12-13 19:30, Marius Bakke wrote:

> Hi Rutger,
> 
> Rutger Helling <rhelling@mykolab.com> writes:
> 
>> Hey Guix,
>> 
>> this patch series adds Vulkan support for mesa on x86_64-linux and adds 
>> a few new packages.
>> Since a rebuild of mesa is necessary I'm sending it in for core-updates.
> 
> That is excellent, thank you!
> 
>> Here's a short explanation of all the patches:
>> #1: Add Vulkan support to mesa on x86_64-linux. On i686-linux mesa 
>> didn't build unfortunately.
>> I haven't tried other architectures.
>> #2: Add vulkan.scm to gnu/local.mk.
>> #3: Create vulkan.scm and add spirv-headers.
>> #4: Add spirv-tools to vulkan.scm.
>> #5: Add glslang to vulkan.scm.
>> #6: Add vulkan-icd-loader to vulkan.scm.
>> This provides the 'vulkaninfo' tool that you can use to query if your 
>> system is Vulkan-capable.
>> 
>> I tested it out after a full rebuild on a Vulkan-capable system.
>> 'vulkaninfo' showed Vulkan was available on that system.
> 
> Great!  Unfortunately the mesa patch did not apply for me, can you
> rebase this series on current 'core-updates'?  We've had some trouble
> getting Hydra started on it, so we can probably squeeze this in.
> 
> Some comments..
> 
>> From cb4266a1a21f4e16d4d32bbca683b5aae938986d Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Sat, 9 Dec 2017 00:28:36 +0100
>> Subject: [PATCH] gnu: mesa: Enable Vulkan drivers for Intel and Radeon on
>> x86-64.
>> 
>> * gnu/packages/gl.scm (mesa)[arguments]: Add
>> "--with-vulkan-drivers=intel,radeon" to configure-flags for
>> x86_64-linux. [synopsis]: Mention Vulkan. [description]: Mention Vulkan.
> 
> Please add line breaks between the various commit message "fields".
> 
>> ---
>> gnu/packages/gl.scm | 17 ++++++++++++-----
>> 1 file changed, 12 insertions(+), 5 deletions(-)
>> 
>> diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
>> index 005b49b86..b18861eb7 100644
>> --- a/gnu/packages/gl.scm
>> +++ b/gnu/packages/gl.scm
>> @@ -296,6 +296,13 @@ also known as DXTn or DXTC) for Mesa.")
>> ;; are stuck at OpenGL 2.1 instead of OpenGL 3.0+.
>> "--enable-texture-float"
>> 
>> +         ;; Enable Vulkan on x86-64.
>> +         ,@(match (%current-system)
>> +             ((or "x86_64-linux")
>> +                '("--with-vulkan-drivers=intel,radeon"))
>> +             (_
>> +              '("")))
>> +
>> ;; Also enable the tests.
>> "--enable-gallium-tests"
>> 
>> @@ -343,11 +350,11 @@ also known as DXTn or DXTC) for Mesa.")
>> (string-append "\"" out "/lib/dri/gbm_dri.so")))
>> #t))))))
>> (home-page "https://mesa3d.org/")
>> -    (synopsis "OpenGL implementation")
>> -    (description "Mesa is a free implementation of the OpenGL specification -
>> -a system for rendering interactive 3D graphics.  A variety of device drivers
>> -allows Mesa to be used in many different environments ranging from software
>> -emulation to complete hardware acceleration for modern GPUs.")
>> +    (synopsis "OpenGL and Vulkan implementations")
>> +    (description "Mesa is a free implementation of the OpenGL and Vulkan
>> +specifications - systems for rendering interactive 3D graphics.  A variety of
>> +device drivers allows Mesa to be used in many different environments ranging
>> +from software emulation to complete hardware acceleration for modern GPUs.")
>> (license license:x11)))
>> 
>> (define-public mesa-headers
>> -- 
>> 2.15.1
>> 
>> From 35b07f1e24c8597bdd504ae9f986abed486cb8df Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Fri, 8 Dec 2017 13:39:16 +0100
>> Subject: [PATCH] gnu: local.mk: Add vulkan.scm.
>> 
>> * gnu/local.mk: Add vulkan.scm.
>> ---
>> gnu/local.mk | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/gnu/local.mk b/gnu/local.mk
>> index a0e3f6ebe..51876487d 100644
>> --- a/gnu/local.mk
>> +++ b/gnu/local.mk
>> @@ -418,6 +418,7 @@ GNU_SYSTEM_MODULES =                \
>> %D%/packages/vim.scm                \
>> %D%/packages/virtualization.scm        \
>> %D%/packages/vpn.scm                \
>> +  %D%/packages/vulkan.scm                \
>> %D%/packages/w3m.scm                \
>> %D%/packages/wdiff.scm            \
>> %D%/packages/web.scm                \
>> -- 
>> 2.15.1
>> 
>> From 043a4adbcf2023cb5b610bb9cb6529aca76c2922 Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Fri, 8 Dec 2017 14:10:36 +0100
>> Subject: [PATCH] gnu: vulkan: Add spirv-headers.
>> 
>> * gnu/packages/vulkan.scm: Create file. (spirv-headers): New variable.
>> ---
>> gnu/packages/vulkan.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 59 insertions(+)
>> create mode 100644 gnu/packages/vulkan.scm
>> 
>> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
>> new file mode 100644
>> index 000000000..2079b8e0a
>> --- /dev/null
>> +++ b/gnu/packages/vulkan.scm
>> @@ -0,0 +1,59 @@
>> +;;; GNU Guix --- Functional package management for GNU
>> +;;; Copyright (c) 2017 Rutger Helling <rhelling@mykolab.com>
>> +;;;
>> +;;; This file is part of GNU Guix.
>> +;;;
>> +;;; GNU Guix is free software; you can redistribute it and/or modify it
>> +;;; under the terms of the GNU General Public License as published by
>> +;;; the Free Software Foundation; either version 3 of the License, or (at
>> +;;; your option) any later version.
>> +;;;
>> +;;; GNU Guix is distributed in the hope that it will be useful, but
>> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
>> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +;;; GNU General Public License for more details.
>> +;;;
>> +;;; You should have received a copy of the GNU General Public License
>> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
>> +
>> +(define-module (gnu packages vulkan)
>> +  #:use-module ((guix licenses) #:prefix license:)
>> +  #:use-module (guix packages)
>> +  #:use-module (guix git-download)
>> +  #:use-module (guix build-system cmake)
>> +  #:use-module (gnu packages))
>> +
>> +(define-public spirv-headers
>> +  (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
>> +        (revision "1"))
>> +    (package
>> +     (name "spirv-headers")
>> +     (version (string-append "0.0-" revision "." (string-take commit 9)))
>> +     (source
>> +      (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/KhronosGroup/SPIRV-Headers")
>> +             (commit commit)))
>> +       (sha256
>> +        (base32
>> +         "15bknwkv3xwmjs3lmkp282a1wrp0da1b4lp45i4yiav04zmqygj2"))
>> +       (file-name (string-append name "-" version "-checkout"))))
>> +     (build-system cmake-build-system)
>> +     (arguments
>> +      `(#:tests? #f ;; No tests
>> +        #:phases (modify-phases %standard-phases
>> +                   (replace 'install
>> +                     (lambda*
>> +                       (#:key outputs #:allow-other-keys)
>> +                         (system* "cmake" "-E" "copy_directory"
>> +                                  "../source/include/spirv" (string-append
>> +                                  (assoc-ref outputs "out")
>> +                                  "/include/spirv")))))))
> 
> Please use (zero? (system* ...)) here so the return value is checked.
> 
>> +     (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
>> +     (synopsis "Machine-readable files from the SPIR-V Registry")
>> +     (description "SPIRV-Headers is a repository containing machine-readable
>> +files from the SPIR-V Registry.")
>> +     (license license:x11-style)))) ;; Custom license. See
>> +     ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
>> +     ;; details.
> 
> You can use the 'non-copyleft' procedure here.
> 
>> -- 
>> 2.15.1
>> 
>> From 80e82f1f92823e04893e8400dc82b69e890c7276 Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Fri, 8 Dec 2017 14:56:36 +0100
>> Subject: [PATCH] gnu: vulkan: Add spirv-tools.
>> 
>> * gnu/packages/vulkan.scm (spirv-tools): New variable.
>> ---
>> gnu/packages/vulkan.scm | 35 ++++++++++++++++++++++++++++++++++-
>> 1 file changed, 34 insertions(+), 1 deletion(-)
>> 
>> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
>> index 2079b8e0a..248dc206c 100644
>> --- a/gnu/packages/vulkan.scm
>> +++ b/gnu/packages/vulkan.scm
>> @@ -19,9 +19,12 @@
>> (define-module (gnu packages vulkan)
>> #:use-module ((guix licenses) #:prefix license:)
>> #:use-module (guix packages)
>> +  #:use-module (guix download)
>> #:use-module (guix git-download)
>> #:use-module (guix build-system cmake)
>> -  #:use-module (gnu packages))
>> +  #:use-module (gnu packages)
>> +  #:use-module (gnu packages pkg-config)
>> +  #:use-module (gnu packages python))
>> 
>> (define-public spirv-headers
>> (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
>> @@ -57,3 +60,33 @@ files from the SPIR-V Registry.")
>> (license license:x11-style)))) ;; Custom license. See
>> ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
>> ;; details.
>> +
>> +(define-public spirv-tools
>> +  (package
>> +   (name "spirv-tools")
>> +   (version "2017.1")
>> +   (source
>> +    (origin
>> +     (method url-fetch)
>> +     (uri (string-append "https://github.com/KhronosGroup/SPIRV-Tools/archive/v"
>> +           version ".tar.gz"))
>> +     (sha256
>> +      (base32
>> +       "009vflaa71a7xhvmm23f4sdbcgdkl1k4facqkwsg6djha2sdpsqq"))
>> +     (file-name (string-append name "-" version ".tar.gz"))))
>> +   (build-system cmake-build-system)
>> +   (arguments
>> +    `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
>> +                                             (assoc-ref %outputs "out")
>> +                                             "/lib")
>> +                              (string-append "-DSPIRV-Headers_SOURCE_DIR="
>> +                                             (assoc-ref %build-inputs
>> +                                                        "spirv-headers")))))
>> +   (inputs `(("python" ,python)
>> +             ("spirv-headers" ,spirv-headers)))
>> +   (native-inputs `(("pkg-config", pkg-config)))
>> +   (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
>> +   (synopsis "API and commands for processing SPIR-V modules")
>> +   (description "The SPIR-V Tools project provides an API and commands for
>> +processing SPIR-V modules.")
>> +   (license license:asl2.0)))
>> -- 
>> 2.15.1
>> 
>> From dd17b03c487b64212fae77a406075fc83514a369 Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Fri, 8 Dec 2017 15:56:34 +0100
>> Subject: [PATCH] gnu: vulkan: Add glslang.
>> 
>> * gnu/packages/vulkan.scm (glslang): New variable.
>> ---
>> gnu/packages/vulkan.scm | 39 +++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 39 insertions(+)
>> 
>> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
>> index 248dc206c..03562e45d 100644
>> --- a/gnu/packages/vulkan.scm
>> +++ b/gnu/packages/vulkan.scm
>> @@ -23,6 +23,7 @@
>> #:use-module (guix git-download)
>> #:use-module (guix build-system cmake)
>> #:use-module (gnu packages)
>> +  #:use-module (gnu packages bison)
>> #:use-module (gnu packages pkg-config)
>> #:use-module (gnu packages python))
>> 
>> @@ -90,3 +91,41 @@ files from the SPIR-V Registry.")
>> (description "The SPIR-V Tools project provides an API and commands for
>> processing SPIR-V modules.")
>> (license license:asl2.0)))
>> +
>> +(define-public glslang
>> +  ;; Version 3.0 is too old for vulkan-icd-loader. Use a recent git commit
>> +  ;; until the next stable version.
>> +  (let ((commit "471bfed0621162a7513fc24a51e8a1ccc2e640ff")
>> +        (revision "1"))
>> +    (package
>> +     (name "glslang")
>> +     (version (string-append "0.0-" revision "." (string-take commit 9)))
>> +     (source
>> +      (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/KhronosGroup/glslang")
>> +             (commit commit)))
>> +       (sha256
>> +        (base32
>> +         "0m2vljmrqppp80ghbbwfnayqw2canxlcjhgy6jw9xjdssln0d3pd"))
>> +       (file-name (string-append name "-" version "-checkout"))))
>> +     (build-system cmake-build-system)
>> +     (arguments
>> +      `(#:tests? #f ;; No tests
>> +        ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
>> +        ;; offending line.
>> +        #:phases (modify-phases %standard-phases
>> +                   (add-after 'patch-source-shebangs 'fix-cmakelists
>> +                     (lambda _
>> +                       (substitute* "CMakeLists.txt"
>> +                                    (("set.*CMAKE_INSTALL_PREFIX.*") "")))))))
> 
> Return #t here since (substitute* ...) has an undefined return value.
> 
> The rest LGTM at a cursory glance.  Can you send updated patches?
> 
> TIA!

[-- Attachment #1.2: Type: text/html, Size: 22625 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-mesa-Enable-Vulkan-drivers-for-Intel-and-Radeon-v2.patch --]
[-- Type: text/x-diff; name=0001-gnu-mesa-Enable-Vulkan-drivers-for-Intel-and-Radeon-v2.patch, Size: 2037 bytes --]

From 9d13265ac579adfd7d18c7710e793fa78b4aa0f6 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Thu, 14 Dec 2017 20:16:37 +0100
Subject: [PATCH] gnu: mesa: Enable Vulkan drivers for Intel and Radeon.

* gnu/packages/gl.scm (mesa)[arguments]: Add
"--with-vulkan-drivers=intel,radeon" to configure-flags for x86_64-linux.
[synopsis]: Mention Vulkan.
[description]: Mention Vulkan.
---
 gnu/packages/gl.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index fa2d708e1..79721efe6 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -294,6 +294,13 @@ also known as DXTn or DXTC) for Mesa.")
          ;; are stuck at OpenGL 2.1 instead of OpenGL 3.0+.
          "--enable-texture-float"
 
+         ;; Enable Vulkan on x86-64.
+         ,@(match (%current-system)
+             ((or "x86_64-linux")
+                '("--with-vulkan-drivers=intel,radeon"))
+             (_
+              '("")))
+
          ;; Also enable the tests.
          "--enable-gallium-tests"
 
@@ -380,11 +387,11 @@ also known as DXTn or DXTC) for Mesa.")
                          (delete-duplicates inodes))
                #t))))))
     (home-page "https://mesa3d.org/")
-    (synopsis "OpenGL implementation")
-    (description "Mesa is a free implementation of the OpenGL specification -
-a system for rendering interactive 3D graphics.  A variety of device drivers
-allows Mesa to be used in many different environments ranging from software
-emulation to complete hardware acceleration for modern GPUs.")
+    (synopsis "OpenGL and Vulkan implementations")
+    (description "Mesa is a free implementation of the OpenGL and Vulkan
+specifications - systems for rendering interactive 3D graphics.  A variety of
+device drivers allows Mesa to be used in many different environments ranging
+from software emulation to complete hardware acceleration for modern GPUs.")
     (license license:x11)))
 
 (define-public mesa-headers
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-local.mk-Add-vulkan.scm.patch --]
[-- Type: text/x-diff; name=0002-gnu-local.mk-Add-vulkan.scm.patch, Size: 677 bytes --]

From 35b07f1e24c8597bdd504ae9f986abed486cb8df Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 13:39:16 +0100
Subject: [PATCH] gnu: local.mk: Add vulkan.scm.

* gnu/local.mk: Add vulkan.scm.
---
 gnu/local.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index a0e3f6ebe..51876487d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -418,6 +418,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/vim.scm				\
   %D%/packages/virtualization.scm		\
   %D%/packages/vpn.scm				\
+  %D%/packages/vulkan.scm				\
   %D%/packages/w3m.scm				\
   %D%/packages/wdiff.scm			\
   %D%/packages/web.scm				\
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-vulkan-Add-spirv-headers-v2.patch --]
[-- Type: text/x-diff; name=0003-gnu-vulkan-Add-spirv-headers-v2.patch, Size: 3206 bytes --]

From 9c0b6c5e7729d94651b54c9597496f284cac5dbe Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Thu, 14 Dec 2017 22:37:45 +0100
Subject: [PATCH] gnu: vulkan: Add spirv-headers.

* gnu/packages/vulkan.scm: Create file. (spirv-headers): New variable.
---
 gnu/packages/vulkan.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 gnu/packages/vulkan.scm

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
new file mode 100644
index 000000000..a0d704b50
--- /dev/null
+++ b/gnu/packages/vulkan.scm
@@ -0,0 +1,59 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages vulkan)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
+  #:use-module (gnu packages))
+
+(define-public spirv-headers
+  (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
+        (revision "1"))
+    (package
+     (name "spirv-headers")
+     (version (string-append "0.0-" revision "." (string-take commit 9)))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/SPIRV-Headers")
+             (commit commit)))
+       (sha256
+        (base32
+         "15bknwkv3xwmjs3lmkp282a1wrp0da1b4lp45i4yiav04zmqygj2"))
+       (file-name (string-append name "-" version "-checkout"))))
+     (build-system cmake-build-system)
+     (arguments
+      `(#:tests? #f ;; No tests
+        #:phases (modify-phases %standard-phases
+                   (replace 'install
+                     (lambda*
+                       (#:key outputs #:allow-other-keys)
+                         (zero? (system* "cmake" "-E" "copy_directory"
+                                  "../source/include/spirv" (string-append
+                                  (assoc-ref outputs "out")
+                                  "/include/spirv"))))))))
+     (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
+     (synopsis "Machine-readable files from the SPIR-V Registry")
+     (description "SPIRV-Headers is a repository containing machine-readable
+files from the SPIR-V Registry.")
+     (license license:non-copyleft)))) ;; Custom license. See
+     ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
+     ;; details.
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-vulkan-Add-spirv-tools.patch --]
[-- Type: text/x-diff; name=0004-gnu-vulkan-Add-spirv-tools.patch, Size: 2525 bytes --]

From 80e82f1f92823e04893e8400dc82b69e890c7276 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 14:56:36 +0100
Subject: [PATCH] gnu: vulkan: Add spirv-tools.

* gnu/packages/vulkan.scm (spirv-tools): New variable.
---
 gnu/packages/vulkan.scm | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 2079b8e0a..248dc206c 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -19,9 +19,12 @@
 (define-module (gnu packages vulkan)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
-  #:use-module (gnu packages))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python))
 
 (define-public spirv-headers
   (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
@@ -57,3 +60,33 @@ files from the SPIR-V Registry.")
      (license license:x11-style)))) ;; Custom license. See
      ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
      ;; details.
+
+(define-public spirv-tools
+  (package
+   (name "spirv-tools")
+   (version "2017.1")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (string-append "https://github.com/KhronosGroup/SPIRV-Tools/archive/v"
+           version ".tar.gz"))
+     (sha256
+      (base32
+       "009vflaa71a7xhvmm23f4sdbcgdkl1k4facqkwsg6djha2sdpsqq"))
+     (file-name (string-append name "-" version ".tar.gz"))))
+   (build-system cmake-build-system)
+   (arguments
+    `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
+                                             (assoc-ref %outputs "out")
+                                             "/lib")
+                              (string-append "-DSPIRV-Headers_SOURCE_DIR="
+                                             (assoc-ref %build-inputs
+                                                        "spirv-headers")))))
+   (inputs `(("python" ,python)
+             ("spirv-headers" ,spirv-headers)))
+   (native-inputs `(("pkg-config", pkg-config)))
+   (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
+   (synopsis "API and commands for processing SPIR-V modules")
+   (description "The SPIR-V Tools project provides an API and commands for
+processing SPIR-V modules.")
+   (license license:asl2.0)))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-vulkan-Add-glslang-v2.patch --]
[-- Type: text/x-diff; name=0005-gnu-vulkan-Add-glslang-v2.patch, Size: 2606 bytes --]

From e45701483f559eccac56e087fb40e075afe2ffd3 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Thu, 14 Dec 2017 23:03:02 +0100
Subject: [PATCH] gnu: vulkan: Add glslang.

* gnu/packages/vulkan.scm (glslang): New variable.
---
 gnu/packages/vulkan.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index e5a635ead..80fa5a492 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -23,6 +23,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python))
 
@@ -90,3 +91,42 @@ files from the SPIR-V Registry.")
    (description "The SPIR-V Tools project provides an API and commands for
 processing SPIR-V modules.")
    (license license:asl2.0)))
+
+(define-public glslang
+  ;; Version 3.0 is too old for vulkan-icd-loader. Use a recent git commit
+  ;; until the next stable version.
+  (let ((commit "471bfed0621162a7513fc24a51e8a1ccc2e640ff")
+        (revision "1"))
+    (package
+     (name "glslang")
+     (version (string-append "0.0-" revision "." (string-take commit 9)))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/glslang")
+             (commit commit)))
+       (sha256
+        (base32
+         "0m2vljmrqppp80ghbbwfnayqw2canxlcjhgy6jw9xjdssln0d3pd"))
+       (file-name (string-append name "-" version "-checkout"))))
+     (build-system cmake-build-system)
+     (arguments
+      `(#:tests? #f ;; No tests
+        ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
+        ;; offending line.
+        #:phases (modify-phases %standard-phases
+                   (add-after 'patch-source-shebangs 'fix-cmakelists
+                     (lambda _
+                       (substitute* "CMakeLists.txt"
+                                    (("set.*CMAKE_INSTALL_PREFIX.*") ""))
+                       #t)))))
+   (inputs `(("bison" ,bison)))
+   (native-inputs `(("pkg-config" ,pkg-config)))
+   (home-page "https://github.com/KhronosGroup/glslang")
+   (synopsis "OpenGL and OpenGL ES shader front end and validator")
+   (description "glslang is a OpenGL and OpenGL ES shader front end and
+validator.")
+   ;; Modified BSD license. See "copyright" section of
+   ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
+   (license license:bsd-3))))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-vulkan-Add-vulkan-icd-loader.patch --]
[-- Type: text/x-diff; name=0006-gnu-vulkan-Add-vulkan-icd-loader.patch, Size: 2506 bytes --]

From 0172d3cb7cbdae03f143a4c7966c4694e69eea15 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Fri, 8 Dec 2017 16:06:05 +0100
Subject: [PATCH] gnu: vulkan: Add vulkan-icd-loader.

* gnu/packages/vulkan.scm (vulkan-icd-loader): New variable.
---
 gnu/packages/vulkan.scm | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 03562e45d..d8fa616f2 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -24,8 +24,11 @@
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages pkg-config)
-  #:use-module (gnu packages python))
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages xorg))
 
 (define-public spirv-headers
   (let ((commit "98b01515724c428d0f0a5d01deffcce0f5f5e61c")
@@ -129,3 +132,37 @@ validator.")
    ;; Modified BSD license. See "copyright" section of
    ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
    (license license:bsd-3))))
+
+(define-public vulkan-icd-loader
+  (package
+   (name "vulkan-icd-loader")
+   (version "1.0.61.1")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (string-append
+           "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/"
+           "archive/sdk-" version ".tar.gz"))
+     (sha256
+      (base32
+       "05g60hk30sbc4rwkh7nrgqdk6hfsi4hwxs54yrysrzr18xpfb8j7"))))
+   (build-system cmake-build-system)
+   (arguments
+    `(#:tests? #f ;; No tests
+      #:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
+                                (assoc-ref %outputs "out") "/lib"))))
+   (inputs `(("glslang" ,glslang)
+             ("libxcb" ,libxcb)
+             ("libx11" ,libx11)
+             ("libxrandr" ,libxrandr)
+             ("mesa" ,mesa)
+             ("python" ,python)
+             ("spirv-tools" ,spirv-tools)
+             ("wayland" ,wayland)))
+   (native-inputs `(("pkg-config", pkg-config)))
+   (home-page (string-append "https://github.com/"
+              "KhronosGroup/Vulkan-LoaderAndValidationLayers"))
+   (synopsis "Khronos official ICD loader for Vulkan")
+   (description "Vulkan-ICD-Loader provides Khronos official ICD loader and
+validation layers for Vulkan developers on GNU/Linux.")
+   (license license:asl2.0)))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-gnu-retroarch-Enable-Vulkan-support.patch --]
[-- Type: text/x-diff; name=0007-gnu-retroarch-Enable-Vulkan-support.patch, Size: 1880 bytes --]

From 3b45c0ea6d35a0fa7895344fe53758fb4b64d00f Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Sun, 10 Dec 2017 11:15:03 +0100
Subject: [PATCH] gnu: retroarch: Enable Vulkan support.

* gnu/packages/games.scm (retroarch)[arguments]: Hard-code the path to
libvulkan.so. [native-inputs]: Add vulkan-icd-loader.
---
 gnu/packages/games.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 524572b99..2c86c6b78 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -134,6 +134,7 @@
   #:use-module (gnu packages gnuzilla)
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages vulkan)
   #:use-module (gnu packages web)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
@@ -1446,6 +1447,10 @@ either by Infocom or created using the Inform compiler.")
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (etc (string-append out "/etc")))
+               ;; Hard-code the path to libvulkan.so.
+               (substitute* "gfx/common/vulkan_common.c"
+                 (("libvulkan.so") (string-append (assoc-ref %build-inputs
+                  "vulkan-icd-loader") "/lib/libvulkan.so")))
                (substitute* "qb/qb.libs.sh"
                  (("/bin/true") (which "true")))
                ;; The configure script does not yet accept the extra arguments
@@ -1472,6 +1477,7 @@ either by Infocom or created using the Inform compiler.")
        ("zlib" ,zlib)))
     (native-inputs
      `(("pkg-config" ,pkg-config)
+       ("vulkan-icd-loader" ,vulkan-icd-loader)
        ("which" ,which)))
     (home-page "https://www.libretro.com/")
     (synopsis "Reference frontend for the libretro API")
-- 
2.15.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#29625: [PATCH core-updates] Vulkan patch series.
  2017-12-14 22:26   ` Rutger Helling
@ 2017-12-18  0:26     ` Marius Bakke
  2017-12-18  9:10       ` [bug#29625] " Rutger Helling
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Bakke @ 2017-12-18  0:26 UTC (permalink / raw)
  To: Rutger Helling; +Cc: 29625-done

[-- Attachment #1: Type: text/plain, Size: 7028 bytes --]

Rutger Helling <rhelling@mykolab.com> writes:

> Hey Marius, 
>
> thanks for the feedback!
> I've changed the patches and made sure they work on the latest
> core-updates commit. 

Thank you!  One of the commits was not rebased, but I ended up doing a
lot of adjustments anyway (including re-indent), so I fixed it up.

Changes detailed below.  Most of the issues were cosmetic and should
have been caught in the first round, but I was in a hurry :-)

> From 9d13265ac579adfd7d18c7710e793fa78b4aa0f6 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Thu, 14 Dec 2017 20:16:37 +0100
> Subject: [PATCH] gnu: mesa: Enable Vulkan drivers for Intel and Radeon.

[...]

> +         ;; Enable Vulkan on x86-64.
> +         ,@(match (%current-system)
> +             ((or "x86_64-linux")
> +                '("--with-vulkan-drivers=intel,radeon"))
> +             (_
> +              '("")))

The "or" here was not doing anything useful.  Is there any particular
reason i686 is not supported?

> From 35b07f1e24c8597bdd504ae9f986abed486cb8df Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Fri, 8 Dec 2017 13:39:16 +0100
> Subject: [PATCH] gnu: local.mk: Add vulkan.scm.
>
> * gnu/local.mk: Add vulkan.scm.

I squashed this into the next patch.

> From 9c0b6c5e7729d94651b54c9597496f284cac5dbe Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Thu, 14 Dec 2017 22:37:45 +0100
> Subject: [PATCH] gnu: vulkan: Add spirv-headers.
>
> * gnu/packages/vulkan.scm: Create file. (spirv-headers): New variable.

[...]

> +     (license license:non-copyleft)))) ;; Custom license. See
> +     ;; https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
> +     ;; details.

Note: "non-copyleft" and "x11-style" are procedures and takes a URI as
argument.  I changed this back to x11-style which was indeed more
appropriate with a link to the upstream license:

      (license (license:x11-style
                (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
                               commit "/LICENSE")))

> From 80e82f1f92823e04893e8400dc82b69e890c7276 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Fri, 8 Dec 2017 14:56:36 +0100
> Subject: [PATCH] gnu: vulkan: Add spirv-tools.
>
> * gnu/packages/vulkan.scm (spirv-tools): New variable.

[...]

> +   (inputs `(("python" ,python)
> +             ("spirv-headers" ,spirv-headers)))
> +   (native-inputs `(("pkg-config", pkg-config)))

I moved python to native-inputs, since it is only needed for building.

> From e45701483f559eccac56e087fb40e075afe2ffd3 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Thu, 14 Dec 2017 23:03:02 +0100
> Subject: [PATCH] gnu: vulkan: Add glslang.
>
> * gnu/packages/vulkan.scm (glslang): New variable.

[...]

> +(define-public glslang
> +  ;; Version 3.0 is too old for vulkan-icd-loader. Use a recent git commit
> +  ;; until the next stable version.
> +  (let ((commit "471bfed0621162a7513fc24a51e8a1ccc2e640ff")
> +        (revision "1"))
> +    (package
> +     (name "glslang")
> +     (version (string-append "0.0-" revision "." (string-take commit 9)))

Since the last proper tag in the upstream repo was "3.0", I changed this
to (string-append "3.0-" ...).

> +   (inputs `(("bison" ,bison)))

Bison is only required for building, so I made it a native-input.

> +   (native-inputs `(("pkg-config" ,pkg-config)))
> +   (home-page "https://github.com/KhronosGroup/glslang")
> +   (synopsis "OpenGL and OpenGL ES shader front end and validator")
> +   (description "glslang is a OpenGL and OpenGL ES shader front end and
> +validator.")
> +   ;; Modified BSD license. See "copyright" section of
> +   ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
> +   (license license:bsd-3))))

I changed the description to be the first paragraph of that URL :)
Also mentioned two Apache 2.0 header files that gets installed here.

> From 0172d3cb7cbdae03f143a4c7966c4694e69eea15 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Fri, 8 Dec 2017 16:06:05 +0100
> Subject: [PATCH] gnu: vulkan: Add vulkan-icd-loader.
>
> * gnu/packages/vulkan.scm (vulkan-icd-loader): New variable.

[...]

> +   (inputs `(("glslang" ,glslang)
> +             ("libxcb" ,libxcb)
> +             ("libx11" ,libx11)
> +             ("libxrandr" ,libxrandr)
> +             ("mesa" ,mesa)
> +             ("python" ,python)
> +             ("spirv-tools" ,spirv-tools)
> +             ("wayland" ,wayland)))
> +   (native-inputs `(("pkg-config", pkg-config)))

Python was not referenced by the output, so I moved it to a native-input.

> +   (home-page (string-append "https://github.com/"
> +              "KhronosGroup/Vulkan-LoaderAndValidationLayers"))
> +   (synopsis "Khronos official ICD loader for Vulkan")
> +   (description "Vulkan-ICD-Loader provides Khronos official ICD loader and
> +validation layers for Vulkan developers on GNU/Linux.")

I mentioned that ICD is and expanded a little based on my limited
understanding of Vulkan.  Improvements welcome!

> +   (license license:asl2.0)))

And added a mention of the licenses listed in COPYRIGHT.txt.  While
snooping around I also found tests and tried adding this phase:

                  (replace 'check
                    (lambda _
                      (zero? (system* "bash" "tests/run_all_tests.sh")))))

But got 23/39 failures.  I suspect most can be resolved by pointing
$VK_LAYER_PATH to the right place in the build directory.  Added a FIXME
for now.

> From 3b45c0ea6d35a0fa7895344fe53758fb4b64d00f Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Sun, 10 Dec 2017 11:15:03 +0100
> Subject: [PATCH] gnu: retroarch: Enable Vulkan support.
>
> * gnu/packages/games.scm (retroarch)[arguments]: Hard-code the path to
> libvulkan.so. [native-inputs]: Add vulkan-icd-loader.

Since libvulkan.so is used at runtime, it should be a normal input.

[...]

> @@ -1446,6 +1447,10 @@ either by Infocom or created using the Inform compiler.")
>             (lambda* (#:key outputs #:allow-other-keys)
>               (let* ((out (assoc-ref outputs "out"))
>                      (etc (string-append out "/etc")))
> +               ;; Hard-code the path to libvulkan.so.
> +               (substitute* "gfx/common/vulkan_common.c"
> +                 (("libvulkan.so") (string-append (assoc-ref %build-inputs
> +                  "vulkan-icd-loader") "/lib/libvulkan.so")))

I made this a little more idiomatic by dereferencing vulkan-icd-loader
in the let binding instead of the global %build-inputs.

Do you know if RetroArch (or rather the dependencies) will still work on
platform for which we don't have Vulkan support?

I've pushed this series as e1454e0e..01564e5a.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#29625] [PATCH core-updates] Vulkan patch series.
  2017-12-18  0:26     ` bug#29625: " Marius Bakke
@ 2017-12-18  9:10       ` Rutger Helling
  2017-12-18 12:16         ` Marius Bakke
  0 siblings, 1 reply; 8+ messages in thread
From: Rutger Helling @ 2017-12-18  9:10 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 29625-done

Hey Marius,

Thanks a lot for improving and fixing the patches!

Regarding your questions; when I tried to build the Vulkan drivers on 
Mesa on i686 it failed to build.
I figured it was better to just leave it at x86_86 for now. In a future 
core-updates cycle it might be a good idea to start looking into other 
architectures.

Retroarch won't be affected if your hardware doesn't support Vulkan, it 
defaults to OpenGL anyway. It's just a setting you can modify 
(video_driver).

I also had an unrelated question. I saw that you updated Mesa to 17.2.7. 
I'm running 17.3.0 myself right now.
Is it customary in Guix to wait for the first point release, or do you 
want me to send in a patch?
It really only consists of updating the version, checksum and adding a 
native-input python2-mako.

On 2017-12-18 01:26, Marius Bakke wrote:

> Rutger Helling <rhelling@mykolab.com> writes:
> 
>> Hey Marius,
>> 
>> thanks for the feedback!
>> I've changed the patches and made sure they work on the latest
>> core-updates commit.
> 
> Thank you!  One of the commits was not rebased, but I ended up doing a
> lot of adjustments anyway (including re-indent), so I fixed it up.
> 
> Changes detailed below.  Most of the issues were cosmetic and should
> have been caught in the first round, but I was in a hurry :-)
> 
>> From 9d13265ac579adfd7d18c7710e793fa78b4aa0f6 Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Thu, 14 Dec 2017 20:16:37 +0100
>> Subject: [PATCH] gnu: mesa: Enable Vulkan drivers for Intel and 
>> Radeon.
> 
> [...]
> 
>> +         ;; Enable Vulkan on x86-64.
>> +         ,@(match (%current-system)
>> +             ((or "x86_64-linux")
>> +                '("--with-vulkan-drivers=intel,radeon"))
>> +             (_
>> +              '("")))
> 
> The "or" here was not doing anything useful.  Is there any particular
> reason i686 is not supported?
> 
>> From 35b07f1e24c8597bdd504ae9f986abed486cb8df Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Fri, 8 Dec 2017 13:39:16 +0100
>> Subject: [PATCH] gnu: local.mk: Add vulkan.scm.
>> 
>> * gnu/local.mk: Add vulkan.scm.
> 
> I squashed this into the next patch.
> 
>> From 9c0b6c5e7729d94651b54c9597496f284cac5dbe Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Thu, 14 Dec 2017 22:37:45 +0100
>> Subject: [PATCH] gnu: vulkan: Add spirv-headers.
>> 
>> * gnu/packages/vulkan.scm: Create file. (spirv-headers): New variable.
> 
> [...]
> 
>> +     (license license:non-copyleft)))) ;; Custom license. See
>> +     ;; 
>> https://github.com/KhronosGroup/SPIRV-Headers/blob/master/LICENSE for
>> +     ;; details.
> 
> Note: "non-copyleft" and "x11-style" are procedures and takes a URI as
> argument.  I changed this back to x11-style which was indeed more
> appropriate with a link to the upstream license:
> 
> (license (license:x11-style
> (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
> commit "/LICENSE")))
> 
>> From 80e82f1f92823e04893e8400dc82b69e890c7276 Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Fri, 8 Dec 2017 14:56:36 +0100
>> Subject: [PATCH] gnu: vulkan: Add spirv-tools.
>> 
>> * gnu/packages/vulkan.scm (spirv-tools): New variable.
> 
> [...]
> 
>> +   (inputs `(("python" ,python)
>> +             ("spirv-headers" ,spirv-headers)))
>> +   (native-inputs `(("pkg-config", pkg-config)))
> 
> I moved python to native-inputs, since it is only needed for building.
> 
>> From e45701483f559eccac56e087fb40e075afe2ffd3 Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Thu, 14 Dec 2017 23:03:02 +0100
>> Subject: [PATCH] gnu: vulkan: Add glslang.
>> 
>> * gnu/packages/vulkan.scm (glslang): New variable.
> 
> [...]
> 
>> +(define-public glslang
>> +  ;; Version 3.0 is too old for vulkan-icd-loader. Use a recent git 
>> commit
>> +  ;; until the next stable version.
>> +  (let ((commit "471bfed0621162a7513fc24a51e8a1ccc2e640ff")
>> +        (revision "1"))
>> +    (package
>> +     (name "glslang")
>> +     (version (string-append "0.0-" revision "." (string-take commit 
>> 9)))
> 
> Since the last proper tag in the upstream repo was "3.0", I changed 
> this
> to (string-append "3.0-" ...).
> 
>> +   (inputs `(("bison" ,bison)))
> 
> Bison is only required for building, so I made it a native-input.
> 
>> +   (native-inputs `(("pkg-config" ,pkg-config)))
>> +   (home-page "https://github.com/KhronosGroup/glslang")
>> +   (synopsis "OpenGL and OpenGL ES shader front end and validator")
>> +   (description "glslang is a OpenGL and OpenGL ES shader front end 
>> and
>> +validator.")
>> +   ;; Modified BSD license. See "copyright" section of
>> +   ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
>> +   (license license:bsd-3))))
> 
> I changed the description to be the first paragraph of that URL :)
> Also mentioned two Apache 2.0 header files that gets installed here.
> 
>> From 0172d3cb7cbdae03f143a4c7966c4694e69eea15 Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Fri, 8 Dec 2017 16:06:05 +0100
>> Subject: [PATCH] gnu: vulkan: Add vulkan-icd-loader.
>> 
>> * gnu/packages/vulkan.scm (vulkan-icd-loader): New variable.
> 
> [...]
> 
>> +   (inputs `(("glslang" ,glslang)
>> +             ("libxcb" ,libxcb)
>> +             ("libx11" ,libx11)
>> +             ("libxrandr" ,libxrandr)
>> +             ("mesa" ,mesa)
>> +             ("python" ,python)
>> +             ("spirv-tools" ,spirv-tools)
>> +             ("wayland" ,wayland)))
>> +   (native-inputs `(("pkg-config", pkg-config)))
> 
> Python was not referenced by the output, so I moved it to a 
> native-input.
> 
>> +   (home-page (string-append "https://github.com/"
>> +              "KhronosGroup/Vulkan-LoaderAndValidationLayers"))
>> +   (synopsis "Khronos official ICD loader for Vulkan")
>> +   (description "Vulkan-ICD-Loader provides Khronos official ICD 
>> loader and
>> +validation layers for Vulkan developers on GNU/Linux.")
> 
> I mentioned that ICD is and expanded a little based on my limited
> understanding of Vulkan.  Improvements welcome!
> 
>> +   (license license:asl2.0)))
> 
> And added a mention of the licenses listed in COPYRIGHT.txt.  While
> snooping around I also found tests and tried adding this phase:
> 
> (replace 'check
> (lambda _
> (zero? (system* "bash" "tests/run_all_tests.sh")))))
> 
> But got 23/39 failures.  I suspect most can be resolved by pointing
> $VK_LAYER_PATH to the right place in the build directory.  Added a 
> FIXME
> for now.
> 
>> From 3b45c0ea6d35a0fa7895344fe53758fb4b64d00f Mon Sep 17 00:00:00 2001
>> From: Rutger Helling <rhelling@mykolab.com>
>> Date: Sun, 10 Dec 2017 11:15:03 +0100
>> Subject: [PATCH] gnu: retroarch: Enable Vulkan support.
>> 
>> * gnu/packages/games.scm (retroarch)[arguments]: Hard-code the path to
>> libvulkan.so. [native-inputs]: Add vulkan-icd-loader.
> 
> Since libvulkan.so is used at runtime, it should be a normal input.
> 
> [...]
> 
>> @@ -1446,6 +1447,10 @@ either by Infocom or created using the Inform 
>> compiler.")
>> (lambda* (#:key outputs #:allow-other-keys)
>> (let* ((out (assoc-ref outputs "out"))
>> (etc (string-append out "/etc")))
>> +               ;; Hard-code the path to libvulkan.so.
>> +               (substitute* "gfx/common/vulkan_common.c"
>> +                 (("libvulkan.so") (string-append (assoc-ref 
>> %build-inputs
>> +                  "vulkan-icd-loader") "/lib/libvulkan.so")))
> 
> I made this a little more idiomatic by dereferencing vulkan-icd-loader
> in the let binding instead of the global %build-inputs.
> 
> Do you know if RetroArch (or rather the dependencies) will still work 
> on
> platform for which we don't have Vulkan support?
> 
> I've pushed this series as e1454e0e..01564e5a.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#29625] [PATCH core-updates] Vulkan patch series.
  2017-12-18  9:10       ` [bug#29625] " Rutger Helling
@ 2017-12-18 12:16         ` Marius Bakke
  2017-12-18 12:24           ` Rutger Helling
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Bakke @ 2017-12-18 12:16 UTC (permalink / raw)
  To: Rutger Helling; +Cc: 29625-done

[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]

Rutger Helling <rhelling@mykolab.com> writes:

> Hey Marius,
>
> Thanks a lot for improving and fixing the patches!
>
> Regarding your questions; when I tried to build the Vulkan drivers on 
> Mesa on i686 it failed to build.
> I figured it was better to just leave it at x86_86 for now. In a future 
> core-updates cycle it might be a good idea to start looking into other 
> architectures.
>
> Retroarch won't be affected if your hardware doesn't support Vulkan, it 
> defaults to OpenGL anyway. It's just a setting you can modify 
> (video_driver).

OK, thanks for confirming.

> I also had an unrelated question. I saw that you updated Mesa to 17.2.7. 
> I'm running 17.3.0 myself right now.
> Is it customary in Guix to wait for the first point release, or do you 
> want me to send in a patch?
> It really only consists of updating the version, checksum and adding a 
> native-input python2-mako.

The Mesa release notes[0] has this blurb when the minor version changes:

Mesa 17.3.0 is a new development release. People who are concerned with
stability and reliability should stick with a previous release or wait
for Mesa 17.3.1.

Since we will be "stuck" on this Mesa version for some time, I prefer
sticking to the stable branches.  17.2.7 is also newer than 17.3.0 :-)

[0] https://www.mesa3d.org/relnotes/17.3.0.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#29625] [PATCH core-updates] Vulkan patch series.
  2017-12-18 12:16         ` Marius Bakke
@ 2017-12-18 12:24           ` Rutger Helling
  0 siblings, 0 replies; 8+ messages in thread
From: Rutger Helling @ 2017-12-18 12:24 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 29625-done

Thanks for clarifying!

I guess this is just a heads-up then that adding python2-mako to 
native-inputs is likely enough to make 17.3.1 work, whenever that comes 
out :).

On 2017-12-18 13:16, Marius Bakke wrote:

> Rutger Helling <rhelling@mykolab.com> writes:
> 
>> Hey Marius,
>> 
>> Thanks a lot for improving and fixing the patches!
>> 
>> Regarding your questions; when I tried to build the Vulkan drivers on
>> Mesa on i686 it failed to build.
>> I figured it was better to just leave it at x86_86 for now. In a 
>> future
>> core-updates cycle it might be a good idea to start looking into other
>> architectures.
>> 
>> Retroarch won't be affected if your hardware doesn't support Vulkan, 
>> it
>> defaults to OpenGL anyway. It's just a setting you can modify
>> (video_driver).
> 
> OK, thanks for confirming.
> 
>> I also had an unrelated question. I saw that you updated Mesa to 
>> 17.2.7.
>> I'm running 17.3.0 myself right now.
>> Is it customary in Guix to wait for the first point release, or do you
>> want me to send in a patch?
>> It really only consists of updating the version, checksum and adding a
>> native-input python2-mako.
> 
> The Mesa release notes[0] has this blurb when the minor version 
> changes:
> 
> Mesa 17.3.0 is a new development release. People who are concerned with
> stability and reliability should stick with a previous release or wait
> for Mesa 17.3.1.
> 
> Since we will be "stuck" on this Mesa version for some time, I prefer
> sticking to the stable branches.  17.2.7 is also newer than 17.3.0 :-)
> 
> [0] https://www.mesa3d.org/relnotes/17.3.0.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-12-18 12:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-09 13:54 [bug#29625] [PATCH core-updates] Vulkan patch series Rutger Helling
2017-12-10 10:41 ` Rutger Helling
2017-12-13 18:30 ` Marius Bakke
2017-12-14 22:26   ` Rutger Helling
2017-12-18  0:26     ` bug#29625: " Marius Bakke
2017-12-18  9:10       ` [bug#29625] " Rutger Helling
2017-12-18 12:16         ` Marius Bakke
2017-12-18 12:24           ` Rutger Helling

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).