Only run NVIDIA Reflex if the display driver vendor is NVIDIA

This is to ensure we don't cause any performance hits when running the game on an AMD or Intel GPU.
This commit is contained in:
Kawe Mazidjatari 2023-09-13 22:24:59 +02:00
parent a639a4befd
commit eaa5347fa3

View File

@ -17,6 +17,7 @@
#include "engine/traceinit.h"
#ifndef DEDICATED
#include "engine/sys_mainwind.h"
#include "materialsystem/cmaterialsystem.h"
#include "windows/id3dx.h"
#include "client/vengineclient_impl.h"
#include "geforce/reflex.h"
@ -183,32 +184,40 @@ bool CEngineAPI::MainLoop()
}
#ifndef DEDICATED
if (GFX_HasPendingLowLatencyParameterUpdates())
const MaterialAdapterInfo_t& adapterInfo = g_pMaterialAdapterMgr->GetAdapterInfo();
// Only run on NVIDIA display drivers; AMD and Intel are not
// supported by NVIDIA Reflex.
if (adapterInfo.m_VendorID == NVIDIA_VENDOR_ID)
{
const bool bUseLowLatencyMode = gfx_nvnUseLowLatency->GetBool();
const bool bUseLowLatencyBoost = gfx_nvnUseLowLatencyBoost->GetBool();
float fpsMax = fps_max_gfx->GetFloat();
if (fpsMax == -1.0f)
if (GFX_HasPendingLowLatencyParameterUpdates())
{
const float globalFps = fps_max->GetFloat();
const bool bUseLowLatencyMode = gfx_nvnUseLowLatency->GetBool();
const bool bUseLowLatencyBoost = gfx_nvnUseLowLatencyBoost->GetBool();
// 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.
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, false, fpsMax);
}
GFX_UpdateLowLatencyParameters(D3D11Device(), bUseLowLatencyMode,
bUseLowLatencyBoost, false, fpsMax);
GFX_RunLowLatencyFrame(D3D11Device());
}
GFX_RunLowLatencyFrame(D3D11Device());
CEngineAPI::PumpMessages();
#endif // !DEDICATED