xref: /aosp_15_r20/external/mesa3d/docs/viewperf.rst (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard WorkerViewperf Issues
2*61046927SAndroid Build Coastguard Worker===============
3*61046927SAndroid Build Coastguard Worker
4*61046927SAndroid Build Coastguard WorkerThis page lists known issues with `SPEC Viewperf
5*61046927SAndroid Build Coastguard Worker11 <https://gwpg.spec.org/benchmarks/benchmark/specviewperf-11/>`__ and
6*61046927SAndroid Build Coastguard Worker`SPEC Viewperf
7*61046927SAndroid Build Coastguard Worker12 <https://gwpg.spec.org/benchmarks/benchmark/specviewperf-12/>`__ when
8*61046927SAndroid Build Coastguard Workerrunning on Mesa-based drivers.
9*61046927SAndroid Build Coastguard Worker
10*61046927SAndroid Build Coastguard WorkerThe Viewperf data sets are basically GL API traces that are recorded
11*61046927SAndroid Build Coastguard Workerfrom CAD applications, then replayed in the Viewperf framework.
12*61046927SAndroid Build Coastguard Worker
13*61046927SAndroid Build Coastguard WorkerThe primary problem with these traces is they blindly use features and
14*61046927SAndroid Build Coastguard WorkerOpenGL extensions that were supported by the OpenGL driver when the
15*61046927SAndroid Build Coastguard Workertrace was recorded, but there's no checks to see if those features are
16*61046927SAndroid Build Coastguard Workersupported by the driver when playing back the traces with Viewperf.
17*61046927SAndroid Build Coastguard Worker
18*61046927SAndroid Build Coastguard WorkerThese issues have been reported to the SPEC organization in the hope
19*61046927SAndroid Build Coastguard Workerthat they'll be fixed in the future.
20*61046927SAndroid Build Coastguard Worker
21*61046927SAndroid Build Coastguard WorkerViewperf 11
22*61046927SAndroid Build Coastguard Worker-----------
23*61046927SAndroid Build Coastguard Worker
24*61046927SAndroid Build Coastguard WorkerSome of the Viewperf 11 tests use a lot of memory. At least 2GB of RAM
25*61046927SAndroid Build Coastguard Workeris recommended.
26*61046927SAndroid Build Coastguard Worker
27*61046927SAndroid Build Coastguard WorkerCatia-03 test 2
28*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~~
29*61046927SAndroid Build Coastguard Worker
30*61046927SAndroid Build Coastguard WorkerThis test creates over 38000 vertex buffer objects. On some systems this
31*61046927SAndroid Build Coastguard Workercan exceed the maximum number of buffer allocations. Mesa generates
32*61046927SAndroid Build Coastguard WorkerGL_OUT_OF_MEMORY errors in this situation, but Viewperf does no error
33*61046927SAndroid Build Coastguard Workerchecking and continues. When this happens, some drawing commands become
34*61046927SAndroid Build Coastguard Workerno-ops. This can also eventually lead to a segfault either in Viewperf
35*61046927SAndroid Build Coastguard Workeror the Mesa driver.
36*61046927SAndroid Build Coastguard Worker
37*61046927SAndroid Build Coastguard WorkerCatia-03 tests 3, 4, 8
38*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~~~~~~~~~
39*61046927SAndroid Build Coastguard Worker
40*61046927SAndroid Build Coastguard WorkerThese tests use features of the
41*61046927SAndroid Build Coastguard Worker:ext:`GL_NV_fragment_program2` and :ext:`GL_NV_vertex_program3` extensions
42*61046927SAndroid Build Coastguard Workerwithout checking if the driver supports them.
43*61046927SAndroid Build Coastguard Worker
44*61046927SAndroid Build Coastguard WorkerWhen Mesa tries to compile the vertex/fragment programs it generates
45*61046927SAndroid Build Coastguard Workererrors (which Viewperf ignores). Subsequent drawing calls become no-ops
46*61046927SAndroid Build Coastguard Workerand the rendering is incorrect.
47*61046927SAndroid Build Coastguard Worker
48*61046927SAndroid Build Coastguard Workersw-02 tests 1, 2, 4, 6
49*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~~~~~~~~~
50*61046927SAndroid Build Coastguard Worker
51*61046927SAndroid Build Coastguard WorkerThese tests depend on the :ext:`GL_NV_primitive_restart` extension.
52*61046927SAndroid Build Coastguard Worker
53*61046927SAndroid Build Coastguard WorkerIf the Mesa driver doesn't support this extension the rendering will be
54*61046927SAndroid Build Coastguard Workerincorrect and the test will fail.
55*61046927SAndroid Build Coastguard Worker
56*61046927SAndroid Build Coastguard WorkerAlso, the color of the line drawings in test 2 seem to appear in a
57*61046927SAndroid Build Coastguard Workerrandom color. This is probably due to some uninitialized state
58*61046927SAndroid Build Coastguard Workersomewhere.
59*61046927SAndroid Build Coastguard Worker
60*61046927SAndroid Build Coastguard Workersw-02 test 6
61*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~
62*61046927SAndroid Build Coastguard Worker
63*61046927SAndroid Build Coastguard WorkerThe lines drawn in this test appear in a random color. That's because
64*61046927SAndroid Build Coastguard Workertexture mapping is enabled when the lines are drawn, but no texture
65*61046927SAndroid Build Coastguard Workerimage is defined (glTexImage2D() is called with pixels=NULL). Since GL
66*61046927SAndroid Build Coastguard Workersays the contents of the texture image are undefined in that situation,
67*61046927SAndroid Build Coastguard Workerwe get a random color.
68*61046927SAndroid Build Coastguard Worker
69*61046927SAndroid Build Coastguard WorkerLightwave-01 test 3
70*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~~~~~~
71*61046927SAndroid Build Coastguard Worker
72*61046927SAndroid Build Coastguard WorkerThis test uses a number of mipmapped textures, but the textures are
73*61046927SAndroid Build Coastguard Workerincomplete because the last/smallest mipmap level (1 x 1 pixel) is never
74*61046927SAndroid Build Coastguard Workerspecified.
75*61046927SAndroid Build Coastguard Worker
76*61046927SAndroid Build Coastguard WorkerA trace captured with `API
77*61046927SAndroid Build Coastguard Workertrace <https://github.com/apitrace/apitrace>`__ shows this sequences of
78*61046927SAndroid Build Coastguard Workercalls like this:
79*61046927SAndroid Build Coastguard Worker
80*61046927SAndroid Build Coastguard Worker::
81*61046927SAndroid Build Coastguard Worker
82*61046927SAndroid Build Coastguard Worker   2504 glBindTexture(target = GL_TEXTURE_2D, texture = 55)
83*61046927SAndroid Build Coastguard Worker   2505 glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_RGBA, width = 512, height = 512, border = 0, format = GL_RGB, type = GL_UNSIGNED_SHORT, pixels = blob(1572864))
84*61046927SAndroid Build Coastguard Worker   2506 glTexImage2D(target = GL_TEXTURE_2D, level = 1, internalformat = GL_RGBA, width = 256, height = 256, border = 0, format = GL_RGB, type = GL_UNSIGNED_SHORT, pixels = blob(393216))
85*61046927SAndroid Build Coastguard Worker   2507 glTexImage2D(target = GL_TEXTURE_2D, level = 2, internalformat = GL_RGBA, width = 128, height = 128, border = 0, format = GL_RGB, type = GL_UNSIGNED_SHORT, pixels = blob(98304))
86*61046927SAndroid Build Coastguard Worker   [...]
87*61046927SAndroid Build Coastguard Worker   2512 glTexImage2D(target = GL_TEXTURE_2D, level = 7, internalformat = GL_RGBA, width = 4, height = 4, border = 0, format = GL_RGB, type = GL_UNSIGNED_SHORT, pixels = blob(96))
88*61046927SAndroid Build Coastguard Worker   2513 glTexImage2D(target = GL_TEXTURE_2D, level = 8, internalformat = GL_RGBA, width = 2, height = 2, border = 0, format = GL_RGB, type = GL_UNSIGNED_SHORT, pixels = blob(24))
89*61046927SAndroid Build Coastguard Worker   2514 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MIN_FILTER, param = GL_LINEAR_MIPMAP_LINEAR)
90*61046927SAndroid Build Coastguard Worker   2515 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_S, param = GL_REPEAT)
91*61046927SAndroid Build Coastguard Worker   2516 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_T, param = GL_REPEAT)
92*61046927SAndroid Build Coastguard Worker   2517 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAG_FILTER, param = GL_NEAREST)
93*61046927SAndroid Build Coastguard Worker
94*61046927SAndroid Build Coastguard WorkerNote that one would expect call 2514 to be glTexImage(level=9, width=1,
95*61046927SAndroid Build Coastguard Workerheight=1) but it's not there.
96*61046927SAndroid Build Coastguard Worker
97*61046927SAndroid Build Coastguard WorkerThe minification filter is GL_LINEAR_MIPMAP_LINEAR and the texture's
98*61046927SAndroid Build Coastguard WorkerGL_TEXTURE_MAX_LEVEL is 1000 (the default) so a full mipmap is expected.
99*61046927SAndroid Build Coastguard Worker
100*61046927SAndroid Build Coastguard WorkerLater, these incomplete textures are bound before drawing calls.
101*61046927SAndroid Build Coastguard WorkerAccording to the GL specification, if a fragment program or fragment
102*61046927SAndroid Build Coastguard Workershader is being used, the sampler should return (0,0,0,1) ("black") when
103*61046927SAndroid Build Coastguard Workersampling from an incomplete texture. This is what Mesa does and the
104*61046927SAndroid Build Coastguard Workerresulting rendering is darker than it should be.
105*61046927SAndroid Build Coastguard Worker
106*61046927SAndroid Build Coastguard WorkerIt appears that NVIDIA's driver (and possibly AMD's driver) detects this
107*61046927SAndroid Build Coastguard Workercase and returns (1,1,1,1) (white) which causes the rendering to appear
108*61046927SAndroid Build Coastguard Workerbrighter and match the reference image (however, AMD's rendering is
109*61046927SAndroid Build Coastguard Worker*much* brighter than NVIDIA's).
110*61046927SAndroid Build Coastguard Worker
111*61046927SAndroid Build Coastguard WorkerIf the fallback texture created in \_mesa_get_fallback_texture() is
112*61046927SAndroid Build Coastguard Workerinitialized to be full white instead of full black the rendering appears
113*61046927SAndroid Build Coastguard Workercorrect. However, we have no plans to implement this work-around in
114*61046927SAndroid Build Coastguard WorkerMesa.
115*61046927SAndroid Build Coastguard Worker
116*61046927SAndroid Build Coastguard WorkerMaya-03 test 2
117*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~
118*61046927SAndroid Build Coastguard Worker
119*61046927SAndroid Build Coastguard WorkerThis test makes some unusual calls to glRotate. For example:
120*61046927SAndroid Build Coastguard Worker
121*61046927SAndroid Build Coastguard Worker.. code-block:: c
122*61046927SAndroid Build Coastguard Worker
123*61046927SAndroid Build Coastguard Worker   glRotate(50, 50, 50, 1);
124*61046927SAndroid Build Coastguard Worker   glRotate(100, 100, 100, 1);
125*61046927SAndroid Build Coastguard Worker   glRotate(52, 52, 52, 1);
126*61046927SAndroid Build Coastguard Worker
127*61046927SAndroid Build Coastguard WorkerThese unusual values lead to invalid modelview matrices. For example,
128*61046927SAndroid Build Coastguard Workerthe last glRotate command above produces this matrix with Mesa:
129*61046927SAndroid Build Coastguard Worker
130*61046927SAndroid Build Coastguard Worker.. math::
131*61046927SAndroid Build Coastguard Worker
132*61046927SAndroid Build Coastguard Worker   \begin{matrix}
133*61046927SAndroid Build Coastguard Worker   1.08536 \times 10^{24} & 2.55321 \times 10^{-23} & -0.000160389         & 0\\
134*61046927SAndroid Build Coastguard Worker   5.96937 \times 10^{25} & 1.08536 \times 10^{24}  & 103408               & 0\\
135*61046927SAndroid Build Coastguard Worker                   103408 & -0.000160389            & 1.74755\times 10^{9} & 0\\
136*61046927SAndroid Build Coastguard Worker   0                      &                       0 &                      0 & nan
137*61046927SAndroid Build Coastguard Worker   \end{matrix}
138*61046927SAndroid Build Coastguard Worker
139*61046927SAndroid Build Coastguard Workerand with NVIDIA's OpenGL:
140*61046927SAndroid Build Coastguard Worker
141*61046927SAndroid Build Coastguard Worker.. math::
142*61046927SAndroid Build Coastguard Worker
143*61046927SAndroid Build Coastguard Worker   \begin{matrix}
144*61046927SAndroid Build Coastguard Worker   1.4013 \times 10^{-45} &                      0 &                   -nan & 0\\
145*61046927SAndroid Build Coastguard Worker                        0 & 1.4013 \times 10^{-45} & 1.4013 \times 10^{-45} & 0\\
146*61046927SAndroid Build Coastguard Worker   1.4013 \times 10^{-45} &                   -nan & 1.4013 \times 10^{-45} & 0\\
147*61046927SAndroid Build Coastguard Worker                        0 &                      0 &                      0 & 1.4013 \times 10^{-45}
148*61046927SAndroid Build Coastguard Worker   \end{matrix}
149*61046927SAndroid Build Coastguard Worker
150*61046927SAndroid Build Coastguard WorkerThis causes the object in question to be drawn in a strange orientation
151*61046927SAndroid Build Coastguard Workerand with a semi-random color (between white and black) since GL_FOG is
152*61046927SAndroid Build Coastguard Workerenabled.
153*61046927SAndroid Build Coastguard Worker
154*61046927SAndroid Build Coastguard WorkerProe-05 test 1
155*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~
156*61046927SAndroid Build Coastguard Worker
157*61046927SAndroid Build Coastguard WorkerThis uses depth testing but there's two problems:
158*61046927SAndroid Build Coastguard Worker
159*61046927SAndroid Build Coastguard Worker#. The glXChooseFBConfig() call doesn't request a depth buffer
160*61046927SAndroid Build Coastguard Worker#. The test never calls glClear(GL_DEPTH_BUFFER_BIT) to initialize the
161*61046927SAndroid Build Coastguard Worker   depth buffer
162*61046927SAndroid Build Coastguard Worker
163*61046927SAndroid Build Coastguard WorkerIf the chosen visual does not have a depth buffer, you'll see the
164*61046927SAndroid Build Coastguard Workerwireframe car model but it won't be rendered correctly.
165*61046927SAndroid Build Coastguard Worker
166*61046927SAndroid Build Coastguard WorkerIf (by luck) the chosen visual has a depth buffer, its initial contents
167*61046927SAndroid Build Coastguard Workerwill be undefined so you may or may not see parts of the model.
168*61046927SAndroid Build Coastguard Worker
169*61046927SAndroid Build Coastguard WorkerInterestingly, with NVIDIA's driver most visuals happen to have a depth
170*61046927SAndroid Build Coastguard Workerbuffer and apparently the contents are initialized to 1.0 by default so
171*61046927SAndroid Build Coastguard Workerthis test just happens to work with their drivers.
172*61046927SAndroid Build Coastguard Worker
173*61046927SAndroid Build Coastguard WorkerFinally, even if a depth buffer was requested and the
174*61046927SAndroid Build Coastguard WorkerglClear(GL_COLOR_BUFFER_BIT) calls were changed to
175*61046927SAndroid Build Coastguard WorkerglClear(GL_COLOR_BUFFER_BIT \| GL_DEPTH_BUFFER_BIT) the problem still
176*61046927SAndroid Build Coastguard Workerwouldn't be fixed because GL_DEPTH_WRITEMASK=GL_FALSE when glClear is
177*61046927SAndroid Build Coastguard Workercalled so clearing the depth buffer would be a no-op anyway.
178*61046927SAndroid Build Coastguard Worker
179*61046927SAndroid Build Coastguard WorkerProe-05 test 6
180*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~~~~
181*61046927SAndroid Build Coastguard Worker
182*61046927SAndroid Build Coastguard WorkerThis test draws an engine model with a two-pass algorithm. The first
183*61046927SAndroid Build Coastguard Workerpass is drawn with polygon stipple enabled. The second pass is drawn
184*61046927SAndroid Build Coastguard Workerwithout polygon stipple but with blending and GL_DEPTH_FUNC=GL_LEQUAL.
185*61046927SAndroid Build Coastguard WorkerIf either of the two passes happen to use a software fallback of some
186*61046927SAndroid Build Coastguard Workersort, the Z values of fragments may be different between the two passes.
187*61046927SAndroid Build Coastguard WorkerThis leads to incorrect rendering.
188*61046927SAndroid Build Coastguard Worker
189*61046927SAndroid Build Coastguard WorkerFor example, the VMware SVGA Gallium driver uses a special semi-fallback
190*61046927SAndroid Build Coastguard Workerpath for drawing with polygon stipple. Since the two passes are rendered
191*61046927SAndroid Build Coastguard Workerwith different vertex transformation implementations, the rendering
192*61046927SAndroid Build Coastguard Workerdoesn't appear as expected. Setting the SVGA_FORCE_SWTNL environment
193*61046927SAndroid Build Coastguard Workervariable to 1 will force the driver to use the software vertex path all
194*61046927SAndroid Build Coastguard Workerthe time and clears up this issue.
195*61046927SAndroid Build Coastguard Worker
196*61046927SAndroid Build Coastguard WorkerAccording to the OpenGL invariance rules, there's no guarantee that the
197*61046927SAndroid Build Coastguard Workerpixels produced by these two rendering states will match. To achieve
198*61046927SAndroid Build Coastguard Workerinvariance, both passes should enable polygon stipple and blending with
199*61046927SAndroid Build Coastguard Workerappropriate patterns/modes to ensure the same fragments are produced in
200*61046927SAndroid Build Coastguard Workerboth passes.
201*61046927SAndroid Build Coastguard Worker
202*61046927SAndroid Build Coastguard WorkerViewperf 12
203*61046927SAndroid Build Coastguard Worker-----------
204*61046927SAndroid Build Coastguard Worker
205*61046927SAndroid Build Coastguard WorkerNote that Viewperf 12 only runs on 64-bit Windows 7 or later.
206*61046927SAndroid Build Coastguard Worker
207*61046927SAndroid Build Coastguard Workercatia-04
208*61046927SAndroid Build Coastguard Worker~~~~~~~~
209*61046927SAndroid Build Coastguard Worker
210*61046927SAndroid Build Coastguard WorkerOne of the catia tests calls wglGetProcAddress() to get some
211*61046927SAndroid Build Coastguard Worker:ext:`GL_EXT_direct_state_access` functions (such as
212*61046927SAndroid Build Coastguard WorkerglBindMultiTextureEXT) and some :ext:`GL_NV_half_float` functions (such
213*61046927SAndroid Build Coastguard Workeras glMultiTexCoord3hNV). If the extension/function is not supported,
214*61046927SAndroid Build Coastguard WorkerwglGetProcAddress() can return NULL. Unfortunately, Viewperf doesn't check
215*61046927SAndroid Build Coastguard Workerfor null pointers and crashes when it later tries to use the pointer.
216*61046927SAndroid Build Coastguard Worker
217*61046927SAndroid Build Coastguard WorkerAnother catia test uses OpenGL 3.1's primitive restart feature. But when
218*61046927SAndroid Build Coastguard WorkerViewperf creates an OpenGL context, it doesn't request version 3.1 If
219*61046927SAndroid Build Coastguard Workerthe driver returns version 3.0 or earlier all the calls related to
220*61046927SAndroid Build Coastguard Workerprimitive restart generate an OpenGL error. Some of the rendering is
221*61046927SAndroid Build Coastguard Workerthen incorrect.
222*61046927SAndroid Build Coastguard Worker
223*61046927SAndroid Build Coastguard Workerenergy-01
224*61046927SAndroid Build Coastguard Worker~~~~~~~~~
225*61046927SAndroid Build Coastguard Worker
226*61046927SAndroid Build Coastguard WorkerThis test creates a 3D luminance texture of size 1K x 1K x 1K. If the
227*61046927SAndroid Build Coastguard WorkerOpenGL driver/device doesn't support a texture of this size the
228*61046927SAndroid Build Coastguard WorkerglTexImage3D() call will fail with GL_INVALID_VALUE or GL_OUT_OF_MEMORY
229*61046927SAndroid Build Coastguard Workerand all that's rendered is plain white polygons. Ideally, the test would
230*61046927SAndroid Build Coastguard Workeruse a proxy texture to determine the max 3D texture size. But it does
231*61046927SAndroid Build Coastguard Workernot do that.
232*61046927SAndroid Build Coastguard Worker
233*61046927SAndroid Build Coastguard Workermaya-04
234*61046927SAndroid Build Coastguard Worker~~~~~~~
235*61046927SAndroid Build Coastguard Worker
236*61046927SAndroid Build Coastguard WorkerThis test generates many GL_INVALID_OPERATION errors in its calls to
237*61046927SAndroid Build Coastguard WorkerglUniform(). Causes include:
238*61046927SAndroid Build Coastguard Worker
239*61046927SAndroid Build Coastguard Worker-  Trying to set float uniforms with glUniformi()
240*61046927SAndroid Build Coastguard Worker-  Trying to set float uniforms with glUniform3f()
241*61046927SAndroid Build Coastguard Worker-  Trying to set matrix uniforms with glUniform() instead of
242*61046927SAndroid Build Coastguard Worker   glUniformMatrix().
243*61046927SAndroid Build Coastguard Worker
244*61046927SAndroid Build Coastguard WorkerApparently, the indexes returned by glGetUniformLocation() were
245*61046927SAndroid Build Coastguard Workerhard-coded into the application trace when it was created. Since
246*61046927SAndroid Build Coastguard Workerdifferent implementations of glGetUniformLocation() may return different
247*61046927SAndroid Build Coastguard Workervalues for any given uniform name, subsequent calls to glUniform() will
248*61046927SAndroid Build Coastguard Workerbe invalid since they refer to the wrong uniform variables. This causes
249*61046927SAndroid Build Coastguard Workermany OpenGL errors and leads to incorrect rendering.
250*61046927SAndroid Build Coastguard Worker
251*61046927SAndroid Build Coastguard Workermedical-01
252*61046927SAndroid Build Coastguard Worker~~~~~~~~~~
253*61046927SAndroid Build Coastguard Worker
254*61046927SAndroid Build Coastguard WorkerThis test uses a single GLSL fragment shader which contains a GLSL 1.20
255*61046927SAndroid Build Coastguard Workerarray initializer statement, but it neglects to specify ``#version 120``
256*61046927SAndroid Build Coastguard Workerat the top of the shader code. So, the shader does not compile and all
257*61046927SAndroid Build Coastguard Workerthat's rendered is plain white polygons.
258*61046927SAndroid Build Coastguard Worker
259*61046927SAndroid Build Coastguard WorkerAlso, the test tries to create a very large 3D texture that may exceed
260*61046927SAndroid Build Coastguard Workerthe device driver's limit. When this happens, the glTexImage3D call
261*61046927SAndroid Build Coastguard Workerfails and all that's rendered is a white box.
262*61046927SAndroid Build Coastguard Worker
263*61046927SAndroid Build Coastguard Workershowcase-01
264*61046927SAndroid Build Coastguard Worker~~~~~~~~~~~
265*61046927SAndroid Build Coastguard Worker
266*61046927SAndroid Build Coastguard WorkerThis is actually a DX11 test based on Autodesk's Showcase product. As
267*61046927SAndroid Build Coastguard Workersuch, it won't run with Mesa.
268