fix ffmpeg 1.1 builds... another way

This commit is contained in:
Devin J. Pohly
2013-02-21 03:18:28 -05:00
parent a6bfbb19ac
commit a280f513b4
17 changed files with 166 additions and 166 deletions
+2 -2
View File
@@ -233,9 +233,9 @@ struct BannerTexture: public RageTexture
/* Find a supported texture format. If it happens to match the stored
* file, we won't have to do any conversion here, and that'll happen
* often with paletted images. */
PixelFormat pf = m_pImage->format->BitsPerPixel == 8? PixelFormat_PAL: PixelFormat_RGB5A1;
RagePixelFormat pf = m_pImage->format->BitsPerPixel == 8? RagePixelFormat_PAL: RagePixelFormat_RGB5A1;
if( !DISPLAY->SupportsTextureFormat(pf) )
pf = PixelFormat_RGBA4;
pf = RagePixelFormat_RGBA4;
ASSERT( DISPLAY->SupportsTextureFormat(pf) );
+12 -12
View File
@@ -166,7 +166,7 @@ void RageBitmapTexture::Create()
if( pImg->w != m_iImageWidth || pImg->h != m_iImageHeight )
RageSurfaceUtils::Zoom( pImg, m_iImageWidth, m_iImageHeight );
if( actualID.iGrayscaleBits != -1 && DISPLAY->SupportsTextureFormat(PixelFormat_PAL) )
if( actualID.iGrayscaleBits != -1 && DISPLAY->SupportsTextureFormat(RagePixelFormat_PAL) )
{
RageSurface *pGrayscale = RageSurfaceUtils::PalettizeToGrayscale( pImg, actualID.iGrayscaleBits, actualID.iAlphaBits );
@@ -175,12 +175,12 @@ void RageBitmapTexture::Create()
}
// Figure out which texture format we want the renderer to use.
PixelFormat pixfmt;
RagePixelFormat pixfmt;
// If the source is palleted, always load as paletted if supported.
if( pImg->format->BitsPerPixel == 8 && DISPLAY->SupportsTextureFormat(PixelFormat_PAL) )
if( pImg->format->BitsPerPixel == 8 && DISPLAY->SupportsTextureFormat(RagePixelFormat_PAL) )
{
pixfmt = PixelFormat_PAL;
pixfmt = RagePixelFormat_PAL;
}
else
{
@@ -199,16 +199,16 @@ void RageBitmapTexture::Create()
{
case 0:
case 1:
pixfmt = PixelFormat_RGB5A1;
pixfmt = RagePixelFormat_RGB5A1;
break;
default:
pixfmt = PixelFormat_RGBA4;
pixfmt = RagePixelFormat_RGBA4;
break;
}
}
break;
case 32:
pixfmt = PixelFormat_RGBA8;
pixfmt = RagePixelFormat_RGBA8;
break;
default: FAIL_M( ssprintf("%i", actualID.iColorDepth) );
}
@@ -217,9 +217,9 @@ void RageBitmapTexture::Create()
// Make we're using a supported format. Every card supports either RGBA8 or RGBA4.
if( !DISPLAY->SupportsTextureFormat(pixfmt) )
{
pixfmt = PixelFormat_RGBA8;
pixfmt = RagePixelFormat_RGBA8;
if( !DISPLAY->SupportsTextureFormat(pixfmt) )
pixfmt = PixelFormat_RGBA4;
pixfmt = RagePixelFormat_RGBA4;
}
/* Dither if appropriate.
@@ -228,10 +228,10 @@ void RageBitmapTexture::Create()
* on at least one color channel than the source. For example, it doesn't
* make sense to do this when pixfmt is RGBA5551 if the image is only RGBA555. */
if( actualID.bDither &&
(pixfmt==PixelFormat_RGBA4 || pixfmt==PixelFormat_RGB5A1) )
(pixfmt==RagePixelFormat_RGBA4 || pixfmt==RagePixelFormat_RGB5A1) )
{
// Dither down to the destination format.
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
const RageDisplay::RagePixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
RageSurface *dst = CreateSurface( pImg->w, pImg->h, pfd->bpp,
pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
@@ -318,7 +318,7 @@ void RageBitmapTexture::Create()
RString sProperties;
sProperties += PixelFormatToString( pixfmt ) + " ";
sProperties += RagePixelFormatToString( pixfmt ) + " ";
if( actualID.iAlphaBits == 0 ) sProperties += "opaque ";
if( actualID.iAlphaBits == 1 ) sProperties += "matte ";
if( actualID.bStretch ) sProperties += "stretch ";
+10 -10
View File
@@ -48,7 +48,7 @@ RageDisplay* DISPLAY = NULL;
Preference<bool> LOG_FPS( "LogFPS", true );
Preference<float> g_fFrameLimitPercent( "FrameLimitPercent", 0.0f );
static const char *PixelFormatNames[] = {
static const char *RagePixelFormatNames[] = {
"RGBA8",
"BGRA8",
"RGBA4",
@@ -60,7 +60,7 @@ static const char *PixelFormatNames[] = {
"A1BGR5",
"X1RGB5",
};
XToString( PixelFormat );
XToString( RagePixelFormat );
/* bNeedReloadTextures is set to true if the device was re-created and we need
* to reload textures. On failure, an error message is returned.
@@ -626,10 +626,10 @@ RageMatrix RageDisplay::GetPerspectiveMatrix(float fovy, float aspect, float zNe
return GetFrustumMatrix(xmin, xmax, ymin, ymax, zNear, zFar);
}
RageSurface *RageDisplay::CreateSurfaceFromPixfmt( PixelFormat pixfmt,
RageSurface *RageDisplay::CreateSurfaceFromPixfmt( RagePixelFormat pixfmt,
void *pixels, int width, int height, int pitch )
{
const PixelFormatDesc *tpf = GetPixelFormatDesc(pixfmt);
const RagePixelFormatDesc *tpf = GetPixelFormatDesc(pixfmt);
RageSurface *surf = CreateSurfaceFrom(
width, height, tpf->bpp,
@@ -639,14 +639,14 @@ RageSurface *RageDisplay::CreateSurfaceFromPixfmt( PixelFormat pixfmt,
return surf;
}
PixelFormat RageDisplay::FindPixelFormat( int iBPP, unsigned iRmask, unsigned iGmask, unsigned iBmask, unsigned iAmask, bool bRealtime )
RagePixelFormat RageDisplay::FindPixelFormat( int iBPP, unsigned iRmask, unsigned iGmask, unsigned iBmask, unsigned iAmask, bool bRealtime )
{
PixelFormatDesc tmp = { iBPP, { iRmask, iGmask, iBmask, iAmask } };
RagePixelFormatDesc tmp = { iBPP, { iRmask, iGmask, iBmask, iAmask } };
FOREACH_ENUM( PixelFormat, iPixFmt )
FOREACH_ENUM( RagePixelFormat, iPixFmt )
{
const PixelFormatDesc *pf = GetPixelFormatDesc( PixelFormat(iPixFmt) );
if( !SupportsTextureFormat(PixelFormat(iPixFmt), bRealtime) )
const RagePixelFormatDesc *pf = GetPixelFormatDesc( RagePixelFormat(iPixFmt) );
if( !SupportsTextureFormat(RagePixelFormat(iPixFmt), bRealtime) )
continue;
if( memcmp(pf, &tmp, sizeof(tmp)) )
@@ -654,7 +654,7 @@ PixelFormat RageDisplay::FindPixelFormat( int iBPP, unsigned iRmask, unsigned iG
return iPixFmt;
}
return PixelFormat_Invalid;
return RagePixelFormat_Invalid;
}
/* These convert to OpenGL's coordinate system: -1,-1 is the bottom-left,
+20 -20
View File
@@ -51,25 +51,25 @@ protected:
bool m_bAnyNeedsTextureMatrixScale;
};
enum PixelFormat
enum RagePixelFormat
{
PixelFormat_RGBA8,
PixelFormat_BGRA8,
PixelFormat_RGBA4,
PixelFormat_RGB5A1,
PixelFormat_RGB5,
PixelFormat_RGB8,
PixelFormat_PAL,
RagePixelFormat_RGBA8,
RagePixelFormat_BGRA8,
RagePixelFormat_RGBA4,
RagePixelFormat_RGB5A1,
RagePixelFormat_RGB5,
RagePixelFormat_RGB8,
RagePixelFormat_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. */
PixelFormat_BGR8,
PixelFormat_A1BGR5,
PixelFormat_X1RGB5,
NUM_PixelFormat,
PixelFormat_Invalid
RagePixelFormat_BGR8,
RagePixelFormat_A1BGR5,
RagePixelFormat_X1RGB5,
NUM_RagePixelFormat,
RagePixelFormat_Invalid
};
const RString& PixelFormatToString( PixelFormat i );
const RString& RagePixelFormatToString( RagePixelFormat i );
/** @brief The parameters used for the present Video Mode. */
class VideoModeParams
@@ -168,12 +168,12 @@ class RageDisplay
public:
struct PixelFormatDesc {
struct RagePixelFormatDesc {
int bpp;
unsigned int masks[4];
};
virtual const PixelFormatDesc *GetPixelFormatDesc( PixelFormat pf ) const = 0;
virtual const RagePixelFormatDesc *GetPixelFormatDesc( RagePixelFormat pf ) const = 0;
RageDisplay();
virtual ~RageDisplay();
@@ -198,7 +198,7 @@ public:
virtual void SetBlendMode( BlendMode mode ) = 0;
virtual bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ) = 0;
virtual bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false ) = 0;
virtual bool SupportsThreadedRendering() { return false; }
virtual bool SupportsPerVertexMatrixScale() = 0;
@@ -212,7 +212,7 @@ public:
/* return 0 if failed or internal texture resource handle
* (unsigned in OpenGL, texture pointer in D3D) */
virtual unsigned CreateTexture(
PixelFormat pixfmt, // format of img and of texture in video mem
RagePixelFormat pixfmt, // format of img and of texture in video mem
RageSurface* img, // must be in pixfmt
bool bGenerateMipMaps
) = 0;
@@ -379,8 +379,8 @@ public:
void CenteringPopMatrix();
void ChangeCentering( int trans_x, int trans_y, int add_width, int add_height );
RageSurface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch );
PixelFormat FindPixelFormat( int bpp, unsigned Rmask, unsigned Gmask, unsigned Bmask, unsigned Amask, bool realtime=false );
RageSurface *CreateSurfaceFromPixfmt( RagePixelFormat pixfmt, void *pixels, int width, int height, int pitch );
RagePixelFormat FindPixelFormat( int bpp, unsigned Rmask, unsigned Gmask, unsigned Bmask, unsigned Amask, bool realtime=false );
// Lua
void PushSelf( lua_State *L );
+13 -13
View File
@@ -101,7 +101,7 @@ static void SetPalette( unsigned TexResource )
#define D3DFVF_RageModelVertex (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
static const RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
static const RageDisplay::RagePixelFormatDesc PIXEL_FORMAT_DESC[NUM_RagePixelFormat] = {
{
/* A8B8G8R8 */
32,
@@ -155,7 +155,7 @@ static const RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
}
};
static D3DFORMAT D3DFORMATS[NUM_PixelFormat] =
static D3DFORMAT D3DFORMATS[NUM_RagePixelFormat] =
{
D3DFMT_A8R8G8B8,
D3DFMT_UNKNOWN,
@@ -169,9 +169,9 @@ static D3DFORMAT D3DFORMATS[NUM_PixelFormat] =
D3DFMT_UNKNOWN, // X1R5G5B5
};
const RageDisplay::PixelFormatDesc *RageDisplay_D3D::GetPixelFormatDesc(PixelFormat pf) const
const RageDisplay::RagePixelFormatDesc *RageDisplay_D3D::GetPixelFormatDesc(RagePixelFormat pf) const
{
ASSERT( pf < NUM_PixelFormat );
ASSERT( pf < NUM_RagePixelFormat );
return &PIXEL_FORMAT_DESC[pf];
}
@@ -598,11 +598,11 @@ void RageDisplay_D3D::EndFrame()
RageDisplay::EndFrame();
}
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt, bool realtime )
bool RageDisplay_D3D::SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime )
{
// Some cards (Savage) don't support alpha in palettes.
// Don't allow paletted textures if this is the case.
if( pixfmt == PixelFormat_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
if( pixfmt == RagePixelFormat_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
return false;
if( D3DFORMATS[pixfmt] == D3DFMT_UNKNOWN )
@@ -660,7 +660,7 @@ RageSurface* RageDisplay_D3D::CreateScreenshot()
pCopy->LockRect( &lr, &rect, D3DLOCK_READONLY );
}
RageSurface *surface = CreateSurfaceFromPixfmt( PixelFormat_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
RageSurface *surface = CreateSurfaceFromPixfmt( RagePixelFormat_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
ASSERT( surface != NULL );
// We need to make a copy, since lr.pBits will go away when we call UnlockRect().
@@ -1342,7 +1342,7 @@ void RageDisplay_D3D::DeleteTexture( unsigned iTexHandle )
unsigned RageDisplay_D3D::CreateTexture(
PixelFormat pixfmt,
RagePixelFormat pixfmt,
RageSurface* img,
bool bGenerateMipMaps )
{
@@ -1352,11 +1352,11 @@ unsigned RageDisplay_D3D::CreateTexture(
if( FAILED(hr) )
RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s",
img->w, img->h, PixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() );
img->w, img->h, RagePixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() );
unsigned uTexHandle = (unsigned)pTex;
if( pixfmt == PixelFormat_PAL )
if( pixfmt == RagePixelFormat_PAL )
{
// Save palette
TexturePalette pal;
@@ -1403,11 +1403,11 @@ void RageDisplay_D3D::UpdateTexture(
// Copy bits
int texpixfmt;
for(texpixfmt = 0; texpixfmt < NUM_PixelFormat; ++texpixfmt)
for(texpixfmt = 0; texpixfmt < NUM_RagePixelFormat; ++texpixfmt)
if(D3DFORMATS[texpixfmt] == desc.Format) break;
ASSERT( texpixfmt != NUM_PixelFormat );
ASSERT( texpixfmt != NUM_RagePixelFormat );
RageSurface *Texture = CreateSurfaceFromPixfmt(PixelFormat(texpixfmt), lr.pBits, width, height, lr.Pitch);
RageSurface *Texture = CreateSurfaceFromPixfmt(RagePixelFormat(texpixfmt), lr.pBits, width, height, lr.Pitch);
ASSERT( Texture != NULL );
RageSurfaceUtils::Blit( img, Texture, width, height );
+3 -3
View File
@@ -13,17 +13,17 @@ public:
virtual RString GetApiDescription() const { return "D3D"; }
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
void ResolutionChanged();
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
const RagePixelFormatDesc *GetPixelFormatDesc(RagePixelFormat pf) const;
bool BeginFrame();
void EndFrame();
VideoModeParams GetActualVideoModeParams() const;
void SetBlendMode( BlendMode mode );
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false );
bool SupportsThreadedRendering();
bool SupportsPerVertexMatrixScale() { return false; }
unsigned CreateTexture(
PixelFormat pixfmt,
RagePixelFormat pixfmt,
RageSurface* img,
bool bGenerateMipMaps );
void UpdateTexture(
+14 -14
View File
@@ -23,8 +23,8 @@
namespace
{
RageDisplay::PixelFormatDesc
PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
RageDisplay::RagePixelFormatDesc
PIXEL_FORMAT_DESC[NUM_RagePixelFormat] = {
{
/* R8G8B8A8 */
32,
@@ -96,8 +96,8 @@ namespace
};
/* g_GLPixFmtInfo is used for both texture formats and surface formats.
* For example, it's fine to ask for a PixelFormat_RGB5 texture, but to
* supply a surface matching PixelFormat_RGB8. OpenGL will simply
* For example, it's fine to ask for a RagePixelFormat_RGB5 texture, but to
* supply a surface matching RagePixelFormat_RGB8. OpenGL will simply
* discard the extra bits.
*
* It's possible for a format to be supported as a texture format but
@@ -110,7 +110,7 @@ namespace
GLenum internalfmt; /* target format */
GLenum format; /* target format */
GLenum type; /* data format */
} const g_GLPixFmtInfo[NUM_PixelFormat] = {
} const g_GLPixFmtInfo[NUM_RagePixelFormat] = {
{
/* R8G8B8A8 */
GL_RGBA8,
@@ -175,9 +175,9 @@ namespace
return;
bInitialized = true;
for( int i = 0; i < NUM_PixelFormat; ++i )
for( int i = 0; i < NUM_RagePixelFormat; ++i )
{
RageDisplay::PixelFormatDesc &pf = PIXEL_FORMAT_DESC[i];
RageDisplay::RagePixelFormatDesc &pf = PIXEL_FORMAT_DESC[i];
/* OpenGL and RageSurface handle byte formats differently; we need
* to flip non-paletted masks to make them line up. */
@@ -453,7 +453,7 @@ RageDisplay_GLES2::GetDisplayResolutions( DisplayResolutions &out ) const
RageSurface*
RageDisplay_GLES2::CreateScreenshot()
{
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[PixelFormat_RGB8];
const RagePixelFormatDesc &desc = PIXEL_FORMAT_DESC[RagePixelFormat_RGB8];
RageSurface *image = CreateSurface(
640, 480, desc.bpp,
desc.masks[0], desc.masks[1], desc.masks[2], desc.masks[3] );
@@ -463,10 +463,10 @@ RageDisplay_GLES2::CreateScreenshot()
return image;
}
const RageDisplay::PixelFormatDesc*
RageDisplay_GLES2::GetPixelFormatDesc(PixelFormat pf) const
const RageDisplay::RagePixelFormatDesc*
RageDisplay_GLES2::GetPixelFormatDesc(RagePixelFormat pf) const
{
ASSERT( pf >= 0 && pf < NUM_PixelFormat );
ASSERT( pf >= 0 && pf < NUM_RagePixelFormat );
return &PIXEL_FORMAT_DESC[pf];
}
@@ -530,7 +530,7 @@ RageDisplay_GLES2::SetBlendMode( BlendMode mode )
}
bool
RageDisplay_GLES2::SupportsTextureFormat( PixelFormat pixfmt, bool realtime )
RageDisplay_GLES2::SupportsTextureFormat( RagePixelFormat 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.
@@ -561,7 +561,7 @@ RageDisplay_GLES2::SupportsPerVertexMatrixScale()
unsigned
RageDisplay_GLES2::CreateTexture(
PixelFormat pixfmt,
RagePixelFormat pixfmt,
RageSurface* img,
bool bGenerateMipMaps
)
@@ -968,7 +968,7 @@ RageDisplay_GLES2::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], i
}
bool
RageDisplay_GLES2::SupportsSurfaceFormat( PixelFormat pixfmt )
RageDisplay_GLES2::SupportsSurfaceFormat( RagePixelFormat pixfmt )
{
switch (g_GLPixFmtInfo[pixfmt].type)
{
+4 -4
View File
@@ -10,16 +10,16 @@ public:
virtual RString GetApiDescription() const;
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
const RagePixelFormatDesc *GetPixelFormatDesc(RagePixelFormat pf) const;
bool BeginFrame();
void EndFrame();
VideoModeParams GetActualVideoModeParams() const;
void SetBlendMode( BlendMode mode );
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false );
bool SupportsPerVertexMatrixScale();
unsigned CreateTexture(
PixelFormat pixfmt,
RagePixelFormat pixfmt,
RageSurface* img,
bool bGenerateMipMaps );
void UpdateTexture(
@@ -80,7 +80,7 @@ protected:
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut );
RageSurface* CreateScreenshot();
RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf );
bool SupportsSurfaceFormat( PixelFormat pixfmt );
bool SupportsSurfaceFormat( RagePixelFormat pixfmt );
bool SupportsRenderToTexture() const { return true; }
};
+4 -4
View File
@@ -11,7 +11,7 @@
#include "RageSurface.h"
#include "DisplayResolutions.h"
static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
static RageDisplay::RagePixelFormatDesc PIXEL_FORMAT_DESC[NUM_RagePixelFormat] = {
{
/* R8G8B8A8 */
32,
@@ -90,7 +90,7 @@ void RageDisplay_Null::GetDisplayResolutions( DisplayResolutions &out ) const
RageSurface* RageDisplay_Null::CreateScreenshot()
{
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[PixelFormat_RGB8];
const RagePixelFormatDesc &desc = PIXEL_FORMAT_DESC[RagePixelFormat_RGB8];
RageSurface *image = CreateSurface(
640, 480, desc.bpp,
desc.masks[0], desc.masks[1], desc.masks[2], desc.masks[3] );
@@ -100,9 +100,9 @@ RageSurface* RageDisplay_Null::CreateScreenshot()
return image;
}
const RageDisplay::PixelFormatDesc *RageDisplay_Null::GetPixelFormatDesc(PixelFormat pf) const
const RageDisplay::RagePixelFormatDesc *RageDisplay_Null::GetPixelFormatDesc(RagePixelFormat pf) const
{
ASSERT( pf >= 0 && pf < NUM_PixelFormat );
ASSERT( pf >= 0 && pf < NUM_RagePixelFormat );
return &PIXEL_FORMAT_DESC[pf];
}
+4 -4
View File
@@ -11,16 +11,16 @@ public:
virtual RString GetApiDescription() const { return "Null"; }
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
const RagePixelFormatDesc *GetPixelFormatDesc(RagePixelFormat pf) const;
bool BeginFrame() { return true; }
void EndFrame();
VideoModeParams GetActualVideoModeParams() const { return m_Params; }
void SetBlendMode( BlendMode ) { }
bool SupportsTextureFormat( PixelFormat, bool /* realtime */ =false ) { return true; }
bool SupportsTextureFormat( RagePixelFormat, bool /* realtime */ =false ) { return true; }
bool SupportsPerVertexMatrixScale() { return false; }
unsigned CreateTexture(
PixelFormat,
RagePixelFormat,
RageSurface* /* img */,
bool /* bGenerateMipMaps */ ) { return 1; }
void UpdateTexture(
@@ -80,7 +80,7 @@ protected:
RString TryVideoMode( const VideoModeParams &p, bool & /* bNewDeviceOut */ ) { m_Params = p; return RString(); }
RageSurface* CreateScreenshot();
RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf );
bool SupportsSurfaceFormat( PixelFormat ) { return true; }
bool SupportsSurfaceFormat( RagePixelFormat ) { return true; }
};
#endif
+32 -32
View File
@@ -72,7 +72,7 @@ static bool g_bInvertY = false;
static void InvalidateObjects();
static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
static RageDisplay::RagePixelFormatDesc PIXEL_FORMAT_DESC[NUM_RagePixelFormat] = {
{
/* R8G8B8A8 */
32,
@@ -144,8 +144,8 @@ static RageDisplay::PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PixelFormat] = {
};
/* g_GLPixFmtInfo is used for both texture formats and surface formats. For example,
* it's fine to ask for a PixelFormat_RGB5 texture, but to supply a surface matching
* PixelFormat_RGB8. OpenGL will simply discard the extra bits.
* it's fine to ask for a RagePixelFormat_RGB5 texture, but to supply a surface matching
* RagePixelFormat_RGB8. OpenGL will simply discard the extra bits.
*
* It's possible for a format to be supported as a texture format but not as a
* surface format. For example, if packed pixels aren't supported, we can still
@@ -157,7 +157,7 @@ struct GLPixFmtInfo_t {
GLenum internalfmt; /* target format */
GLenum format; /* target format */
GLenum type; /* data format */
} const g_GLPixFmtInfo[NUM_PixelFormat] = {
} const g_GLPixFmtInfo[NUM_RagePixelFormat] = {
{
/* R8G8B8A8 */
GL_RGBA8,
@@ -220,9 +220,9 @@ static void FixLittleEndian()
return;
bInitialized = true;
for( int i = 0; i < NUM_PixelFormat; ++i )
for( int i = 0; i < NUM_RagePixelFormat; ++i )
{
RageDisplay::PixelFormatDesc &pf = PIXEL_FORMAT_DESC[i];
RageDisplay::RagePixelFormatDesc &pf = PIXEL_FORMAT_DESC[i];
/* OpenGL and RageSurface handle byte formats differently; we need
* to flip non-paletted masks to make them line up. */
@@ -579,9 +579,9 @@ static void CheckPalettedTextures()
}
/* Check to see if paletted textures really work. */
GLenum glTexFormat = g_GLPixFmtInfo[PixelFormat_PAL].internalfmt;
GLenum glImageFormat = g_GLPixFmtInfo[PixelFormat_PAL].format;
GLenum glImageType = g_GLPixFmtInfo[PixelFormat_PAL].type;
GLenum glTexFormat = g_GLPixFmtInfo[RagePixelFormat_PAL].internalfmt;
GLenum glImageFormat = g_GLPixFmtInfo[RagePixelFormat_PAL].format;
GLenum glImageType = g_GLPixFmtInfo[RagePixelFormat_PAL].type;
int iBits = 8;
@@ -814,7 +814,7 @@ RageSurface* RageDisplay_Legacy::CreateScreenshot()
int width = g_pWind->GetActualVideoModeParams().width;
int height = g_pWind->GetActualVideoModeParams().height;
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[PixelFormat_RGBA8];
const RagePixelFormatDesc &desc = PIXEL_FORMAT_DESC[RagePixelFormat_RGBA8];
RageSurface *image = CreateSurface( width, height, desc.bpp,
desc.masks[0], desc.masks[1], desc.masks[2], 0 );
@@ -844,9 +844,9 @@ RageSurface *RageDisplay_Legacy::GetTexture( unsigned iTexture )
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &iHeight );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &iWidth );
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &iAlphaBits );
int iFormat = iAlphaBits? PixelFormat_RGBA8:PixelFormat_RGB8;
int iFormat = iAlphaBits? RagePixelFormat_RGBA8:RagePixelFormat_RGB8;
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[iFormat];
const RagePixelFormatDesc &desc = PIXEL_FORMAT_DESC[iFormat];
RageSurface *pImage = CreateSurface( iWidth, iHeight, desc.bpp,
desc.masks[0], desc.masks[1], desc.masks[2], desc.masks[3] );
@@ -1947,9 +1947,9 @@ void RageDisplay_Legacy::SetCullMode( CullMode mode )
}
}
const RageDisplay::PixelFormatDesc *RageDisplay_Legacy::GetPixelFormatDesc(PixelFormat pf) const
const RageDisplay::RagePixelFormatDesc *RageDisplay_Legacy::GetPixelFormatDesc(RagePixelFormat pf) const
{
ASSERT( pf < NUM_PixelFormat );
ASSERT( pf < NUM_RagePixelFormat );
return &PIXEL_FORMAT_DESC[pf];
}
@@ -1997,9 +1997,9 @@ void RageDisplay_Legacy::DeleteTexture( unsigned iTexture )
}
PixelFormat RageDisplay_Legacy::GetImgPixelFormat( RageSurface* &img, bool &bFreeImg, int width, int height, bool bPalettedTexture )
RagePixelFormat RageDisplay_Legacy::GetImgPixelFormat( RageSurface* &img, bool &bFreeImg, int width, int height, bool bPalettedTexture )
{
PixelFormat pixfmt = FindPixelFormat( img->format->BitsPerPixel, img->format->Rmask, img->format->Gmask, img->format->Bmask, img->format->Amask );
RagePixelFormat pixfmt = FindPixelFormat( img->format->BitsPerPixel, img->format->Rmask, img->format->Gmask, img->format->Bmask, img->format->Amask );
/* If img is paletted, we're setting up a non-paletted texture, and color indexes
* are too small, depalettize. */
@@ -2007,7 +2007,7 @@ PixelFormat RageDisplay_Legacy::GetImgPixelFormat( RageSurface* &img, bool &bFre
if (!bPalettedTexture && img->fmt.BytesPerPixel == 1 && !g_bColorIndexTableWorks)
bSupported = false;
if (pixfmt == PixelFormat_Invalid || !SupportsSurfaceFormat(pixfmt))
if (pixfmt == RagePixelFormat_Invalid || !SupportsSurfaceFormat(pixfmt))
bSupported = false;
if (!bSupported)
@@ -2016,10 +2016,10 @@ PixelFormat RageDisplay_Legacy::GetImgPixelFormat( RageSurface* &img, bool &bFre
* it ourself. Just convert it to RGBA8, and let OpenGL convert it back
* down to whatever the actual pixel format is. This is a very slow code
* path, which should almost never be used. */
pixfmt = PixelFormat_RGBA8;
pixfmt = RagePixelFormat_RGBA8;
ASSERT( SupportsSurfaceFormat(pixfmt) );
const PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
const RagePixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
RageSurface *imgconv = CreateSurface( img->w, img->h,
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
@@ -2065,17 +2065,17 @@ void SetPixelMapForSurface( int glImageFormat, int glTexFormat, const RageSurfac
}
unsigned RageDisplay_Legacy::CreateTexture(
PixelFormat pixfmt,
RagePixelFormat pixfmt,
RageSurface* pImg,
bool bGenerateMipMaps )
{
ASSERT( pixfmt < NUM_PixelFormat );
ASSERT( pixfmt < NUM_RagePixelFormat );
/* Find the pixel format of the surface we've been given. */
bool bFreeImg;
PixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, pImg->w, pImg->h, pixfmt == PixelFormat_PAL );
ASSERT( SurfacePixFmt != PixelFormat_Invalid );
RagePixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, pImg->w, pImg->h, pixfmt == RagePixelFormat_PAL );
ASSERT( SurfacePixFmt != RagePixelFormat_Invalid );
GLenum glTexFormat = g_GLPixFmtInfo[pixfmt].internalfmt;
GLenum glImageFormat = g_GLPixFmtInfo[SurfacePixFmt].format;
@@ -2093,10 +2093,10 @@ unsigned RageDisplay_Legacy::CreateTexture(
switch( pixfmt )
{
// OpenGL 1.1 types
case PixelFormat_RGBA8:
case PixelFormat_RGB8:
case PixelFormat_PAL:
case PixelFormat_BGR8:
case RagePixelFormat_RGBA8:
case RagePixelFormat_RGB8:
case RagePixelFormat_PAL:
case RagePixelFormat_BGR8:
break;
// OpenGL 1.2 types
default:
@@ -2129,7 +2129,7 @@ unsigned RageDisplay_Legacy::CreateTexture(
glPixelStorei( GL_UNPACK_ROW_LENGTH, pImg->pitch / pImg->format->BytesPerPixel );
if (pixfmt == PixelFormat_PAL)
if (pixfmt == RagePixelFormat_PAL)
{
/* The texture is paletted; set the texture palette. */
GLubyte palette[256*4];
@@ -2186,7 +2186,7 @@ unsigned RageDisplay_Legacy::CreateTexture(
/* Sanity check: */
if (pixfmt == PixelFormat_PAL)
if (pixfmt == RagePixelFormat_PAL)
{
GLint iSize = 0;
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GLenum(GL_TEXTURE_INDEX_SIZE_EXT), &iSize );
@@ -2290,7 +2290,7 @@ void RageDisplay_Legacy::UpdateTexture(
glBindTexture( GL_TEXTURE_2D, iTexHandle );
bool bFreeImg;
PixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, iWidth, iHeight, false );
RagePixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, iWidth, iHeight, false );
glPixelStorei( GL_UNPACK_ROW_LENGTH, pImg->pitch / pImg->format->BytesPerPixel );
@@ -2606,7 +2606,7 @@ void RageDisplay_Legacy::SetAlphaTest(bool b)
* Another case of this is incomplete packed pixels support. Some implementations
* neglect GL_UNSIGNED_SHORT_*_REV.
*/
bool RageDisplay_Legacy::SupportsSurfaceFormat(PixelFormat pixfmt)
bool RageDisplay_Legacy::SupportsSurfaceFormat(RagePixelFormat pixfmt)
{
switch (g_GLPixFmtInfo[pixfmt].type)
{
@@ -2618,7 +2618,7 @@ bool RageDisplay_Legacy::SupportsSurfaceFormat(PixelFormat pixfmt)
}
bool RageDisplay_Legacy::SupportsTextureFormat(PixelFormat pixfmt, bool bRealtime)
bool RageDisplay_Legacy::SupportsTextureFormat(RagePixelFormat pixfmt, bool bRealtime)
{
/* 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.
+5 -5
View File
@@ -33,7 +33,7 @@ public:
virtual RString GetApiDescription() const { return "OpenGL"; }
virtual void GetDisplayResolutions( DisplayResolutions &out ) const;
void ResolutionChanged();
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
const RagePixelFormatDesc *GetPixelFormatDesc(RagePixelFormat pf) const;
bool SupportsThreadedRendering();
void BeginConcurrentRenderingMainThread();
@@ -45,10 +45,10 @@ public:
void EndFrame();
VideoModeParams GetActualVideoModeParams() const;
void SetBlendMode( BlendMode mode );
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false );
bool SupportsPerVertexMatrixScale();
unsigned CreateTexture(
PixelFormat pixfmt,
RagePixelFormat pixfmt,
RageSurface* img,
bool bGenerateMipMaps );
void UpdateTexture(
@@ -120,8 +120,8 @@ protected:
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut );
RageSurface* CreateScreenshot();
PixelFormat GetImgPixelFormat( RageSurface* &img, bool &FreeImg, int width, int height, bool bPalettedTexture );
bool SupportsSurfaceFormat( PixelFormat pixfmt );
RagePixelFormat GetImgPixelFormat( RageSurface* &img, bool &FreeImg, int width, int height, bool bPalettedTexture );
bool SupportsSurfaceFormat( RagePixelFormat pixfmt );
void SendCurrentMatrices();
};
@@ -64,20 +64,20 @@ void LowLevelWindow_Win32::GetDisplayResolutions( DisplayResolutions &out ) cons
GraphicsWindow::GetDisplayResolutions( out );
}
int ChooseWindowPixelFormat( const VideoModeParams &p, PIXELFORMATDESCRIPTOR *PixelFormat )
int ChooseWindowPixelFormat( const VideoModeParams &p, PIXELFORMATDESCRIPTOR *pixfmt )
{
ASSERT( GraphicsWindow::GetHwnd() != NULL );
ASSERT( GraphicsWindow::GetHDC() != NULL );
ZERO( *PixelFormat );
PixelFormat->nSize = sizeof(PIXELFORMATDESCRIPTOR);
PixelFormat->nVersion = 1;
PixelFormat->dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;
PixelFormat->iPixelType = PFD_TYPE_RGBA;
PixelFormat->cColorBits = p.bpp == 16? 16:24;
PixelFormat->cDepthBits = 16;
ZERO( *pixfmt );
pixfmt->nSize = sizeof(PIXELFORMATDESCRIPTOR);
pixfmt->nVersion = 1;
pixfmt->dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;
pixfmt->iPixelType = PFD_TYPE_RGBA;
pixfmt->cColorBits = p.bpp == 16? 16:24;
pixfmt->cDepthBits = 16;
return ChoosePixelFormat( GraphicsWindow::GetHDC(), PixelFormat );
return ChoosePixelFormat( GraphicsWindow::GetHDC(), pixfmt );
}
void DumpPixelFormat( const PIXELFORMATDESCRIPTOR &pfd )
@@ -148,8 +148,8 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
if( !sErr.empty() )
return sErr;
PIXELFORMATDESCRIPTOR PixelFormat;
int iPixelFormat = ChooseWindowPixelFormat( p, &PixelFormat );
PIXELFORMATDESCRIPTOR pixfmt;
int iPixelFormat = ChooseWindowPixelFormat( p, &pixfmt );
if( iPixelFormat == 0 )
{
/* Destroy the window. */
@@ -201,7 +201,7 @@ RString LowLevelWindow_Win32::TryVideoMode( const VideoModeParams &p, bool &bNew
if( bNeedToSetPixelFormat )
{
/* Set the pixel format. */
if( !SetPixelFormat(GraphicsWindow::GetHDC(), iPixelFormat, &PixelFormat) )
if( !SetPixelFormat(GraphicsWindow::GetHDC(), iPixelFormat, &pixfmt) )
{
/* Destroy the window. */
DestroyGraphicsWindowAndOpenGLContext();
+12 -12
View File
@@ -451,32 +451,32 @@ void MovieTexture_DShow::CreateTexture()
if( m_uTexHandle )
return;
PixelFormat pixfmt;
RagePixelFormat pixfmt;
int depth = TEXTUREMAN->GetPrefs().m_iMovieColorDepth;
switch( depth )
{
default:
FAIL_M(ssprintf("Unsupported movie color depth: %i", depth));
case 16:
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGB5) )
pixfmt = RagePixelFormat_RGB5;
else
pixfmt = PixelFormat_RGBA4; // everything supports RGBA4
pixfmt = RagePixelFormat_RGBA4; // everything supports RGBA4
break;
case 32:
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB8) )
pixfmt = PixelFormat_RGB8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGBA8) )
pixfmt = PixelFormat_RGBA8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGB8) )
pixfmt = RagePixelFormat_RGB8;
else if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGBA8) )
pixfmt = RagePixelFormat_RGBA8;
else if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGB5) )
pixfmt = RagePixelFormat_RGB5;
else
pixfmt = PixelFormat_RGBA4; // everything supports RGBA4
pixfmt = RagePixelFormat_RGBA4; // everything supports RGBA4
break;
}
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
const RageDisplay::RagePixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
RageSurface *img = CreateSurface( m_iTextureWidth, m_iTextureHeight,
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
@@ -179,7 +179,7 @@ static int FindCompatibleAVFormat( bool bHighColor )
continue;
}
PixelFormat pixfmt = DISPLAY->FindPixelFormat( fmt.bpp,
RagePixelFormat pixfmt = DISPLAY->FindPixelFormat( fmt.bpp,
fmt.masks[0],
fmt.masks[1],
fmt.masks[2],
@@ -187,7 +187,7 @@ static int FindCompatibleAVFormat( bool bHighColor )
true /* realtime */
);
if( pixfmt == PixelFormat_Invalid )
if( pixfmt == RagePixelFormat_Invalid )
continue;
return i;
+14 -14
View File
@@ -110,7 +110,7 @@ class RageMovieTexture_Generic_Intermediate : public RageTexture
public:
RageMovieTexture_Generic_Intermediate( RageTextureID ID, int iWidth, int iHeight,
int iImageWidth, int iImageHeight, int iTextureWidth, int iTextureHeight,
RageSurfaceFormat SurfaceFormat, PixelFormat pixfmt ):
RageSurfaceFormat SurfaceFormat, RagePixelFormat pixfmt ):
RageTexture(ID),
m_SurfaceFormat( SurfaceFormat )
{
@@ -170,7 +170,7 @@ private:
unsigned m_uTexHandle;
RageSurfaceFormat m_SurfaceFormat;
PixelFormat m_PixFmt;
RagePixelFormat m_PixFmt;
};
void MovieTexture_Generic::Invalidate()
@@ -222,13 +222,13 @@ void MovieTexture_Generic::CreateTexture()
}
PixelFormat pixfmt = DISPLAY->FindPixelFormat( m_pSurface->format->BitsPerPixel,
RagePixelFormat pixfmt = DISPLAY->FindPixelFormat( m_pSurface->format->BitsPerPixel,
m_pSurface->format->Mask[0],
m_pSurface->format->Mask[1],
m_pSurface->format->Mask[2],
m_pSurface->format->Mask[3] );
if( pixfmt == PixelFormat_Invalid )
if( pixfmt == RagePixelFormat_Invalid )
{
/* We weren't given a natively-supported pixel format. Pick a supported
* one. This is a fallback case, and implies a second conversion. */
@@ -238,22 +238,22 @@ void MovieTexture_Generic::CreateTexture()
default:
FAIL_M(ssprintf("Unsupported movie color depth: %i", depth));
case 16:
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGB5) )
pixfmt = RagePixelFormat_RGB5;
else
pixfmt = PixelFormat_RGBA4;
pixfmt = RagePixelFormat_RGBA4;
break;
case 32:
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB8) )
pixfmt = PixelFormat_RGB8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGBA8) )
pixfmt = PixelFormat_RGBA8;
else if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGB8) )
pixfmt = RagePixelFormat_RGB8;
else if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGBA8) )
pixfmt = RagePixelFormat_RGBA8;
else if( DISPLAY->SupportsTextureFormat(RagePixelFormat_RGB5) )
pixfmt = RagePixelFormat_RGB5;
else
pixfmt = PixelFormat_RGBA4;
pixfmt = RagePixelFormat_RGBA4;
break;
}
}
+3 -3
View File
@@ -44,12 +44,12 @@ MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
CreateFrameRects();
PixelFormat pixfmt = PixelFormat_RGBA4;
RagePixelFormat pixfmt = RagePixelFormat_RGBA4;
if( !DISPLAY->SupportsTextureFormat(pixfmt) )
pixfmt = PixelFormat_RGBA8;
pixfmt = RagePixelFormat_RGBA8;
ASSERT( DISPLAY->SupportsTextureFormat(pixfmt) );
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt );
const RageDisplay::RagePixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt );
RageSurface *img = CreateSurface( size, size, pfd->bpp,
pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
memset( img->pixels, 0, img->pitch*img->h );