Skip to content

Commit

Permalink
Fix GL errors with legacy driver
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed Nov 11, 2024
1 parent dca84ff commit 0d3a93d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions irr/src/COpenGLCoreCacheHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,19 @@ class COpenGLCoreCacheHandler
GL.BindTexture(prevTextureType, 0);

#if defined(IRR_COMPILE_GL_COMMON)
GL.Disable(prevTextureType);
GL.Enable(curTextureType);
// The "enable/disable texture" stuff is so legacy that
// it's not even allowed for multisample textures.
// (IRR_COMPILE_GL_COMMON is for the legacy driver.)
if ((prevTexture ? prevTexture : curTexture)->getType() != ETT_2D_MS)
GL.Disable(prevTextureType);
if (curTexture->getType() != ETT_2D_MS)
GL.Enable(curTextureType);
#endif
}
#if defined(IRR_COMPILE_GL_COMMON)
else if (!prevTexture)
GL.Enable(curTextureType);
if (curTexture->getType() != ETT_2D_MS)
GL.Enable(curTextureType);
#endif

GL.BindTexture(curTextureType, static_cast<const TOpenGLTexture *>(texture)->getOpenGLTextureName());
Expand All @@ -110,7 +116,8 @@ class COpenGLCoreCacheHandler
GL.BindTexture(prevTextureType, 0);

#if defined(IRR_COMPILE_GL_COMMON)
GL.Disable(prevTextureType);
if (prevTexture->getType() != ETT_2D_MS)
GL.Disable(prevTextureType);
#endif
}

Expand Down

0 comments on commit 0d3a93d

Please sign in to comment.