diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 16f0cde14c..88e5edd47c 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -170,12 +170,6 @@ public: virtual bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ) = 0; - /* This really indicates whether 4-bit palettes will actually use less memory - * than 8-bit ones. Note that 4-bit palettes are uploaded as 8-bit paletted - * surfaces with color index values in the range 0..15; not as 4-bit "packed - * indexes". */ - virtual bool Supports4BitPalettes() { return false; } - /* return 0 if failed or internal texture resource handle * (unsigned in OpenGL, texture pointer in D3D) */ virtual unsigned CreateTexture( diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index a4e3b48c3d..4f7fca354e 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -89,7 +89,6 @@ static bool g_bEXT_texture_env_combine = true; static bool g_bGL_EXT_bgra = true; static bool g_bReversePackedPixelsWorks = true; -static bool g_b4BitPalettesWork = true; /* OpenGL system information that generally doesn't change at runtime. */ @@ -508,7 +507,7 @@ bool HasExtension(CString ext) return g_glExts.find(ext) != g_glExts.end(); } -static void CheckPalettedTextures( bool LowColor ) +static void CheckPalettedTextures() { CString error; do @@ -538,12 +537,6 @@ static void CheckPalettedTextures( bool LowColor ) int bits = 8; - if( LowColor ) - { - glTexFormat = GL_COLOR_INDEX4_EXT; - bits = 4; - } - FlushGLErrors(); #define GL_CHECK_ERROR(f) \ { \ @@ -573,7 +566,7 @@ static void CheckPalettedTextures( bool LowColor ) GLubyte palette[256*4]; memset(palette, 0, sizeof(palette)); - GLExt::glColorTableEXT(GL_PROXY_TEXTURE_2D, GL_RGBA8, 1 << bits, GL_RGBA, GL_UNSIGNED_BYTE, palette); + GLExt::glColorTableEXT(GL_PROXY_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, palette); GL_CHECK_ERROR( "glColorTableEXT" ); GLint size = 0; @@ -608,18 +601,11 @@ static void CheckPalettedTextures( bool LowColor ) if( error == "" ) return; - if( LowColor ) - { - /* Disable 4-bit palettes, but allow 8-bit ones. */ - g_b4BitPalettesWork = false; - LOG->Info("4-bit paletted textures disabled: %s.", error.c_str()); - } else { - /* If 8-bit palettes don't work, disable them entirely--don't trust 4-bit - * palettes if it can't even get 8-bit ones right. */ - GLExt::glColorTableEXT = NULL; - GLExt::glGetColorTableParameterivEXT = NULL; - LOG->Info("Paletted textures disabled: %s.", error.c_str()); - } + /* If 8-bit palettes don't work, disable them entirely--don't trust 4-bit + * palettes if it can't even get 8-bit ones right. */ + GLExt::glColorTableEXT = NULL; + GLExt::glGetColorTableParameterivEXT = NULL; + LOG->Info("Paletted textures disabled: %s.", error.c_str()); } static void CheckReversePackedPixels() @@ -668,9 +654,7 @@ void SetupExtensions() GLExt::glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) wind->GetProcAddress("glDrawRangeElements"); g_bEXT_texture_env_combine = HasExtension("GL_EXT_texture_env_combine"); g_bGL_EXT_bgra = HasExtension("GL_EXT_bgra"); - CheckPalettedTextures( false ); - if( g_b4BitPalettesWork ) // don't bother if the last one failed - CheckPalettedTextures( true ); + CheckPalettedTextures(); CheckReversePackedPixels(); } @@ -831,11 +815,6 @@ void RageDisplay_OGL::EndFrame() ProcessStatsOnFlip(); } -bool RageDisplay_OGL::Supports4BitPalettes() -{ - return g_b4BitPalettesWork; -} - SDL_Surface* RageDisplay_OGL::CreateScreenshot() { int width = wind->GetVideoModeParams().width; @@ -1667,16 +1646,6 @@ unsigned RageDisplay_OGL::CreateTexture( GLenum glImageFormat = GL_PIXFMT_INFO[imgpixfmt].format; GLenum glImageType = GL_PIXFMT_INFO[imgpixfmt].type; - /* If we support 4-bit palettes, and this image fits in 4 bits, then change - * internalformat to GL_COLOR_INDEX4_EXT. We'll still upload it as 256 colors, - * but OpenGL can discard the extra bits. */ - if( (img->unused1 & FOUR_BIT_PALETTE) && Supports4BitPalettes() ) - { - LOG->Trace("did 4 bit"); - glTexFormat = GL_COLOR_INDEX4_EXT; - } - - // HACK: OpenGL 1.2 types aren't available in GLU 1.3. Don't call GLU for mip // mapping if we're using an OGL 1.2 type and don't have >= GLU 1.3. // http://pyopengl.sourceforge.net/documentation/manual/gluBuild2DMipmaps.3G.html diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index 20428ec901..c2f8d8a20d 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -21,7 +21,6 @@ public: VideoModeParams GetVideoModeParams() const; void SetBlendMode( BlendMode mode ); bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ); - bool Supports4BitPalettes(); unsigned CreateTexture( PixelFormat pixfmt, SDL_Surface* img, diff --git a/stepmania/src/SDL_utils.cpp b/stepmania/src/SDL_utils.cpp index 715db4c356..6b8e6b1b6b 100644 --- a/stepmania/src/SDL_utils.cpp +++ b/stepmania/src/SDL_utils.cpp @@ -1062,9 +1062,6 @@ SDL_Surface *mySDL_Palettize( SDL_Surface *src_surf, int GrayBits, int AlphaBits const int Amask = ((1 << AlphaBits) - 1) << Ashift; // alpha mask const int Aloss = 8-AlphaBits; - if( TotalColors <= 16 ) - dst_surf->unused1 |= FOUR_BIT_PALETTE; - for( int index = 0; index < TotalColors; ++index ) { const int I = (index & Imask) >> Ishift; diff --git a/stepmania/src/SDL_utils.h b/stepmania/src/SDL_utils.h index 75df3adc42..03a657b9d8 100644 --- a/stepmania/src/SDL_utils.h +++ b/stepmania/src/SDL_utils.h @@ -76,10 +76,6 @@ void mySDL_BlitTransform( const SDL_Surface *src, SDL_Surface *dst, void mySDL_BlitSurface( SDL_Surface *src, SDL_Surface *dst, int width, int height, bool ckey); -/* Use the "unused1" field in surfaces to mark paletted surfaces that only use - * 16 palette values. */ -enum { FOUR_BIT_PALETTE = 0x1 }; - SDL_Surface *mySDL_Palettize( SDL_Surface *src_surf, int GrayBits, int AlphaBits ); SDL_Surface *SDL_LoadImage( const CString &sPath );