2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv
|
2020-10-14 13:47:10 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, writeText
|
|
|
|
, python3
|
|
|
|
, spirv-headers
|
|
|
|
, spirv-tools
|
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
|
|
|
, glslang
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2020-10-14 13:47:10 +01:00
|
|
|
, xlibsWrapper
|
|
|
|
, libxcb
|
|
|
|
, libXrandr
|
|
|
|
, wayland
|
|
|
|
}:
|
|
|
|
# vulkan-validation-layers requires a custom glslang version, while glslang requires
|
|
|
|
# custom versions for spirv-tools and spirv-headers. The git hashes required for all
|
|
|
|
# of these deps is documented upstream here:
|
|
|
|
# https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/scripts/known_good.json
|
|
|
|
|
|
|
|
let
|
2020-12-15 03:59:22 +00:00
|
|
|
localSpirvHeaders = spirv-headers.overrideAttrs (_: {
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Headers";
|
|
|
|
rev = "f027d53ded7e230e008d37c8b47ede7cd308e19d";
|
|
|
|
sha256 = "12gp2mqcar6jj57jw9isfr62yn72kmvdcl0zga4gvrlyfhnf582q";
|
|
|
|
};
|
|
|
|
});
|
2020-10-14 13:47:10 +01:00
|
|
|
localGlslang = (glslang.override {
|
|
|
|
argSpirv-tools = spirv-tools.overrideAttrs (_: {
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "SPIRV-Tools";
|
2020-12-15 03:59:22 +00:00
|
|
|
rev = "c9c1f54330d13a0bec1aa3f08d436249d8e35596";
|
|
|
|
sha256 = "0r5whsw9x8j4199xwxv293ar2ga73pm2s7rngw732ylh6rw3bkly";
|
2020-10-14 13:47:10 +01:00
|
|
|
};
|
|
|
|
});
|
2020-12-15 03:59:22 +00:00
|
|
|
argSpirv-headers = localSpirvHeaders;
|
2020-10-14 13:47:10 +01:00
|
|
|
}).overrideAttrs (_: {
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "glslang";
|
2020-12-15 03:59:22 +00:00
|
|
|
rev = "dd69df7f3dac26362e10b0f38efb9e47990f7537";
|
|
|
|
sha256 = "1iafbh524avsjg4pjiq156b62pck2rwlfl2pjnml8sjy285506rk";
|
2020-10-14 13:47:10 +01:00
|
|
|
};
|
|
|
|
});
|
|
|
|
in
|
2019-08-06 23:42:10 +01:00
|
|
|
|
2018-06-27 04:36:00 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-06 23:42:10 +01:00
|
|
|
pname = "vulkan-validation-layers";
|
2020-12-15 03:59:22 +00:00
|
|
|
version = "1.2.162.0";
|
2018-06-27 04:36:00 +01:00
|
|
|
|
2020-11-16 07:46:03 +00:00
|
|
|
# If we were to use "dev" here instead of headers, the setupHook would be
|
|
|
|
# placed in that output instead of "out".
|
|
|
|
outputs = ["out" "headers"];
|
|
|
|
outputInclude = "headers";
|
|
|
|
|
2018-06-27 04:36:00 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KhronosGroup";
|
|
|
|
repo = "Vulkan-ValidationLayers";
|
|
|
|
rev = "sdk-${version}";
|
2020-12-15 03:59:22 +00:00
|
|
|
sha256 = "1mpqmxh9zm20jdar59lp4yjpqfzxn2pwds6bkvnzihfy0pymf15k";
|
2018-06-27 04:36:00 +01:00
|
|
|
};
|
|
|
|
|
2020-07-28 02:07:19 +01:00
|
|
|
nativeBuildInputs = [
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2020-07-28 02:07:19 +01:00
|
|
|
cmake
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2020-10-14 13:47:10 +01:00
|
|
|
localGlslang
|
|
|
|
localGlslang.spirv-headers
|
2020-07-28 02:07:19 +01:00
|
|
|
vulkan-headers
|
|
|
|
vulkan-loader
|
|
|
|
libxcb
|
|
|
|
libXrandr
|
|
|
|
wayland
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2020-10-14 13:47:10 +01:00
|
|
|
"-DGLSLANG_INSTALL_DIR=${localGlslang}"
|
2020-12-15 03:59:22 +00:00
|
|
|
"-DSPIRV_HEADERS_INSTALL_DIR=${localSpirvHeaders}"
|
2020-11-16 07:46:03 +00:00
|
|
|
"-DBUILD_LAYER_SUPPORT_FILES=ON"
|
2020-07-28 02:07:19 +01:00
|
|
|
];
|
2018-06-27 04:36:00 +01:00
|
|
|
|
2018-12-07 18:17:57 +00:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-12-15 03:59:22 +00:00
|
|
|
description = "The official Khronos Vulkan validation layers";
|
|
|
|
homepage = "https://github.com/KhronosGroup/Vulkan-ValidationLayers";
|
2018-06-27 04:36:00 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.ralith ];
|
|
|
|
};
|
|
|
|
}
|