freedreno/a3xx: add support for SRGB render targets
[mesa.git] / docs / viewperf.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html lang="en">
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 <title>Viewperf Issues</title>
6 <link rel="stylesheet" type="text/css" href="mesa.css">
7 </head>
8 <body>
9
10 <div class="header">
11 <h1>The Mesa 3D Graphics Library</h1>
12 </div>
13
14 <iframe src="contents.html"></iframe>
15 <div class="content">
16
17 <h1>Viewperf Issues</h1>
18
19 <p>
20 This page lists known issues with
21 <a href="http://www.spec.org/gwpg/gpc.static/vp11info.html" target="_main">SPEC Viewperf 11</a>
22 when running on Mesa-based drivers.
23 </p>
24
25 <p>
26 The Viewperf data sets are basically GL API traces that are recorded from
27 CAD applications, then replayed in the Viewperf framework.
28 </p>
29
30 <p>
31 The primary problem with these traces is they blindly use features and
32 OpenGL extensions that were supported by the OpenGL driver when the trace
33 was recorded,
34 but there's no checks to see if those features are supported by the driver
35 when playing back the traces with Viewperf.
36 </p>
37
38 <p>
39 These issues have been reported to the SPEC organization in the hope that
40 they'll be fixed in the future.
41 </p>
42
43 <p>
44 Some of the Viewperf tests use a lot of memory.
45 At least 2GB of RAM is recommended.
46 </p>
47
48
49 <h2>Catia-03 test 2</h2>
50
51 <p>
52 This test creates over 38000 vertex buffer objects. On some systems
53 this can exceed the maximum number of buffer allocations. Mesa
54 generates GL_OUT_OF_MEMORY errors in this situation, but Viewperf
55 does no error checking and continues. When this happens, some drawing
56 commands become no-ops. This can also eventually lead to a segfault
57 either in Viewperf or the Mesa driver.
58 </p>
59
60
61
62 <h2>Catia-03 tests 3, 4, 8</h2>
63
64 <p>
65 These tests use features of the
66 <a href="http://www.opengl.org/registry/specs/NV/fragment_program2.txt"
67 target="_main">
68 GL_NV_fragment_program2</a> and
69 <a href="http://www.opengl.org/registry/specs/NV/vertex_program3.txt"
70 target="_main">
71 GL_NV_vertex_program3</a> extensions without checking if the driver supports
72 them.
73 </p>
74 <p>
75 When Mesa tries to compile the vertex/fragment programs it generates errors
76 (which Viewperf ignores).
77 Subsequent drawing calls become no-ops and the rendering is incorrect.
78 </p>
79
80
81
82 <h2>sw-02 tests 1, 2, 4, 6</h2>
83
84 <p>
85 These tests depend on the
86 <a href="http://www.opengl.org/registry/specs/NV/primitive_restart.txt"
87 target="_main">GL_NV_primitive_restart</a> extension.
88 </p>
89
90 <p>
91 If the Mesa driver doesn't support this extension the rendering will
92 be incorrect and the test will fail.
93 </p>
94
95 <p>
96 Also, the color of the line drawings in test 2 seem to appear in a random
97 color. This is probably due to some uninitialized state somewhere.
98 </p>
99
100
101
102 <h2>sw-02 test 6</h2>
103
104 <p>
105 The lines drawn in this test appear in a random color.
106 That's because texture mapping is enabled when the lines are drawn, but no
107 texture image is defined (glTexImage2D() is called with pixels=NULL).
108 Since GL says the contents of the texture image are undefined in that
109 situation, we get a random color.
110 </p>
111
112
113
114 <h2>Lightwave-01 test 3</h2>
115
116 <p>
117 This test uses a number of mipmapped textures, but the textures are
118 incomplete because the last/smallest mipmap level (1 x 1 pixel) is
119 never specified.
120 </p>
121
122 <p>
123 A trace captured with
124 <a href="https://github.com/apitrace/apitrace" target="_main">API trace</a>
125 shows this sequences of calls like this:
126
127 <pre>
128 2504 glBindTexture(target = GL_TEXTURE_2D, texture = 55)
129 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))
130 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))
131 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))
132 [...]
133 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))
134 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))
135 2514 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MIN_FILTER, param = GL_LINEAR_MIPMAP_LINEAR)
136 2515 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_S, param = GL_REPEAT)
137 2516 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_T, param = GL_REPEAT)
138 2517 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAG_FILTER, param = GL_NEAREST)
139 </pre>
140
141 <p>
142 Note that one would expect call 2514 to be glTexImage(level=9, width=1,
143 height=1) but it's not there.
144 </p>
145
146 <p>
147 The minification filter is GL_LINEAR_MIPMAP_LINEAR and the texture's
148 GL_TEXTURE_MAX_LEVEL is 1000 (the default) so a full mipmap is expected.
149 </p>
150
151 <p>
152 Later, these incomplete textures are bound before drawing calls.
153 According to the GL specification, if a fragment program or fragment shader
154 is being used, the sampler should return (0,0,0,1) ("black") when sampling
155 from an incomplete texture.
156 This is what Mesa does and the resulting rendering is darker than it should
157 be.
158 </p>
159
160 <p>
161 It appears that NVIDIA's driver (and possibly AMD's driver) detects this case
162 and returns (1,1,1,1) (white) which causes the rendering to appear brighter
163 and match the reference image (however, AMD's rendering is <em>much</em>
164 brighter than NVIDIA's).
165 </p>
166
167 <p>
168 If the fallback texture created in _mesa_get_fallback_texture() is
169 initialized to be full white instead of full black the rendering appears
170 correct.
171 However, we have no plans to implement this work-around in Mesa.
172 </p>
173
174
175 <h2>Maya-03 test 2</h2>
176
177 <p>
178 This test makes some unusual calls to glRotate. For example:
179 </p>
180 <pre>
181 glRotate(50, 50, 50, 1);
182 glRotate(100, 100, 100, 1);
183 glRotate(52, 52, 52, 1);
184 </pre>
185 <p>
186 These unusual values lead to invalid modelview matrices.
187 For example, the last glRotate command above produces this matrix with Mesa:
188 <pre>
189 1.08536e+24 2.55321e-23 -0.000160389 0
190 5.96937e-25 1.08536e+24 103408 0
191 103408 -0.000160389 1.74755e+09 0
192 0 0 0 nan
193 </pre>
194 and with NVIDIA's OpenGL:
195 <pre>
196 1.4013e-45 0 -nan 0
197 0 1.4013e-45 1.4013e-45 0
198 1.4013e-45 -nan 1.4013e-45 0
199 0 0 0 1.4013e-45
200 </pre>
201 <p>
202 This causes the object in question to be drawn in a strange orientation
203 and with a semi-random color (between white and black) since GL_FOG is enabled.
204 </p>
205
206
207 <h2>Proe-05 test 1</h2>
208
209 <p>
210 This uses depth testing but there's two problems:
211 <ol>
212 <li>The glXChooseFBConfig() call doesn't request a depth buffer
213 <li>The test never calls glClear(GL_DEPTH_BUFFER_BIT) to initialize the depth buffer
214 </ol>
215 <p>
216 If the chosen visual does not have a depth buffer, you'll see the wireframe
217 car model but it won't be rendered correctly.
218 </p>
219 If (by luck) the chosen visual has a depth buffer, its initial contents
220 will be undefined so you may or may not see parts of the model.
221 <p>
222 Interestingly, with NVIDIA's driver most visuals happen to have a depth buffer
223 and apparently the contents are initialized to 1.0 by default so this test
224 just happens to work with their drivers.
225 </p>
226
227 <p>
228 Finally, even if a depth buffer was requested and the glClear(GL_COLOR_BUFFER_BIT)
229 calls were changed to glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
230 the problem still wouldn't be fixed because GL_DEPTH_WRITEMASK=GL_FALSE when
231 glClear is called so clearing the depth buffer would be a no-op anyway.
232 </p>
233
234
235 <h2>Proe-05 test 6</h2>
236
237 <p>
238 This test draws an engine model with a two-pass algorithm.
239 The first pass is drawn with polygon stipple enabled.
240 The second pass is drawn without polygon stipple but with blending
241 and GL_DEPTH_FUNC=GL_LEQUAL.
242 If either of the two passes happen to use a software fallback of some
243 sort, the Z values of fragments may be different between the two passes.
244 This leads to incorrect rendering.
245 </p>
246
247 <p>
248 For example, the VMware SVGA gallium driver uses a special semi-fallback path
249 for drawing with polygon stipple.
250 Since the two passes are rendered with different vertex transformation
251 implementations, the rendering doesn't appear as expected.
252 Setting the SVGA_FORCE_SWTNL environment variable to 1 will force the
253 driver to use the software vertex path all the time and clears up this issue.
254 </p>
255
256 <p>
257 According to the OpenGL invariance rules, there's no guarantee that
258 the pixels produced by these two rendering states will match.
259 To achieve invariance, both passes should enable polygon stipple and
260 blending with appropriate patterns/modes to ensure the same fragments
261 are produced in both passes.
262 </p>
263
264
265 </div>
266 </body>
267 </html>