Browse Source

More consistent naming in Context::DetectedDriver.

DetectedDriver::AMD is now DetectedDriver::Amd,
DetectedDriver::ProbablyAngle is now just DetectedDriver::Angle. The old
names are still present, but deprecated and will be removed in the
future.
pull/203/merge
Vladimír Vondruš 9 years ago
parent
commit
4b589e10ac
  1. 20
      src/Magnum/Context.cpp
  2. 44
      src/Magnum/Context.h
  3. 4
      src/Magnum/Implementation/driverSpecific.cpp
  4. 2
      src/Magnum/Shaders/MeshVisualizer.cpp
  5. 16
      src/Magnum/Test/ContextTest.cpp
  6. 8
      src/Magnum/Test/MeshGLTest.cpp

20
src/Magnum/Context.cpp

@ -894,14 +894,16 @@ Debug& operator<<(Debug& debug, const Context::DetectedDriver value) {
/* LCOV_EXCL_START */ /* LCOV_EXCL_START */
#define _c(value) case Context::DetectedDriver::value: return debug << "Context::DetectedDriver::" #value; #define _c(value) case Context::DetectedDriver::value: return debug << "Context::DetectedDriver::" #value;
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
_c(AMD) _c(Amd)
#endif
#ifdef MAGNUM_TARGET_GLES
_c(Angle)
#endif
#ifndef MAGNUM_TARGET_WEBGL
_c(IntelWindows) _c(IntelWindows)
_c(Mesa) _c(Mesa)
_c(NVidia) _c(NVidia)
#endif #endif
#ifdef MAGNUM_TARGET_GLES
_c(ProbablyAngle)
#endif
#undef _c #undef _c
/* LCOV_EXCL_STOP */ /* LCOV_EXCL_STOP */
} }
@ -912,14 +914,16 @@ Debug& operator<<(Debug& debug, const Context::DetectedDriver value) {
Debug& operator<<(Debug& debug, const Context::DetectedDrivers value) { Debug& operator<<(Debug& debug, const Context::DetectedDrivers value) {
return Containers::enumSetDebugOutput(debug, value, "Context::DetectedDrivers{}", { return Containers::enumSetDebugOutput(debug, value, "Context::DetectedDrivers{}", {
#ifndef MAGNUM_TARGET_WEBGL #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::IntelWindows,
Context::DetectedDriver::Mesa, Context::DetectedDriver::Mesa,
Context::DetectedDriver::NVidia, Context::DetectedDriver::NVidia,
#endif #endif
#ifdef MAGNUM_TARGET_GLES
Context::DetectedDriver::ProbablyAngle
#endif
}); });
} }
#endif #endif

44
src/Magnum/Context.h

@ -220,38 +220,54 @@ class MAGNUM_EXPORT Context {
* @requires_gles Not detectable on WebGL, as browsers * @requires_gles Not detectable on WebGL, as browsers
* intentionally hide most of the driver information. * 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 * Intel desktop drivers on Windows
* @requires_gles Not detectable on WebGL, as browsers * @requires_gles Not detectable on WebGL, as browsers
* intentionally hide most of the driver information. * intentionally hide most of the driver information.
*/ */
IntelWindows = 1 << 1, IntelWindows = 1 << 2,
/** /**
* Mesa drivers on Linux * Mesa drivers on Linux
* @requires_gles Not detectable on WebGL, as browsers * @requires_gles Not detectable on WebGL, as browsers
* intentionally hide most of the driver information. * intentionally hide most of the driver information.
*/ */
Mesa = 1 << 2, Mesa = 1 << 3,
/** /**
* Binary NVidia drivers on Windows and Linux * Binary NVidia drivers on Windows and Linux
* @requires_gles Not detectable on WebGL, as browsers * @requires_gles Not detectable on WebGL, as browsers
* intentionally hide most of the driver information. * intentionally hide most of the driver information.
*/ */
NVidia = 1 << 3, NVidia = 1 << 4
#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
#endif #endif
}; };

4
src/Magnum/Implementation/driverSpecific.cpp

@ -137,7 +137,7 @@ auto Context::detectedDriver() -> DetectedDrivers {
#if !defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_WEBGL)
/* AMD binary desktop drivers */ /* AMD binary desktop drivers */
if(vendor.find("ATI Technologies Inc.") != std::string::npos) if(vendor.find("ATI Technologies Inc.") != std::string::npos)
return *_detectedDrivers |= DetectedDriver::AMD; return *_detectedDrivers |= DetectedDriver::Amd;
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
/* Intel Windows drivers */ /* Intel Windows drivers */
@ -165,7 +165,7 @@ auto Context::detectedDriver() -> DetectedDrivers {
Range1Di range; Range1Di range;
glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data()); glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data());
if(range.min() == 1 && range.max() == 1 && vendor != "Internet Explorer") if(range.min() == 1 && range.max() == 1 && vendor != "Internet Explorer")
return *_detectedDrivers |= DetectedDriver::ProbablyAngle; return *_detectedDrivers |= DetectedDriver::Angle;
} }
#endif #endif

2
src/Magnum/Shaders/MeshVisualizer.cpp

@ -76,7 +76,7 @@ MeshVisualizer::MeshVisualizer(const Flags flags): _flags{flags} {
#ifdef MAGNUM_TARGET_WEBGL #ifdef MAGNUM_TARGET_WEBGL
.addSource("#define SUBSCRIPTING_WORKAROUND\n") .addSource("#define SUBSCRIPTING_WORKAROUND\n")
#elif defined(MAGNUM_TARGET_GLES2) #elif defined(MAGNUM_TARGET_GLES2)
.addSource(Context::current().detectedDriver() & Context::DetectedDriver::ProbablyAngle ? .addSource(Context::current().detectedDriver() & Context::DetectedDriver::Angle ?
"#define SUBSCRIPTING_WORKAROUND\n" : "") "#define SUBSCRIPTING_WORKAROUND\n" : "")
#endif #endif
.addSource(rs.get("generic.glsl")) .addSource(rs.get("generic.glsl"))

16
src/Magnum/Test/ContextTest.cpp

@ -71,22 +71,22 @@ void ContextTest::debugFlags() {
void ContextTest::debugDetectedDriver() { void ContextTest::debugDetectedDriver() {
std::ostringstream out; std::ostringstream out;
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
Debug{&out} << Context::DetectedDriver::AMD << Context::DetectedDriver(0xdead); Debug{&out} << Context::DetectedDriver::Amd << Context::DetectedDriver(0xdead);
CORRADE_COMPARE(out.str(), "Context::DetectedDriver::AMD Context::DetectedDriver(0xdead)\n"); CORRADE_COMPARE(out.str(), "Context::DetectedDriver::Amd Context::DetectedDriver(0xdead)\n");
#else #else
Debug{&out} << Context::DetectedDriver::ProbablyAngle << Context::DetectedDriver(0xdead); Debug{&out} << Context::DetectedDriver::Angle << Context::DetectedDriver(0xdead);
CORRADE_COMPARE(out.str(), "Context::DetectedDriver::ProbablyAngle Context::DetectedDriver(0xdead)\n"); CORRADE_COMPARE(out.str(), "Context::DetectedDriver::Angle Context::DetectedDriver(0xdead)\n");
#endif #endif
} }
void ContextTest::debugDetectedDrivers() { void ContextTest::debugDetectedDrivers() {
std::ostringstream out; std::ostringstream out;
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::AMD|Context::DetectedDriver::NVidia) << (Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)); 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"); CORRADE_COMPARE(out.str(), "Context::DetectedDrivers{} Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)\n");
#else #else
Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::ProbablyAngle) << (Context::DetectedDriver::ProbablyAngle|Context::DetectedDriver(0xde00)); Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::Angle) << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00));
CORRADE_COMPARE(out.str(), "Context::DetectedDrivers{} Context::DetectedDriver::ProbablyAngle Context::DetectedDriver::ProbablyAngle|Context::DetectedDriver(0xde00)\n"); CORRADE_COMPARE(out.str(), "Context::DetectedDrivers{} Context::DetectedDriver::Angle Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)\n");
#endif #endif
} }

8
src/Magnum/Test/MeshGLTest.cpp

@ -793,13 +793,13 @@ void MeshGLTest::addVertexBufferMatrixNxNd() {
MAGNUM_VERIFY_NO_ERROR(); 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<UnsignedShort>(315, 65201, 2576)); CORRADE_COMPARE(value, Math::Vector3<UnsignedShort>(315, 65201, 2576));
} }
/* This is wrong, but check if it's still the right wrong. Fails on AMD /* 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 */ 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<UnsignedShort>(315, 65201, 0)); CORRADE_COMPARE(value, Math::Vector3<UnsignedShort>(315, 65201, 0));
} }
#endif #endif
@ -859,13 +859,13 @@ void MeshGLTest::addVertexBufferMatrixMxNd() {
MAGNUM_VERIFY_NO_ERROR(); 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<UnsignedShort>(315, 65201, 2576)); CORRADE_COMPARE(value, Math::Vector3<UnsignedShort>(315, 65201, 2576));
} }
/* This is wrong, but check if it's still the right wrong. Fails on AMD /* 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 */ 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<UnsignedShort>(315, 65201, 0)); CORRADE_COMPARE(value, Math::Vector3<UnsignedShort>(315, 65201, 0));
} }
#endif #endif

Loading…
Cancel
Save