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
This commit is contained in:
cutealien 2021-08-20 14:46:12 +00:00
parent 7ce229a658
commit 54e10d0dbe
2 changed files with 11 additions and 2 deletions

@ -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<const char*>(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:

@ -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