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. 218
      src/Magnum/GL/Implementation/driverSpecific.cpp

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

@ -36,103 +36,98 @@ namespace {
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 /* On Windows Intel drivers ARB_shading_language_420pack is exposed in GLSL
GLSL even though the extension (e.g. binding keyword) is not even though the extension (e.g. binding keyword) is not supported */
supported */
"intel-windows-glsl-exposes-unsupported-shading-language-420pack", "intel-windows-glsl-exposes-unsupported-shading-language-420pack",
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Forward-compatible GL contexts on Mesa still report line width range /* Forward-compatible GL contexts on Mesa still report line width range as
as [1, 7], but setting wide line width fails. According to the specs [1, 7], but setting wide line width fails. According to the specs the max
the max value on forward compatible contexts should be 1.0, so value on forward compatible contexts should be 1.0, so patching it. */
patching it. */
"mesa-forward-compatible-line-width-range", "mesa-forward-compatible-line-width-range",
#endif #endif
#if !defined(MAGNUM_TARGET_GLES2) && defined(CORRADE_TARGET_WINDOWS) #if !defined(MAGNUM_TARGET_GLES2) && defined(CORRADE_TARGET_WINDOWS)
/* On Windows NVidia drivers the glTransformFeedbackVaryings() does not /* On Windows NVidia drivers the glTransformFeedbackVaryings() does not make a
make a copy of its char* arguments so it fails at link time when the copy of its char* arguments so it fails at link time when the original char
original char arrays are not in scope anymore. Enabling arrays are not in scope anymore. Enabling *synchronous* debug output
*synchronous* debug output circumvents this bug. Can be triggered by circumvents this bug. Can be triggered by running TransformFeedbackGLTest
running TransformFeedbackGLTest with GL_KHR_debug extension with GL_KHR_debug extension disabled. */
disabled. */
"nv-windows-dangling-transform-feedback-varying-names", "nv-windows-dangling-transform-feedback-varying-names",
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Layout qualifier causes compiler error with GLSL 1.20 on Mesa, GLSL /* Layout qualifier causes compiler error with GLSL 1.20 on Mesa, GLSL 1.30 on
1.30 on NVidia and 1.40 on macOS. Everything is fine when using NVidia and 1.40 on macOS. Everything is fine when using a newer GLSL
newer GLSL version. */ version. */
"no-layout-qualifiers-on-old-glsl", "no-layout-qualifiers-on-old-glsl",
/* NVidia drivers (358.16) report compressed block size from internal /* NVidia drivers (358.16) report compressed block size from internal format
format query in bits instead of bytes */ query in bits instead of bytes */
"nv-compressed-block-size-in-bits", "nv-compressed-block-size-in-bits",
/* NVidia drivers (358.16) report different compressed image size for /* NVidia drivers (358.16) report different compressed image size for cubemaps
cubemaps based on whether the texture is immutable or not and not based on whether the texture is immutable or not and not based on whether
based on whether I'm querying all faces (ARB_DSA) or a single face I'm querying all faces (ARB_DSA) or a single face (non-DSA, EXT_DSA) */
(non-DSA, EXT_DSA) */
"nv-cubemap-inconsistent-compressed-image-size", "nv-cubemap-inconsistent-compressed-image-size",
/* NVidia drivers (358.16) return only the first slice of compressed /* NVidia drivers (358.16) return only the first slice of compressed cube map
cube map image when querying all six slice using ARB_DSA API */ image when querying all six slices using the ARB_DSA API */
"nv-cubemap-broken-full-compressed-image-query", "nv-cubemap-broken-full-compressed-image-query",
/* NVidia drivers return 0 when asked for GL_CONTEXT_PROFILE_MASK, /* NVidia drivers return 0 when asked for GL_CONTEXT_PROFILE_MASK, so it needs
so it needs to be worked around by asking for GL_ARB_compatibility */ to be worked around by asking for GL_ARB_compatibility */
"nv-zero-context-profile-mask", "nv-zero-context-profile-mask",
/* (Headless) EGL contexts for desktop GL on NVidia 384 and 390 drivers /* (Headless) EGL contexts for desktop GL on NVidia 384 and 390 drivers don't
don't have correct statically linked GL 1.0 and 1.1 functions (such have correct statically linked GL 1.0 and 1.1 functions (such as
as glGetString()) and one has to retrieve them explicitly using glGetString()) and one has to retrieve them explicitly using
eglGetProcAddress(). Doesn't seem to happen on pre-384 and 396, but eglGetProcAddress(). Doesn't seem to happen on pre-384 and 396, but it's not
it's not possible to get driver version through EGL, so enabling possible to get driver version through EGL, so enabling this unconditionally
this unconditionally on all EGL NV contexts. */ on all EGL NV contexts. */
"nv-egl-incorrect-gl11-function-pointers", "nv-egl-incorrect-gl11-function-pointers",
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* SVGA3D (VMware host GL driver) glDrawArrays() draws nothing when the /* SVGA3D (VMware host GL driver) glDrawArrays() draws nothing when the vertex
vertex buffer memory is initialized using glNamedBufferData() from buffer memory is initialized using glNamedBufferData() from ARB_DSA. Using
ARB_DSA. Using the non-DSA glBufferData() works. */ the non-DSA glBufferData() works. */
"svga3d-broken-dsa-bufferdata", "svga3d-broken-dsa-bufferdata",
/* SVGA3D does out-of-bound writes in some cases of glGetTexSubImage(), /* SVGA3D does out-of-bound writes in some cases of glGetTexSubImage(), leading
leading to memory corruption on client machines. That's nasty, so the to memory corruption on client machines. That's nasty, so the whole
whole ARB_get_texture_sub_image is disabled. */ ARB_get_texture_sub_image is disabled. */
"svga3d-gettexsubimage-oob-write", "svga3d-gettexsubimage-oob-write",
#endif #endif
/* SVGA3D has broken handling of glTex[ture][Sub]Image*D() for 1D /* SVGA3D has broken handling of glTex[ture][Sub]Image*D() for 1D arrays, 2D
arrays, 2D arrays, 3D textures and cube map textures where it arrays, 3D textures and cube map textures where it uploads just the first
uploads just the first slice in the last dimension. This is only slice in the last dimension. This is only with copies from host memory, not
with copies from host memory, not with buffer images. Seems to be with buffer images. Seems to be fixed in Mesa 13, but I have no such system
fixed in Mesa 13, but I have no such system to verify that on. 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
@ -141,46 +136,44 @@ namespace {
#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
crashes. */
"swiftshader-no-es2-draw-instanced-entrypoints", "swiftshader-no-es2-draw-instanced-entrypoints",
/* SwiftShader 4.1.0 on ES2 contexts reports GL_OES_texture_3D but from /* SwiftShader 4.1.0 on ES2 contexts reports GL_OES_texture_3D but from all its
all its entrypoints only glTexImage3DOES is present, all others are entrypoints only glTexImage3DOES is present, all others are present only in
present only in the ES3 unsuffixed versions. Relevant code: 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",
@ -190,61 +183,56 @@ namespace {
/* 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 /* Intel drivers on Windows have some synchronization / memory alignment bug in
alignment bug in the DSA glNamedBufferData() when the same buffer is the DSA glNamedBufferData() when the same buffer is set as an index buffer
set as an index buffer to a mesh right after or repeatedly. Calling to a mesh right after or repeatedly. Calling glBindBuffer() right before or
glBindBuffer() right before or after the data upload fixes the after the data upload fixes the issue. Note that this workaround is done
issue. Note that this workaround is done only for buffers with only for buffers with TargetHint::ElementArray, as the issue was not
TargetHint::ElementArray, as the issue was not observed elsewhere. observed elsewhere. Reproducible with the 2019.01 ImGui example,
Reproducible with the 2019.01 ImGui example, unfortunately I was not unfortunately I was not able to create a standalone minimal repro case. */
able to create a standalone minimal repro case. */
"intel-windows-buggy-dsa-bufferdata-for-index-buffers", "intel-windows-buggy-dsa-bufferdata-for-index-buffers",
/* ARB_direct_state_access implementation on Intel Windows drivers has /* ARB_direct_state_access implementation on Intel Windows drivers has broken
broken *everything* related to cube map textures (but not cube map *everything* related to cube map textures (but not cube map arrays) -- data
arrays) -- data upload, data queries, framebuffer attachment, upload, data queries, framebuffer attachment, framebuffer copies, all
framebuffer copies, all complaining about "Wrong <func> 6 provided 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
for <target> 34067" (GL_TEXTURE_CUBE_MAP is 34067). Using the workaround. */
non-DSA code path as a workaround. */
"intel-windows-broken-dsa-for-cubemaps", "intel-windows-broken-dsa-for-cubemaps",
/* DSA glBindTextureUnit() on Intel Windows drivers simply doesn't work /* DSA glBindTextureUnit() on Intel Windows drivers simply doesn't work when
when passing 0 to it. Non-zero IDs work correctly except for cube passing 0 to it. Non-zero IDs work correctly except for cube maps. Using the
maps. Using the non-DSA code path for unbinding and cube maps as a non-DSA code path for unbinding and cube maps as a workaround. */
workaround. */
"intel-windows-half-baked-dsa-texture-bind", "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

Loading…
Cancel
Save