diff --git a/doc/changelog.dox b/doc/changelog.dox index 5945ac2ce..d7f56c697 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -52,6 +52,14 @@ See also: - Recognizing @gl_extension{AMD,shader_explicit_vertex_parameter} desktop and @gl_extension{NV,fragment_shader_barycentric} desktop / ES extensions. These add only shading language features. +- A @cpp "intel-windows-crazy-broken-buffer-dsa" @ce workaround for Intel + Windows drivers, disabling @gl_extension{ARB,direct_state_access} code + paths in everything releated to buffers. There are several issues occuring + only in heavier apps, impossible to track down and reproduce in a + controlled environment. This replaces the previous + @cpp "intel-windows-buggy-dsa-bufferdata-for-index-buffers" @ce workaround + that attempted to fix this by doing an explicit buffer binding in some + cases. See @ref opengl-workarounds for more information. @subsubsection changelog-latest-new-math Math library diff --git a/src/Magnum/GL/Buffer.cpp b/src/Magnum/GL/Buffer.cpp index 3237b0599..d74b1c274 100644 --- a/src/Magnum/GL/Buffer.cpp +++ b/src/Magnum/GL/Buffer.cpp @@ -458,18 +458,6 @@ void Buffer::dataImplementationDefault(GLsizeiptr size, const GLvoid* data, Buff void Buffer::dataImplementationDSA(const GLsizeiptr size, const GLvoid* const data, const BufferUsage usage) { glNamedBufferData(_id, size, data, GLenum(usage)); } - -#ifdef CORRADE_TARGET_WINDOWS -void Buffer::dataImplementationDSAIntelWindows(const GLsizeiptr size, const GLvoid* const data, const BufferUsage usage) { - glNamedBufferData(_id, size, data, GLenum(usage)); - /* See the "intel-windows-buggy-dsa-bufferdata-for-index-buffers" - workaround for more information */ - if(_targetHint == TargetHint::ElementArray) { - bindInternal(TargetHint::ElementArray, nullptr); - bindInternal(TargetHint::ElementArray, this); - } -} -#endif #endif void Buffer::subDataImplementationDefault(GLintptr offset, GLsizeiptr size, const GLvoid* data) { diff --git a/src/Magnum/GL/Buffer.h b/src/Magnum/GL/Buffer.h index 87f59e4c1..b2e2a54de 100644 --- a/src/Magnum/GL/Buffer.h +++ b/src/Magnum/GL/Buffer.h @@ -1216,7 +1216,6 @@ class MAGNUM_GL_EXPORT Buffer: public AbstractObject { void MAGNUM_GL_LOCAL dataImplementationDefault(GLsizeiptr size, const GLvoid* data, BufferUsage usage); #ifndef MAGNUM_TARGET_GLES - void MAGNUM_GL_LOCAL dataImplementationDSAIntelWindows(GLsizeiptr size, const GLvoid* data, BufferUsage usage); void MAGNUM_GL_LOCAL dataImplementationDSA(GLsizeiptr size, const GLvoid* data, BufferUsage usage); #endif diff --git a/src/Magnum/GL/Implementation/BufferState.cpp b/src/Magnum/GL/Implementation/BufferState.cpp index 19d6fa1cb..2d29627af 100644 --- a/src/Magnum/GL/Implementation/BufferState.cpp +++ b/src/Magnum/GL/Implementation/BufferState.cpp @@ -88,25 +88,21 @@ BufferState::BufferState(Context& context, std::vector& extensions) , uniformOffsetAlignment{0}, maxUniformBindings{0} #endif { - /* Create implementation */ + /* DSA, except Intel Windows, because I have no patience for that anymore */ #ifndef MAGNUM_TARGET_GLES - if(context.isExtensionSupported()) { - extensions.emplace_back(Extensions::ARB::direct_state_access::string()); - createImplementation = &Buffer::createImplementationDSA; - - } else - #endif - { - createImplementation = &Buffer::createImplementationDefault; - } - - #ifndef MAGNUM_TARGET_GLES - if(context.isExtensionSupported()) { + if(context.isExtensionSupported() + #ifdef CORRADE_TARGET_WINDOWS + && (!(context.detectedDriver() & Context::DetectedDriver::IntelWindows) || + context.isDriverWorkaroundDisabled("intel-windows-crazy-broken-buffer-dsa")) + #endif + ) { extensions.emplace_back(Extensions::ARB::direct_state_access::string()); + createImplementation = &Buffer::createImplementationDSA; copyImplementation = &Buffer::copyImplementationDSA; getParameterImplementation = &Buffer::getParameterImplementationDSA; getSubDataImplementation = &Buffer::getSubDataImplementationDSA; + dataImplementation = &Buffer::dataImplementationDSA; subDataImplementation = &Buffer::subDataImplementationDSA; mapImplementation = &Buffer::mapImplementationDSA; mapRangeImplementation = &Buffer::mapRangeImplementationDSA; @@ -115,6 +111,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) } else #endif { + createImplementation = &Buffer::createImplementationDefault; #ifndef MAGNUM_TARGET_GLES2 copyImplementation = &Buffer::copyImplementationDefault; #endif @@ -122,6 +119,7 @@ BufferState::BufferState(Context& context, std::vector& extensions) #ifndef MAGNUM_TARGET_GLES getSubDataImplementation = &Buffer::getSubDataImplementationDefault; #endif + dataImplementation = &Buffer::dataImplementationDefault; subDataImplementation = &Buffer::subDataImplementationDefault; #ifndef MAGNUM_TARGET_WEBGL mapImplementation = &Buffer::mapImplementationDefault; @@ -179,24 +177,6 @@ BufferState::BufferState(Context& context, std::vector& extensions) setTargetHintImplementation = &Buffer::setTargetHintImplementationDefault; } - #ifndef MAGNUM_TARGET_GLES - if(context.isExtensionSupported()) { - #ifdef CORRADE_TARGET_WINDOWS - if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && - !context.isDriverWorkaroundDisabled("intel-windows-buggy-dsa-bufferdata-for-index-buffers")) - { - dataImplementation = &Buffer::dataImplementationDSAIntelWindows; - } else - #endif - { - dataImplementation = &Buffer::dataImplementationDSA; - } - } else - #endif - { - dataImplementation = &Buffer::dataImplementationDefault; - } - #ifdef MAGNUM_TARGET_GLES static_cast(context); static_cast(extensions); diff --git a/src/Magnum/GL/Implementation/driverSpecific.cpp b/src/Magnum/GL/Implementation/driverSpecific.cpp index 3c0126f11..43711f49b 100644 --- a/src/Magnum/GL/Implementation/driverSpecific.cpp +++ b/src/Magnum/GL/Implementation/driverSpecific.cpp @@ -231,11 +231,12 @@ namespace { /* Intel drivers on Windows have some synchronization / memory alignment bug in the DSA glNamedBufferData() when the same buffer is set as an index buffer to a mesh right after or repeatedly. Calling glBindBuffer() right before or - after the data upload fixes the issue. Note that this workaround is done - only for buffers with TargetHint::ElementArray, as the issue was not - observed elsewhere. 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", + after the data upload fixes the issue. The above is reproducible with the + 2019.01 ImGui example, however there are numerous reports of things going + *bad* in heavier ImGui-based apps and none of my tests are able to reproduce + anything. Since I lost patience already, I'm disabling the DSA code paths + for everything related to buffers. */ +"intel-windows-crazy-broken-buffer-dsa", /* ARB_direct_state_access implementation on Intel Windows drivers has broken *everything* related to cube map textures (but not cube map arrays) -- data