diff --git a/doc/changelog.dox b/doc/changelog.dox index c3070f652..80066275b 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -94,6 +94,12 @@ See also: - @cpp "intel-windows-broken-dsa-integer-vertex-attributes" @ce fixing @ref GL::Mesh::addVertexBuffer() with @ref Magnum::Short "Short" attributes +- New @cpp "arm-mali-timer-queries-oom-in-shell" @ce workaround for + @ref GL::Context::DetectedDriver::ArmMali "ARM Mali" drivers on Android + disabling the @gl_extension{EXT,disjoint_timer_query} extension in Android + shell (as opposed to an APK) because using it causes the + @ref GL::Renderer::Error::OutOfMemory error. See @ref opengl-workarounds + for more information. - New `--magnum-gpu-validation` @ref GL-Context-command-line "command-line option" and a corresponding environment variable to conveniently enable @gl_extension{KHR,debug} debug output diff --git a/src/Magnum/GL/Implementation/driverSpecific.cpp b/src/Magnum/GL/Implementation/driverSpecific.cpp index add04c066..e7db5152e 100644 --- a/src/Magnum/GL/Implementation/driverSpecific.cpp +++ b/src/Magnum/GL/Implementation/driverSpecific.cpp @@ -35,6 +35,14 @@ namespace { /* Search the code for the following strings to see where they are implemented. */ std::vector KnownWorkarounds{ /* [workarounds] */ +#if defined(CORRADE_TARGET_ANDROID) && defined(MAGNUM_TARGET_GLES) +/* glBeginQuery() with GL_TIME_ELAPSED causes a GL_OUT_OF_MEMORY error when + running from the Android shell (through ADB). No such error happens in an + APK. Detecting using the $SHELL environment variable and disabling + GL_EXT_disjoint_timer_query in that case. */ +"arm-mali-timer-queries-oom-in-shell", +#endif + #if !defined(MAGNUM_TARGET_GLES) && !defined(CORRADE_TARGET_APPLE) /* Creating core context with specific version on AMD and NV proprietary drivers on Linux/Windows and Intel drivers on Windows causes the context to @@ -413,6 +421,12 @@ void Context::setupDriverWorkarounds() { _setRequiredVersion(MAGNUM::shader_vertex_id, None); #endif + #if defined(CORRADE_TARGET_ANDROID) && defined(MAGNUM_TARGET_GLES) + if((detectedDriver() & Context::DetectedDriver::ArmMali) && + std::getenv("SHELL") && !isDriverWorkaroundDisabled("arm-mali-timer-queries-oom-in-shell")) + _setRequiredVersion(EXT::disjoint_timer_query, None); + #endif + #undef _setRequiredVersion }