1*35238bceSAndroid Build Coastguard Worker------------------------------------------------------------------------- 2*35238bceSAndroid Build Coastguard WorkerdrawElements Quality Program Test Specification 3*35238bceSAndroid Build Coastguard Worker----------------------------------------------- 4*35238bceSAndroid Build Coastguard Worker 5*35238bceSAndroid Build Coastguard WorkerCopyright 2014 The Android Open Source Project 6*35238bceSAndroid Build Coastguard Worker 7*35238bceSAndroid Build Coastguard WorkerLicensed under the Apache License, Version 2.0 (the "License"); 8*35238bceSAndroid Build Coastguard Workeryou may not use this file except in compliance with the License. 9*35238bceSAndroid Build Coastguard WorkerYou may obtain a copy of the License at 10*35238bceSAndroid Build Coastguard Worker 11*35238bceSAndroid Build Coastguard Worker http://www.apache.org/licenses/LICENSE-2.0 12*35238bceSAndroid Build Coastguard Worker 13*35238bceSAndroid Build Coastguard WorkerUnless required by applicable law or agreed to in writing, software 14*35238bceSAndroid Build Coastguard Workerdistributed under the License is distributed on an "AS IS" BASIS, 15*35238bceSAndroid Build Coastguard WorkerWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16*35238bceSAndroid Build Coastguard WorkerSee the License for the specific language governing permissions and 17*35238bceSAndroid Build Coastguard Workerlimitations under the License. 18*35238bceSAndroid Build Coastguard Worker------------------------------------------------------------------------- 19*35238bceSAndroid Build Coastguard Worker Shader atomic counter tests 20*35238bceSAndroid Build Coastguard Worker 21*35238bceSAndroid Build Coastguard WorkerTests: 22*35238bceSAndroid Build Coastguard Worker + dEQP-GLES31.functional.shaders.atomic_counter.* 23*35238bceSAndroid Build Coastguard Worker 24*35238bceSAndroid Build Coastguard WorkerIncludes: 25*35238bceSAndroid Build Coastguard Worker + Calls to atomicCounter(), atomicCounterIncrement() and atomicCounterDecrement() 26*35238bceSAndroid Build Coastguard Worker - Only in compute shaders 27*35238bceSAndroid Build Coastguard Worker - With different number of parallel shaders 28*35238bceSAndroid Build Coastguard Worker - With different number of calls per shader 29*35238bceSAndroid Build Coastguard Worker - With different combinations of operations 30*35238bceSAndroid Build Coastguard Worker - With conditional calls depending on thread and call number 31*35238bceSAndroid Build Coastguard Worker + Atomic counters with different offsets 32*35238bceSAndroid Build Coastguard Worker + Atomic counters with default layout qualifier and implicit offset and binding 33*35238bceSAndroid Build Coastguard Worker + Invalid offsets and bindings in layout qualifier 34*35238bceSAndroid Build Coastguard Worker + Invalid offsets and bindings in default layout qualifier 35*35238bceSAndroid Build Coastguard Worker 36*35238bceSAndroid Build Coastguard WorkerExcludes: 37*35238bceSAndroid Build Coastguard Worker + Multiple binding points and buffers 38*35238bceSAndroid Build Coastguard Worker - Only single binding point is required by specification 39*35238bceSAndroid Build Coastguard Worker + Use in other than compute shader 40*35238bceSAndroid Build Coastguard Worker - Specification requires zero binding points in other shader types 41*35238bceSAndroid Build Coastguard Worker + Usage in multiple shaders at same time 42*35238bceSAndroid Build Coastguard Worker + Multiple shader innovocations 43*35238bceSAndroid Build Coastguard Worker 44*35238bceSAndroid Build Coastguard WorkerDescription: 45*35238bceSAndroid Build Coastguard Worker 46*35238bceSAndroid Build Coastguard WorkerTest cases perform atomic counter calls and saves results to a SSBO. The SSBO 47*35238bceSAndroid Build Coastguard Workerand the atomic counter buffer are read back from the device after executing 48*35238bceSAndroid Build Coastguard Workerthe shader. Atomic counter values are verified by comparing against the 49*35238bceSAndroid Build Coastguard Workerinitial value subtracted by total number of calls to atomicCounterDecrement() 50*35238bceSAndroid Build Coastguard Workerand incremented by total number of calls to atomicCounterIncrement() performed 51*35238bceSAndroid Build Coastguard Workerby the shader. SSBO value verification depends on the set of functions used in 52*35238bceSAndroid Build Coastguard Workerthe shader. Values returned by call to atomicCounterDecrement() are 53*35238bceSAndroid Build Coastguard Workerincremented by one so that all values in the SSBO are values of counter before 54*35238bceSAndroid Build Coastguard Workerpeforming operation. Atomic counter values returned by different atomic 55*35238bceSAndroid Build Coastguard Workercounters are verified separately. 56*35238bceSAndroid Build Coastguard Worker 57*35238bceSAndroid Build Coastguard WorkerTest cases using only atomicCounter() call are verified by checking that all 58*35238bceSAndroid Build Coastguard Workercalls returned the same value as set initially to the atomic counter. 59*35238bceSAndroid Build Coastguard Worker 60*35238bceSAndroid Build Coastguard WorkerTest case using either atomicCounterIncrement() or atomicCounterDecrement() 61*35238bceSAndroid Build Coastguard Workercall check that each value returned is unique and all values are in continuous 62*35238bceSAndroid Build Coastguard Workerrange from initial value to the expected result value. 63*35238bceSAndroid Build Coastguard Worker 64*35238bceSAndroid Build Coastguard WorkerTest cases using either atomicCounterIncrement() or atomicCounterDecrement() 65*35238bceSAndroid Build Coastguard Workerand atomicCounter() call perform call to atomicCounter() before and after each 66*35238bceSAndroid Build Coastguard Workercall to atomicCounterIncrement()/atomicCounterDecrement(). Test cases check 67*35238bceSAndroid Build Coastguard Workerthat value returned by atomicCounterIncrement()/atomicCounterDecrement() is 68*35238bceSAndroid Build Coastguard Workerbetween values returned by previous and following call to atomicCounter(). 69*35238bceSAndroid Build Coastguard Worker 70*35238bceSAndroid Build Coastguard WorkerTest cases with calls to both atomicCounterIncrement() and 71*35238bceSAndroid Build Coastguard WorkeratomicCounterDecrement() are verified by counting how many times each value 72*35238bceSAndroid Build Coastguard Workerwas returned by each function. Using these counts we check that there is 73*35238bceSAndroid Build Coastguard Workerpossible order in which operations could have been performed. Following pseudo 74*35238bceSAndroid Build Coastguard Workercode checks that there is possible order in which increments and decrements 75*35238bceSAndroid Build Coastguard Workercould have happened. 76*35238bceSAndroid Build Coastguard Worker 77*35238bceSAndroid Build Coastguard Worker// Minimum value returned by atomicCounterDecrement() or atomicCounterIncrement() 78*35238bceSAndroid Build Coastguard WorkerminValue 79*35238bceSAndroid Build Coastguard Worker// Maximum value returned by atomicCounterDecrement() or atomicCounterIncrement() 80*35238bceSAndroid Build Coastguard WorkermaxValue 81*35238bceSAndroid Build Coastguard Worker// incrementCounts[value] is how many times value was returned by atomicCounterIncrement() 82*35238bceSAndroid Build Coastguard WorkerincrementCounts[] 83*35238bceSAndroid Build Coastguard Worker// decrementCounts[value] is how many times value-1 was returned by atomicCounterDecrement() 84*35238bceSAndroid Build Coastguard WorkerdecrementCounts[] 85*35238bceSAndroid Build Coastguard Worker// Value of counter before any operation has been performed 86*35238bceSAndroid Build Coastguard WorkerinitialValue 87*35238bceSAndroid Build Coastguard Worker// Value of counter after executing shader 88*35238bceSAndroid Build Coastguard WorkerresultValue 89*35238bceSAndroid Build Coastguard Worker 90*35238bceSAndroid Build Coastguard Workerpos = initialValue 91*35238bceSAndroid Build Coastguard Worker 92*35238bceSAndroid Build Coastguard Workerwhile incrementCounts[pos] + decrementCounts[pos] == 0: 93*35238bceSAndroid Build Coastguard Worker // Prefer operations that would move away from the result value. 94*35238bceSAndroid Build Coastguard Worker if incrementCounts[pos] > 0 and pos > resultValue: 95*35238bceSAndroid Build Coastguard Worker incrementCounts[pos]-- 96*35238bceSAndroid Build Coastguard Worker pos++ 97*35238bceSAndroid Build Coastguard Worker else if decrementCounts[pos]: 98*35238bceSAndroid Build Coastguard Worker decrementCounts[pos]-- 99*35238bceSAndroid Build Coastguard Worker pos-- 100*35238bceSAndroid Build Coastguard Worker else 101*35238bceSAndroid Build Coastguard Worker incrementCounts[pos]-- 102*35238bceSAndroid Build Coastguard Worker pos++ 103*35238bceSAndroid Build Coastguard Worker 104*35238bceSAndroid Build Coastguard Worker // Last value might have never been returned by call 105*35238bceSAndroid Build Coastguard Worker // to atomicCounterIncrement() or atomicCounterDecrement() 106*35238bceSAndroid Build Coastguard Worker // if it's outside of range. 107*35238bceSAndroid Build Coastguard Worker if pos < minValue or pos > maxValue: 108*35238bceSAndroid Build Coastguard Worker break 109*35238bceSAndroid Build Coastguard Worker 110*35238bceSAndroid Build Coastguard Worker// Check that incrementCounts and decrementCounts contain only zero values. 111*35238bceSAndroid Build Coastguard Worker 112*35238bceSAndroid Build Coastguard WorkerTest set includes negative shader compilation cases as well. In such cases the 113*35238bceSAndroid Build Coastguard Workercompilation is simply expected to fail. 114