CP: Remove two read-backs from copy image tests am: 263e135474 am: a691d5ca5c am...
[platform/upstream/VK-GL-CTS.git] / doc / testspecs / VK / pipeline.spec_constant.txt
1     Specialization Constants tests
2
3 Tests:
4  + dEQP-VK.pipeline.spec_constant.*
5
6 Includes:
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)
16    - struct members
17    - array elements
18    - vector components
19    - matrix columns
20  + Specialization constants in expressions (OpSpecConstantOp instruction)
21    - Array size
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).
27
28 Excludes:
29  + SPIR-V assembly code
30  + OpSpecConstantOp instructions are covered by assembly tests in
31    external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp
32
33 Notes:
34  + SPIR-V generated from GLSL should be inspected for instruction coverage
35    and overall correctness before accepting the tests.
36
37 Description:
38
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).
45
46 For expression tests result of an operation is written to the output SSBO and
47 then compared to a reference operation result.
48
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.
52
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):
56
57   // Basic specialization constants and const expressions
58
59   layout(constant_id = 7) const int foo = 3;
60   layout(constant_id = 9) const float bar = 6.5;
61
62   int data[foo];
63   int data2[foo + 2];
64
65   // Specialization constant expressions
66
67   const float expr_fadd = bar + 3.5;  // OpFAdd
68
69   // Specialization constant composites
70
71   const vec3 sc_vec = vec3(1.0, bar, 3.0);
72   const int sc_array[4] = int[](foo, 2, 3, 4);
73
74   // Override work group size
75
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=?
78
79   // Override Built-in constant
80
81   layout(constant_id = 13) gl_MaxImageUnits;