mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
Merge #14404: add a couple of vulkan utilities
This commit is contained in:
commit
7aeca58779
25
pkgs/development/compilers/glslang/default.nix
Normal file
25
pkgs/development/compilers/glslang/default.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{ stdenv, fetchFromGitHub, cmake, bison }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "glslang-git-${version}";
|
||||
version = "2016-08-26";
|
||||
|
||||
# `vulkan-loader` requires a specific version of `glslang` as specified in
|
||||
# `<vulkan-loader-repo>/glslang_revision`.
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "glslang";
|
||||
rev = "81cd764b5ffc475bc73f1fb35f75fd1171bb2343";
|
||||
sha256 = "1vfwl6lzkjh9nh29q32b7zca4q1abf3q4nqkahskijgznw5lr59g";
|
||||
};
|
||||
|
||||
patches = [ ./install-headers.patch ];
|
||||
|
||||
buildInputs = [ cmake bison ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
inherit (src.meta) homepage;
|
||||
description = "Khronos reference front-end for GLSL and ESSL";
|
||||
};
|
||||
}
|
26
pkgs/development/compilers/glslang/install-headers.patch
Normal file
26
pkgs/development/compilers/glslang/install-headers.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt
|
||||
index 48a6c46..593d941 100755
|
||||
--- a/SPIRV/CMakeLists.txt
|
||||
+++ b/SPIRV/CMakeLists.txt
|
||||
@@ -42,3 +42,8 @@ endif(WIN32)
|
||||
|
||||
install(TARGETS SPIRV SPVRemapper
|
||||
ARCHIVE DESTINATION lib)
|
||||
+
|
||||
+foreach(file ${HEADERS} ${SPVREMAP_HEADERS})
|
||||
+ get_filename_component(dir ${file} DIRECTORY)
|
||||
+ install(FILES ${file} DESTINATION include/SPIRV/${dir})
|
||||
+endforeach()
|
||||
diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt
|
||||
index ff91135..4318279 100644
|
||||
--- a/glslang/CMakeLists.txt
|
||||
+++ b/glslang/CMakeLists.txt
|
||||
@@ -90,3 +90,8 @@ endif(WIN32)
|
||||
|
||||
install(TARGETS glslang
|
||||
ARCHIVE DESTINATION lib)
|
||||
+
|
||||
+foreach(file ${HEADERS})
|
||||
+ get_filename_component(dir ${file} DIRECTORY)
|
||||
+ install(FILES ${file} DESTINATION include/glslang/${dir})
|
||||
+endforeach()
|
31
pkgs/development/compilers/shaderc/default.nix
Normal file
31
pkgs/development/compilers/shaderc/default.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{ stdenv, fetchFromGitHub, cmake, glslang, spirv-tools, python }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "shaderc-git-${version}";
|
||||
version = "2016-09-08";
|
||||
|
||||
# `vulkan-loader` requires a specific version of `glslang` as specified in
|
||||
# `<vulkan-loader-repo>/glslang_revision`.
|
||||
src = fetchFromGitHub {
|
||||
owner = "google";
|
||||
repo = "shaderc";
|
||||
rev = "e17bb8ba3b8b0b9142b788d988612a40541c54ce";
|
||||
sha256 = "17qfjqkz6j355qi130kixaz51svl09k9b5sfikksgnbmzglzcwki";
|
||||
};
|
||||
|
||||
patchPhase = ''
|
||||
cp -r ${spirv-tools.src} third_party/spirv-tools
|
||||
chmod -R +w third_party/spirv-tools
|
||||
ln -s ${spirv-tools.headers} third_party/spirv-tools/external/spirv-headers
|
||||
'';
|
||||
|
||||
buildInputs = [ cmake glslang python ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" "-DSHADERC_GLSLANG_DIR=${glslang.src}" ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
inherit (src.meta) homepage;
|
||||
description = "A collection of tools, libraries and tests for shader compilation.";
|
||||
};
|
||||
}
|
52
pkgs/development/libraries/vulkan-loader/default.nix
Normal file
52
pkgs/development/libraries/vulkan-loader/default.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
|
||||
python3Packages, glslang, spirv-tools, x11, libxcb, wayland }:
|
||||
|
||||
assert stdenv.system == "x86_64-linux";
|
||||
|
||||
let
|
||||
version = "1.0.26.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "Vulkan-LoaderAndValidationLayers";
|
||||
rev = "sdk-${version}";
|
||||
sha256 = "157m746hc76xrxd3qq0f44f5dy7pjbz8cx74ykqrlbc7rmpjpk58";
|
||||
};
|
||||
getRev = name: builtins.substring 0 40 (builtins.readFile "${src}/${name}_revision");
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "vulkan-loader-${version}";
|
||||
inherit version src;
|
||||
|
||||
prePatch = ''
|
||||
if [ "$(cat '${src}/spirv-tools_revision')" != '${spirv-tools.src.rev}' ] \
|
||||
|| [ "$(cat '${src}/spirv-headers_revision')" != '${spirv-tools.headers.rev}' ] \
|
||||
|| [ "$(cat '${src}/glslang_revision')" != '${glslang.src.rev}' ]
|
||||
then
|
||||
echo "Version mismatch, aborting!"
|
||||
false
|
||||
fi
|
||||
'';
|
||||
|
||||
buildInputs = [ cmake pkgconfig git python3 python3Packages.lxml
|
||||
glslang spirv-tools x11 libxcb wayland
|
||||
];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DBUILD_WSI_WAYLAND_SUPPORT=ON" # XLIB/XCB supported by default
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
mkdir -p $out/bin
|
||||
cp loader/libvulkan.so* $out/lib
|
||||
cp demos/vulkaninfo $out/bin
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "LunarG Vulkan loader";
|
||||
homepage = http://www.lunarg.com;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
42
pkgs/development/tools/spirv-tools/default.nix
Normal file
42
pkgs/development/tools/spirv-tools/default.nix
Normal file
@ -0,0 +1,42 @@
|
||||
{ stdenv, fetchFromGitHub, cmake, python }:
|
||||
|
||||
let
|
||||
|
||||
spirv_sources = {
|
||||
# `vulkan-loader` requires a specific version of `spirv-tools` and `spirv-headers` as specified in
|
||||
# `<vulkan-loader-repo>/spirv-tools_revision`.
|
||||
tools = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "SPIRV-Tools";
|
||||
rev = "923a4596b44831a07060df45caacb522613730c9";
|
||||
sha256 = "0hmgng2sv34amfsag3ya09prnv1w535djwlzfn8h2vh430vgawxa";
|
||||
};
|
||||
headers = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "SPIRV-Headers";
|
||||
rev = "33d41376d378761ed3a4c791fc4b647761897f26";
|
||||
sha256 = "1s103bpi3g6hhq453qa4jbabfkyxxpf9vn213j8k4vm26lsi8hs2";
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "spirv-tools-${version}";
|
||||
version = "2016-07-18";
|
||||
|
||||
src = spirv_sources.tools;
|
||||
patchPhase = ''ln -sv ${spirv_sources.headers} external/spirv-headers'';
|
||||
enableParallelBuilding = true;
|
||||
|
||||
buildInputs = [ cmake python ];
|
||||
|
||||
passthru = {
|
||||
headers = spirv_sources.headers;
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
inherit (src.meta) homepage;
|
||||
description = "The SPIR-V Tools project provides an API and commands for processing SPIR-V modules.";
|
||||
};
|
||||
}
|
@ -4852,6 +4852,8 @@ in
|
||||
|
||||
dotnetPackages = recurseIntoAttrs (callPackage ./dotnet-packages.nix {});
|
||||
|
||||
glslang = callPackage ../development/compilers/glslang { };
|
||||
|
||||
go_bootstrap = callPackage ../development/compilers/go/1.4.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
};
|
||||
@ -6355,6 +6357,8 @@ in
|
||||
|
||||
spin = callPackage ../development/tools/analysis/spin { };
|
||||
|
||||
spirv-tools = callPackage ../development/tools/spirv-tools { };
|
||||
|
||||
splint = callPackage ../development/tools/analysis/splint {
|
||||
flex = flex_2_5_35;
|
||||
};
|
||||
@ -9367,6 +9371,8 @@ in
|
||||
CoreText IOSurface ImageIO OpenGL GLUT;
|
||||
};
|
||||
|
||||
vulkan-loader = callPackage ../development/libraries/vulkan-loader { };
|
||||
|
||||
vtkWithQt4 = vtk.override { qtLib = qt4; };
|
||||
|
||||
vxl = callPackage ../development/libraries/vxl {
|
||||
@ -11799,6 +11805,8 @@ in
|
||||
|
||||
sampradaya = callPackage ../data/fonts/sampradaya { };
|
||||
|
||||
shaderc = callPackage ../development/compilers/shaderc { };
|
||||
|
||||
shared_mime_info = callPackage ../data/misc/shared-mime-info { };
|
||||
|
||||
shared_desktop_ontologies = callPackage ../data/misc/shared-desktop-ontologies { };
|
||||
|
Loading…
Reference in New Issue
Block a user