Browse Source

GL: new "intel-windows-broken-dsa-for-cubemaps" workaround.

Fixes everything related to cube maps when ARB_DSA is used.
pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
580a3c5553
  1. 14
      doc/changelog.dox
  2. 24
      src/Magnum/GL/Implementation/FramebufferState.cpp
  3. 33
      src/Magnum/GL/Implementation/TextureState.cpp
  4. 8
      src/Magnum/GL/Implementation/driverSpecific.cpp

14
doc/changelog.dox

@ -71,10 +71,16 @@ See also:
@ref opengl-workarounds for more information). This pseudo-extension can be
also explicitly disabled using the usual `--magnum-disable-extensions`
@ref GL-Context-command-line "command-line option" for testing purposes.
- New @cpp "intel-windows-buggy-dsa-bufferdata-for-index-buffers" @ce
workaround for a synchronization bug in the Intel Windows drivers when
@ref GL::Buffer::setData() is followed by @ref GL::Mesh::setIndexBuffer()
when @gl_extension{ARB,direct_state_access} is used
- An assorted collection of workarounds for Intel Windows drivers "fixing"
various issues related to @gl_extension{ARB,direct_state_access} by using a
non-DSA code path in the affected cases --- see
@ref opengl-workarounds for more information:
- @cpp "intel-windows-buggy-dsa-bufferdata-for-index-buffers" @ce
fixing a nasty hard-to-reproduce synchronization bug when
@ref GL::Buffer::setData() is followed by
@ref GL::Mesh::setIndexBuffer()
- @cpp "intel-windows-broken-dsa-for-cubemaps" @ce fixing everything
about @ref GL::CubeMapTexture (see [mosra/magnum-examples#55](https://github.com/mosra/magnum-examples/issues/55))
- 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

24
src/Magnum/GL/Implementation/FramebufferState.cpp

@ -76,7 +76,6 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
copySub1DImplementation = &AbstractFramebuffer::copySub1DImplementationDSA;
copySub2DImplementation = &AbstractFramebuffer::copySub2DImplementationDSA;
copySubCubeMapImplementation = &AbstractFramebuffer::copySubCubeMapImplementationDSA;
copySub3DImplementation = &AbstractFramebuffer::copySub3DImplementationDSA;
renderbufferImplementation = &Framebuffer::renderbufferImplementationDSA;
@ -86,7 +85,6 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
function to specify cube map face */
texture2DImplementation = &Framebuffer::texture2DImplementationDSA;
textureImplementation = &Framebuffer::textureImplementationDSA;
textureCubeMapImplementation = &Framebuffer::textureCubeMapImplementationDSA;
textureLayerImplementation = &Framebuffer::textureLayerImplementationDSA;
renderbufferStorageImplementation = &Renderbuffer::storageImplementationDSA;
@ -117,7 +115,6 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
copySub1DImplementation = &AbstractFramebuffer::copySub1DImplementationDefault;
#endif
copySub2DImplementation = &AbstractFramebuffer::copySub2DImplementationDefault;
copySubCubeMapImplementation = &AbstractFramebuffer::copySub2DImplementationDefault;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
copySub3DImplementation = &AbstractFramebuffer::copySub3DImplementationDefault;
#endif
@ -131,7 +128,6 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
#ifndef MAGNUM_TARGET_GLES
textureImplementation = &Framebuffer::textureImplementationDefault;
#endif
textureCubeMapImplementation = &Framebuffer::texture2DImplementationDefault;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
textureLayerImplementation = &Framebuffer::textureLayerImplementationDefault;
#endif
@ -139,6 +135,26 @@ FramebufferState::FramebufferState(Context& context, std::vector<std::string>& e
renderbufferStorageImplementation = &Renderbuffer::storageImplementationDefault;
}
/* DSA/non-DSA implementation for cubemaps, because Intel Windows drivers
have to be broken in a special way */
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"))
#endif
) {
/* Extension name added above */
copySubCubeMapImplementation = &AbstractFramebuffer::copySubCubeMapImplementationDSA;
textureCubeMapImplementation = &Framebuffer::textureCubeMapImplementationDSA;
} else
#endif
{
copySubCubeMapImplementation = &AbstractFramebuffer::copySub2DImplementationDefault;
textureCubeMapImplementation = &Framebuffer::texture2DImplementationDefault;
}
/* Framebuffer texture attachment on ES3 */
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2)
if(context.isVersionSupported(Version::GLES320))

33
src/Magnum/GL/Implementation/TextureState.cpp

@ -130,10 +130,6 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
setBufferImplementation = &BufferTexture::setBufferImplementationDSA;
setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDSA;
getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDSA;
cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDSA;
cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDSA;
} else
#endif
{
@ -166,7 +162,25 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
setBufferImplementation = &BufferTexture::setBufferImplementationDefault;
setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDefault;
#endif
}
/* DSA/non-DSA implementation for cubemaps, because Intel Windows drivers
have to be broken in a special way */
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"))
#endif
) {
/* Extension name added above */
getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDSA;
cubeSubImageImplementation = &CubeMapTexture::subImageImplementationDSA;
cubeCompressedSubImageImplementation = &CubeMapTexture::compressedSubImageImplementationDSA;
} else
#endif
{
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
getCubeLevelParameterivImplementation = &CubeMapTexture::getLevelParameterImplementationDefault;
#endif
@ -222,10 +236,15 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>())
getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSANonImmutableWorkaround;
else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefaultImmutableWorkaround;
} else {
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>())
} else if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#ifdef CORRADE_TARGET_WINDOWS
&& (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) ||
context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"))
#endif
) {
getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSA;
else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefault;
} else {
getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefault;
}
/* Image retrieval implementation */

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

@ -210,6 +210,14 @@ namespace {
Reproducible with the 2019.01 ImGui example, unfortunately I was not
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 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",
#endif
#ifndef MAGNUM_TARGET_GLES

Loading…
Cancel
Save