1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 13:41:26 +00:00

Merge pull request #42638 from Ralith/vulkan

Vulkan updates
This commit is contained in:
Matthew Bauer 2018-06-28 22:27:01 -04:00 committed by GitHub
commit c7c34f1261
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 140 additions and 96 deletions

View file

@ -2,15 +2,13 @@
stdenv.mkDerivation rec {
name = "glslang-git-${version}";
version = "2018-02-05";
version = "2018-06-21";
# `vulkan-loader` requires a specific version of `glslang` as specified in
# `<vulkan-loader-repo>/external_revisions/glslang_revision`.
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "glslang";
rev = "2651ccaec8";
sha256 = "0x5x5i07n9g809rzf5jgw70mmwck31ishdmxnmi0wxx737jjqwaq";
rev = "ef1f899b5d64a9628023f1bb129198674cba2b97";
sha256 = "052w6rahmy1wlphv533wz8nyn82icky28lprvl8w3acfq3831zg6";
};
buildInputs = [ cmake bison jq ] ++ spirv-tools.buildInputs;

View file

@ -1,32 +1,52 @@
{ stdenv, fetchFromGitHub, cmake, glslang, spirv-tools, python }:
{ stdenv, fetchFromGitHub, cmake, python }:
# Like many google projects, shaderc doesn't gracefully support separately compiled dependencies, so we can't easily use
# the versions of glslang and spirv-tools used by vulkan-loader. Exact revisions are taken from
# https://github.com/google/shaderc/blob/known-good/known_good.json
stdenv.mkDerivation rec {
# Future work: extract and fetch all revisions automatically based on a revision of shaderc's known-good branch.
let
glslang = fetchFromGitHub {
owner = "KhronosGroup";
repo = "glslang";
rev = "32d3ec319909fcad0b2b308fe1635198773e8316";
sha256 = "1kmgjv5kbrjy6azpgwnjcn3cj8vg5i8hnyk3m969sc0gq2j1rbjj";
};
spirv-tools = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
rev = "fe2fbee294a8ad4434f828a8b4d99eafe9aac88c";
sha256 = "03rq4ypwqnz34n8ip85n95a3b9rxb34j26azzm3b3invaqchv19x";
};
spirv-headers = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Headers";
rev = "3ce3e49d73b8abbf2ffe33f829f941fb2a40f552";
sha256 = "0yk4bzqifdqpmdxkhvrxbdqhf5ngkga0ig1yyz7khr7rklqfz7wp";
};
in stdenv.mkDerivation rec {
name = "shaderc-git-${version}";
version = "2016-09-08";
version = "2018-06-01";
# `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";
rev = "be8e0879750303a1de09385465d6b20ecb8b380d";
sha256 = "16p25ry2i4zrj00zihfpf210f8xd7g398ffbw25igvi9mbn4nbfd";
};
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
cp -r --no-preserve=mode ${glslang} third_party/glslang
cp -r --no-preserve=mode ${spirv-tools} third_party/spirv-tools
ln -s ${spirv-headers} third_party/spirv-tools/external/spirv-headers
'';
buildInputs = [ cmake glslang python ];
buildInputs = [ cmake python ];
enableParallelBuilding = true;
cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" "-DSHADERC_GLSLANG_DIR=${glslang.src}" ];
cmakeFlags = [ "-DSHADERC_SKIP_TESTS=ON" ];
meta = with stdenv.lib; {
inherit (src.meta) homepage;
description = "A collection of tools, libraries and tests for shader compilation.";
broken = true;
};
}

View file

@ -0,0 +1,22 @@
{ stdenv, fetchFromGitHub, cmake }:
stdenv.mkDerivation rec {
name = "vulkan-headers-${version}";
version = "1.1.77.0";
buildInputs = [ cmake ];
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Headers";
rev = "sdk-${version}";
sha256 = "1k01y5cj154mw7853w5xh135b2jp6k83kzwknw0dbs5adj4dx0kf";
};
meta = with stdenv.lib; {
description = "Vulkan Header files and API registry";
homepage = "http://www.lunarg.com";
platforms = platforms.linux;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
};
}

View file

@ -1,65 +1,31 @@
{ stdenv, fetchgit, fetchFromGitHub, cmake, pkgconfig, git, python3,
python3Packages, glslang, spirv-tools, x11, libxcb, libXrandr,
libXext, wayland, libGL_driver, makeWrapper }:
let
version = "1.1.70.0";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-LoaderAndValidationLayers";
rev = "sdk-${version}";
sha256 = "1a7xwl65bi03l4zbjq54qkxjb8kb4m78qvw8bas5alhf9v6i6yqp";
};
in
{ stdenv, fetchFromGitHub, cmake, python3, vulkan-headers, pkgconfig,
x11, libxcb, libXrandr, libXext, wayland, libGL_driver }:
let version = "1.1.77.0"; in
assert version == vulkan-headers.version;
stdenv.mkDerivation rec {
name = "vulkan-loader-${version}";
inherit version src;
inherit version;
nativeBuildInputs = [ makeWrapper pkgconfig ];
buildInputs = [ cmake git python3 python3Packages.lxml
glslang x11 libxcb libXrandr libXext wayland
];
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Loader";
rev = "sdk-${version}";
sha256 = "1nzzkqh0i3j1d3h7kgmaxzi748l338m2p31lxkwxm4y81xp56a94";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake python3 x11 libxcb libXrandr libXext wayland ];
enableParallelBuilding = true;
cmakeFlags = [
"-DBUILD_WSI_MIR_SUPPORT=OFF"
"-DFALLBACK_DATA_DIRS=${libGL_driver.driverLink}/share:/usr/local/share:/usr/share"
"-DVULKAN_HEADERS_INSTALL_DIR=${vulkan-headers}"
];
outputs = [ "out" "dev" "demos" ];
patches = [ ./rev-file.patch ];
outputs = [ "out" "dev" ];
postUnpack = ''
# Hack so a version header can be generated. Relies on ./rev-file.patch to work.
mkdir -p "$sourceRoot/external/glslang/External"
echo "${spirv-tools.src.rev}" > "$sourceRoot/external/glslang/External/spirv-tools"
'';
preConfigure = ''
checkRev() {
[ "$2" = $(cat "external_revisions/$1_revision") ] || (echo "ERROR: dependency $1 is revision $2 but should be revision" $(cat "external_revisions/$1_revision") && exit 1)
}
checkRev glslang "${glslang.src.rev}"
'';
installPhase = ''
mkdir -p $out/lib $out/bin
cp -d loader/libvulkan.so* $out/lib
cp demos/vulkaninfo $out/bin
mkdir -p $out/lib $out/share/vulkan/explicit_layer.d
cp -L layers/*.so $out/lib/
cp -L layers/*.json $out/share/vulkan/explicit_layer.d/
sed -i "s:\\./lib:$out/lib/lib:g" "$out/share/vulkan/"*/*.json
mkdir -p $dev/include
cp -rv ../include $dev/
mkdir -p $demos/share/vulkan-demos
cp demos/*.spv demos/*.ppm $demos/share/vulkan-demos
mkdir -p $demos/bin
find demos -type f -executable -not -name vulkaninfo -exec cp -v {} $demos/bin \;
for p in cube cubepp; do
wrapProgram $demos/bin/$p --run "cd $demos/share/vulkan-demos"
done
postInstall = ''
cp -r "${vulkan-headers}/include" "$dev"
'';
meta = with stdenv.lib; {

View file

@ -1,21 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9f73ce96..d14ffeed9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -339,13 +339,13 @@ macro(run_vk_xml_generate dependency output)
endmacro()
# Define macro used for generating header files containing commit IDs for external dependencies
-macro(run_external_revision_generate source_dir symbol_name output)
+macro(run_external_revision_generate rev_file symbol_name output)
add_custom_command(OUTPUT ${output}
# NOTE: If you modify this call to use --rev_file instead of --git_dir (to read the commit ID from a file instead of
# parsing from a Git repository), you probably also want to add the revision file to the list of DEPENDS on the
# subsequent line (to ensure that the script is re-run when the revision file is modified).
- COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/external_revision_generator.py --git_dir ${source_dir} -s ${symbol_name} -o ${output}
- DEPENDS ${SCRIPTS_DIR}/external_revision_generator.py ${source_dir}/.git/HEAD ${source_dir}/.git/index
+ COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/external_revision_generator.py --rev_file ${rev_file} -s ${symbol_name} -o ${output}
+ DEPENDS ${SCRIPTS_DIR}/external_revision_generator.py ${rev_file}
)
endmacro()

View file

@ -7,14 +7,14 @@ spirv_sources = {
tools = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Tools";
rev = "9e19fc0f31ceaf1f6bc907dbf17dcfded85f2ce8";
sha256 = "1zpwznq0fyvkzs5h9nnkr7g6svr0w8z6zx62xgnss17c2a5cz0lk";
rev = "f2c93c6e124836797311facb8449f9a0b76fefc2";
sha256 = "03w5xk2hjijj1rfbx5dw3lhy7vb9zrssfcwvp09q47f77vkgl105";
};
headers = fetchFromGitHub {
owner = "KhronosGroup";
repo = "SPIRV-Headers";
rev = "ce309203d7eceaf908bea8862c27f3e0749f7d00";
sha256 = "1sv1iy2d46sg7r3xy591db6fn9h78wd079yvfa87vwmwsdkhiqhm";
rev = "12f8de9f04327336b699b1b80aa390ae7f9ddbf4";
sha256 = "0fswk5ndvkmy64har3dmhpkv09zmvb0p4knbqc4fdl4qiggz0fvf";
};
};
@ -22,7 +22,7 @@ in
stdenv.mkDerivation rec {
name = "spirv-tools-${version}";
version = "2018-02-05";
version = "2018-06-06";
src = spirv_sources.tools;
patchPhase = ''ln -sv ${spirv_sources.headers} external/spirv-headers'';

View file

@ -0,0 +1,28 @@
{ stdenv, fetchFromGitHub, cmake, python3, vulkan-headers, vulkan-loader,
glslang, pkgconfig, x11, libxcb, libXrandr, wayland }:
stdenv.mkDerivation rec {
name = "vulkan-validation-layers-${version}";
version = "1.1.77.0";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-ValidationLayers";
rev = "sdk-${version}";
sha256 = "1c7m0x63fv8paph4rlha9bzv6sd0d7j277b31hh1sqkdcv2mzjhj";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake python3 vulkan-headers vulkan-loader x11 libxcb libXrandr wayland ];
enableParallelBuilding = true;
cmakeFlags = [ "-DGLSLANG_INSTALL_DIR=${glslang}" ];
meta = with stdenv.lib; {
description = "LunarG Vulkan loader";
homepage = "http://www.lunarg.com";
platforms = platforms.linux;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
};
}

View file

@ -0,0 +1,28 @@
{ stdenv, fetchFromGitHub, cmake, python3, vulkan-loader,
glslang, pkgconfig, x11, libxcb, libXrandr, wayland }:
stdenv.mkDerivation rec {
name = "vulkan-tools-${version}";
version = "1.1.77.0";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Tools";
rev = "sdk-${version}";
sha256 = "1c827n0xz8d7ydqpjchd58as943acyi182a0p4aq3bdsaxlmmpkg";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake python3 vulkan-loader x11 libxcb libXrandr wayland ];
enableParallelBuilding = true;
cmakeFlags = [ "-DBUILD_ICD=OFF" "-DGLSLANG_INSTALL_DIR=${glslang}" ];
meta = with stdenv.lib; {
description = "LunarG Vulkan loader";
homepage = "http://www.lunarg.com";
platforms = platforms.linux;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
};
}

View file

@ -12068,7 +12068,10 @@ with pkgs;
CoreText IOSurface ImageIO OpenGL GLUT;
};
vulkan-headers = callPackage ../development/libraries/vulkan-headers { };
vulkan-loader = callPackage ../development/libraries/vulkan-loader { };
vulkan-tools = callPackage ../tools/graphics/vulkan-tools { };
vulkan-validation-layers = callPackage ../development/tools/vulkan-validation-layers { };
vtkWithQt4 = vtk.override { qtLib = qt4; };