mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
NVIDIA: low latency code decouple
This commit is contained in:
parent
6575f80447
commit
f08f9dd4cb
@ -179,6 +179,49 @@ void CEngineAPI::PumpMessages()
|
|||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEngineAPI::UpdateLowLatencyParameters()
|
||||||
|
{
|
||||||
|
#ifndef DEDICATED
|
||||||
|
const bool bUseLowLatencyMode = gfx_nvnUseLowLatency->GetBool();
|
||||||
|
const bool bUseLowLatencyBoost = gfx_nvnUseLowLatencyBoost->GetBool();
|
||||||
|
const bool bUseMarkersToOptimize = gfx_nvnUseMarkersToOptimize->GetBool();
|
||||||
|
|
||||||
|
float fpsMax = fps_max_gfx->GetFloat();
|
||||||
|
|
||||||
|
if (fpsMax == -1.0f)
|
||||||
|
{
|
||||||
|
const float globalFps = fps_max->GetFloat();
|
||||||
|
|
||||||
|
// Make sure the global fps limiter is 'unlimited'
|
||||||
|
// before we let the gfx frame limiter cap it to
|
||||||
|
// the desktop's refresh rate; not adhering to
|
||||||
|
// this will result in a major performance drop.
|
||||||
|
if (globalFps == 0.0f)
|
||||||
|
fpsMax = g_pGame->GetTVRefreshRate();
|
||||||
|
else
|
||||||
|
fpsMax = 0.0f; // Don't let NVIDIA limit the frame rate.
|
||||||
|
}
|
||||||
|
|
||||||
|
GFX_UpdateLowLatencyParameters(D3D11Device(), bUseLowLatencyMode,
|
||||||
|
bUseLowLatencyBoost, bUseMarkersToOptimize, fpsMax);
|
||||||
|
#endif // !DEDICATED
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEngineAPI::RunLowLatencyFrame()
|
||||||
|
{
|
||||||
|
#ifndef DEDICATED
|
||||||
|
if (GFX_IsLowLatencySDKEnabled())
|
||||||
|
{
|
||||||
|
if (GFX_HasPendingLowLatencyParameterUpdates())
|
||||||
|
{
|
||||||
|
UpdateLowLatencyParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
GFX_RunLowLatencyFrame(D3D11Device());
|
||||||
|
}
|
||||||
|
#endif // !DEDICATED
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -197,37 +240,7 @@ bool CEngineAPI::MainLoop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
if (GFX_IsLowLatencySDKEnabled())
|
CEngineAPI::RunLowLatencyFrame();
|
||||||
{
|
|
||||||
if (GFX_HasPendingLowLatencyParameterUpdates())
|
|
||||||
{
|
|
||||||
const bool bUseLowLatencyMode = gfx_nvnUseLowLatency->GetBool();
|
|
||||||
const bool bUseLowLatencyBoost = gfx_nvnUseLowLatencyBoost->GetBool();
|
|
||||||
const bool bUseMarkersToOptimize = gfx_nvnUseMarkersToOptimize->GetBool();
|
|
||||||
|
|
||||||
float fpsMax = fps_max_gfx->GetFloat();
|
|
||||||
|
|
||||||
if (fpsMax == -1.0f)
|
|
||||||
{
|
|
||||||
const float globalFps = fps_max->GetFloat();
|
|
||||||
|
|
||||||
// Make sure the global fps limiter is 'unlimited'
|
|
||||||
// before we let the gfx frame limiter cap it to
|
|
||||||
// the desktop's refresh rate; not adhering to
|
|
||||||
// this will result in a major performance drop.
|
|
||||||
if (globalFps == 0.0f)
|
|
||||||
fpsMax = g_pGame->GetTVRefreshRate();
|
|
||||||
else
|
|
||||||
fpsMax = 0.0f; // Don't let NVIDIA limit the frame rate.
|
|
||||||
}
|
|
||||||
|
|
||||||
GFX_UpdateLowLatencyParameters(D3D11Device(), bUseLowLatencyMode,
|
|
||||||
bUseLowLatencyBoost, bUseMarkersToOptimize, fpsMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
GFX_RunLowLatencyFrame(D3D11Device());
|
|
||||||
}
|
|
||||||
|
|
||||||
CEngineAPI::PumpMessages();
|
CEngineAPI::PumpMessages();
|
||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
|
|
||||||
|
@ -35,6 +35,9 @@ public:
|
|||||||
static void VSetStartupInfo(CEngineAPI* pEngineAPI, StartupInfo_t* pStartupInfo);
|
static void VSetStartupInfo(CEngineAPI* pEngineAPI, StartupInfo_t* pStartupInfo);
|
||||||
|
|
||||||
static void PumpMessages();
|
static void PumpMessages();
|
||||||
|
static void RunLowLatencyFrame();
|
||||||
|
static void UpdateLowLatencyParameters();
|
||||||
|
|
||||||
static bool MainLoop();
|
static bool MainLoop();
|
||||||
//private:
|
//private:
|
||||||
void* m_hEditorHWnd;
|
void* m_hEditorHWnd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user