GetVideoModeParams -> GetActualVideoModeParams

add GetApiDescription
This commit is contained in:
Chris Danford
2005-11-11 21:16:48 +00:00
parent 4d8ab8a6f6
commit 182232344f
15 changed files with 45 additions and 36 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ static void CheckGameLoopTimerSkips( float fDeltaTime )
/* If vsync is on, and we have a solid framerate (vsync == refresh and we've sustained this
* for at least one second), we expect the amount of time for the last frame to be 1/FPS. */
if( iThisFPS != DISPLAY->GetVideoModeParams().rate || iThisFPS != iLastFPS )
if( iThisFPS != DISPLAY->GetActualVideoModeParams().rate || iThisFPS != iLastFPS )
{
iLastFPS = iThisFPS;
return;
+1 -1
View File
@@ -433,7 +433,7 @@ float GameSoundManager::GetFrameTimingAdjustment( float fDeltaTime )
static int iLastFPS = 0;
int iThisFPS = DISPLAY->GetFPS();
if( iThisFPS != DISPLAY->GetVideoModeParams().rate || iThisFPS != iLastFPS )
if( iThisFPS != DISPLAY->GetActualVideoModeParams().rate || iThisFPS != iLastFPS )
{
iLastFPS = iThisFPS;
return 0;
+2 -2
View File
@@ -629,8 +629,8 @@ bool RageDisplay::SaveScreenshot( CString sPath, GraphicsFileFormat format )
if( format != SAVE_LOSSLESS )
{
/* Maintain the DAR. */
int iWidth = lrintf( 640 / GetVideoModeParams().fDisplayAspectRatio );
LOG->Trace( "%ix%i -> %ix%i (%.3f)", surface->w, surface->h, 640, iWidth, GetVideoModeParams().fDisplayAspectRatio );
int iWidth = lrintf( 640 / GetActualVideoModeParams().fDisplayAspectRatio );
LOG->Trace( "%ix%i -> %ix%i (%.3f)", surface->w, surface->h, 640, iWidth, GetActualVideoModeParams().fDisplayAspectRatio );
RageSurfaceUtils::Zoom( surface, 640, iWidth );
}
+4 -2
View File
@@ -133,6 +133,8 @@ public:
/* This is needed or the overridden classes' dtors will not be called. */
virtual ~RageDisplay() { }
virtual CString GetApiDescription() = 0;
// Don't override this. Override TryVideoMode() instead.
// This will set the video mode to be as close as possible to params.
// Return true if device was re-created and we need to reload textures.
@@ -143,8 +145,8 @@ public:
virtual bool BeginFrame() = 0;
virtual void EndFrame();
virtual VideoModeParams GetVideoModeParams() const = 0;
bool IsWindowed() const { return this->GetVideoModeParams().windowed; }
virtual VideoModeParams GetActualVideoModeParams() const = 0;
bool IsWindowed() const { return this->GetActualVideoModeParams().windowed; }
virtual void SetBlendMode( BlendMode mode ) = 0;
+2 -1
View File
@@ -10,12 +10,13 @@ public:
~RageDisplay_D3D();
CString Init( VideoModeParams p );
virtual CString GetApiDescription() { return "D3D"; }
void ResolutionChanged();
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
bool BeginFrame();
void EndFrame();
VideoModeParams GetVideoModeParams() const;
VideoModeParams GetActualVideoModeParams() const;
void SetBlendMode( BlendMode mode );
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
bool SupportsThreadedRendering();
+2 -1
View File
@@ -8,12 +8,13 @@ class RageDisplay_Null: public RageDisplay
public:
RageDisplay_Null( VideoModeParams p );
virtual CString GetApiDescription() { return "Null"; }
void ResolutionChanged() { }
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
bool BeginFrame() { return true; }
void EndFrame();
VideoModeParams GetVideoModeParams() const { return m_Params; }
VideoModeParams GetActualVideoModeParams() const { return m_Params; }
void SetBlendMode( BlendMode mode ) { }
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ) { return true; }
bool SupportsPerVertexMatrixScale() { return false; }
+15 -12
View File
@@ -706,10 +706,10 @@ void RageDisplay_OGL::SetViewport(int shift_left, int shift_down)
{
/* left and down are on a 0..SCREEN_WIDTH, 0..SCREEN_HEIGHT scale.
* Scale them to the actual viewport range. */
shift_left = int( shift_left * float(wind->GetVideoModeParams().width) / SCREEN_WIDTH );
shift_down = int( shift_down * float(wind->GetVideoModeParams().height) / SCREEN_HEIGHT );
shift_left = int( shift_left * float(wind->GetActualVideoModeParams().width) / SCREEN_WIDTH );
shift_down = int( shift_down * float(wind->GetActualVideoModeParams().height) / SCREEN_HEIGHT );
glViewport(shift_left, -shift_down, wind->GetVideoModeParams().width, wind->GetVideoModeParams().height);
glViewport(shift_left, -shift_down, wind->GetActualVideoModeParams().width, wind->GetActualVideoModeParams().height);
}
int RageDisplay_OGL::GetMaxTextureSize() const
@@ -777,8 +777,8 @@ void RageDisplay_OGL::EndFrame()
RageSurface* RageDisplay_OGL::CreateScreenshot()
{
int width = wind->GetVideoModeParams().width;
int height = wind->GetVideoModeParams().height;
int width = wind->GetActualVideoModeParams().width;
int height = wind->GetActualVideoModeParams().height;
const PixelFormatDesc &desc = PIXEL_FORMAT_DESC[PixelFormat_RGBA8];
RageSurface *image = CreateSurface( width, height, desc.bpp,
@@ -789,7 +789,7 @@ RageSurface* RageDisplay_OGL::CreateScreenshot()
glReadBuffer( GL_FRONT );
AssertNoGLError();
glReadPixels(0, 0, wind->GetVideoModeParams().width, wind->GetVideoModeParams().height, GL_RGBA,
glReadPixels(0, 0, wind->GetActualVideoModeParams().width, wind->GetActualVideoModeParams().height, GL_RGBA,
GL_UNSIGNED_BYTE, image->pixels);
AssertNoGLError();
@@ -798,7 +798,10 @@ RageSurface* RageDisplay_OGL::CreateScreenshot()
return image;
}
VideoModeParams RageDisplay_OGL::GetVideoModeParams() const { return wind->GetVideoModeParams(); }
VideoModeParams RageDisplay_OGL::GetActualVideoModeParams() const
{
return wind->GetActualVideoModeParams();
}
static void SetupVertices( const RageSpriteVertex v[], int iNumVerts )
{
@@ -1334,7 +1337,7 @@ void RageDisplay_OGL::DrawLineStripInternal( const RageSpriteVertex v[], int iNu
{
TurnOffHardwareVBO();
if( !GetVideoModeParams().bSmoothLines )
if( !GetActualVideoModeParams().bSmoothLines )
{
/* Fall back on the generic polygon-based line strip. */
RageDisplay::DrawLineStripInternal(v, iNumVerts, LineWidth );
@@ -1351,8 +1354,8 @@ void RageDisplay_OGL::DrawLineStripInternal( const RageSpriteVertex v[], int iNu
/* Our line width is wrt the regular internal SCREEN_WIDTHxSCREEN_HEIGHT screen,
* but these width functions actually want raster sizes (that is, actual pixels).
* Scale the line width and point size by the average ratio of the scale. */
float WidthVal = float(wind->GetVideoModeParams().width) / SCREEN_WIDTH;
float HeightVal = float(wind->GetVideoModeParams().height) / SCREEN_HEIGHT;
float WidthVal = float(wind->GetActualVideoModeParams().width) / SCREEN_WIDTH;
float HeightVal = float(wind->GetActualVideoModeParams().height) / SCREEN_HEIGHT;
LineWidth *= (WidthVal + HeightVal) / 2;
/* Clamp the width to the hardware max for both lines and points (whichever
@@ -1787,7 +1790,7 @@ unsigned RageDisplay_OGL::CreateTexture(
GLint minFilter;
if( bGenerateMipMaps )
{
if( wind->GetVideoModeParams().bTrilinearFiltering )
if( wind->GetActualVideoModeParams().bTrilinearFiltering )
minFilter = GL_LINEAR_MIPMAP_LINEAR;
else
minFilter = GL_LINEAR_MIPMAP_NEAREST;
@@ -1798,7 +1801,7 @@ unsigned RageDisplay_OGL::CreateTexture(
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
if( wind->GetVideoModeParams().bAnisotropicFiltering &&
if( wind->GetActualVideoModeParams().bAnisotropicFiltering &&
GLExt.HasExtension("GL_EXT_texture_filter_anisotropic") )
{
GLfloat largest_supported_anisotropy;
+2 -1
View File
@@ -10,13 +10,14 @@ public:
virtual ~RageDisplay_OGL();
CString Init( VideoModeParams p, bool bAllowUnacceleratedRenderer );
virtual CString GetApiDescription() { return "OpenGL"; }
bool IsSoftwareRenderer();
void ResolutionChanged();
const PixelFormatDesc *GetPixelFormatDesc(PixelFormat pf) const;
bool BeginFrame();
void EndFrame();
VideoModeParams GetVideoModeParams() const;
VideoModeParams GetActualVideoModeParams() const;
void SetBlendMode( BlendMode mode );
bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false );
bool SupportsPerVertexMatrixScale();
+9 -8
View File
@@ -112,14 +112,15 @@ void GetPreferredVideoModeParams( VideoModeParams &paramsOut )
static void StoreActualGraphicOptions( bool initial )
{
// find out what we actually have
PREFSMAN->m_bWindowed.Set( DISPLAY->GetVideoModeParams().windowed );
PREFSMAN->m_iDisplayWidth.Set( DISPLAY->GetVideoModeParams().width );
PREFSMAN->m_iDisplayHeight.Set( DISPLAY->GetVideoModeParams().height );
PREFSMAN->m_iDisplayColorDepth.Set( DISPLAY->GetVideoModeParams().bpp );
PREFSMAN->m_iRefreshRate.Set( DISPLAY->GetVideoModeParams().rate );
PREFSMAN->m_bVsync.Set( DISPLAY->GetVideoModeParams().vsync );
PREFSMAN->m_bWindowed .Set( DISPLAY->GetActualVideoModeParams().windowed );
PREFSMAN->m_iDisplayWidth .Set( DISPLAY->GetActualVideoModeParams().width );
PREFSMAN->m_iDisplayHeight .Set( DISPLAY->GetActualVideoModeParams().height );
PREFSMAN->m_iDisplayColorDepth .Set( DISPLAY->GetActualVideoModeParams().bpp );
PREFSMAN->m_iRefreshRate .Set( DISPLAY->GetActualVideoModeParams().rate );
PREFSMAN->m_bVsync .Set( DISPLAY->GetActualVideoModeParams().vsync );
CString log = ssprintf("%s %dx%d %d color %d texture %dHz %s %s",
CString log = ssprintf("%s %s %dx%d %d color %d texture %dHz %s %s",
DISPLAY->GetApiDescription().c_str(),
PREFSMAN->m_bWindowed ? "Windowed" : "Fullscreen",
(int)PREFSMAN->m_iDisplayWidth,
(int)PREFSMAN->m_iDisplayHeight,
@@ -133,7 +134,7 @@ static void StoreActualGraphicOptions( bool initial )
else
SCREENMAN->SystemMessage( log );
Dialog::SetWindowed( DISPLAY->GetVideoModeParams().windowed );
Dialog::SetWindowed( DISPLAY->GetActualVideoModeParams().windowed );
}
RageDisplay *CreateDisplay();
@@ -20,7 +20,7 @@ public:
virtual void SwapBuffers() = 0;
virtual void Update() { }
virtual VideoModeParams GetVideoModeParams() const = 0;
virtual VideoModeParams GetActualVideoModeParams() const = 0;
};
#endif
@@ -217,7 +217,7 @@ void LowLevelWindow_SDL::Update()
break;
if( event.active.gain && // app regaining focus
!DISPLAY->GetVideoModeParams().windowed ) // full screen
!DISPLAY->GetActualVideoModeParams().windowed ) // full screen
{
// need to reacquire an OGL context
/* This hasn't been done in a long time, since HandleSDLEvents was
@@ -225,7 +225,7 @@ void LowLevelWindow_SDL::Update()
* it resulted in input not being regained and textures being erased,
* so I left it disabled; but this might be needed on some cards (with
* the above fixed) ... */
// DISPLAY->SetVideoMode( DISPLAY->GetVideoModeParams() );
// DISPLAY->SetVideoMode( DISPLAY->GetActualVideoModeParams() );
}
{
@@ -13,7 +13,7 @@ public:
void SwapBuffers();
void Update();
VideoModeParams GetVideoModeParams() const { return CurrentParams; }
VideoModeParams GetActualVideoModeParams() const { return CurrentParams; }
private:
VideoModeParams CurrentParams;
@@ -221,7 +221,7 @@ void LowLevelWindow_Win32::Update()
GraphicsWindow::Update();
}
VideoModeParams LowLevelWindow_Win32::GetVideoModeParams() const
VideoModeParams LowLevelWindow_Win32::GetActualVideoModeParams() const
{
VideoModeParams p;
GraphicsWindow::GetParams( p );
@@ -13,7 +13,7 @@ public:
void SwapBuffers();
void Update();
VideoModeParams GetVideoModeParams() const;
VideoModeParams GetActualVideoModeParams() const;
};
#ifdef ARCH_LOW_LEVEL_WINDOW
@@ -15,7 +15,7 @@ public:
CString TryVideoMode(VideoModeParams p, bool &bNewDeviceOut);
void SwapBuffers();
VideoModeParams GetVideoModeParams() const { return CurrentParams; }
VideoModeParams GetActualVideoModeParams() const { return CurrentParams; }
private:
bool m_bWindowIsOpen;