From 6faf6c009a716ad3240e39e26d39e32174f6b126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 26 Apr 2017 18:00:13 +0200 Subject: [PATCH] On the other hand, most driver detection makes no sense on WebGL. --- src/Magnum/Context.h | 32 +++++++++++++++----- src/Magnum/Implementation/driverSpecific.cpp | 4 +-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/Magnum/Context.h b/src/Magnum/Context.h index 2862a015f..96af8e062 100644 --- a/src/Magnum/Context.h +++ b/src/Magnum/Context.h @@ -214,19 +214,35 @@ class MAGNUM_EXPORT Context { * @see @ref DetectedDriver, @ref detectedDriver() */ enum class DetectedDriver: UnsignedShort { - /** Binary AMD desktop drivers on Windows and Linux */ + #ifndef MAGNUM_TARGET_WEBGL + /** + * Binary AMD desktop drivers on Windows and Linux + * @requires_gles Not detectable on WebGL, as browsers + * intentionally hide most of the driver information. + */ AMD = 1 << 0, - /** Intel desktop drivers on Windows */ + /** + * Intel desktop drivers on Windows + * @requires_gles Not detectable on WebGL, as browsers + * intentionally hide most of the driver information. + */ IntelWindows = 1 << 1, - #ifndef MAGNUM_TARGET_WEBGL - /** Binary NVidia drivers on Windows and Linux */ - NVidia = 1 << 2, - #endif + /** + * Mesa drivers on Linux + * @requires_gles Not detectable on WebGL, as browsers + * intentionally hide most of the driver information. + */ + Mesa = 1 << 2, - /** Mesa drivers on Linux */ - Mesa = 1 << 3, + /** + * Binary NVidia drivers on Windows and Linux + * @requires_gles Not detectable on WebGL, as browsers + * intentionally hide most of the driver information. + */ + NVidia = 1 << 3, + #endif #ifdef MAGNUM_TARGET_GLES /** diff --git a/src/Magnum/Implementation/driverSpecific.cpp b/src/Magnum/Implementation/driverSpecific.cpp index 5775bb8df..7b6a32594 100644 --- a/src/Magnum/Implementation/driverSpecific.cpp +++ b/src/Magnum/Implementation/driverSpecific.cpp @@ -134,7 +134,7 @@ auto Context::detectedDriver() -> DetectedDrivers { const std::string version = versionString(); /* Apple has its own drivers */ - #ifndef CORRADE_TARGET_APPLE + #if !defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_WEBGL) /* AMD binary desktop drivers */ if(vendor.find("ATI Technologies Inc.") != std::string::npos) return *_detectedDrivers |= DetectedDriver::AMD; @@ -151,11 +151,9 @@ auto Context::detectedDriver() -> DetectedDrivers { return *_detectedDrivers |= DetectedDriver::Mesa; #endif - #ifndef MAGNUM_TARGET_WEBGL if(vendor.find("NVIDIA Corporation") != std::string::npos) return *_detectedDrivers |= DetectedDriver::NVidia; #endif - #endif /** @todo there is also D3D9/D3D11 distinction on webglreport.com, is it useful? */ #ifdef MAGNUM_TARGET_GLES