From 0d3a93d9f251f467845e3440eb45f84845245944 Mon Sep 17 00:00:00 2001 From: grorp Date: Mon, 11 Nov 2024 16:06:48 +0100 Subject: [PATCH] Fix GL errors with legacy driver --- irr/src/COpenGLCoreCacheHandler.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/irr/src/COpenGLCoreCacheHandler.h b/irr/src/COpenGLCoreCacheHandler.h index a1277bfeda38e..6e88c6b2114d8 100644 --- a/irr/src/COpenGLCoreCacheHandler.h +++ b/irr/src/COpenGLCoreCacheHandler.h @@ -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(texture)->getOpenGLTextureName()); @@ -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 }