NVIDIA: only run and shutdown PCL stats if it has been initialized

This commit is contained in:
Kawe Mazidjatari 2024-09-15 12:45:26 +02:00
parent 7d7c31d4a0
commit ebd89d934f
3 changed files with 15 additions and 3 deletions

View File

@ -16,6 +16,9 @@ static bool s_ReflexModeInfoUpToDate = false;
// If not, the Low Latency SDK will not run.
static NvAPI_Status s_ReflexModeUpdateStatus = NvAPI_Status::NVAPI_OK;
// True if the PCL stats system was initialized.
bool g_PCLStatsAvailable = false;
//-----------------------------------------------------------------------------
// Purpose: enable/disable low latency SDK
// Input : enable -
@ -133,6 +136,9 @@ void GeForce_SetLatencyMarker(IUnknown* const device,
NvAPI_D3D_SetLatencyMarker(device, &params);
}
// PCLStats runs separately and is supported on non-NVIDIA hardware.
PCLSTATS_MARKER(markerType, frameID);
if (g_PCLStatsAvailable)
{
// PCLStats runs separately and is supported on non-NVIDIA hardware.
PCLSTATS_MARKER(markerType, frameID);
}
}

View File

@ -1,6 +1,8 @@
#ifndef GFSDK_REFLEX_H
#define GFSDK_REFLEX_H
extern bool g_PCLStatsAvailable;
void GeForce_EnableLowLatencySDK(const bool enable);
bool GeForce_IsLowLatencySDKEnabled(void);

View File

@ -63,6 +63,8 @@ InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr)
{
Radeon_InitLowLatencySDK();
PCLSTATS_INIT(0);
g_PCLStatsAvailable = true;
}
return CMaterialSystem__Init(thisptr);
@ -77,7 +79,9 @@ int CMaterialSystem::Shutdown(CMaterialSystem* thisptr)
#ifndef MATERIALSYSTEM_NODX
if (s_useLowLatency)
{
PCLSTATS_SHUTDOWN();
if (g_PCLStatsAvailable)
PCLSTATS_SHUTDOWN();
Radeon_ShutdownLowLatencySDK();
}
#endif