diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 6a8140e1b..ef02fc2c7 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -1122,13 +1122,13 @@ Containers::StringView Context::shadingLanguageVersionString() const { Containers::Array Context::shadingLanguageVersionStrings() const { #ifndef MAGNUM_TARGET_GLES - GLint versionCount = 0; - glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS, &versionCount); + /* GL_NUM_SHADING_LANGUAGE_VERSIONS is only since GL 4.3 */ + if(_version >= Version::GL430) { + GLint versionCount = 0; + glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS, &versionCount); + /* If on GL 4.3+, there should be always at least one */ + CORRADE_INTERNAL_ASSERT(versionCount); - /* If zero, the implementation doesn't yet support this query (< GL4.3) */ - /** @todo doesn't this throw a GL error? some better handling? */ - if(versionCount) { - /* Get all of them */ Containers::Array versions{std::size_t(versionCount)}; for(GLint i = 0; i != versionCount; ++i) versions[i] = {reinterpret_cast(glGetStringi(GL_SHADING_LANGUAGE_VERSION, i)), Containers::StringViewFlag::Global}; @@ -1136,6 +1136,7 @@ Containers::Array Context::shadingLanguageVersionStrings } #endif + /* On GLES or GL < 4.3 return just the main */ return Containers::array({shadingLanguageVersionString()}); }