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