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 compiler performance tests
20e5c31af7Sopenharmony_ci
21e5c31af7Sopenharmony_ciTests:
22e5c31af7Sopenharmony_ci + dEQP-GLES2.performance.compiler.*
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ciIncludes:
25e5c31af7Sopenharmony_ci + Shader compile, link and specialization (draw call -time) time measurements
26e5c31af7Sopenharmony_ci + Tests for impact of cache hits on compilation time (note: in release 2012.4)
27e5c31af7Sopenharmony_ci + Front-end time estimation with invalid shaders
28e5c31af7Sopenharmony_ci + Typical use cases
29e5c31af7Sopenharmony_ci   - Vertex and fragment lighting
30e5c31af7Sopenharmony_ci   - Mandelbrot viewer
31e5c31af7Sopenharmony_ci   - Normal mapping, parallax and relief mapping (note: in release 2012.4)
32e5c31af7Sopenharmony_ci + Synthetic cases
33e5c31af7Sopenharmony_ci   - A number of texture lookups blended together in fragment shader
34e5c31af7Sopenharmony_ci   - Single or nested loops
35e5c31af7Sopenharmony_ci   - Single expression consisting of a variable number of vec4 multiplications
36e5c31af7Sopenharmony_ci + Shaders designed to stress compiler (note: in release 2012.4)
37e5c31af7Sopenharmony_ci   - High register pressure
38e5c31af7Sopenharmony_ci   - Lots of control flow
39e5c31af7Sopenharmony_ci
40e5c31af7Sopenharmony_ciExcludes:
41e5c31af7Sopenharmony_ci + Shader functional testing
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_ciDescription:
44e5c31af7Sopenharmony_ci
45e5c31af7Sopenharmony_ciShader compiler performance tests measure the time to compile GLSL shader programs.
46e5c31af7Sopenharmony_ciThe tests will take into account implementations that postpone final compilation
47e5c31af7Sopenharmony_ciuntil execution of a draw call.
48e5c31af7Sopenharmony_ci
49e5c31af7Sopenharmony_ciSeparate cases are made for testing compilation time when avoiding cache hits and
50e5c31af7Sopenharmony_ciwhen allowing them (note that tests that allow cache will be in release 2012.4).
51e5c31af7Sopenharmony_ciCache-avoiding cases use a different shader for different iterations of the same
52e5c31af7Sopenharmony_citest case, whereas cache-allowing cases use the same shader for all iterations.
53e5c31af7Sopenharmony_ciCache hits are however only ever allowed between the iterations of a case and not
54e5c31af7Sopenharmony_ciacross separate cases.
55e5c31af7Sopenharmony_ci
56e5c31af7Sopenharmony_ciThe method for defeating the shader cache is to append a postfix to all uniform,
57e5c31af7Sopenharmony_ciattribute and varying names. The postfix depends on the current time as well as
58e5c31af7Sopenharmony_cithe case that is in question. In case of cache-avoiding cases, the postfix also
59e5c31af7Sopenharmony_cidepends on the current iteration. This method forces at least re-linking.
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_ciFront-end time is estimated by compiling invalid shaders with either an invalid
62e5c31af7Sopenharmony_cicharacter at the end of the shader or an invalid statement at the end of the main()
63e5c31af7Sopenharmony_ciblock.
64e5c31af7Sopenharmony_ci
65e5c31af7Sopenharmony_ciThe result value is the average number of milliseconds used per test case
66e5c31af7Sopenharmony_ciiteration. In cases that allow cache hits the average excludes the first
67e5c31af7Sopenharmony_cicompilation.
68e5c31af7Sopenharmony_ci
69e5c31af7Sopenharmony_ciBefore any measurements are done, each test case first draws with a simple dummy
70e5c31af7Sopenharmony_cishader for warm-up.
71e5c31af7Sopenharmony_ci
72e5c31af7Sopenharmony_ciOverview for valid shader cases:
73e5c31af7Sopenharmony_ci - 1. Create program and shaders; compile and link
74e5c31af7Sopenharmony_ci - 2. Set inputs and draw a small quad
75e5c31af7Sopenharmony_ci - 3. Flush
76e5c31af7Sopenharmony_ci - 4. Repeat without step 1
77e5c31af7Sopenharmony_ci - 5. Compute difference of times measured for 1-3 and 4 and record it as
78e5c31af7Sopenharmony_ci      compilation time
79e5c31af7Sopenharmony_ci - Repeat the above steps several times and compute average
80e5c31af7Sopenharmony_ci
81e5c31af7Sopenharmony_ciOverview for invalid shader cases (front-end time estimation):
82e5c31af7Sopenharmony_ci - 1. Create program and invalid shaders; compile (expect failure)
83e5c31af7Sopenharmony_ci - 2. Record time measured for step 1
84e5c31af7Sopenharmony_ci - Repeat the above steps several times and compute average
85