DriverDetails.h 15 KB

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