diff --git a/doc/changelog.dox b/doc/changelog.dox index 3da51ea8a..aa2b3d044 100644 --- a/doc/changelog.dox +++ b/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 diff --git a/src/Magnum/GL/Implementation/FramebufferState.cpp b/src/Magnum/GL/Implementation/FramebufferState.cpp index b0480683b..d5682d80e 100644 --- a/src/Magnum/GL/Implementation/FramebufferState.cpp +++ b/src/Magnum/GL/Implementation/FramebufferState.cpp @@ -76,7 +76,6 @@ FramebufferState::FramebufferState(Context& context, std::vector& 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& 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& 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& 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& 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() + #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)) diff --git a/src/Magnum/GL/Implementation/TextureState.cpp b/src/Magnum/GL/Implementation/TextureState.cpp index eb3c1f6d8..a5df7e4ae 100644 --- a/src/Magnum/GL/Implementation/TextureState.cpp +++ b/src/Magnum/GL/Implementation/TextureState.cpp @@ -130,10 +130,6 @@ TextureState::TextureState(Context& context, std::vector& 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& 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() + #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& extension if(context.isExtensionSupported()) getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSANonImmutableWorkaround; else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefaultImmutableWorkaround; + } else if(context.isExtensionSupported() + #ifdef CORRADE_TARGET_WINDOWS + && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || + context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps")) + #endif + ) { + getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSA; } else { - if(context.isExtensionSupported()) - getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDSA; - else getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefault; + getCubeLevelCompressedImageSizeImplementation = &CubeMapTexture::getLevelCompressedImageSizeImplementationDefault; } /* Image retrieval implementation */ diff --git a/src/Magnum/GL/Implementation/driverSpecific.cpp b/src/Magnum/GL/Implementation/driverSpecific.cpp index 5ba70aebf..8e24b0c5e 100644 --- a/src/Magnum/GL/Implementation/driverSpecific.cpp +++ b/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 6 provided + for 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