2025-06-14 04:56 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000999Spring engineGeneralpublic2010-02-10 14:11
Reporterimbaczek 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
Product Version0.76b1+svn 
Target VersionFixed in Version0.79.0.0 
Summary0000999: mipmaps (glGenerateMipmapEXT) broken on ATI hardware
Descriptionwhat the summary says. attached patch fixes it - when AtiHacks config var is true, don't try using glGenerateMipmapEXT, use glTexImage2D and friends. (don't have svn installed on the new box yet ;p)
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • diff file icon fix-ati-rendering-mipmaps.diff (1,429 bytes) 2008-08-15 01:13 -
    diff --git a/rts/Rendering/GL/myGL.cpp b/rts/Rendering/GL/myGL.cpp
    index 21e702c..9dc9345 100644
    --- a/rts/Rendering/GL/myGL.cpp
    +++ b/rts/Rendering/GL/myGL.cpp
    @@ -9,12 +9,14 @@
     #include "Game/GameVersion.h"
     #include "Rendering/Textures/Bitmap.h"
     #include "Platform/errorhandler.h"
    +#include "Platform/ConfigHandler.h"
     #include "LogOutput.h"
     #include "FPUCheck.h"
     #include <SDL.h>
     #include "mmgr.h"
     #include "System/GlobalStuff.h"
     
    +
     #include "IFramebuffer.h"
     
     using namespace std;
    @@ -132,17 +134,17 @@ void glBuildMipmaps(const GLenum target,GLint internalFormat,const GLsizei width
     			case 3:
     			case GL_RGB8 :
     			case GL_RGB :   internalFormat = GL_COMPRESSED_RGB_ARB; break;
    -			
    +
     			case 4:
     			case GL_RGBA8 :
     			case GL_RGBA : internalFormat = GL_COMPRESSED_RGBA_ARB; break;
    -			
    +
     			case GL_LUMINANCE: internalFormat = GL_COMPRESSED_LUMINANCE_ARB; break;
     		}
     	}
    -	
    +
     	// create mipmapped texture
    -	if (glGenerateMipmapEXT) {
    +	if (configHandler.GetInt("AtiHacks", 0) == 0 && glGenerateMipmapEXT) {
     		// newest method
     		glTexImage2D(target, 0, internalFormat, width, height, 0, format, type, data);
     		glGenerateMipmapEXT(target);
    @@ -188,7 +190,7 @@ static string SelectPicture(const std::string& dir, const std::string& prefix)
     
     void LoadStartPicture(const std::string& sidePref)
     {
    -	if (startupTexture) 
    +	if (startupTexture)
     		return;
     	const string picDir = "bitmaps/loadpictures/";
     
    
    diff file icon fix-ati-rendering-mipmaps.diff (1,429 bytes) 2008-08-15 01:13 +

-Relationships
+Relationships

-Notes

~0002456

jK (developer)

There is a similar issue with nvidias and glGenerateMipmapEXT, so it shouldn't be used in general _to create texture mipmaps_.
But it should work fine for FBO textures ;)

(will fix it after I collected some more infos)

~0002457

imbaczek (reporter)

I'll apply the workaround patch while your fix is cooking.

~0002465

imbaczek (reporter)

this also happens for nvidia, so the currently committed "fix" requires "tuning" ;p

~0004636

tvo (reporter)

Has the better fix finished cooking yet? :P

~0004638

jK (developer)

It's already in the repro:
        glTexImage2D(target, 0, internalFormat, width, height, 0, format, type, data);
        if (gu->atiHacks) {
            glEnable(target);
            glGenerateMipmapEXT(target);
            glDisable(target);
        }else{
            glGenerateMipmapEXT(target);
        }

(ati got a bug that the texture target needs to be enabled when you want to use glGenerateMipmapEXT, and nvidia fixed their drivers)
+Notes

-Issue History
Date Modified Username Field Change
2008-08-15 01:13 imbaczek New Issue
2008-08-15 01:13 imbaczek File Added: fix-ati-rendering-mipmaps.diff
2008-08-15 03:02 jK Note Added: 0002456
2008-08-15 15:58 imbaczek Note Added: 0002457
2008-08-17 00:59 imbaczek Status new => confirmed
2008-08-21 00:40 imbaczek Note Added: 0002465
2010-02-10 12:01 tvo Note Added: 0004636
2010-02-10 12:01 tvo Status confirmed => feedback
2010-02-10 14:11 jK Note Added: 0004638
2010-02-10 14:11 jK Status feedback => closed
2010-02-10 14:11 jK Resolution open => fixed
2010-02-10 14:11 jK Fixed in Version => 0.79.0.0
+Issue History