Browse Source

GL: fix Mesa detection on AMD cards.

There it doesn't report Mesa in the renderer, but only in the version
string. Broken since d0f57f0153.
pull/542/merge
Vladimír Vondruš 4 years ago
parent
commit
1c27ee587b
  1. 23
      src/Magnum/GL/Implementation/driverSpecific.cpp

23
src/Magnum/GL/Implementation/driverSpecific.cpp

@ -448,6 +448,9 @@ auto Context::detectedDriver() -> DetectedDrivers {
#endif #endif
; ;
#endif #endif
#if !defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_WEBGL)
const Containers::StringView version = versionString();
#endif
/* In some cases we can have a combination of drivers (e.g. ANGLE running /* In some cases we can have a combination of drivers (e.g. ANGLE running
on top of Mesa, Mesa Zink running on top of NVidia drivers...) so the on top of Mesa, Mesa Zink running on top of NVidia drivers...) so the
@ -466,10 +469,22 @@ auto Context::detectedDriver() -> DetectedDrivers {
*_detectedDrivers |= DetectedDriver::IntelWindows; *_detectedDrivers |= DetectedDriver::IntelWindows;
#endif #endif
/* Mesa drivers. On desktop GL and GLES the version string contains Mesa /* Mesa drivers.
as well, but not on WebGL. Renderer contains it on all three, except - Intel GL/GLES drivers contain Mesa both in renderer and version
for Firefox for some reason. */ string
if(renderer.contains("Mesa"_s)) { - AMD GL/GLES drivers have Mesa only in the version string
- On WebGL the version string is useless, always saying just
"WebGL X.Y (Chromium)" or "WebGL X.Y"
- Mesa is in renderer string in Chromium and nowhere in Firefox for
some reason
To avoid misdetecting the driver, simply test both where it makes
sense. */
if(renderer.contains("Mesa"_s)
#ifndef MAGNUM_TARGET_WEBGL
|| version.contains("Mesa"_s)
#endif
) {
*_detectedDrivers |= DetectedDriver::Mesa; *_detectedDrivers |= DetectedDriver::Mesa;
if(renderer.contains("SVGA3D"_s)) if(renderer.contains("SVGA3D"_s))

Loading…
Cancel
Save