From 108a3cceee242d9620c042ffdf1de0c13c1417b5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 30 Jun 2003 03:13:53 +0000 Subject: [PATCH] add FMT_A1BGR5 --- stepmania/src/RageDisplay.h | 7 +++++-- stepmania/src/RageDisplay_D3D.cpp | 12 ++++++++---- stepmania/src/RageDisplay_OGL.cpp | 27 ++++++++++++++++++++------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index de807fdbfc..a92d246367 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -43,9 +43,12 @@ enum PixelFormat { FMT_RGB5A1, FMT_RGB5, FMT_RGB8, - /* This may not be as well-supported as RGBA; it's used to speed up DirectShow. */ - FMT_BGR8, FMT_PAL, + /* The above formats differ between OpenGL and D3D. These are provided as + * alternatives for OpenGL that match some format in D3D. Don't use them + * directly; they'll be matched automatically by FindPixelFormat. */ + FMT_BGR8, + FMT_A1BGR5, NUM_PIX_FORMATS }; diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 5a2d50ec75..b6d90d2333 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -166,13 +166,16 @@ static const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = { 0x00FF00, 0x0000FF, 0x000000 } - }, { - /* BGRA (N/A; OpenGL only) */ - 0, { 0,0,0,0 } }, { /* Paletted */ 8, { 0,0,0,0 } /* N/A */ + }, { + /* BGR (N/A; OpenGL only) */ + 0, { 0,0,0,0 } + }, { + /* ABGR (N/A; OpenGL only) */ + 0, { 0,0,0,0 } } }; @@ -187,8 +190,9 @@ static D3DFORMAT D3DFORMATS[NUM_PIX_FORMATS] = #else D3DFMT_A8R8G8B8, #endif + D3DFMT_P8, D3DFMT_UNKNOWN, /* no BGR */ - D3DFMT_P8 + D3DFMT_UNKNOWN /* no ABGR */ }; const PixelFormatDesc *RageDisplay_D3D::GetPixelFormatDesc(PixelFormat pf) const diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index ac93c34ddb..c869cf3839 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -134,6 +134,10 @@ static PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = { 0x00FF00, 0x0000FF, 0x000000 } + }, { + /* Paletted */ + 8, + { 0,0,0,0 } /* N/A */ }, { /* B8G8R8A8 */ 24, @@ -142,9 +146,12 @@ static PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = { 0xFF0000, 0x000000 } }, { - /* Paletted */ - 8, - { 0,0,0,0 } /* N/A */ + /* A1B5G5R5 */ + 16, + { 0x7C00, + 0x03E0, + 0x001F, + 0x8000 }, } }; @@ -178,16 +185,21 @@ struct GLPixFmtInfo_t { GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, + }, { + /* Paletted */ + GL_COLOR_INDEX8_EXT, + GL_COLOR_INDEX, + GL_UNSIGNED_BYTE, }, { /* B8G8R8 */ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, }, { - /* Paletted */ - GL_COLOR_INDEX8_EXT, - GL_COLOR_INDEX, - GL_UNSIGNED_BYTE, + /* A1R5G5B5 (matches D3DFMT_A1R5G5B5) */ + GL_RGB5_A1, + GL_BGRA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, } }; @@ -528,6 +540,7 @@ bool RageDisplay_OGL::SupportsTextureFormat( PixelFormat pixfmt ) case FMT_PAL: return GLExt::glColorTableEXT && GLExt::glGetColorTableParameterivEXT; case FMT_BGR8: + case FMT_A1BGR5: return g_bGL_EXT_bgra; default: return true; // No way to query this in OGL. You pass it a format and hope it doesn't have to convert.