diff --git a/src/Magnum/GL/AbstractShaderProgram.h b/src/Magnum/GL/AbstractShaderProgram.h index 7b3a24161..72791a466 100644 --- a/src/Magnum/GL/AbstractShaderProgram.h +++ b/src/Magnum/GL/AbstractShaderProgram.h @@ -844,7 +844,9 @@ class MAGNUM_GL_EXPORT AbstractShaderProgram: public AbstractObject { * @m_class{m-doc-external} [ANGLE_multi_draw](https://chromium.googlesource.com/angle/angle/+/master/extensions/ANGLE_multi_draw.txt) * is present, and on WebGL if @webgl_extension{WEBGL,multi_draw} is * not present, the functionality is emulated using a sequence of - * @ref draw(MeshView&) calls. + * @ref draw(MeshView&) calls. Note that @webgl_extension{WEBGL,multi_draw} + * is only implemented since Emscripten 2.0.0, so it's not even + * advertised on older versions. * * If @gl_extension{ARB,vertex_array_object} (part of OpenGL 3.0), * OpenGL ES 3.0, WebGL 2.0, @gl_extension{OES,vertex_array_object} in diff --git a/src/Magnum/GL/Implementation/MeshState.cpp b/src/Magnum/GL/Implementation/MeshState.cpp index 7901a6a8e..eeed2fe08 100644 --- a/src/Magnum/GL/Implementation/MeshState.cpp +++ b/src/Magnum/GL/Implementation/MeshState.cpp @@ -136,9 +136,16 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector= 20000 multiDrawArraysImplementation = glMultiDrawArraysANGLE; multiDrawElementsImplementation = glMultiDrawElementsANGLE; + #else + /* In Context::setupDriverWorkarounds() we make sure the extension + is not even advertised, so this shouldn't be reached. */ + CORRADE_INTERNAL_ASSERT_UNREACHABLE(); + #endif } #endif diff --git a/src/Magnum/GL/Implementation/driverSpecific.cpp b/src/Magnum/GL/Implementation/driverSpecific.cpp index 370c97fd3..c78065eee 100644 --- a/src/Magnum/GL/Implementation/driverSpecific.cpp +++ b/src/Magnum/GL/Implementation/driverSpecific.cpp @@ -560,6 +560,16 @@ void Context::setupDriverWorkarounds() { _setRequiredVersion(EXT::disjoint_timer_query, None); #endif + #ifdef MAGNUM_TARGET_WEBGL + /* The WEBGL_multi_draw entrypoints are only available since Emscripten + 2.0.0: https://github.com/emscripten-core/emscripten/pull/11650 + However, the extension is advertised even on older versions and we have + no way to link to those entrypoints there. */ + #if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 20000 + _setRequiredVersion(WEBGL::multi_draw, None); + #endif + #endif + #undef _setRequiredVersion #ifndef MAGNUM_TARGET_GLES