From 608a80c20d4cca4cee58dc3b06038cf80f475be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Jun 2015 18:26:13 +0200 Subject: [PATCH] Improve ANGLE driver detection. It is now also on ES3, avoid mistakenly detecting Internet Explorer WebGL implementation as ANGLE (it has the same properties). --- src/Magnum/Context.h | 6 +++--- src/Magnum/Implementation/driverSpecific.cpp | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Magnum/Context.h b/src/Magnum/Context.h index 1ffa8ab30..9bae750a7 100644 --- a/src/Magnum/Context.h +++ b/src/Magnum/Context.h @@ -189,10 +189,10 @@ class MAGNUM_EXPORT Context { IntelWindows = 1 << 1, #endif - #ifdef MAGNUM_TARGET_GLES2 + #ifdef MAGNUM_TARGET_GLES /** - * OpenGL ES 2.0 implementation by ANGLE (translated to D3D9), used - * by browsers on Windows for Native Client and WebGL. As the WebGL + * OpenGL ES implementation by ANGLE (translated to D3D), used by + * browsers on Windows for Native Client and WebGL. As the WebGL * specification explicitly disallows exposing driver information * to the application, this check cannot be done reliably. */ diff --git a/src/Magnum/Implementation/driverSpecific.cpp b/src/Magnum/Implementation/driverSpecific.cpp index d20eba533..aced71d71 100644 --- a/src/Magnum/Implementation/driverSpecific.cpp +++ b/src/Magnum/Implementation/driverSpecific.cpp @@ -34,9 +34,9 @@ auto Context::detectedDriver() -> DetectedDrivers { _detectedDrivers = DetectedDrivers{}; - #ifndef MAGNUM_TARGET_GLES const std::string vendor = vendorString(); + #ifndef MAGNUM_TARGET_GLES /* AMD binary desktop drivers */ if(vendor.find("ATI Technologies Inc.") != std::string::npos) return *_detectedDrivers |= DetectedDriver::AMD; @@ -48,13 +48,16 @@ auto Context::detectedDriver() -> DetectedDrivers { #endif #endif - #ifdef MAGNUM_TARGET_GLES2 - /* OpenGL ES 2.0 implementation using ANGLE. Taken from - http://stackoverflow.com/a/20149090 */ + /** @todo there is also D3D9/D3D11 distinction on webglreport.com, is it useful? */ + #ifdef MAGNUM_TARGET_GLES + /* OpenGL ES implementation using ANGLE. Taken from these sources: + http://stackoverflow.com/a/20149090 + http://webglreport.com + */ { Range1Di range; glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data()); - if(range.min() == 1 && range.max() == 1) + if(range.min() == 1 && range.max() == 1 && vendor != "Internet Explorer") return *_detectedDrivers |= DetectedDriver::ProbablyAngle; } #endif