OpenGL » Driver workarounds

List of OpenGL driver workarounds used by Magnum.

Driver workarounds used by a particular app are listed in the engine startup log such as here:

Renderer: GeForce GT 740M/PCIe/SSE2 by NVIDIA Corporation
OpenGL version: 4.6.0 NVIDIA 390.25
Using optional features:
    GL_ARB_ES2_compatibility
    GL_ARB_direct_state_access
    ...
Using driver workarounds:
    no-forward-compatible-core-context
    no-layout-qualifiers-on-old-glsl
    nv-zero-context-profile-mask
    ...

These identifiers correspond to the strings in the below listing. For debugging and diagnostic purpose it's possible to disable particular workarounds by passing their identifier string to the --magnum-disable-workarounds command-line option. See Command-line options for more information.

        #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 be forced to given version instead of
           selecting latest available version */
        "no-forward-compatible-core-context",
        #endif

        #if !defined(MAGNUM_TARGET_GLES) && defined(CORRADE_TARGET_WINDOWS)
        /* On Windows Intel drivers ARB_shading_language_420pack is exposed in
           GLSL even though the extension (e.g. binding keyword) is not
           supported */
        "intel-windows-glsl-exposes-unsupported-shading-language-420pack",
        #endif

        #if !defined(MAGNUM_TARGET_GLES2) && defined(CORRADE_TARGET_WINDOWS)
        /* On Windows NVidia drivers the glTransformFeedbackVaryings() does not
           make a copy of its char* arguments so it fails at link time when the
           original char arrays are not in scope anymore. Enabling
           *synchronous* debug output circumvents this bug. Can be triggered by
           running TransformFeedbackGLTest with GL_KHR_debug extension
           disabled. */
        "nv-windows-dangling-transform-feedback-varying-names",
        #endif

        #ifndef MAGNUM_TARGET_GLES
        /* Layout qualifier causes compiler error with GLSL 1.20 on Mesa, GLSL
           1.30 on NVidia and 1.40 on macOS. Everything is fine when using
           newer GLSL version. */
        "no-layout-qualifiers-on-old-glsl",

        /* NVidia drivers (358.16) report compressed block size from internal
           format query in bits instead of bytes */
        "nv-compressed-block-size-in-bits",

        /* NVidia drivers (358.16) report different compressed image size for
           cubemaps based on whether the texture is immutable or not and not
           based on whether I'm querying all faces (ARB_DSA) or a single face
           (non-DSA, EXT_DSA) */
        "nv-cubemap-inconsistent-compressed-image-size",

        /* NVidia drivers (358.16) return only the first slice of compressed
           cube map image when querying all six slice using ARB_DSA API */
        "nv-cubemap-broken-full-compressed-image-query",

        /* NVidia drivers return 0 when asked for GL_CONTEXT_PROFILE_MASK,
           so it needs to be worked around by asking for GL_ARB_compatibility */
        "nv-zero-context-profile-mask",
        #endif

        #ifndef MAGNUM_TARGET_GLES
        /* SVGA3D (VMware host GL driver) glDrawArrays() draws nothing when the
           vertex buffer memory is initialized using glNamedBufferData() from
           ARB_DSA. Using the non-DSA glBufferData() works. */
        "svga3d-broken-dsa-bufferdata",

        /* SVGA3D does out-of-bound writes in some cases of glGetTexSubImage(),
           leading to memory corruption on client machines. That's nasty, so the
           whole ARB_get_texture_sub_image is disabled. */
        "svga3d-gettexsubimage-oob-write",
        #endif

        /* SVGA3D has broken handling of glTex[ture][Sub]Image*D() for 1D
           arrays, 2D arrays, 3D textures and cube map textures where it
           uploads just the first slice in the last dimension. This is only
           with copies from host memory, not with buffer images. Seems to be
           fixed in Mesa 13, but I have no such system to verify that on.
           https://github.com/mesa3d/mesa/commit/2aa9ff0cda1f6ad97c83d5583fab7a84efabe19e */
        "svga3d-texture-upload-slice-by-slice",

        #if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(__EMSCRIPTEN_PTHREADS__)
        /* Shader sources containing UTF-8 characters are converted to empty
           strings when running on Emscripten with -s USE_PTHREADS=1. Working
           around that by replacing all chars > 127 with spaces. Relevant code:
           https://github.com/kripken/emscripten/blob/7f89560101843198787530731f40a65288f6f15f/src/fetch-worker.js#L54-L58 */
        "emscripten-pthreads-broken-unicode-shader-sources"
        #endif