diff --git a/src/Magnum/Context.cpp b/src/Magnum/Context.cpp index 54cb724a1..c17303403 100644 --- a/src/Magnum/Context.cpp +++ b/src/Magnum/Context.cpp @@ -894,14 +894,16 @@ Debug& operator<<(Debug& debug, const Context::DetectedDriver value) { /* LCOV_EXCL_START */ #define _c(value) case Context::DetectedDriver::value: return debug << "Context::DetectedDriver::" #value; #ifndef MAGNUM_TARGET_WEBGL - _c(AMD) + _c(Amd) + #endif + #ifdef MAGNUM_TARGET_GLES + _c(Angle) + #endif + #ifndef MAGNUM_TARGET_WEBGL _c(IntelWindows) _c(Mesa) _c(NVidia) #endif - #ifdef MAGNUM_TARGET_GLES - _c(ProbablyAngle) - #endif #undef _c /* LCOV_EXCL_STOP */ } @@ -912,14 +914,16 @@ Debug& operator<<(Debug& debug, const Context::DetectedDriver value) { Debug& operator<<(Debug& debug, const Context::DetectedDrivers value) { return Containers::enumSetDebugOutput(debug, value, "Context::DetectedDrivers{}", { #ifndef MAGNUM_TARGET_WEBGL - Context::DetectedDriver::AMD, + Context::DetectedDriver::Amd, + #endif + #ifdef MAGNUM_TARGET_GLES + Context::DetectedDriver::Angle, + #endif + #ifndef MAGNUM_TARGET_WEBGL Context::DetectedDriver::IntelWindows, Context::DetectedDriver::Mesa, Context::DetectedDriver::NVidia, #endif - #ifdef MAGNUM_TARGET_GLES - Context::DetectedDriver::ProbablyAngle - #endif }); } #endif diff --git a/src/Magnum/Context.h b/src/Magnum/Context.h index 29ca68749..7a2494b2a 100644 --- a/src/Magnum/Context.h +++ b/src/Magnum/Context.h @@ -220,38 +220,54 @@ class MAGNUM_EXPORT Context { * @requires_gles Not detectable on WebGL, as browsers * intentionally hide most of the driver information. */ - AMD = 1 << 0, + Amd = 1 << 0, + #ifdef MAGNUM_BUILD_DEPRECATED + /** @copydoc DetectedDriver::Amd + * @deprecated Use @ref DetectedDriver::Amd instead. + */ + AMD CORRADE_DEPRECATED_ENUM("use DetectedDriver::Amd instead") = UnsignedShort(DetectedDriver::Amd), + #endif + #endif + + #ifdef MAGNUM_TARGET_GLES + /** + * 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. + */ + Angle = 1 << 1, + + #ifdef MAGNUM_BUILD_DEPRECATED + /** @copydoc DetectedDriver::Angle + * @deprecated Use @ref DetectedDriver::Angle instead. + */ + ProbablyAngle CORRADE_DEPRECATED_ENUM("use DetectedDriver::Angle instead") = UnsignedShort(DetectedDriver::Angle), + #endif + #endif + + #ifndef MAGNUM_TARGET_WEBGL /** * Intel desktop drivers on Windows * @requires_gles Not detectable on WebGL, as browsers * intentionally hide most of the driver information. */ - IntelWindows = 1 << 1, + IntelWindows = 1 << 2, /** * Mesa drivers on Linux * @requires_gles Not detectable on WebGL, as browsers * intentionally hide most of the driver information. */ - Mesa = 1 << 2, + 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 - /** - * 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. - */ - ProbablyAngle = 1 << 4 + NVidia = 1 << 4 #endif }; diff --git a/src/Magnum/Implementation/driverSpecific.cpp b/src/Magnum/Implementation/driverSpecific.cpp index 7b6a32594..618b61b8b 100644 --- a/src/Magnum/Implementation/driverSpecific.cpp +++ b/src/Magnum/Implementation/driverSpecific.cpp @@ -137,7 +137,7 @@ auto Context::detectedDriver() -> DetectedDrivers { #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; + return *_detectedDrivers |= DetectedDriver::Amd; #ifdef CORRADE_TARGET_WINDOWS /* Intel Windows drivers */ @@ -165,7 +165,7 @@ auto Context::detectedDriver() -> DetectedDrivers { Range1Di range; glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data()); if(range.min() == 1 && range.max() == 1 && vendor != "Internet Explorer") - return *_detectedDrivers |= DetectedDriver::ProbablyAngle; + return *_detectedDrivers |= DetectedDriver::Angle; } #endif diff --git a/src/Magnum/Shaders/MeshVisualizer.cpp b/src/Magnum/Shaders/MeshVisualizer.cpp index 20a37cb7b..1eee0de33 100644 --- a/src/Magnum/Shaders/MeshVisualizer.cpp +++ b/src/Magnum/Shaders/MeshVisualizer.cpp @@ -76,7 +76,7 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} { #ifdef MAGNUM_TARGET_WEBGL .addSource("#define SUBSCRIPTING_WORKAROUND\n") #elif defined(MAGNUM_TARGET_GLES2) - .addSource(Context::current().detectedDriver() & Context::DetectedDriver::ProbablyAngle ? + .addSource(Context::current().detectedDriver() & Context::DetectedDriver::Angle ? "#define SUBSCRIPTING_WORKAROUND\n" : "") #endif .addSource(rs.get("generic.glsl")) diff --git a/src/Magnum/Test/ContextTest.cpp b/src/Magnum/Test/ContextTest.cpp index 0f03bd6e7..9ddd45b0a 100644 --- a/src/Magnum/Test/ContextTest.cpp +++ b/src/Magnum/Test/ContextTest.cpp @@ -71,22 +71,22 @@ void ContextTest::debugFlags() { void ContextTest::debugDetectedDriver() { std::ostringstream out; #ifndef MAGNUM_TARGET_WEBGL - Debug{&out} << Context::DetectedDriver::AMD << Context::DetectedDriver(0xdead); - CORRADE_COMPARE(out.str(), "Context::DetectedDriver::AMD Context::DetectedDriver(0xdead)\n"); + Debug{&out} << Context::DetectedDriver::Amd << Context::DetectedDriver(0xdead); + CORRADE_COMPARE(out.str(), "Context::DetectedDriver::Amd Context::DetectedDriver(0xdead)\n"); #else - Debug{&out} << Context::DetectedDriver::ProbablyAngle << Context::DetectedDriver(0xdead); - CORRADE_COMPARE(out.str(), "Context::DetectedDriver::ProbablyAngle Context::DetectedDriver(0xdead)\n"); + Debug{&out} << Context::DetectedDriver::Angle << Context::DetectedDriver(0xdead); + CORRADE_COMPARE(out.str(), "Context::DetectedDriver::Angle Context::DetectedDriver(0xdead)\n"); #endif } void ContextTest::debugDetectedDrivers() { std::ostringstream out; #ifndef MAGNUM_TARGET_WEBGL - Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::AMD|Context::DetectedDriver::NVidia) << (Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)); - CORRADE_COMPARE(out.str(), "Context::DetectedDrivers{} Context::DetectedDriver::AMD|Context::DetectedDriver::NVidia Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)\n"); + Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia) << (Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)); + CORRADE_COMPARE(out.str(), "Context::DetectedDrivers{} Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)\n"); #else - Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::ProbablyAngle) << (Context::DetectedDriver::ProbablyAngle|Context::DetectedDriver(0xde00)); - CORRADE_COMPARE(out.str(), "Context::DetectedDrivers{} Context::DetectedDriver::ProbablyAngle Context::DetectedDriver::ProbablyAngle|Context::DetectedDriver(0xde00)\n"); + Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::Angle) << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)); + CORRADE_COMPARE(out.str(), "Context::DetectedDrivers{} Context::DetectedDriver::Angle Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)\n"); #endif } diff --git a/src/Magnum/Test/MeshGLTest.cpp b/src/Magnum/Test/MeshGLTest.cpp index 6008f3b53..c82cfe9f5 100644 --- a/src/Magnum/Test/MeshGLTest.cpp +++ b/src/Magnum/Test/MeshGLTest.cpp @@ -793,13 +793,13 @@ void MeshGLTest::addVertexBufferMatrixNxNd() { MAGNUM_VERIFY_NO_ERROR(); { - CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & (Context::DetectedDriver::AMD|Context::DetectedDriver::NVidia), "Somehow only first two values are extracted"); + CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia), "Somehow only first two values are extracted"); CORRADE_COMPARE(value, Math::Vector3(315, 65201, 2576)); } /* This is wrong, but check if it's still the right wrong. Fails on AMD 15.201.1151 but seems to be fixed in 15.300.1025.0 */ - if(Context::current().detectedDriver() & (Context::DetectedDriver::AMD|Context::DetectedDriver::NVidia)) + if(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia)) CORRADE_COMPARE(value, Math::Vector3(315, 65201, 0)); } #endif @@ -859,13 +859,13 @@ void MeshGLTest::addVertexBufferMatrixMxNd() { MAGNUM_VERIFY_NO_ERROR(); { - CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & (Context::DetectedDriver::AMD|Context::DetectedDriver::NVidia), "Somehow only first two values are extracted"); + CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia), "Somehow only first two values are extracted"); CORRADE_COMPARE(value, Math::Vector3(315, 65201, 2576)); } /* This is wrong, but check if it's still the right wrong. Fails on AMD 15.201.1151 but seems to be fixed in 15.300.1025.0 */ - if(Context::current().detectedDriver() & (Context::DetectedDriver::AMD|Context::DetectedDriver::NVidia)) + if(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia)) CORRADE_COMPARE(value, Math::Vector3(315, 65201, 0)); } #endif