Take into account television refresh rates

TV's tend to output @59.939999 FPS, set out frame limiter's to that if FPS happens to be 59 or 60.
This commit is contained in:
Kawe Mazidjatari 2023-09-11 22:48:28 +02:00
parent 1baaf25929
commit 85de096f98
3 changed files with 6 additions and 17 deletions

View File

@ -83,16 +83,7 @@ void CFrameLimit::Run(void)
// the desktop's refresh rate; not adhering to
// this will result in a major performance drop.
if (globalFps == 0.0f && targetFps == -1)
{
float desktopRefreshRate = (float)g_pGame->GetDesktopRefreshRate();
//if (dekstopRefreshRate == 59.0f || dekstopRefreshRate == 60.0f)
//{
// desktopRefreshRate = 59.939999f;
//}
targetFps = desktopRefreshRate;
}
targetFps = g_pGame->GetTVRefreshRate();
if (m_FramesPerSecond != targetFps)
Reset(targetFps);

View File

@ -186,13 +186,9 @@ bool CEngineAPI::MainLoop()
// the desktop's refresh rate; not adhering to
// this will result in a major performance drop.
if (globalFps == 0.0f)
{
fpsMax = (float)g_pGame->GetDesktopRefreshRate();
}
else // Don't let NVIDIA limit the frame rate.
{
fpsMax = 0.0f;
}
fpsMax = g_pGame->GetTVRefreshRate();
else
fpsMax = 0.0f; // Don't let NVIDIA limit the frame rate.
}
NV_SET_SLEEP_MODE_PARAMS_V1 params = {};

View File

@ -30,6 +30,8 @@ public:
inline int GetDesktopWidth() const { return m_iDesktopWidth; }
inline int GetDesktopHeight() const { return m_iDesktopHeight; }
inline int GetDesktopRefreshRate() const { return m_iDesktopRefreshRate; }
inline float GetTVRefreshRate() const // Avoid stutter on TV's running on broadcast frame rates.
{ return ((float)m_iDesktopRefreshRate == 59.0f || (float)m_iDesktopRefreshRate == 60.0f) ? 59.939999f : (float)m_iDesktopRefreshRate; }
private:
HWND m_hWindow;