diff --git a/src/Magnum/GL/Test/ContextTest.cpp b/src/Magnum/GL/Test/ContextTest.cpp index 08436619f..a8ae02d0c 100644 --- a/src/Magnum/GL/Test/ContextTest.cpp +++ b/src/Magnum/GL/Test/ContextTest.cpp @@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include #include @@ -95,7 +96,11 @@ void ContextTest::makeCurrentNoOp() { void ContextTest::extensions() { const char* used[GL::Implementation::ExtensionCount]{}; - /* Check that all extension indices are unique */ + std::set unique; + + /* Check that all extension indices are unique, are in correct lists, are + not compiled on versions that shouldn't have them, are listed just once + etc. */ for(Version version: { #ifndef MAGNUM_TARGET_GLES Version::GL300, @@ -133,6 +138,39 @@ void ContextTest::extensions() { } used[e.index()] = e.string(); + if(!unique.insert(e.string()).second) { + Error{} << "Extension" << e.string() << "listed more than once"; + CORRADE_VERIFY(false); + } + + CORRADE_VERIFY(Int(e.coreVersion()) >= Int(e.requiredVersion())); + if(e.coreVersion() != version + #if defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL) + /* These two are replaced by EXT_color_buffer_float for 2.0, + but aren't core in WebGL 2 */ + && e.index() != Extensions::EXT::color_buffer_half_float::Index + && e.index() != Extensions::WEBGL::color_buffer_float::Index + #endif + ) { + Error{} << "Extension" << e.string() << "should have core version" + << version << "but has" << e.coreVersion(); + CORRADE_VERIFY(false); + } + + #ifdef MAGNUM_TARGET_GLES2 + if(e.requiredVersion() != Version::GLES200) { + Error{} << "Extension" << e.string() << "should have required version" + << Version::GLES200 << "but has" << e.requiredVersion(); + CORRADE_VERIFY(false); + } + #endif + + #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) + if(e.coreVersion() == Version::GLES300) { + Error{} << "Extension" << e.string() << "has core version" << e.coreVersion() << "on a GLES3 build -- it shouldn't be present at all"; + CORRADE_VERIFY(false); + } + #endif } }