Browse Source

GL: give up and disable DSA for everything buffer-related on Intel/Windows.

Sad.
pull/403/head
Vladimír Vondruš 7 years ago
parent
commit
a29cb46549
  1. 8
      doc/changelog.dox
  2. 12
      src/Magnum/GL/Buffer.cpp
  3. 1
      src/Magnum/GL/Buffer.h
  4. 42
      src/Magnum/GL/Implementation/BufferState.cpp
  5. 11
      src/Magnum/GL/Implementation/driverSpecific.cpp

8
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

12
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) {

1
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

42
src/Magnum/GL/Implementation/BufferState.cpp

@ -88,25 +88,21 @@ BufferState::BufferState(Context& context, std::vector<std::string>& 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::ARB::direct_state_access>()) {
extensions.emplace_back(Extensions::ARB::direct_state_access::string());
createImplementation = &Buffer::createImplementationDSA;
} else
#endif
{
createImplementation = &Buffer::createImplementationDefault;
}
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()
#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<std::string>& extensions)
} else
#endif
{
createImplementation = &Buffer::createImplementationDefault;
#ifndef MAGNUM_TARGET_GLES2
copyImplementation = &Buffer::copyImplementationDefault;
#endif
@ -122,6 +119,7 @@ BufferState::BufferState(Context& context, std::vector<std::string>& 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<std::string>& extensions)
setTargetHintImplementation = &Buffer::setTargetHintImplementationDefault;
}
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
#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<void>(context);
static_cast<void>(extensions);

11
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

Loading…
Cancel
Save