1e5c31af7Sopenharmony_cig-------------------------------------------------------------------------
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    Buffer upload performance tests
20e5c31af7Sopenharmony_ci
21e5c31af7Sopenharmony_ciTests:
22e5c31af7Sopenharmony_ci + dEQP-GLES3.performance.buffer.data_upload.*
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ciIncludes:
25e5c31af7Sopenharmony_ci + Memcpy performance tests for reference values
26e5c31af7Sopenharmony_ci + Performance of glBufferData and glBufferSubData
27e5c31af7Sopenharmony_ci    - STREAM, STATIC and DYNAMIC buffer usages
28e5c31af7Sopenharmony_ci    - Target buffer in different states:
29e5c31af7Sopenharmony_ci        * BufferData:
30e5c31af7Sopenharmony_ci            ~ Just generated buffer
31e5c31af7Sopenharmony_ci            ~ Generated buffer with unspecified contents (bufferData(..., NULL))
32e5c31af7Sopenharmony_ci            ~ Generated buffer with specified contents
33e5c31af7Sopenharmony_ci            ~ Buffer (with the same size) that has been used in drawing earlier
34e5c31af7Sopenharmony_ci            ~ Buffer (with a larger size) that has been used in drawing earlier
35e5c31af7Sopenharmony_ci        * BufferSubData:
36e5c31af7Sopenharmony_ci            ~ Respecify whole buffer contents
37e5c31af7Sopenharmony_ci            ~ Respecify half of the buffer
38e5c31af7Sopenharmony_ci            ~ Invalidate buffer contents manually (bufferData(..., NULL)) before
39e5c31af7Sopenharmony_ci              calling bufferSubData
40e5c31af7Sopenharmony_ci + Buffer mapping performance
41e5c31af7Sopenharmony_ci    - STREAM, STATIC and DYNAMIC buffer usages
42e5c31af7Sopenharmony_ci    - Full and partial (half of the buffer) mapping
43e5c31af7Sopenharmony_ci    - Different map bits:
44e5c31af7Sopenharmony_ci        * Write
45e5c31af7Sopenharmony_ci        * Write-Read
46e5c31af7Sopenharmony_ci        * Write-InvalidateRange
47e5c31af7Sopenharmony_ci        * Write-InvalidateBuffer
48e5c31af7Sopenharmony_ci        * Write-Unsynchronized
49e5c31af7Sopenharmony_ci        * Write-Unsynchronized-InvalidateBuffer
50e5c31af7Sopenharmony_ci        * Write-FlushExplicit
51e5c31af7Sopenharmony_ci    - Target buffer in different states:
52e5c31af7Sopenharmony_ci        * Generated buffer with unspecified contents (bufferData(..., NULL))
53e5c31af7Sopenharmony_ci        * Generated buffer with specified contents
54e5c31af7Sopenharmony_ci        * A buffer (with the same size) that has been used in drawing earlier
55e5c31af7Sopenharmony_ci    - Different mapping & flushing strategies:
56e5c31af7Sopenharmony_ci        * Map whole buffer and flush whole mapped area (in one call)
57e5c31af7Sopenharmony_ci        * Map buffer partially (half) and flush whole mapped area (in one call)
58e5c31af7Sopenharmony_ci        * Map whole buffer and flush buffer partially (half) (in one call)
59e5c31af7Sopenharmony_ci        * Map whole buffer and flush whole mapped area in 4 non-interleaving
60e5c31af7Sopenharmony_ci          flush calls
61e5c31af7Sopenharmony_ci + Buffer upload performance after a draw call using the target buffer
62e5c31af7Sopenharmony_ci    - STREAM, STATIC and DYNAMIC buffer usages
63e5c31af7Sopenharmony_ci    - BufferData, BufferSubData, MapBufferRange methods
64e5c31af7Sopenharmony_ci + Uploaded buffer rendering performance tests
65e5c31af7Sopenharmony_ci
66e5c31af7Sopenharmony_ciExcludes:
67e5c31af7Sopenharmony_ci + Exhaustive testing of all combinations of usages, buffer states, and methods
68e5c31af7Sopenharmony_ci + Complex buffer usage before upload (e.g transform feedback, copyBufferSubData)
69e5c31af7Sopenharmony_ci + Sustained upload performance tests
70e5c31af7Sopenharmony_ci
71e5c31af7Sopenharmony_ciDescription:
72e5c31af7Sopenharmony_ci
73e5c31af7Sopenharmony_ciUpload performance tests approximate upload speed by testing time usage of different
74e5c31af7Sopenharmony_cibuffer upload functions with multiple different buffer sizes. The time usage of these
75e5c31af7Sopenharmony_cifunctions is expected to be of form t(x) = b * x + c, where x is the buffer size, b
76e5c31af7Sopenharmony_ciis the linear cost of the function and c is the constant cost of the function. Tests
77e5c31af7Sopenharmony_cifind suitable parameters b and c to fit the sampled values and then report these
78e5c31af7Sopenharmony_ciparameters. The test result of an upload test is the median transfer rate of the test
79e5c31af7Sopenharmony_cisamples unless stated otherwise.
80e5c31af7Sopenharmony_ci
81e5c31af7Sopenharmony_ciAdditionally, test cases calculate "sample linearity" and "sample temporal stability"
82e5c31af7Sopenharmony_cimetrics. Sample linearity describes the curvature of the sampled values and it is
83e5c31af7Sopenharmony_cicalculated by comparing the line fitted to the first half of the samples (the half with
84e5c31af7Sopenharmony_cismaller buffer sizes) to the line fitted to the second half of the samples. A straight
85e5c31af7Sopenharmony_ciline would result in 100% linearity. A linearity value less than 90% usually implies
86e5c31af7Sopenharmony_cieither large errors in sampling (noise), insufficient timer resolution, or non-linearity
87e5c31af7Sopenharmony_ciof the function.
88e5c31af7Sopenharmony_ci
89e5c31af7Sopenharmony_ciSample temporal stability describes the stability of the function during the sampling.
90e5c31af7Sopenharmony_ciSamples are split to two categories: early and late samples. All early samples are tested
91e5c31af7Sopenharmony_cibefore any late sample. A line is fitted to the early samples and it is compared to a
92e5c31af7Sopenharmony_ciline fitted to the late samples. If the samples get similar values in the beginning of
93e5c31af7Sopenharmony_cithe test and in the end of the test, the temporal stability will be 100%. A value less
94e5c31af7Sopenharmony_cithan 90% usually implies that test samples are not independent from other samples, or
95e5c31af7Sopenharmony_cithat there were large errors in sampling (noise).
96e5c31af7Sopenharmony_ci
97e5c31af7Sopenharmony_ci(Note that all logged data sizes are MiBs (mebibytes) even if they are marked with unit
98e5c31af7Sopenharmony_cisymbol "MB".)
99e5c31af7Sopenharmony_ci
100e5c31af7Sopenharmony_cireference.* tests test memcpy with different sizes. The transfer rate may be useful as a
101e5c31af7Sopenharmony_cireference value. "small_buffers" test case tests memcpy performance with transfer size
102e5c31af7Sopenharmony_ciin range 0 - 256KiB. The result is the median transfer rate of the test samples.
103e5c31af7Sopenharmony_ci"large_buffers" test case measures the transfer rate with the transfer size in range
104e5c31af7Sopenharmony_ci256KiB - 16 MiB. The result is the approximated transfer rate of an infinitely large
105e5c31af7Sopenharmony_citransfer size calculated form the fitted line. (i.e c = 0).
106e5c31af7Sopenharmony_ci
107e5c31af7Sopenharmony_cifunction_call.* tests measure the time taken by the corresponding command or the series of
108e5c31af7Sopenharmony_cicommands with different buffer sizes. The result is the median transfer rate of the test
109e5c31af7Sopenharmony_cisamples.
110e5c31af7Sopenharmony_ci
111e5c31af7Sopenharmony_cimodify_after_use.* tests are similar to the function_call.* test but they target a buffer
112e5c31af7Sopenharmony_cithat has been used in a draw operation just before the measured function call. "_repeated"
113e5c31af7Sopenharmony_civariants repeat the "specify buffer contents, draw buffer" sequence a few times before
114e5c31af7Sopenharmony_cithe test target function is called.
115e5c31af7Sopenharmony_ci
116e5c31af7Sopenharmony_cirender_after_upload.* tests measure rendering time of a buffer in different scenarios. The
117e5c31af7Sopenharmony_citests measure time from rendering command issuance (glDraw* call) to finished rendering
118e5c31af7Sopenharmony_ci(return from glReadPixels call). The purpose of the tests is to measure the data transfer
119e5c31af7Sopenharmony_ciperformance from the observation of a buffer upload completion (a return from a
120e5c31af7Sopenharmony_ciglBuffer(Sub)Data / glUnmap) to observation of finished rendering. This combined rate of
121e5c31af7Sopenharmony_cidata transfer and rendering is in these tests referred to as "processing rate". Note that
122e5c31af7Sopenharmony_ci"processing time" does not include the upload time. All tests and test samples have the
123e5c31af7Sopenharmony_cisame number of visible fragments but may have different number of vertices. The tests are
124e5c31af7Sopenharmony_ciNOT rendering performance tests and should not be treated as such.
125e5c31af7Sopenharmony_ci
126e5c31af7Sopenharmony_ciEach case's draw function, uploaded buffer type, and upload method is encoded to the case
127e5c31af7Sopenharmony_ciname. For example "draw_elements_upload_indices_with_buffer_data" would specify index
128e5c31af7Sopenharmony_ci(GL_ELEMENT_ARRAY_BUFFER) buffer contents with glBufferData, and issue render with
129e5c31af7Sopenharmony_ciglDrawElements call.
130e5c31af7Sopenharmony_ci
131e5c31af7Sopenharmony_cirender_after_upload.reference.draw.* tests produce baseline results for basic functions.
132e5c31af7Sopenharmony_ci"read_pixels" case measures the constant cost (in microseconds) of a single glReadPixels
133e5c31af7Sopenharmony_cicall with identical arguments as in other rendering tests. The result might used for
134e5c31af7Sopenharmony_ciexcluding ReadPixels' constant cost from the total constant costs in the other test
135e5c31af7Sopenharmony_ciresults. "draw_arrays" and "draw_elements" tests measure the processing rate in the case
136e5c31af7Sopenharmony_ciwhere there is no buffer uploading required. As such, they are expected to result in the
137e5c31af7Sopenharmony_cihighest processing rates. The results should be interpreted as a reference values for
138e5c31af7Sopenharmony_cirender_after_upload.upload_and_draw.* group tests.
139e5c31af7Sopenharmony_ci
140e5c31af7Sopenharmony_cirender_after_upload.reference.draw_upload_draw.* cases first render from an existing
141e5c31af7Sopenharmony_cibuffer, upload another buffer, and then render using the just uploaded buffer. The
142e5c31af7Sopenharmony_ciprocessing rate (excluding the upload time) is measured. The results are baseline
143e5c31af7Sopenharmony_cireference results for render_after_upload.draw_modify_draw.* group tests.
144e5c31af7Sopenharmony_ci
145e5c31af7Sopenharmony_cirender_after_upload.upload_unrelated_and_draw.* tests upload an unrelated buffer and
146e5c31af7Sopenharmony_cithen render to the viewport. The rendering does not depend on the uploaded buffer. The
147e5c31af7Sopenharmony_ciunrelated upload size is equal to the rendering workload size.
148e5c31af7Sopenharmony_ci
149e5c31af7Sopenharmony_cirender_after_upload.upload_and_draw.* cases upload a buffer and then render using it. In
150e5c31af7Sopenharmony_ciused_buffer.* group cases, the buffer has been used in rendering before upload. In
151e5c31af7Sopenharmony_cinew_buffer.* group cases, the uploaded buffer is generated just before uploading. In this
152e5c31af7Sopenharmony_cicase if the upload method is not glBufferData, glBufferData is called with NULL data
153e5c31af7Sopenharmony_ciargument before using the actual upload method for specifying the buffer contents. In
154e5c31af7Sopenharmony_cicases in test case groups "*_and_unrelated_upload", another buffer is uploaded after the
155e5c31af7Sopenharmony_citarget buffer upload with glBufferData. The rendering does not depend on this second
156e5c31af7Sopenharmony_ciupload. The unrelated upload size is equal to the rendering workload size.
157e5c31af7Sopenharmony_ci
158e5c31af7Sopenharmony_cirender_after_upload.draw_modify_draw.* cases draw from a buffer, respecify its contents,
159e5c31af7Sopenharmony_ciand draw again using the buffer. Cases are identical to
160e5c31af7Sopenharmony_cirender_after_upload.reference.draw_upload_draw.* cases with the exception that the upload
161e5c31af7Sopenharmony_citarget buffer is used in rendering just before issuing upload commands.
162e5c31af7Sopenharmony_ci
163e5c31af7Sopenharmony_cirender_after_upload.upload_wait_draw.* cases upload a buffer, wait a certain number of
164e5c31af7Sopenharmony_ciframes (buffer swaps), and then render using the buffer. The number of frames required
165e5c31af7Sopenharmony_cifor the render times to stabilize is measured and reported as a test result. For example,
166e5c31af7Sopenharmony_ciresult value of 0 would indicate that rendering is just as fast just after upload than
167e5c31af7Sopenharmony_ciN frames later. A value of 1 would mean that performance of rendering from the buffer
168e5c31af7Sopenharmony_ciis different during the frame it was uploaded in, but does not change after one frame
169e5c31af7Sopenharmony_ciswap.
170e5c31af7Sopenharmony_ci
171e5c31af7Sopenharmony_ciSince the frame times during the "waiting" period may be significantly lower than in the
172e5c31af7Sopenharmony_ciupload frame or in the frame of the final rendering, in order to keep frame times
173e5c31af7Sopenharmony_ciconsistent, the test code performs dummy calculations (busy waits) for 8 milliseconds in
174e5c31af7Sopenharmony_cieach frame. Also during the "dummy" frames, a simple grid pattern is drawn to the viewport.
175