don't use GL_UNSIGNED_SHORT_1_5_5_5_REV for movie textures
if it'll require an additional conversion
This commit is contained in:
@@ -593,14 +593,14 @@ SDL_Surface *RageDisplay::CreateSurfaceFromPixfmt( PixelFormat pixfmt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RageDisplay::PixelFormat RageDisplay::FindPixelFormat(
|
RageDisplay::PixelFormat RageDisplay::FindPixelFormat(
|
||||||
int bpp, int Rmask, int Gmask, int Bmask, int Amask )
|
int bpp, int Rmask, int Gmask, int Bmask, int Amask, bool realtime )
|
||||||
{
|
{
|
||||||
PixelFormatDesc tmp = { bpp, Rmask, Gmask, Bmask, Amask };
|
PixelFormatDesc tmp = { bpp, Rmask, Gmask, Bmask, Amask };
|
||||||
|
|
||||||
for(int pixfmt = 0; pixfmt < NUM_PIX_FORMATS; ++pixfmt)
|
for(int pixfmt = 0; pixfmt < NUM_PIX_FORMATS; ++pixfmt)
|
||||||
{
|
{
|
||||||
const PixelFormatDesc *pf = GetPixelFormatDesc(PixelFormat(pixfmt));
|
const PixelFormatDesc *pf = GetPixelFormatDesc(PixelFormat(pixfmt));
|
||||||
if(!SupportsTextureFormat( PixelFormat(pixfmt) ))
|
if(!SupportsTextureFormat( PixelFormat(pixfmt), realtime ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(memcmp(pf, &tmp, sizeof(tmp)))
|
if(memcmp(pf, &tmp, sizeof(tmp)))
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public:
|
|||||||
|
|
||||||
virtual void SetBlendMode( BlendMode mode ) = 0;
|
virtual void SetBlendMode( BlendMode mode ) = 0;
|
||||||
|
|
||||||
virtual bool SupportsTextureFormat( PixelFormat pixfmt ) = 0;
|
virtual bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ) = 0;
|
||||||
|
|
||||||
/* This really indicates whether 4-bit palettes will actually use less memory
|
/* 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
|
* than 8-bit ones. Note that 4-bit palettes are uploaded as 8-bit paletted
|
||||||
@@ -254,7 +254,7 @@ public:
|
|||||||
void ChangeCentering( int trans_x, int trans_y, float scale_x, float scale_y );
|
void ChangeCentering( int trans_x, int trans_y, float scale_x, float scale_y );
|
||||||
|
|
||||||
SDL_Surface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch );
|
SDL_Surface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch );
|
||||||
PixelFormat FindPixelFormat( int bpp, int Rmask, int Gmask, int Bmask, int Amask );
|
PixelFormat FindPixelFormat( int bpp, int Rmask, int Gmask, int Bmask, int Amask, bool realtime=false );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RageMatrix GetPerspectiveMatrix(float fovy, float aspect, float zNear, float zFar);
|
RageMatrix GetPerspectiveMatrix(float fovy, float aspect, float zNear, float zFar);
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ void RageDisplay_D3D::EndFrame()
|
|||||||
ProcessStatsOnFlip();
|
ProcessStatsOnFlip();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt )
|
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt, bool realtime )
|
||||||
{
|
{
|
||||||
#if defined _XBOX
|
#if defined _XBOX
|
||||||
// Lazy... Xbox handles paletted textures completely differently
|
// Lazy... Xbox handles paletted textures completely differently
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
void EndFrame();
|
void EndFrame();
|
||||||
VideoModeParams GetVideoModeParams() const;
|
VideoModeParams GetVideoModeParams() const;
|
||||||
void SetBlendMode( BlendMode mode );
|
void SetBlendMode( BlendMode mode );
|
||||||
bool SupportsTextureFormat( PixelFormat pixfmt );
|
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
|
||||||
unsigned CreateTexture( PixelFormat pixfmt, SDL_Surface* img );
|
unsigned CreateTexture( PixelFormat pixfmt, SDL_Surface* img );
|
||||||
void UpdateTexture(
|
void UpdateTexture(
|
||||||
unsigned uTexHandle,
|
unsigned uTexHandle,
|
||||||
|
|||||||
@@ -693,20 +693,6 @@ void RageDisplay_OGL::EndFrame()
|
|||||||
ProcessStatsOnFlip();
|
ProcessStatsOnFlip();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RageDisplay_OGL::SupportsTextureFormat( PixelFormat pixfmt )
|
|
||||||
{
|
|
||||||
switch( 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.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RageDisplay_OGL::Supports4BitPalettes()
|
bool RageDisplay_OGL::Supports4BitPalettes()
|
||||||
{
|
{
|
||||||
return g_b4BitPalettesWork;
|
return g_b4BitPalettesWork;
|
||||||
@@ -1386,3 +1372,23 @@ bool RageDisplay_OGL::SupportsSurfaceFormat( PixelFormat pixfmt )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool RageDisplay_OGL::SupportsTextureFormat( PixelFormat pixfmt, bool realtime )
|
||||||
|
{
|
||||||
|
/* If we support a pixfmt for texture formats but not for surface formats, then
|
||||||
|
* we'll have to convert the texture to a supported surface format before uploading.
|
||||||
|
* This is too slow for dynamic textures. */
|
||||||
|
if( realtime && !SupportsSurfaceFormat( pixfmt ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch( GL_PIXFMT_INFO[pixfmt].format )
|
||||||
|
{
|
||||||
|
case GL_COLOR_INDEX:
|
||||||
|
return GLExt::glColorTableEXT && GLExt::glGetColorTableParameterivEXT;
|
||||||
|
case GL_BGR:
|
||||||
|
case GL_BGRA:
|
||||||
|
return g_bGL_EXT_bgra;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
void EndFrame();
|
void EndFrame();
|
||||||
VideoModeParams GetVideoModeParams() const;
|
VideoModeParams GetVideoModeParams() const;
|
||||||
void SetBlendMode( BlendMode mode );
|
void SetBlendMode( BlendMode mode );
|
||||||
bool SupportsTextureFormat( PixelFormat pixfmt );
|
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
|
||||||
bool Supports4BitPalettes();
|
bool Supports4BitPalettes();
|
||||||
unsigned CreateTexture( PixelFormat pixfmt, SDL_Surface* img );
|
unsigned CreateTexture( PixelFormat pixfmt, SDL_Surface* img );
|
||||||
void UpdateTexture(
|
void UpdateTexture(
|
||||||
|
|||||||
@@ -117,7 +117,9 @@ static int FindCompatibleAVFormat( RageDisplay::PixelFormat &pixfmt, bool HighCo
|
|||||||
fmt.masks[0],
|
fmt.masks[0],
|
||||||
fmt.masks[1],
|
fmt.masks[1],
|
||||||
fmt.masks[2],
|
fmt.masks[2],
|
||||||
fmt.masks[3] );
|
fmt.masks[3],
|
||||||
|
true /* realtime */
|
||||||
|
);
|
||||||
|
|
||||||
if( pixfmt == RageDisplay::NUM_PIX_FORMATS )
|
if( pixfmt == RageDisplay::NUM_PIX_FORMATS )
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user