Browse Source

GL: unindent the workaround list so it shows better in the docs.

pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
689fbe7f35
  1. 382
      src/Magnum/GL/Implementation/driverSpecific.cpp

382
src/Magnum/GL/Implementation/driverSpecific.cpp

@ -34,228 +34,216 @@ namespace Magnum { namespace GL {
namespace { namespace {
/* Search the code for the following strings to see where they are implemented. */ /* Search the code for the following strings to see where they are implemented. */
std::vector<std::string> KnownWorkarounds{ std::vector<std::string> KnownWorkarounds{
/* [workarounds] */ /* [workarounds] */
#if !defined(MAGNUM_TARGET_GLES) && !defined(CORRADE_TARGET_APPLE) #if !defined(MAGNUM_TARGET_GLES) && !defined(CORRADE_TARGET_APPLE)
/* Creating core context with specific version on AMD and NV /* Creating core context with specific version on AMD and NV proprietary
proprietary drivers on Linux/Windows and Intel drivers on Windows drivers on Linux/Windows and Intel drivers on Windows causes the context to
causes the context to be forced to given version instead of be forced to given version instead of selecting latest available version */
selecting latest available version */ "no-forward-compatible-core-context",
"no-forward-compatible-core-context", #endif
#endif
#if !defined(MAGNUM_TARGET_GLES) && defined(CORRADE_TARGET_WINDOWS)
#if !defined(MAGNUM_TARGET_GLES) && defined(CORRADE_TARGET_WINDOWS) /* On Windows Intel drivers ARB_shading_language_420pack is exposed in GLSL
/* On Windows Intel drivers ARB_shading_language_420pack is exposed in even though the extension (e.g. binding keyword) is not supported */
GLSL even though the extension (e.g. binding keyword) is not "intel-windows-glsl-exposes-unsupported-shading-language-420pack",
supported */ #endif
"intel-windows-glsl-exposes-unsupported-shading-language-420pack",
#endif #ifndef MAGNUM_TARGET_GLES
/* Forward-compatible GL contexts on Mesa still report line width range as
#ifndef MAGNUM_TARGET_GLES [1, 7], but setting wide line width fails. According to the specs the max
/* Forward-compatible GL contexts on Mesa still report line width range value on forward compatible contexts should be 1.0, so patching it. */
as [1, 7], but setting wide line width fails. According to the specs "mesa-forward-compatible-line-width-range",
the max value on forward compatible contexts should be 1.0, so #endif
patching it. */
"mesa-forward-compatible-line-width-range", #if !defined(MAGNUM_TARGET_GLES2) && defined(CORRADE_TARGET_WINDOWS)
#endif /* 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
#if !defined(MAGNUM_TARGET_GLES2) && defined(CORRADE_TARGET_WINDOWS) arrays are not in scope anymore. Enabling *synchronous* debug output
/* On Windows NVidia drivers the glTransformFeedbackVaryings() does not circumvents this bug. Can be triggered by running TransformFeedbackGLTest
make a copy of its char* arguments so it fails at link time when the with GL_KHR_debug extension disabled. */
original char arrays are not in scope anymore. Enabling "nv-windows-dangling-transform-feedback-varying-names",
*synchronous* debug output circumvents this bug. Can be triggered by #endif
running TransformFeedbackGLTest with GL_KHR_debug extension
disabled. */ #ifndef MAGNUM_TARGET_GLES
"nv-windows-dangling-transform-feedback-varying-names", /* Layout qualifier causes compiler error with GLSL 1.20 on Mesa, GLSL 1.30 on
#endif NVidia and 1.40 on macOS. Everything is fine when using a newer GLSL
version. */
#ifndef MAGNUM_TARGET_GLES "no-layout-qualifiers-on-old-glsl",
/* 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 /* NVidia drivers (358.16) report compressed block size from internal format
newer GLSL version. */ query in bits instead of bytes */
"no-layout-qualifiers-on-old-glsl", "nv-compressed-block-size-in-bits",
/* NVidia drivers (358.16) report compressed block size from internal /* NVidia drivers (358.16) report different compressed image size for cubemaps
format query in bits instead of bytes */ based on whether the texture is immutable or not and not based on whether
"nv-compressed-block-size-in-bits", 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) report different compressed image size for
cubemaps based on whether the texture is immutable or not and not /* NVidia drivers (358.16) return only the first slice of compressed cube map
based on whether I'm querying all faces (ARB_DSA) or a single face image when querying all six slices using the ARB_DSA API */
(non-DSA, EXT_DSA) */ "nv-cubemap-broken-full-compressed-image-query",
"nv-cubemap-inconsistent-compressed-image-size",
/* NVidia drivers return 0 when asked for GL_CONTEXT_PROFILE_MASK, so it needs
/* NVidia drivers (358.16) return only the first slice of compressed to be worked around by asking for GL_ARB_compatibility */
cube map image when querying all six slice using ARB_DSA API */ "nv-zero-context-profile-mask",
"nv-cubemap-broken-full-compressed-image-query",
/* (Headless) EGL contexts for desktop GL on NVidia 384 and 390 drivers don't
/* NVidia drivers return 0 when asked for GL_CONTEXT_PROFILE_MASK, have correct statically linked GL 1.0 and 1.1 functions (such as
so it needs to be worked around by asking for GL_ARB_compatibility */ glGetString()) and one has to retrieve them explicitly using
"nv-zero-context-profile-mask", eglGetProcAddress(). Doesn't seem to happen on pre-384 and 396, but it's not
possible to get driver version through EGL, so enabling this unconditionally
/* (Headless) EGL contexts for desktop GL on NVidia 384 and 390 drivers on all EGL NV contexts. */
don't have correct statically linked GL 1.0 and 1.1 functions (such "nv-egl-incorrect-gl11-function-pointers",
as glGetString()) and one has to retrieve them explicitly using #endif
eglGetProcAddress(). Doesn't seem to happen on pre-384 and 396, but
it's not possible to get driver version through EGL, so enabling #ifndef MAGNUM_TARGET_GLES
this unconditionally on all EGL NV contexts. */ /* SVGA3D (VMware host GL driver) glDrawArrays() draws nothing when the vertex
"nv-egl-incorrect-gl11-function-pointers", buffer memory is initialized using glNamedBufferData() from ARB_DSA. Using
#endif the non-DSA glBufferData() works. */
"svga3d-broken-dsa-bufferdata",
#ifndef MAGNUM_TARGET_GLES
/* SVGA3D (VMware host GL driver) glDrawArrays() draws nothing when the /* SVGA3D does out-of-bound writes in some cases of glGetTexSubImage(), leading
vertex buffer memory is initialized using glNamedBufferData() from to memory corruption on client machines. That's nasty, so the whole
ARB_DSA. Using the non-DSA glBufferData() works. */ ARB_get_texture_sub_image is disabled. */
"svga3d-broken-dsa-bufferdata", "svga3d-gettexsubimage-oob-write",
#endif
/* SVGA3D does out-of-bound writes in some cases of glGetTexSubImage(),
leading to memory corruption on client machines. That's nasty, so the /* SVGA3D has broken handling of glTex[ture][Sub]Image*D() for 1D arrays, 2D
whole ARB_get_texture_sub_image is disabled. */ arrays, 3D textures and cube map textures where it uploads just the first
"svga3d-gettexsubimage-oob-write", slice in the last dimension. This is only with copies from host memory, not
#endif with buffer images. Seems to be fixed in Mesa 13, but I have no such system
to verify that on.
/* 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 */ https://github.com/mesa3d/mesa/commit/2aa9ff0cda1f6ad97c83d5583fab7a84efabe19e */
"svga3d-texture-upload-slice-by-slice", "svga3d-texture-upload-slice-by-slice",
#if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(__EMSCRIPTEN_PTHREADS__) #if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(__EMSCRIPTEN_PTHREADS__)
/* Shader sources containing UTF-8 characters are converted to empty /* Shader sources containing UTF-8 characters are converted to empty strings
strings when running on Emscripten with -s USE_PTHREADS=1. Working when running on Emscripten with -s USE_PTHREADS=1. Working around that by
around that by replacing all chars > 127 with spaces. Relevant code: replacing all chars > 127 with spaces. Relevant code:
https://github.com/kripken/emscripten/blob/7f89560101843198787530731f40a65288f6f15f/src/fetch-worker.js#L54-L58 */ https://github.com/kripken/emscripten/blob/7f89560101843198787530731f40a65288f6f15f/src/fetch-worker.js#L54-L58 */
"emscripten-pthreads-broken-unicode-shader-sources", "emscripten-pthreads-broken-unicode-shader-sources",
#endif #endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
/* Empty EGL_CONTEXT_FLAGS_KHR cause SwiftShader 3.3.0.1 to fail /* Empty EGL_CONTEXT_FLAGS_KHR cause SwiftShader 3.3.0.1 to fail context
context creation with EGL_BAD_ATTRIBUTE. Not sending the flags then. creation with EGL_BAD_ATTRIBUTE. Not sending the flags then. Relevant code:
Relevant code: https://github.com/google/swiftshader/blob/5fb5e817a20d3e60f29f7338493f922b5ac9d7c4/src/OpenGL/libEGL/libEGL.cpp#L794-L810 */ https://github.com/google/swiftshader/blob/5fb5e817a20d3e60f29f7338493f922b5ac9d7c4/src/OpenGL/libEGL/libEGL.cpp#L794-L810 */
"swiftshader-no-empty-egl-context-flags", "swiftshader-no-empty-egl-context-flags",
/* SwiftShader 3.3.0.1 crashes deep inside eglMakeCurrent() when using /* SwiftShader 3.3.0.1 crashes deep inside eglMakeCurrent() when using
EGL_NO_SURFACE. Supplying a 32x32 PBuffer to work around that. */ EGL_NO_SURFACE. Supplying a 32x32 PBuffer to work around that. */
"swiftshader-egl-context-needs-pbuffer", "swiftshader-egl-context-needs-pbuffer",
#endif #endif
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/* SwiftShader 4.1.0 on ES2 contexts reports GL_ANGLE_instanced_arrays /* SwiftShader 4.1.0 on ES2 contexts reports GL_ANGLE_instanced_arrays and
and GL_EXT_instanced_arrays but has no glDrawArraysInstancedANGLE / GL_EXT_instanced_arrays but has no glDrawArraysInstancedANGLE /
glDrawArraysInstancedEXT nor glDrawElementsInstancedANGLE / glDrawArraysInstancedEXT nor glDrawElementsInstancedANGLE /
glDrawElementsInstancedEXT entrypoints, only the unsuffixed versions glDrawElementsInstancedEXT entrypoints, only the unsuffixed versions for
for ES3. OTOH, glVertexAttribDivisor is there for both ANGLE and ES3. OTOH, glVertexAttribDivisor is there for both ANGLE and EXT. Relevant
EXT. Relevant code: code: https://github.com/google/swiftshader/blob/ad5c2952ca88730c07e04f6f1566194b66860c26/src/OpenGL/libGLESv2/libGLESv2.cpp#L6352-L6357
https://github.com/google/swiftshader/blob/ad5c2952ca88730c07e04f6f1566194b66860c26/src/OpenGL/libGLESv2/libGLESv2.cpp#L6352-L6357 Disabling the two extensions on ES2 contexts to avoid nullptr crashes. */
Disabling the two extensions on ES2 contexts to avoid nullptr "swiftshader-no-es2-draw-instanced-entrypoints",
crashes. */
"swiftshader-no-es2-draw-instanced-entrypoints", /* SwiftShader 4.1.0 on ES2 contexts reports GL_OES_texture_3D but from all its
entrypoints only glTexImage3DOES is present, all others are present only in
/* SwiftShader 4.1.0 on ES2 contexts reports GL_OES_texture_3D but from the ES3 unsuffixed versions. Relevant code:
all its entrypoints only glTexImage3DOES is present, all others are
present only in the ES3 unsuffixed versions. Relevant code:
https://github.com/google/swiftshader/blob/ad5c2952ca88730c07e04f6f1566194b66860c26/src/OpenGL/libGLESv2/libGLESv2.cpp#L6504 https://github.com/google/swiftshader/blob/ad5c2952ca88730c07e04f6f1566194b66860c26/src/OpenGL/libGLESv2/libGLESv2.cpp#L6504
Disabling the extension on ES2 contexts to avoid nullptr crashes. */ Disabling the extension on ES2 contexts to avoid nullptr crashes. */
"swiftshader-no-es2-oes-texture-3d-entrypoints", "swiftshader-no-es2-oes-texture-3d-entrypoints",
#endif #endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/* SwiftShader 4.1.0 has special handling for binding buffers to the /* SwiftShader 4.1.0 has special handling for binding buffers to the transform
transform feedback target, requiring an XFB object to be active when feedback target, requiring an XFB object to be active when a buffer is bound
a buffer is bound to GL_TRANSFORM_FEEDBACK_BUFFER and ignoring the to GL_TRANSFORM_FEEDBACK_BUFFER and ignoring the glBindBuffer() call
glBindBuffer() call otherwise. No other driver does that. As a otherwise. No other driver does that. As a workaround, setting
workaround, setting Buffer::TargetHint::TransformFeedback will make Buffer::TargetHint::TransformFeedback will make it use
it use Buffer::TargetHint::Array instead, as that works okay. */ Buffer::TargetHint::Array instead, as that works okay. */
"swiftshader-broken-xfb-buffer-binding-target", "swiftshader-broken-xfb-buffer-binding-target",
/* SwiftShader 4.1.0 does implement gl_VertexID for ES3 contexts, but /* SwiftShader 4.1.0 does implement gl_VertexID for ES3 contexts, but in
in practice it doesn't work, returning a constant value. In order to practice it doesn't work, returning a constant value. In order to make this
make this easier to check, there's a dummy MAGNUM_shader_vertex_id easier to check, there's a dummy MAGNUM_shader_vertex_id extension that's
extension that's defined on all GL 3.0+ and GLES 3.0+ / WebGL 2+ defined on all GL 3.0+ and GLES 3.0+ / WebGL 2+ contexts *except* for
contexts *except* for SwiftShader. */ SwiftShader. */
"swiftshader-broken-shader-vertex-id", "swiftshader-broken-shader-vertex-id",
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Even with the DSA variant, where GL_IMPLEMENTATION_COLOR_READ_* is /* Even with the DSA variant, where GL_IMPLEMENTATION_COLOR_READ_* is passed to
passed to glGetNamedFramebufferParameter(), Mesa complains that the glGetNamedFramebufferParameter(), Mesa complains that the framebuffer is not
framebuffer is not bound for reading. Relevant code: bound for reading. Relevant code:
https://github.com/mesa3d/mesa/blob/212c0c630a849e4737e2808a993d708cbb2f18f7/src/mesa/main/framebuffer.c#L841-L843 https://github.com/mesa3d/mesa/blob/212c0c630a849e4737e2808a993d708cbb2f18f7/src/mesa/main/framebuffer.c#L841-L843
Workaround is to explicitly bind the framebuffer for reading. */ Workaround is to explicitly bind the framebuffer for reading. */
"mesa-implementation-color-read-format-dsa-explicit-binding", "mesa-implementation-color-read-format-dsa-explicit-binding",
#endif #endif
#if !defined(MAGNUM_TARGET_GLES2) && defined(CORRADE_TARGET_WINDOWS) #if !defined(MAGNUM_TARGET_GLES2) && defined(CORRADE_TARGET_WINDOWS)
/* Intel drivers on Windows return GL_UNSIGNED_BYTE for *both* /* Intel drivers on Windows return GL_UNSIGNED_BYTE for *both*
GL_IMPLEMENTATION_COLOR_READ_FORMAT and _TYPE when using either GL_IMPLEMENTATION_COLOR_READ_FORMAT and _TYPE when using either
glGetNamedFramebufferParameter() or glGetFramebufferParameter(), glGetNamedFramebufferParameter() or glGetFramebufferParameter(),
independently on what's the actual framebuffer format. Using independently on what's the actual framebuffer format. Using glGetInteger()
glGetInteger() makes it return GL_RGBA and GL_UNSIGNED_BYTE for makes it return GL_RGBA and GL_UNSIGNED_BYTE for RGBA8 framebuffers, and
RGBA8 framebuffers, and cause a "Error has been generated. GL error cause an "Error has been generated. GL error GL_INVALID_OPERATION in
GL_INVALID_OPERATION in GetIntegerv: (ID: 2576729458) Generic error" GetIntegerv: (ID: 2576729458) Generic error" when it is not. Since glGetInteger() is actually able to return a correct value in *one
when it is not. Since glGetInteger() is actually able to return a circumstance*, it's preferrable to the other random shit the driver is
correct value in *one circumstance*, it's preferrable to the other doing. */
random shit the driver is doing. */ "intel-windows-implementation-color-read-format-completely-broken",
"intel-windows-implementation-color-read-format-completely-broken", #endif
#endif
#if !defined(MAGNUM_TARGET_GLES) && defined(CORRADE_TARGET_WINDOWS)
#if !defined(MAGNUM_TARGET_GLES) && defined(CORRADE_TARGET_WINDOWS) /* Intel drivers on Windows have some synchronization / memory alignment bug in
/* Intel drivers on Windows have some synchronization / memory the DSA glNamedBufferData() when the same buffer is set as an index buffer
alignment bug in the DSA glNamedBufferData() when the same buffer is to a mesh right after or repeatedly. Calling glBindBuffer() right before or
set as an index buffer to a mesh right after or repeatedly. Calling after the data upload fixes the issue. Note that this workaround is done
glBindBuffer() right before or after the data upload fixes the only for buffers with TargetHint::ElementArray, as the issue was not
issue. Note that this workaround is done only for buffers with observed elsewhere. Reproducible with the 2019.01 ImGui example,
TargetHint::ElementArray, as the issue was not observed elsewhere. unfortunately I was not able to create a standalone minimal repro case. */
Reproducible with the 2019.01 ImGui example, unfortunately I was not "intel-windows-buggy-dsa-bufferdata-for-index-buffers",
able to create a standalone minimal repro case. */
"intel-windows-buggy-dsa-bufferdata-for-index-buffers", /* ARB_direct_state_access implementation on Intel Windows drivers has broken
*everything* related to cube map textures (but not cube map arrays) -- data
/* ARB_direct_state_access implementation on Intel Windows drivers has upload, data queries, framebuffer attachment, framebuffer copies, all
broken *everything* related to cube map textures (but not cube map complaining about "Wrong <func> 6 provided for <target> 34067" and similar (GL_TEXTURE_CUBE_MAP is 34067). Using the non-DSA code path as a
arrays) -- data upload, data queries, framebuffer attachment,
framebuffer copies, all complaining about "Wrong <func> 6 provided
for <target> 34067" (GL_TEXTURE_CUBE_MAP is 34067). Using the
non-DSA code path as a workaround. */
"intel-windows-broken-dsa-for-cubemaps",
/* DSA glBindTextureUnit() on Intel Windows drivers simply doesn't work
when passing 0 to it. Non-zero IDs work correctly except for cube
maps. Using the non-DSA code path for unbinding and cube maps as a
workaround. */ workaround. */
"intel-windows-half-baked-dsa-texture-bind", "intel-windows-broken-dsa-for-cubemaps",
/* DSA glBindTextureUnit() on Intel Windows drivers simply doesn't work when
passing 0 to it. Non-zero IDs work correctly except for cube maps. Using the
non-DSA code path for unbinding and cube maps as a workaround. */
"intel-windows-half-baked-dsa-texture-bind",
/* DSA glNamedFramebufferTexture() on Intel Windows drivers doesn't /* DSA glNamedFramebufferTexture() on Intel Windows drivers doesn't work for
work for layered cube map array attachments. Non-layered or layered cube map array attachments. Non-layered or non-array cube map
non-array cube map attachment works. Using the non-DSA code path as attachment works. Using the non-DSA code path as a workaround. */
a workaround. */ "intel-windows-broken-dsa-layered-cubemap-array-framebuffer-attachment",
"intel-windows-broken-dsa-layered-cubemap-array-framebuffer-attachment",
/* DSA glClearNamedFramebuffer*() on Intel Windows drivers doesn't do /* DSA glClearNamedFramebuffer*() on Intel Windows drivers doesn't do anything.
anything. Using the non-DSA code path as a workaournd. */ Using the non-DSA code path as a workaournd. */
"intel-windows-broken-dsa-framebuffer-clear", "intel-windows-broken-dsa-framebuffer-clear",
/* Using DSA glCreateQueries() on Intel Windows drivers breaks /* Using DSA glCreateQueries() on Intel Windows drivers breaks
glBeginQueryIndexed(). Using the non-DSA glGenQueries() instead glBeginQueryIndexed(). Using the non-DSA glGenQueries() instead makes it
makes it work properly. See TransformFeedbackGLTest for a test. */ work properly. See TransformFeedbackGLTest for a test. */
"intel-windows-broken-dsa-indexed-queries", "intel-windows-broken-dsa-indexed-queries",
/* DSA-ified "vertex layout" glVertexArrayAttribIFormat() is broken /* DSA-ified "vertex layout" glVertexArrayAttribIFormat() is broken when
when passing shorts instead of full 32bit ints. Using the old-style passing shorts instead of full 32bit ints. Using the old-style
glVertexAttribIPointer() works correctly. No idea if the non-DSA glVertexAttribIPointer() works correctly. No idea if the non-DSA
glVertexAttribIFormat() works or not. A test that triggers this glVertexAttribIFormat() works or not. A test that triggers this issue is in
issue is in MeshGLTest::addVertexBufferIntWithShort(). */ MeshGLTest::addVertexBufferIntWithShort(). */
"intel-windows-broken-dsa-integer-vertex-attributes", "intel-windows-broken-dsa-integer-vertex-attributes",
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* NVidia seems to be returning values for the default framebuffer when /* NVidia seems to be returning values for the default framebuffer when
GL_IMPLEMENTATION_COLOR_READ_FORMAT and _TYPE is queried using GL_IMPLEMENTATION_COLOR_READ_FORMAT and _TYPE is queried using
glGetNamedFramebufferParameter(). Using either glGetInteger() or glGetNamedFramebufferParameter(). Using either glGetInteger() or
glGetFramebufferParameter() works correctly. */ glGetFramebufferParameter() works correctly. */
"nv-implementation-color-read-format-dsa-broken", "nv-implementation-color-read-format-dsa-broken",
#endif #endif
/* [workarounds] */ /* [workarounds] */
}; };
} }

Loading…
Cancel
Save