1 Specialization Constants tests
4 + dEQP-VK.pipeline.spec_constant.*
7 + Uses extended GLSL (KHR_vulkan_glsl) to specify shaders
8 (dependency on glslang)
9 + Basic specialization constants (OpSpecConstant, OpSpecConstantTrue,
10 OpSpecConstantFalse instructions)
11 - No specialization info (default values)
12 - Partial and full specialization
13 - 32 bit boolean, integer and float types
14 - (optional) 16 and 64 bit types, where supported
15 + Specialization constants in composites (OpSpecConstantComposite instruction)
20 + Specialization constants in expressions (OpSpecConstantOp instruction)
22 - (optional) Various instructions as listed in the spec
23 + Compute shader work group size specialization
24 + Built-in constant specialization (override the default value)
25 + All of the above should be exercised with all applicable shader stages in
26 both pipeline types (compute and graphics).
29 + SPIR-V assembly code
30 + OpSpecConstantOp instructions are covered by assembly tests in
31 external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp
34 + SPIR-V generated from GLSL should be inspected for instruction coverage
35 and overall correctness before accepting the tests.
39 The tests will run various shader stages with some specialization constants.
40 Constant values are read in the shader, written to a SSBO, and read back from
41 a host-visible buffer. Depending on the test, none, some, or all specialization
42 constants are defined through VkSpecializationInfo. The test passes if the value
43 written by the shader matches the expected reference value (either the default
44 or a set specialized value).
46 For expression tests result of an operation is written to the output SSBO and
47 then compared to a reference operation result.
49 A test with no specialization info verifies that the default values defined in
50 the shader are used correctly. Specialization with one or more specialization
51 constants check if Vulkan structure is consumed correctly by the API.
53 Different types and type widths are tested to see if provided value is passed
54 correctly to the shader. The tests will use types and expressions similar to the
55 following (examples are not exhaustive):
57 // Basic specialization constants and const expressions
59 layout(constant_id = 7) const int foo = 3;
60 layout(constant_id = 9) const float bar = 6.5;
65 // Specialization constant expressions
67 const float expr_fadd = bar + 3.5; // OpFAdd
69 // Specialization constant composites
71 const vec3 sc_vec = vec3(1.0, bar, 3.0);
72 const int sc_array[4] = int[](foo, 2, 3, 4);
74 // Override work group size
76 layout(local_size_y_id = 19) in; // y=? (id=19)
77 layout(local_size_x_id = 20, local_size_z_id = 21) in; // x=? z=?
79 // Override Built-in constant
81 layout(constant_id = 13) gl_MaxImageUnits;