Browse Source

GL: new "intel-windows-half-baked-dsa-texture-bind" workaround.

This is broken as well, in a novel and interesting way. Haha.
pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
f9c6deae63
  1. 3
      doc/changelog.dox
  2. 8
      src/Magnum/GL/AbstractTexture.cpp
  3. 3
      src/Magnum/GL/AbstractTexture.h
  4. 15
      src/Magnum/GL/Implementation/TextureState.cpp
  5. 6
      src/Magnum/GL/Implementation/driverSpecific.cpp

3
doc/changelog.dox

@ -81,6 +81,9 @@ See also:
@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))
- @cpp "intel-windows-half-baked-dsa-texture-bind" @ce fixing texture
binding inconsistencies (affected [mosra/magnum-examples#55](https://github.com/mosra/magnum-examples/issues/55)
as well)
- 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

8
src/Magnum/GL/AbstractTexture.cpp

@ -361,6 +361,14 @@ void AbstractTexture::bindImplementationMulti(GLint textureUnit) {
void AbstractTexture::bindImplementationDSA(const GLint textureUnit) {
glBindTextureUnit(textureUnit, _id);
}
#ifdef CORRADE_TARGET_WINDOWS
void AbstractTexture::bindImplementationDSAIntelWindows(const GLint textureUnit) {
/* See the "intel-windows-half-baked-dsa-texture-bind" workaround */
if(_target == GL_TEXTURE_CUBE_MAP) bindImplementationDefault(textureUnit);
else bindImplementationDSA(textureUnit);
}
#endif
#endif
#ifndef MAGNUM_TARGET_GLES2

3
src/Magnum/GL/AbstractTexture.h

@ -531,6 +531,9 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject {
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_GL_LOCAL bindImplementationMulti(GLint textureUnit);
void MAGNUM_GL_LOCAL bindImplementationDSA(GLint textureUnit);
#ifdef CORRADE_TARGET_WINDOWS
void MAGNUM_GL_LOCAL bindImplementationDSAIntelWindows(GLint textureUnit);
#endif
#endif
void MAGNUM_GL_LOCAL parameterImplementationDefault(GLenum parameter, GLint value);

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

@ -79,8 +79,19 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
if(context.isExtensionSupported<Extensions::ARB::direct_state_access>()) {
/* Extension name added below */
unbindImplementation = &AbstractTexture::unbindImplementationDSA;
bindImplementation = &AbstractTexture::bindImplementationDSA;
#ifdef CORRADE_TARGET_WINDOWS
if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) &&
!context.isDriverWorkaroundDisabled("intel-windows-half-baked-dsa-texture-bind"))
{
unbindImplementation = &AbstractTexture::unbindImplementationDefault;
bindImplementation = &AbstractTexture::bindImplementationDSAIntelWindows;
} else
#endif
{
unbindImplementation = &AbstractTexture::unbindImplementationDSA;
bindImplementation = &AbstractTexture::bindImplementationDSA;
}
} else if(context.isExtensionSupported<Extensions::ARB::multi_bind>()) {
/* Extension name added below */

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

@ -218,6 +218,12 @@ namespace {
for <target> 34067" (GL_TEXTURE_CUBE_MAP is 34067). Using the
non-DSA code path as a workaround. */
"intel-windows-broken-dsa-for-cubemaps",
/* DSA glBindTextureUnit() on Intel Windows drivers simply doesn't work
when passing 0 to it. Non-zero IDs work correctly except for cube
maps. Using the non-DSA code path for unbinding and cube maps as a
workaround. */
"intel-windows-half-baked-dsa-texture-bind",
#endif
#ifndef MAGNUM_TARGET_GLES

Loading…
Cancel
Save