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    Shader operator performance tests
20e5c31af7Sopenharmony_ci
21e5c31af7Sopenharmony_ciTests:
22e5c31af7Sopenharmony_ci + dEQP-GLES2.performance.shaders.operator.*
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ciIncludes:
25e5c31af7Sopenharmony_ci + Arithmetic operators in vertex and fragment shaders
26e5c31af7Sopenharmony_ci   - Scalar and vector types
27e5c31af7Sopenharmony_ci + Computation-only built-in functions
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_ciExcludes:
30e5c31af7Sopenharmony_ci + Texture lookup built-in functions
31e5c31af7Sopenharmony_ci   - Covered in performance.texture.
32e5c31af7Sopenharmony_ci
33e5c31af7Sopenharmony_ciDescription:
34e5c31af7Sopenharmony_ci
35e5c31af7Sopenharmony_ciEach test case draws multiple times with different workload sizes. A workload
36e5c31af7Sopenharmony_cisize means the iteration count of a uniform loop in the shader. Time for each
37e5c31af7Sopenharmony_ciframe is measured, and the slope of the workload size vs frame time data is
38e5c31af7Sopenharmony_ciestimated. This slope tells us the estimated increase in frame time caused by
39e5c31af7Sopenharmony_cia workload increase of 1 loop iteration.
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ciGenerally, the shaders contain not just the operation we're interested in (e.g.
42e5c31af7Sopenharmony_ciaddition) but also some other things (e.g. loop overhead). To eliminate this
43e5c31af7Sopenharmony_cicost, we actually do the measurements described above paragraph with two
44e5c31af7Sopenharmony_ciprograms, which contain different amounts of computation in the loop. Then we
45e5c31af7Sopenharmony_cican compute the cost of just one operation by appropriately subtracting the
46e5c31af7Sopenharmony_ciestimated slopes, and dividing by the operation count difference between the
47e5c31af7Sopenharmony_citwo programs.
48e5c31af7Sopenharmony_ci
49e5c31af7Sopenharmony_ciAt this point, the result tells us the increase in frame time caused by the
50e5c31af7Sopenharmony_ciaddition of one operation. Dividing this by the amount of draw calls in a frame,
51e5c31af7Sopenharmony_ciand further by the amount of vertices or fragments in a draw call, we get the
52e5c31af7Sopenharmony_citime cost of one operation.
53e5c31af7Sopenharmony_ci
54e5c31af7Sopenharmony_ciIn reality, there sometimes isn't just a trivial linear dependence between
55e5c31af7Sopenharmony_ciworkload size and frame time. Instead, there tends to be some amount of initial
56e5c31af7Sopenharmony_ci"free" operations. That is, it may be that all workload sizes below some number
57e5c31af7Sopenharmony_ciC yield the same frame time, and only workload sizes beyond C increase the frame
58e5c31af7Sopenharmony_citime in a supposedly linear manner. Graphically, this means that there graph
59e5c31af7Sopenharmony_ciconsists of two parts: a horizontal left part, and a linearly increasing right
60e5c31af7Sopenharmony_cipart; the right part starts where the left parts ends. The principal task of
61e5c31af7Sopenharmony_cithese tests is to look at the slope of the increasing right part. Additionally
62e5c31af7Sopenharmony_cian estimate for the amount of initial free operations is calculated. Note that
63e5c31af7Sopenharmony_ciit is also normal to get graphs where the horizontal left part is of zero width,
64e5c31af7Sopenharmony_cii.e. there are no free operations.
65e5c31af7Sopenharmony_ci
66e5c31af7Sopenharmony_ciNote that the tests use several fixed constants, such as the extent to which the
67e5c31af7Sopenharmony_ciloops in the shaders are unrolled. These may not be the most suitable for all
68e5c31af7Sopenharmony_ciplatforms, and can be modified near the top of es2pShaderOperatorTests.cpp .
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ciThe unit of the test result is millions of operations per second.
71e5c31af7Sopenharmony_ci
72e5c31af7Sopenharmony_ciSee performance.txt for more details on shader performance testing.
73