1e5c31af7Sopenharmony_ci------------------------------------------------------------------------- 2e5c31af7Sopenharmony_cidrawElements Quality Program Test Specification 3e5c31af7Sopenharmony_ci----------------------------------------------- 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ciCopyright 2014 The Android Open Source Project 6e5c31af7Sopenharmony_ci 7e5c31af7Sopenharmony_ciLicensed under the Apache License, Version 2.0 (the "License"); 8e5c31af7Sopenharmony_ciyou may not use this file except in compliance with the License. 9e5c31af7Sopenharmony_ciYou may obtain a copy of the License at 10e5c31af7Sopenharmony_ci 11e5c31af7Sopenharmony_ci http://www.apache.org/licenses/LICENSE-2.0 12e5c31af7Sopenharmony_ci 13e5c31af7Sopenharmony_ciUnless required by applicable law or agreed to in writing, software 14e5c31af7Sopenharmony_cidistributed under the License is distributed on an "AS IS" BASIS, 15e5c31af7Sopenharmony_ciWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16e5c31af7Sopenharmony_ciSee the License for the specific language governing permissions and 17e5c31af7Sopenharmony_cilimitations under the License. 18e5c31af7Sopenharmony_ci------------------------------------------------------------------------- 19e5c31af7Sopenharmony_ci Sample variable tests 20e5c31af7Sopenharmony_ci 21e5c31af7Sopenharmony_ciTests: 22e5c31af7Sopenharmony_ci + dEQP-GLES31.functional.shaders.sample_variables.* 23e5c31af7Sopenharmony_ci 24e5c31af7Sopenharmony_ciIncludes: 25e5c31af7Sopenharmony_ci + Rendering to default framebuffer, multi- and single sample 26e5c31af7Sopenharmony_ci textures and renderbuffers 27e5c31af7Sopenharmony_ci + Built-in variables: 28e5c31af7Sopenharmony_ci - gl_NumSamples 29e5c31af7Sopenharmony_ci - gl_MaxSamples 30e5c31af7Sopenharmony_ci - gl_SampleID 31e5c31af7Sopenharmony_ci - gl_SamplePos 32e5c31af7Sopenharmony_ci - gl_SampleMaskIn 33e5c31af7Sopenharmony_ci + Writing to gl_SampleMask 34e5c31af7Sopenharmony_ci + Interaction with OES_sample_shading 35e5c31af7Sopenharmony_ci 36e5c31af7Sopenharmony_ciExcludes: 37e5c31af7Sopenharmony_ci + Rendering to every supported render buffer sample count / format 38e5c31af7Sopenharmony_ci + Rendering to every supported multisample texture sample count / format 39e5c31af7Sopenharmony_ci 40e5c31af7Sopenharmony_ciDescription: 41e5c31af7Sopenharmony_ci 42e5c31af7Sopenharmony_cinum_samples.* cases test gl_NumSamples built-in value with different render 43e5c31af7Sopenharmony_citarget configurations. max_samples.* cases test gl_MaxSamples built-in variable. 44e5c31af7Sopenharmony_ciValues are verified with verifier fragment shader. 45e5c31af7Sopenharmony_ci 46e5c31af7Sopenharmony_cisample_id.* cases verify gl_SampleID values. A quad is drawn with a shader 47e5c31af7Sopenharmony_ciprogram. With texture targets, each sample encodes its gl_SampleID to the 48e5c31af7Sopenharmony_cifragment output value and then texture contents are verified. With default 49e5c31af7Sopenharmony_ciframebuffer and renderbuffer targets, render area is partitioned to a grid so 50e5c31af7Sopenharmony_cithat in each grid cell only the fragment shader invocations with a certain 51e5c31af7Sopenharmony_cigl_SampleID output a non-zero green value. Result image is then verified to 52e5c31af7Sopenharmony_cicontain only non-zero green values. The test with framebuffer and renderbuffer 53e5c31af7Sopenharmony_cithus only guarantees that for each pixel there exist a fragment shader 54e5c31af7Sopenharmony_ciinvocation for every valid gl_SampleID value, but not that a matching fragment 55e5c31af7Sopenharmony_cishader invocation is unique. 56e5c31af7Sopenharmony_ci 57e5c31af7Sopenharmony_cisample_pos.correctness.* cases verify gl_SamplePosition built-in variable 58e5c31af7Sopenharmony_cicontains the position in which varyings were interpolated. Cases render a quad 59e5c31af7Sopenharmony_ciwith a verifier fragment shader. Fragment shader compares gl_SamplePosition 60e5c31af7Sopenharmony_civalues against a per-sample interpolated screen-space location (in pixels) 61e5c31af7Sopenharmony_civarying. gl_SamplePosition should be equal to the fractional part of the 62e5c31af7Sopenharmony_ciinterpolated varying value. 63e5c31af7Sopenharmony_ci 64e5c31af7Sopenharmony_cisample_pos.distribution.* cases verify the distribution of gl_SamplePositions 65e5c31af7Sopenharmony_ciwithin a pixel. The tests render a quad with a fragment shader that encodes the 66e5c31af7Sopenharmony_cigl_SamplePosition value and value legality (range check) to the color channels. 67e5c31af7Sopenharmony_ciWith texture render targets, the texture contents are read and positions are 68e5c31af7Sopenharmony_civerified for legality, uniqueness and distribution. With framebuffer and 69e5c31af7Sopenharmony_cirenderbuffer render targets only the legality and distribution are verified. 70e5c31af7Sopenharmony_ciDistribution is verified by averaging sample position values (texture) or by 71e5c31af7Sopenharmony_ciresolving with an implementation defined method (framebuffer, renderbuffer). 72e5c31af7Sopenharmony_ciAveraged/resolved value should be reasonably close to the pixel center. Too 73e5c31af7Sopenharmony_cilarge a bias away from the expected value will result in a quality warning. 74e5c31af7Sopenharmony_ci 75e5c31af7Sopenharmony_cisample_mask_in.* cases test reading gl_SampleMaskIn built-in variable and 76e5c31af7Sopenharmony_cisample_mask_in.* cases write values to gl_SampleMask built-in variable. Sample 77e5c31af7Sopenharmony_cimask operations are multisample operations and should not have effect with 78e5c31af7Sopenharmony_cisingle sample render targets. *_per_pixel variations test value when fragment 79e5c31af7Sopenharmony_cishader is executed once per pixel, and *_per_sample when shader is executed per 80e5c31af7Sopenharmony_cisample. *_per_two_samples variations use OES_sample_shading, with sample 81e5c31af7Sopenharmony_cishading value set to 50%, i.e. there should be AT LEAST one invocation per two 82e5c31af7Sopenharmony_cisamples. 83e5c31af7Sopenharmony_ci 84e5c31af7Sopenharmony_cisample_mask_in.sample_mask cases test gl_SampleMaskIn that with multisampled 85e5c31af7Sopenharmony_cirender targets gl_SampleMaskIn does not contain any bits not set in 86e5c31af7Sopenharmony_ciGL_SAMPLE_MASK. With single sample render targets gl_SampleMaskIn should not 87e5c31af7Sopenharmony_cidepend on GL_SAMPLE_MASK value. 88e5c31af7Sopenharmony_ci 89e5c31af7Sopenharmony_cisample_mask_in.bit_count cases test gl_SampleMaskIn contains only a certain 90e5c31af7Sopenharmony_cinumber of set bits. In the per pixel variation, gl_SampleMaskIn should contain 91e5c31af7Sopenharmony_ci[1, numSamples] set bits. In per sample cases, the gl_SampleMaskIn should only 92e5c31af7Sopenharmony_cicontain one set bit. In per two samples cases, there should be [1, numSamples/2] 93e5c31af7Sopenharmony_cibits (all but one invocation gets one sample, one invocation gets the other 94e5c31af7Sopenharmony_cisamples). 95e5c31af7Sopenharmony_ci 96e5c31af7Sopenharmony_cisample_mask_in.bits_unique_per_sample cases tests that the single set bit in 97e5c31af7Sopenharmony_cigl_SampleMaskIn is unique. sample_mask_in.bits_unique_per_two_samples cases test 98e5c31af7Sopenharmony_cithat each bit is set only in a single gl_SampleMaskIn bitset and that number of 99e5c31af7Sopenharmony_cidistinct gl_SampleMaskIn bitsets matches the number guaranteed by 100e5c31af7Sopenharmony_ciOES_sample_shading. Tests render to a multisample texture, encode 101e5c31af7Sopenharmony_cigl_SampleMaskIn to the color channel, and then read back the texture contents. 102e5c31af7Sopenharmony_ci 103e5c31af7Sopenharmony_cisample_mask.discard_half tests discard half of the samples by writing 0xAAAA... 104e5c31af7Sopenharmony_cito gl_SampleMask output variable. With single sample targets, writing to 105e5c31af7Sopenharmony_cigl_SampleMask should have no effect. With multisample targets the result image 106e5c31af7Sopenharmony_cicolor intensity should decrease. With multisample targets with sample count = 1, 107e5c31af7Sopenharmony_ciall fragments should be discarded. 108e5c31af7Sopenharmony_ci 109e5c31af7Sopenharmony_cisample_mask.inverse cases set gl_SampleMask to the inverse of current 110e5c31af7Sopenharmony_ciSAMPLE_MASK. With multisample render targets, all fragments should be discarded. 111e5c31af7Sopenharmony_ciWith single sample render targets, writing to gl_SampleMask should have no 112e5c31af7Sopenharmony_cieffect. 113