12 , vulkan-validation-layers
15 # From https://github.com/google/amber/blob/main/DEPS
16 glslang = fetchFromGitHub {
17 owner = "KhronosGroup";
19 rev = "e8dd0b6903b34f1879520b444634c75ea2deedf5";
20 hash = "sha256-B6jVCeoFjd2H6+7tIses+Kj8DgHS6E2dkVzQAIzDHEc=";
23 lodepng = fetchFromGitHub {
26 rev = "5601b8272a6850b7c5d693dd0c0e16da50be8d8d";
27 hash = "sha256-dD8QoyOoGov6VENFNTXWRmen4nYYleoZ8+4TpICNSpo=";
30 shaderc = fetchFromGitHub {
33 rev = "f59f0d11b80fd622383199c867137ededf89d43b";
34 hash = "sha256-kHz8Io5GZDWv1FjPyBWRpnKhGygKhSU4L9zl/AKXZlU=";
37 spirv-headers = fetchFromGitHub {
38 owner = "KhronosGroup";
39 repo = "SPIRV-Headers";
40 rev = "5e3ad389ee56fca27c9705d093ae5387ce404df4";
41 hash = "sha256-gjF5mVTXqU/GZzr2S6oKGChgvqqHcQSrEq/ePP2yJys=";
44 spirv-tools = fetchFromGitHub {
45 owner = "KhronosGroup";
47 rev = "9241a58a8028c49510bc174b6c970e3c2b4b8e51";
48 hash = "sha256-0qHUpwNDJI2jV4h68QaTNPIwTPxwTt0iAUnMXqFCiJE=";
52 stdenv.mkDerivation (finalAttrs: {
54 version = "unstable-2024-08-21";
56 src = fetchFromGitHub {
59 rev = "66399a35927606a435bf7a59756e87e6cb5a0013";
60 hash = "sha256-PCO64zI/vzp4HyGz5WpeYpCBeaWjTvz1punWsTz1yiM=";
73 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
77 # Tests are disabled so we do not have to pull in googletest and more dependencies
78 cmakeFlags = [ "-DAMBER_SKIP_TESTS=ON" "-DAMBER_DISABLE_WERROR=ON" ];
81 cp -r ${glslang}/ third_party/glslang
82 cp -r ${lodepng}/ third_party/lodepng
83 cp -r ${shaderc}/ third_party/shaderc
84 cp -r ${spirv-tools}/ third_party/spirv-tools
85 cp -r ${spirv-headers}/ third_party/spirv-headers
86 chmod u+w -R third_party
88 substituteInPlace tools/update_build_version.py \
89 --replace "not os.path.exists(directory)" "True"
93 install -Dm755 -t $out/bin amber image_diff
94 wrapProgram $out/bin/amber \
95 --suffix VK_LAYER_PATH : ${vulkan-validation-layers}/share/vulkan/explicit_layer.d
98 passthru.tests.lavapipe = runCommand "vulkan-cts-tests-lavapipe" {
99 nativeBuildInputs = [ finalAttrs.finalPackage mesa.llvmpipeHook ];
101 cat > test.amber <<EOF
103 # Simple amber compute shader.
105 SHADER compute kComputeShader GLSL
108 layout(binding = 3) buffer block {
113 values[gl_WorkGroupID.x + gl_WorkGroupID.y * gl_NumWorkGroups.x] =
118 BUFFER kComputeBuffer DATA_TYPE vec2<int32> SIZE 524288 FILL 0
120 PIPELINE compute kComputePipeline
121 ATTACH kComputeShader
122 BIND BUFFER kComputeBuffer AS storage DESCRIPTOR_SET 0 BINDING 3
125 RUN kComputePipeline 256 256 1
128 EXPECT kComputeBuffer IDX 0 EQ 0 0
129 EXPECT kComputeBuffer IDX 2040 EQ 255 0
130 EXPECT kComputeBuffer IDX 522240 EQ 0 255
131 EXPECT kComputeBuffer IDX 524280 EQ 255 255
134 EXPECT kComputeBuffer IDX 263168 EQ 128 128
142 description = "Multi-API shader test framework";
143 homepage = "https://github.com/google/amber";
144 license = licenses.asl20;
145 maintainers = with maintainers; [ Flakebi ];