Remove 4-bit palette support. As far as I can tell, no hardware supports

it.  (New ATI hardware apparently doesn't even support 8-bit palettes?!)
This commit is contained in:
Glenn Maynard
2004-05-15 08:18:37 +00:00
parent 0dd2a75c5d
commit 6398054e26
5 changed files with 8 additions and 53 deletions
-6
View File
@@ -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(
+8 -39
View File
@@ -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
-1
View File
@@ -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,
-3
View File
@@ -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;
-4
View File
@@ -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 );