Debian Codegraph @

Source/Core/VideoCommon/DriverDetails.h

raw symbols SCIP
1 // Copyright 2013 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 #pragma once
4 #include <string>
5 #include "Common/CommonTypes.h"
6
7 #undef OS // CURL defines that, nobody uses it...
8
9 namespace DriverDetails
10 {
11 // API types supported by driver details
12 // This is separate to APIType in VideoConfig.h due to the fact that a bug
13 // can affect multiple APIs.
14 enum API
15 {
16 API_OPENGL = (1 << 0),
17 API_VULKAN = (1 << 1),
18 API_METAL = (1 << 2),
19 };
20
21 // Enum of supported operating systems
22 enum OS
23 {
24 OS_ALL = (1 << 0),
25 OS_WINDOWS = (1 << 1),
26 OS_LINUX = (1 << 2),
27 OS_OSX = (1 << 3),
28 OS_ANDROID = (1 << 4),
29 OS_FREEBSD = (1 << 5),
30 OS_OPENBSD = (1 << 6),
31 OS_NETBSD = (1 << 7),
32 OS_HAIKU = (1 << 8),
33 };
34 // Enum of known vendors
35 // Tegra and Nvidia are separated out due to such substantial differences
36 enum Vendor
37 {
38 VENDOR_ALL = 0,
39 VENDOR_NVIDIA,
40 VENDOR_ATI,
41 VENDOR_INTEL,
42 VENDOR_ARM,
43 VENDOR_QUALCOMM,
44 VENDOR_IMGTEC,
45 VENDOR_TEGRA,
46 VENDOR_VIVANTE,
47 VENDOR_MESA,
48 VENDOR_APPLE,
49 VENDOR_UNKNOWN
50 };
51
52 // Enum of known drivers
53 enum Driver
54 {
55 DRIVER_ALL = 0,
56 DRIVER_NVIDIA, // Official Nvidia, including mobile GPU
57 DRIVER_NOUVEAU, // OSS nouveau
58 DRIVER_ATI, // Official ATI
59 DRIVER_R600, // OSS Radeon
60 DRIVER_INTEL, // Official Intel
61 DRIVER_I965, // OSS Intel
62 DRIVER_ARM, // Official Mali driver
63 DRIVER_LIMA, // OSS Mali driver
64 DRIVER_QUALCOMM, // Official Adreno driver
65 DRIVER_FREEDRENO, // OSS Adreno driver
66 DRIVER_IMGTEC, // Official PowerVR driver
67 DRIVER_VIVANTE, // Official Vivante driver
68 DRIVER_PORTABILITY, // Vulkan via Metal on macOS
69 DRIVER_APPLE, // Metal on macOS
70 DRIVER_UNKNOWN // Unknown driver, default to official hardware driver
71 };
72
73 enum class Family
74 {
75 UNKNOWN,
76 INTEL_SANDY,
77 INTEL_IVY,
78 };
79
80 // Enum of known bugs
81 // These can be vendor specific, but we put them all in here
82 // For putting a new bug in here, make sure to put a detailed comment above the enum
83 // This'll ensure we know exactly what the issue is.
84 enum Bug
85 {
86 // Bug: UBO buffer offset broken
87 // Affected devices: all mesa drivers
88 // Started Version: 9.0 (mesa doesn't support ubo before)
89 // Ended Version: up to 9.2
90 // The offset of glBindBufferRange was ignored on all Mesa Gallium3D drivers until 9.1.3
91 // Nouveau stored the offset as u16 which isn't enough for all cases with range until 9.1.6
92 // I965 has broken data fetches from uniform buffers which results in a dithering until 9.2.0
93 BUG_BROKEN_UBO,
94 // Bug: The pinned memory extension isn't working for index buffers
95 // Affected devices: AMD as they are the only vendor providing this extension
96 // Started Version: ?
97 // Ended Version: 13.9 working for me (neobrain).
98 // Affected OS: Linux
99 // Pinned memory is disabled for index buffer as the AMD driver (the only one with pinned memory
100 // support) seems
101 // to be broken. We just get flickering/black rendering when using pinned memory here -- degasus -
102 // 2013/08/20
103 // This bug only happens when paired with base_vertex.
104 // Please see issue #6105. Let's hope buffer storage solves this issue.
105 // TODO: Detect broken drivers.
106 BUG_BROKEN_PINNED_MEMORY,
107 // Bug: glBufferSubData/glMapBufferRange stalls + OOM
108 // Affected devices: Adreno a3xx/Mali-t6xx
109 // Started Version: -1
110 // Ended Version: -1
111 // Both Adreno and Mali have issues when you call glBufferSubData or glMapBufferRange
112 // The driver stalls in each instance no matter what you do
113 // Apparently Mali and Adreno share code in this regard since they were written by the same
114 // person.
115 BUG_BROKEN_BUFFER_STREAM,
116 // Bug: ARB_buffer_storage doesn't work with ARRAY_BUFFER type streams
117 // Affected devices: GeForce 4xx+
118 // Started Version: -1
119 // Ended Version: 332.21
120 // The buffer_storage streaming method is required for greater speed gains in our buffer streaming
121 // It reduces what is needed for streaming to basically a memcpy call
122 // It seems to work for all buffer types except GL_ARRAY_BUFFER
123 BUG_BROKEN_BUFFER_STORAGE,
124 // Bug: Intel HD 3000 on OS X has broken primitive restart
125 // Affected devices: Intel HD 3000
126 // Affected OS: OS X
127 // Started Version: -1
128 // Ended Version: -1
129 // The drivers on OS X has broken primitive restart.
130 // Intel HD 4000 series isn't affected by the bug
131 BUG_PRIMITIVE_RESTART,
132 // Bug: unsync mapping doesn't work fine
133 // Affected devices: Nvidia driver, ARM Mali
134 // Started Version: -1
135 // Ended Version: -1
136 // The Nvidia driver (both Windows + Linux) doesn't like unsync mapping performance wise.
137 // Because of their threaded behavior, they seem not to handle unsync mapping complete unsync,
138 // in fact, they serialize the driver which adds a much bigger overhead.
139 // Workaround: Use BufferSubData
140 // The Mali behavior is even worse: They just ignore the unsychronized flag and stall the GPU.
141 // Workaround: As they were even too lazy to implement asynchronous buffer updates,
142 // BufferSubData stalls as well, so we have to use the slowest possible path:
143 // Alloc one buffer per draw call with BufferData.
144 // TODO: some Windows AMD driver/GPU combination seems also affected
145 // but as they all support pinned memory, it doesn't matter
146 BUG_BROKEN_UNSYNC_MAPPING,
147 // Bug: Intel's Window driver broke buffer_storage with GL_ELEMENT_ARRAY_BUFFER
148 // Affected devices: Intel (Windows)
149 // Started Version: 15.36.3.64.3907 (10.18.10.3907)
150 // Ended Version: 15.36.7.64.3960 (10.18.10.3960)
151 // Intel implemented buffer_storage in their GL 4.3 driver.
152 // It works for all the buffer types we use except GL_ELEMENT_ARRAY_BUFFER.
153 // Causes complete blackscreen issues.
154 BUG_INTEL_BROKEN_BUFFER_STORAGE,
155 // Bug: Qualcomm has broken boolean negation
156 // Affected devices: Adreno
157 // Started Version: -1
158 // Ended Version: -1
159 // Qualcomm has the boolean negation broken in their shader compiler
160 // Instead of inverting the boolean value it does a binary negation on the full 32bit register
161 // This causes a compare against zero to fail in their shader since it is no longer a 0 or 1 value
162 // but 0xFFFFFFFF or 0xFFFFFFFE depending on what the boolean value was before the negation.
163 //
164 // This bug has a secondary issue tied to it unlike other bugs.
165 // The correction of this bug is to check the boolean value against false which results in us
166 // not doing a negation of the source but instead checking against the boolean value we want.
167 // The issue with this is that Intel's Windows driver is broken when checking if a boolean value
168 // is equal to true or false, so one has to do a boolean negation of the source
169 //
170 // eg.
171 // Broken on Qualcomm
172 // Works on Windows Intel
173 // if (!cond)
174 //
175 // Works on Qualcomm
176 // Broken on Windows Intel
177 // if (cond == false)
178 BUG_BROKEN_NEGATED_BOOLEAN,
179
180 // Bug: glCopyImageSubData doesn't work on i965
181 // Started Version: -1
182 // Ended Version: 10.6.4
183 // Mesa meta misses to disable the scissor test.
184 BUG_BROKEN_COPYIMAGE,
185
186 // Bug: ARM Mali managed to break disabling vsync
187 // Affected Devices: Mali
188 // Started Version: r5p0-rev2
189 // Ended Version: -1
190 // If we disable vsync with eglSwapInterval(dpy, 0) then the screen will stop showing new updates
191 // after a handful of swaps.
192 // This was noticed on a Samsung Galaxy S6 with its Android 5.1.1 update.
193 // The default Android 5.0 image didn't encounter this issue.
194 // We can't actually detect what the driver version is on Android, so until the driver version
195 // lands that displays the version in
196 // the GL_VERSION string, we will have to force vsync to be enabled at all times.
197 BUG_BROKEN_VSYNC,
198
199 // Bug: Broken lines in geometry shaders
200 // Affected Devices: Mesa r600/radeonsi, Mesa Sandy Bridge
201 // Started Version: -1
202 // Ended Version: 11.1.2 for radeon, -1 for Sandy
203 // Mesa introduced geometry shader support for radeon and sandy bridge devices and failed to test
204 // it with us.
205 // Causes misrenderings on a large amount of things that draw lines.
206 BUG_BROKEN_GEOMETRY_SHADERS,
207
208 // Bug: glGetBufferSubData for bounding box reads is slow on AMD drivers
209 // Started Version: -1
210 // Ended Version: -1
211 // Bounding box reads use glGetBufferSubData to read back the contents of the SSBO, but this is
212 // slow on AMD drivers, compared to
213 // using glMapBufferRange. glMapBufferRange is slower on Nvidia drivers, we suspect due to the
214 // first call moving the buffer from
215 // GPU memory to system memory. Use glMapBufferRange for BBox reads on AMD, and glGetBufferSubData
216 // everywhere else.
217 BUG_SLOW_GETBUFFERSUBDATA,
218
219 // Bug: Broken lines in geometry shaders when writing to gl_ClipDistance in the vertex shader
220 // Affected Devices: Mesa i965
221 // Started Version: -1
222 // Ended Version: -1
223 // Writing to gl_ClipDistance in both the vertex shader and the geometry shader will break
224 // the geometry shader. Current workaround is to make sure the geometry shader always consumes
225 // the gl_ClipDistance inputs from the vertex shader.
226 BUG_BROKEN_CLIP_DISTANCE,
227
228 // Bug: Dual-source outputs from fragment shaders are broken on some drivers.
229 // Started Version: -1
230 // Ended Version: -1
231 // On some AMD drivers, fragment shaders that specify dual-source outputs can cause the driver to
232 // crash. Sometimes this happens in the kernel mode part of the driver, resulting in a BSOD.
233 // These shaders are also particularly problematic on macOS's Intel drivers. On OpenGL, they can
234 // cause depth issues. On Metal, they can cause the driver to not write a primitive to the depth
235 // buffer if dual source blending is output in the shader but not subsequently used in blending.
236 // Compile separate shaders for DSB on vs off for these drivers.
237 BUG_BROKEN_DUAL_SOURCE_BLENDING,
238
239 // BUG: ImgTec GLSL shader compiler fails when negating the input to a bitwise operation
240 // Started version: 1.5
241 // Ended version: 1.8@4693462
242 // Shaders that do something like "variable <<= (-othervariable);" cause the shader to
243 // fail compilation with no useful diagnostic log. This can be worked around by storing
244 // the negated value to a temporary variable then using that in the bitwise op.
245 BUG_BROKEN_BITWISE_OP_NEGATION,
246
247 // BUG: The GPU shader code appears to be context-specific on Mesa/i965.
248 // This means that if we compiled the ubershaders asynchronously, they will be recompiled
249 // on the main thread the first time they are used, causing stutter. For now, disable
250 // asynchronous compilation on Mesa i965. On nouveau, our use of glFinish() can cause
251 // crashes and/or lockups.
252 // Started version: -1
253 // Ended Version: -1
254 BUG_SHARED_CONTEXT_SHADER_COMPILATION,
255
256 // Bug: Fast clears on a MSAA framebuffer can cause NVIDIA GPU resets/lockups.
257 // Started version: -1
258 // Ended version: -1
259 // Calling vkCmdClearAttachments with a partial rect, or specifying a render area in a
260 // render pass with the load op set to clear can cause the GPU to lock up, or raise a
261 // bounds violation. This only occurs on MSAA framebuffers, and it seems when there are
262 // multiple clears in a single command buffer. Worked around by back to the slow path
263 // (drawing quads) when MSAA is enabled.
264 BUG_BROKEN_MSAA_CLEAR,
265
266 // BUG: Some vulkan implementations don't like the 'clear' loadop renderpass.
267 // For example, the ImgTec VK driver fails if you try to use a framebuffer with a different
268 // load/store op than that which it was created with, despite the spec saying they should be
269 // compatible.
270 // Started Version: 1.7
271 // Ended Version: 1.10
272 BUG_BROKEN_CLEAR_LOADOP_RENDERPASS,
273
274 // BUG: 32-bit depth clears are broken in the Adreno Vulkan driver, and have no effect.
275 // To work around this, we use a D24_S8 buffer instead, which results in a loss of accuracy.
276 // We still resolve this to a R32F texture, as there is no 24-bit format.
277 // Started version: -1
278 // Ended version: -1
279 BUG_BROKEN_D32F_CLEAR,
280
281 // BUG: Reversed viewport depth range does not work as intended on some Vulkan drivers.
282 // The Vulkan spec allows the minDepth/maxDepth fields in the viewport to be reversed,
283 // however the implementation is broken on some drivers.
284 BUG_BROKEN_REVERSED_DEPTH_RANGE,
285
286 // BUG: Cached memory is significantly slower for readbacks than coherent memory in the
287 // Mali Vulkan driver, causing high CPU usage in the __pi___inval_cache_range kernel
288 // function. This flag causes readback buffers to select the coherent type.
289 BUG_SLOW_CACHED_READBACK_MEMORY,
290
291 // BUG: Apparently ARM Mali GLSL compiler managed to break bitwise AND operations between
292 // two integers vectors, when one of them is non-constant (though the exact cases of when
293 // this occurs are still unclear). The resulting vector from the operation will be the
294 // constant vector.
295 // Easy enough to fix, just do the bitwise AND operation on the vector components first and
296 // then construct the final vector.
297 // Started version: -1
298 // Ended version: -1
299 BUG_BROKEN_VECTOR_BITWISE_AND,
300
301 // BUG: Accessing gl_SubgroupInvocationID causes the Metal shader compiler to crash.
302 // Affected devices: AMD (older macOS)
303 // Started version: ???
304 // Ended version: ???
305 // (Workaround currently disabled, will put it back when someone hits the issue and we can
306 // find out what devices and OSes it actually affects)
307
308 // BUG: Using subgroupMax in a shader that can discard results in garbage data
309 // (For some reason, this only happens at 4x+ IR on Metal, but 2x+ IR on MoltenVK)
310 // Affected devices: Intel (macOS)
311 // Started version: -1
312 // Ended version: -1
313 BUG_BROKEN_SUBGROUP_OPS_WITH_DISCARD,
314
315 // BUG: gl_HelperInvocation is actually !gl_HelperInvocation
316 // Affected devices: AMD (macOS)
317 // Started version: -1
318 // Ended version: -1
319 BUG_INVERTED_IS_HELPER,
320
321 // BUG: Multi-threaded shader pre-compilation sometimes crashes
322 // Used primarily in Videoconfig.cpp's GetNumAutoShaderPreCompilerThreads()
323 // refer to https://github.com/dolphin-emu/dolphin/pull/9414 for initial validation coverage
324 BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION,
325
326 // BUG: Some driver and Apple Silicon GPU combinations have problems with fragment discard when
327 // early depth test is enabled. Discarded fragments may appear corrupted (Super Mario Sunshine,
328 // Sonic Adventure 2: Battle, Phantasy Star Online Episodes 1 & 2, etc).
329 // Affected devices: Apple Silicon GPUs of Apple family 4 and newer.
330 // Started version: -1
331 // Ended version: -1
332 BUG_BROKEN_DISCARD_WITH_EARLY_Z,
333
334 // BUG: Using dynamic sampler indexing locks up the GPU
335 // Affected devices: Intel (macOS Metal)
336 // Started version: -1
337 // Ended version: -1
338 BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING,
339
340 // BUG: vkCmdCopyImageToBuffer allocates a staging image when used to copy from
341 // an image with optimal tiling.
342 // Affected devices: Adreno
343 // Started Version: -1
344 // Ended Version: -1
345 BUG_SLOW_OPTIMAL_IMAGE_TO_BUFFER_COPY,
346
347 // BUG: Incorrect implementation of VK_EXT_depth_clamp_control causes incorrect depth values to
348 // be written to the depth buffer.
349 // Affected devices: Official AMD (RADV is unaffected)
350 // Started Version: -1
351 // Ended Version: -1
352 BUG_BROKEN_DEPTH_CLAMP_CONTROL
353 };
354
355 // Initializes our internal vendor, device family, and driver version
356 void Init(API api, Vendor vendor, Driver driver, const double version, const Family family,
357 std::string name);
358
359 // Once Vendor and driver version is set, this will return if it has the applicable bug passed to
360 // it.
361 bool HasBug(Bug bug);
362
363 // Overrides the current state of a bug
364 void OverrideBug(Bug bug, bool new_value);
365 } // namespace DriverDetails