vulkan-validation-layers: 1.1.82.0 -> 1.1.85.0

This requires knock-on upgrades for glslang and spirv-tools.

I have also made the validation layers easier to use:
- library files identified by layer definitions now use absolute paths
- the layer definition path is prepended to XDG_DATA_DIRS

Previously, one would have to modify LD_LIBRARY_PATH or install the
derivation in a known location for vulkan-loader to find relevant
files. These changes make using validation layers in a nix-shell work automatically.

Use XDG_DATA_DIRS environment variable rather than VK_LAYER_PATH
This commit is contained in:
Anthony Cowley 2018-12-07 13:17:57 -05:00
parent c26dbef830
commit 6492af66e1
3 changed files with 24 additions and 20 deletions

View File

@ -2,23 +2,15 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "glslang-git-${version}"; name = "glslang-git-${version}";
version = "2018-07-27"; version = "2018-09-26";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "KhronosGroup"; owner = "KhronosGroup";
repo = "glslang"; repo = "glslang";
rev = "e99a26810f65314183163c07664a40e05647c15f"; rev = "91ac4290bcf2cb930b4fb0981f09c00c0b6797e1";
sha256 = "1w11z518xfbnf34xgzg1mp3xicpw2qmpcvaixlzw79s9ifqg5lqs"; sha256 = "0q477pm0n495acnss16ddlf82a6i5l2dfmvc7r8yi0bgmgpzi4av";
}; };
patches = [
# spirv-tools bump for vulkan sdk 1.1.82.1; remove on update
(fetchpatch {
url = "https://github.com/lenny-lunarg/glslang/commit/c7f4e818ac55f545289f87f8c37571b2eadcde86.patch";
sha256 = "197293alxjdpm3x1vd6pksdb1d9za42vlyn8yn2w786av0l7vf1k";
})
];
buildInputs = [ cmake bison jq ] ++ spirv-tools.buildInputs; buildInputs = [ cmake bison jq ] ++ spirv-tools.buildInputs;
enableParallelBuilding = true; enableParallelBuilding = true;

View File

@ -7,14 +7,14 @@ spirv_sources = {
tools = fetchFromGitHub { tools = fetchFromGitHub {
owner = "KhronosGroup"; owner = "KhronosGroup";
repo = "SPIRV-Tools"; repo = "SPIRV-Tools";
rev = "1a283f41ed09e31cd720744f904af3d823ceddbf"; rev = "9bfe0eb25e3dfdf4f3fd86ab6c0cda009c9bd661";
sha256 = "1z65wglg081pri9rmiyydvppgd67qr269ppphy4yhg2wg81gg72c"; sha256 = "1spfii4zib1lmz40vnz1d1cr6is7q2n7rvar1vfzi33gwrn8rqhi";
}; };
headers = fetchFromGitHub { headers = fetchFromGitHub {
owner = "KhronosGroup"; owner = "KhronosGroup";
repo = "SPIRV-Headers"; repo = "SPIRV-Headers";
rev = "ff684ffc6a35d2a58f0f63108877d0064ea33feb"; rev = "d5b2e1255f706ce1f88812217e9a554f299848af";
sha256 = "0ypjx61ksr6vda2iy3kxhyjia5qxf0x4qa4jij0giw9x5rsnga6g"; sha256 = "18530mpa030ckjhn78z9vbfd35l5jgh3mg22ra6k8gw8zx4wjhsl";
}; };
}; };
@ -22,7 +22,7 @@ in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "spirv-tools-${version}"; name = "spirv-tools-${version}";
version = "2018-07-04"; version = "2018-09-20";
src = spirv_sources.tools; src = spirv_sources.tools;
patchPhase = ''ln -sv ${spirv_sources.headers} external/spirv-headers''; patchPhase = ''ln -sv ${spirv_sources.headers} external/spirv-headers'';

View File

@ -1,15 +1,16 @@
{ stdenv, fetchFromGitHub, cmake, python3, vulkan-headers, vulkan-loader, { stdenv, fetchFromGitHub, cmake, writeText, python3
glslang, pkgconfig, xlibsWrapper, libxcb, libXrandr, wayland }: , vulkan-headers, vulkan-loader, glslang
, pkgconfig, xlibsWrapper, libxcb, libXrandr, wayland }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "vulkan-validation-layers-${version}"; name = "vulkan-validation-layers-${version}";
version = "1.1.82.0"; version = "1.1.85.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "KhronosGroup"; owner = "KhronosGroup";
repo = "Vulkan-ValidationLayers"; repo = "Vulkan-ValidationLayers";
rev = "sdk-${version}"; rev = "sdk-${version}";
sha256 = "0vq2hbha2i5wsi6w6kmxbv01a5f0d55w2grl73nya9i06764fdg6"; sha256 = "1y5ny587h62139fxnz760hsyv1dmw29m1a9vq096sn8qafh3jzbz";
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
@ -18,6 +19,17 @@ stdenv.mkDerivation rec {
cmakeFlags = [ "-DGLSLANG_INSTALL_DIR=${glslang}" ]; cmakeFlags = [ "-DGLSLANG_INSTALL_DIR=${glslang}" ];
# Help vulkan-loader find the validation layers
setupHook = writeText "setup-hook" ''
export XDG_DATA_DIRS=@out@/share:$XDG_DATA_DIRS
'';
# Include absolute paths to layer libraries in their associated
# layer definition json files.
patchPhase = ''
sed "s|\([[:space:]]*set(INSTALL_DEFINES \''${INSTALL_DEFINES} -DRELATIVE_LAYER_BINARY=\"\)\(\$<TARGET_FILE_NAME:\''${TARGET_NAME}>\")\)|\1$out/lib/\2|" -i layers/CMakeLists.txt
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "LunarG Vulkan loader"; description = "LunarG Vulkan loader";
homepage = https://www.lunarg.com; homepage = https://www.lunarg.com;