From 54e10d0dbed7434b95545f4bd4066087a3941858 Mon Sep 17 00:00:00 2001 From: cutealien Date: Fri, 20 Aug 2021 14:46:12 +0000 Subject: [PATCH] Fix problem with legacy mipmap code on legacy ATI radeon X cards. This was patch #285 from Danyal Zia and is about old radeon cards not supporting npot textures despite claiming so I think. Was never applied as needed some rewrite first (did string-comparisons a bit too often), so got stuck on patch-tracker. Well, lets hope this fixes it in case anyone ever needs that specific combination ever again ;-) git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6233 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COpenGLExtensionHandler.cpp | 10 ++++++++-- source/Irrlicht/COpenGLExtensionHandler.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/Irrlicht/COpenGLExtensionHandler.cpp b/source/Irrlicht/COpenGLExtensionHandler.cpp index 9c215dd..8a2ed42 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.cpp +++ b/source/Irrlicht/COpenGLExtensionHandler.cpp @@ -22,7 +22,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0), MaxIndices(65535), MaxTextureSize(1), MaxGeometryVerticesOut(0), MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0), - OcclusionQuerySupport(false) + OcclusionQuerySupport(false), IsAtiRadeonX(false) #ifdef _IRR_OPENGL_USE_EXTPOINTER_ ,pGlActiveTexture(0) ,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0), @@ -387,6 +387,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) TextureCompressionExtension = FeatureAvailable[IRR_ARB_texture_compression]; StencilBuffer=stencilBuffer; + const char* renderer = (const char*)glGetString(GL_RENDERER); + if ( renderer ) + { + IsAtiRadeonX = (strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0); + } + #ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_WINDOWS_API_ #define IRR_OGL_LOAD_EXTENSION(x) wglGetProcAddress(reinterpret_cast(x)) @@ -827,7 +833,7 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const case EVDF_MIP_MAP: return true; case EVDF_MIP_MAP_AUTO_UPDATE: - return FeatureAvailable[IRR_SGIS_generate_mipmap] || FeatureAvailable[IRR_EXT_framebuffer_object] || FeatureAvailable[IRR_ARB_framebuffer_object]; + return !IsAtiRadeonX && (FeatureAvailable[IRR_SGIS_generate_mipmap] || FeatureAvailable[IRR_EXT_framebuffer_object] || FeatureAvailable[IRR_ARB_framebuffer_object]); case EVDF_STENCIL_BUFFER: return StencilBuffer; case EVDF_VERTEX_SHADER_1_1: diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h index 0bc23ce..1ce0e02 100644 --- a/source/Irrlicht/COpenGLExtensionHandler.h +++ b/source/Irrlicht/COpenGLExtensionHandler.h @@ -1052,6 +1052,9 @@ class COpenGLExtensionHandler bool OcclusionQuerySupport; + // Info needed for workarounds. + bool IsAtiRadeonX; + //! Workaround until direct state access with framebuffers is stable enough in drivers // https://devtalk.nvidia.com/default/topic/1030494/opengl/bug-amp-amp-spec-violation-checknamedframebufferstatus-returns-gl_framebuffer_incomplete_dimensions_ext-under-gl-4-5-core/ // https://stackoverflow.com/questions/51304706/problems-with-attaching-textures-of-different-sizes-to-fbo