Browse Source

GL: new "intel-windows-broken-dsa-integer-vertex-attributes" workaround.

pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
094ea1bbd0
  1. 3
      doc/changelog.dox
  2. 13
      src/Magnum/GL/Implementation/MeshState.cpp
  3. 7
      src/Magnum/GL/Implementation/driverSpecific.cpp
  4. 11
      src/Magnum/GL/Mesh.cpp
  5. 3
      src/Magnum/GL/Mesh.h

3
doc/changelog.dox

@ -91,6 +91,9 @@ See also:
fixing @ref GL::Framebuffer::clearColor() fixing @ref GL::Framebuffer::clearColor()
- @cpp "intel-windows-broken-dsa-indexed-queries" @ce fixing - @cpp "intel-windows-broken-dsa-indexed-queries" @ce fixing
@ref GL::PrimitiveQuery::begin(UnsignedInt) @ref GL::PrimitiveQuery::begin(UnsignedInt)
- @cpp "intel-windows-broken-dsa-integer-vertex-attributes" @ce fixing
@ref GL::Mesh::addVertexBuffer() with @ref Magnum::Short "Short"
attributes
- New `--magnum-gpu-validation` @ref GL-Context-command-line "command-line option" - New `--magnum-gpu-validation` @ref GL-Context-command-line "command-line option"
and a corresponding environment variable to conveniently enable and a corresponding environment variable to conveniently enable
@gl_extension{KHR,debug} debug output @gl_extension{KHR,debug} debug output

13
src/Magnum/GL/Implementation/MeshState.cpp

@ -57,8 +57,19 @@ MeshState::MeshState(Context& context, ContextState& contextState, std::vector<s
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) { if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
extensions.emplace_back(Extensions::ARB::direct_state_access::string()); extensions.emplace_back(Extensions::ARB::direct_state_access::string());
/* Intel Windows drivers are ... special */
#ifdef CORRADE_TARGET_WINDOWS
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
!context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-integer-vertex-attributes"))
{
attributePointerImplementation = &Mesh::attributePointerImplementationVAODSAIntelWindows;
} else
#endif
{
attributePointerImplementation = &Mesh::attributePointerImplementationVAODSA;
}
createImplementation = &Mesh::createImplementationVAODSA; createImplementation = &Mesh::createImplementationVAODSA;
attributePointerImplementation = &Mesh::attributePointerImplementationVAODSA;
bindIndexBufferImplementation = &Mesh::bindIndexBufferImplementationVAODSA; bindIndexBufferImplementation = &Mesh::bindIndexBufferImplementationVAODSA;
} else } else
#endif #endif

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

@ -239,6 +239,13 @@ namespace {
glBeginQueryIndexed(). Using the non-DSA glGenQueries() instead glBeginQueryIndexed(). Using the non-DSA glGenQueries() instead
makes it work properly. See TransformFeedbackGLTest for a test. */ makes it 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
when passing shorts instead of full 32bit ints. Using the old-style
glVertexAttribIPointer() works correctly. No idea if the non-DSA
glVertexAttribIFormat() works or not. A test that triggers this
issue is in MeshGLTest::addVertexBufferIntWithShort(). */
"intel-windows-broken-dsa-integer-vertex-attributes",
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES

11
src/Magnum/GL/Mesh.cpp

@ -700,6 +700,17 @@ void Mesh::attributePointerImplementationVAODSA(AttributeLayout&& attribute) {
if(attribute.divisor) if(attribute.divisor)
(this->*Context::current().state().mesh->vertexAttribDivisorImplementation)(attribute.location, attribute.divisor); (this->*Context::current().state().mesh->vertexAttribDivisorImplementation)(attribute.location, attribute.divisor);
} }
#ifdef CORRADE_TARGET_WINDOWS
void Mesh::attributePointerImplementationVAODSAIntelWindows(AttributeLayout&& attribute) {
/* See the "intel-windows-broken-dsa-integer-vertex-attributes" workaround
for more information. */
if(attribute.kind == DynamicAttribute::Kind::Integral)
return attributePointerImplementationVAO(std::move(attribute));
else
return attributePointerImplementationVAODSA(std::move(attribute));
}
#endif
#endif #endif
void Mesh::vertexAttribPointer(AttributeLayout& attribute) { void Mesh::vertexAttribPointer(AttributeLayout& attribute) {

3
src/Magnum/GL/Mesh.h

@ -1112,6 +1112,9 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
void MAGNUM_GL_LOCAL attributePointerImplementationVAO(AttributeLayout&& attribute); void MAGNUM_GL_LOCAL attributePointerImplementationVAO(AttributeLayout&& attribute);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_GL_LOCAL attributePointerImplementationVAODSA(AttributeLayout&& attribute); void MAGNUM_GL_LOCAL attributePointerImplementationVAODSA(AttributeLayout&& attribute);
#ifdef CORRADE_TARGET_WINDOWS
void MAGNUM_GL_LOCAL attributePointerImplementationVAODSAIntelWindows(AttributeLayout&& attribute);
#endif
#endif #endif
void MAGNUM_GL_LOCAL vertexAttribPointer(AttributeLayout& attribute); void MAGNUM_GL_LOCAL vertexAttribPointer(AttributeLayout& attribute);

Loading…
Cancel
Save