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