diff --git a/src/Magnum/Extensions.h b/src/Magnum/Extensions.h index 67ef86c65..d9271cffc 100644 --- a/src/Magnum/Extensions.h +++ b/src/Magnum/Extensions.h @@ -101,7 +101,7 @@ namespace GL { _extension(GL,ARB,texture_query_lod, GL210, GL400) // #73 _extension(GL,ARB,texture_compression_bptc, GL310, GL420) // #77 _extension(GL,ARB,blend_func_extended, GL210, GL330) // #78 - _extension(GL,ARB,explicit_attrib_location, /*!*/ GL320, GL330) // #79 + _extension(GL,ARB,explicit_attrib_location, GL210, GL330) // #79 _extension(GL,ARB,occlusion_query2, GL210, GL330) // #80 _extension(GL,ARB,sampler_objects, GL210, GL330) // #81 _extension(GL,ARB,shader_bit_encoding, /*?*/ GL210, GL330) // #82 @@ -125,7 +125,7 @@ namespace GL { _extension(GL,ARB,viewport_array, GL210, GL410) // #100 _extension(GL,ARB,robustness, GL210, None) // #105 _extension(GL,ARB,base_instance, GL210, GL420) // #107 - _extension(GL,ARB,shading_language_420pack, /*!*/ GL320, GL420) // #108 + _extension(GL,ARB,shading_language_420pack, GL300, GL420) // #108 _extension(GL,ARB,transform_feedback_instanced, GL210, GL420) // #109 _extension(GL,ARB,compressed_texture_pixel_storage, GL210, GL420) // #110 _extension(GL,ARB,conservative_depth, GL300, GL420) // #111 @@ -142,7 +142,7 @@ namespace GL { _extension(GL,ARB,texture_view, GL210, GL430) // #124 _extension(GL,ARB,vertex_attrib_binding, GL210, GL430) // #125 _extension(GL,ARB,ES3_compatibility, GL330, GL430) // #127 - _extension(GL,ARB,explicit_uniform_location, /*!*/ GL320, GL430) // #128 + _extension(GL,ARB,explicit_uniform_location, GL210, GL430) // #128 _extension(GL,ARB,fragment_layer_viewport, GL300, GL430) // #129 _extension(GL,ARB,framebuffer_no_attachments, GL210, GL430) // #130 _extension(GL,ARB,internalformat_query2, GL210, GL430) // #131 @@ -296,21 +296,6 @@ namespace GL { #undef _extension #endif -/* - Notes (marked with ! above) - - ARB_explicit_attrib_location, ARB_explicit_uniform_location don't work - with GLSL 1.20 (compiler error related to layout qualifier on Mesa), 1.30 - (compiler error related to layout qualifier on NVidia) or 1.40 (compiler - error on Mac OS X), bumping minimal required version to GL 3.2 even if both - have *2.1* as minimal. - - ARB_shading_language_420pack (particularly sampler bindings) doesn't work - with GLSL 1.40 (compiler error related to layout qualifier, similar to the - above), bumping minimal required version to GL 3.2 even that it has *3.0* - as minimal. -*/ - } } diff --git a/src/Magnum/Implementation/setupDriverWorkarounds.cpp b/src/Magnum/Implementation/setupDriverWorkarounds.cpp index 141542297..5acc64b04 100644 --- a/src/Magnum/Implementation/setupDriverWorkarounds.cpp +++ b/src/Magnum/Implementation/setupDriverWorkarounds.cpp @@ -33,6 +33,15 @@ void Context::setupDriverWorkarounds() { if(_extensionRequiredVersion[Extensions::extension::Index] < Version::version) \ _extensionRequiredVersion[Extensions::extension::Index] = Version::version + #ifndef MAGNUM_TARGET_GLES + /* Layout qualifier causes compiler error with GLSL 1.20 on Mesa, GLSL 1.30 + on NVidia and 1.40 on Mac OS X */ + /** @todo Different version on different vendors? */ + _setRequiredVersion(GL::ARB::explicit_attrib_location, GL320); + _setRequiredVersion(GL::ARB::explicit_uniform_location, GL320); + _setRequiredVersion(GL::ARB::shading_language_420pack, GL320); + #endif + #ifdef MAGNUM_TARGET_GLES /* Disable extensions for which we need extension loader, as they would crash otherwise. */ diff --git a/src/Magnum/Test/ContextGLTest.cpp b/src/Magnum/Test/ContextGLTest.cpp index 90f038f54..e6de8bcfe 100644 --- a/src/Magnum/Test/ContextGLTest.cpp +++ b/src/Magnum/Test/ContextGLTest.cpp @@ -73,10 +73,17 @@ void ContextGLTest::isExtensionSupported() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::EXT::texture_filter_anisotropic::string() + std::string(" extension should be supported, can't test")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test")); + /* Test that we have proper extension list parser */ std::string extensions(reinterpret_cast(glGetString(GL_EXTENSIONS))); CORRADE_VERIFY(extensions.find(Extensions::GL::EXT::texture_filter_anisotropic::string()) != std::string::npos); CORRADE_VERIFY(extensions.find(Extensions::GL::GREMEDY::string_marker::string()) == std::string::npos); + + /* This is disabled in GL < 3.2 to work around GLSL compiler bugs */ + CORRADE_VERIFY(!Context::current()->isExtensionSupported(Version::GL310)); + CORRADE_VERIFY(Context::current()->isExtensionSupported(Version::GL320)); #else CORRADE_SKIP("No useful extensions to test on OpenGL ES"); #endif @@ -87,8 +94,15 @@ void ContextGLTest::isExtensionDisabled() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::APPLE::vertex_array_object::string() + std::string(" extension should be supported, can't test")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test")); + /* This is not disabled anywhere */ CORRADE_VERIFY(!Context::current()->isExtensionDisabled()); + + /* This is disabled in GL < 3.2 to work around GLSL compiler bugs */ + CORRADE_VERIFY(Context::current()->isExtensionDisabled(Version::GL310)); + CORRADE_VERIFY(!Context::current()->isExtensionDisabled(Version::GL320)); #else CORRADE_SKIP("No useful extensions to test on OpenGL ES"); #endif