Merge "Use de::ArrayBuffer, not raw arrays, in sglrReferenceContext."
[platform/upstream/VK-GL-CTS.git] / doc / testspecs / GLES31 / functional.shaders.sample_variables.txt
1 -------------------------------------------------------------------------
2 drawElements Quality Program Test Specification
3 -----------------------------------------------
4
5 Copyright 2014 The Android Open Source Project
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11      http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 -------------------------------------------------------------------------
19     Sample variable tests
20
21 Tests:
22  + dEQP-GLES31.functional.shaders.sample_variables.*
23
24 Includes:
25  + Rendering to default framebuffer, multi- and single sample
26    textures and renderbuffers
27  + Built-in variables:
28     - gl_NumSamples
29     - gl_MaxSamples
30     - gl_SampleID
31     - gl_SamplePos
32     - gl_SampleMaskIn
33  + Writing to gl_SampleMask
34  + Interaction with OES_sample_shading
35
36 Excludes:
37  + Rendering to every supported render buffer sample count / format
38  + Rendering to every supported multisample texture sample count / format
39
40 Description:
41
42 num_samples.* cases test gl_NumSamples built-in value with different render
43 target configurations. max_samples.* cases test gl_MaxSamples built-in variable.
44 Values are verified with verifier fragment shader.
45
46 sample_id.* cases verify gl_SampleID values. A quad is drawn with a shader
47 program. With texture targets, each sample encodes its gl_SampleID to the
48 fragment output value and then texture contents are verified. With default
49 framebuffer and renderbuffer targets, render area is partitioned to a grid so
50 that in each grid cell only the fragment shader invocations with a certain
51 gl_SampleID output a non-zero green value. Result image is then verified to
52 contain only non-zero green values. The test with framebuffer and renderbuffer
53 thus only guarantees that for each pixel there exist a fragment shader
54 invocation for every valid gl_SampleID value, but not that a matching fragment
55 shader invocation is unique.
56
57 sample_pos.correctness.* cases verify gl_SamplePosition built-in variable
58 contains the position in which varyings were interpolated. Cases render a quad
59 with a verifier fragment shader. Fragment shader compares gl_SamplePosition
60 values against a per-sample interpolated screen-space location (in pixels)
61 varying. gl_SamplePosition should be equal to the fractional part of the
62 interpolated varying value.
63
64 sample_pos.distribution.* cases verify the distribution of gl_SamplePositions
65 within a pixel. The tests render a quad with a fragment shader that encodes the
66 gl_SamplePosition value and value legality (range check) to the color channels.
67 With texture render targets, the texture contents are read and positions are
68 verified for legality, uniqueness and distribution. With framebuffer and
69 renderbuffer render targets only the legality and distribution are verified.
70 Distribution is verified by averaging sample position values (texture) or by
71 resolving with an implementation defined method (framebuffer, renderbuffer).
72 Averaged/resolved value should be reasonably close to the pixel center. Too
73 large a bias away from the expected value will result in a quality warning.
74
75 sample_mask_in.* cases test reading gl_SampleMaskIn built-in variable and
76 sample_mask_in.* cases write values to gl_SampleMask built-in variable. Sample
77 mask operations are multisample operations and should not have effect with
78 single sample render targets. *_per_pixel variations test value when fragment
79 shader is executed once per pixel, and *_per_sample when shader is executed per
80 sample. *_per_two_samples variations use OES_sample_shading, with sample
81 shading value set to 50%, i.e. there should be AT LEAST one invocation per two
82 samples.
83
84 sample_mask_in.sample_mask cases test gl_SampleMaskIn that with multisampled
85 render targets gl_SampleMaskIn does not contain any bits not set in
86 GL_SAMPLE_MASK. With single sample render targets gl_SampleMaskIn should not
87 depend on GL_SAMPLE_MASK value.
88
89 sample_mask_in.bit_count cases test gl_SampleMaskIn contains only a certain
90 number of set bits. In the per pixel variation, gl_SampleMaskIn should contain
91 [1, numSamples] set bits. In per sample cases, the gl_SampleMaskIn should only
92 contain one set bit. In per two samples cases, there should be [1, numSamples/2]
93 bits (all but one invocation gets one sample, one invocation gets the other
94 samples).
95
96 sample_mask_in.bits_unique_per_sample cases tests that the single set bit in
97 gl_SampleMaskIn is unique. sample_mask_in.bits_unique_per_two_samples cases test
98 that each bit is set only in a single gl_SampleMaskIn bitset and that number of
99 distinct gl_SampleMaskIn bitsets matches the number guaranteed by
100 OES_sample_shading. Tests render to a multisample texture, encode
101 gl_SampleMaskIn to the color channel, and then read back the texture contents.
102
103 sample_mask.discard_half tests discard half of the samples by writing 0xAAAA...
104 to gl_SampleMask output variable. With single sample targets, writing to
105 gl_SampleMask should have no effect. With multisample targets the result image
106 color intensity should decrease. With multisample targets with sample count = 1,
107 all fragments should be discarded.
108
109 sample_mask.inverse cases set gl_SampleMask to the inverse of current
110 SAMPLE_MASK. With multisample render targets, all fragments should be discarded.
111 With single sample render targets, writing to gl_SampleMask should have no
112 effect.