NVIDIA: rename Reflex function prefixes

Prevent ambiguity when AMD Anti-Lag 2 is implemented.
This commit is contained in:
Kawe Mazidjatari 2024-09-13 21:29:25 +02:00
parent ae60220a00
commit d399b486b6
10 changed files with 36 additions and 36 deletions

View File

@ -79,7 +79,7 @@ void FrameStageNotify_Post(const ClientFrameStage_t frameStage)
case ClientFrameStage_t::FRAME_RENDER_START: case ClientFrameStage_t::FRAME_RENDER_START:
break; break;
case ClientFrameStage_t::FRAME_RENDER_END: case ClientFrameStage_t::FRAME_RENDER_END:
GFX_SetLatencyMarker(D3D11Device(), SIMULATION_END, MaterialSystem()->GetCurrentFrameCount()); GeForce_SetLatencyMarker(D3D11Device(), SIMULATION_END, MaterialSystem()->GetCurrentFrameCount());
break; break;
case ClientFrameStage_t::FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE: case ClientFrameStage_t::FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE:
break; break;

View File

@ -17,7 +17,7 @@ static ConVar r_drawWorldMeshesDepthAtTheEnd("r_drawWorldMeshesDepthAtTheEnd", "
void* R_DrawDepthOfField(const float scalar) void* R_DrawDepthOfField(const float scalar)
{ {
GFX_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_START, MaterialSystem()->GetCurrentFrameCount()); GeForce_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_START, MaterialSystem()->GetCurrentFrameCount());
return V_DrawDepthOfField(scalar); return V_DrawDepthOfField(scalar);
} }

View File

@ -48,7 +48,7 @@ void Host_CountRealTimePackets()
{ {
v_Host_CountRealTimePackets(); v_Host_CountRealTimePackets();
#ifndef DEDICATED #ifndef DEDICATED
GFX_SetLatencyMarker(D3D11Device(), SIMULATION_START, MaterialSystem()->GetCurrentFrameCount()); GeForce_SetLatencyMarker(D3D11Device(), SIMULATION_START, MaterialSystem()->GetCurrentFrameCount());
#endif // !DEDICATED #endif // !DEDICATED
} }

View File

@ -23,7 +23,7 @@ bool Input_Event(const InputEvent_t& inputEvent, const int noKeyUpCheck)
if (runTriggerMarker && (inputEvent.m_nType != IE_ButtonReleased || keyInfo.m_bTrapKeyUp)) if (runTriggerMarker && (inputEvent.m_nType != IE_ButtonReleased || keyInfo.m_bTrapKeyUp))
{ {
GFX_SetLatencyMarker(D3D11Device(), TRIGGER_FLASH, MaterialSystem()->GetCurrentFrameCount()); GeForce_SetLatencyMarker(D3D11Device(), TRIGGER_FLASH, MaterialSystem()->GetCurrentFrameCount());
} }
return v_Input_Event(inputEvent, noKeyUpCheck); return v_Input_Event(inputEvent, noKeyUpCheck);

View File

@ -179,10 +179,10 @@ void CEngineAPI::PumpMessages()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void GFX_NVN_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue, ChangeUserData_t pUserData) static void GFX_NVN_Changed_f(IConVar* pConVar, const char* pOldString, float flOldValue, ChangeUserData_t pUserData)
{ {
GFX_MarkLowLatencyParametersOutOfDate(); GeForce_MarkLowLatencyParametersOutOfDate();
} }
static ConVar fps_max_gfx("fps_max_gfx", "0", FCVAR_RELEASE, "Frame rate limiter using NVIDIA Reflex Low Latency SDK. -1 indicates the use of desktop refresh. 0 is disabled.", true, -1.f, true, 295.f, GFX_NVN_Changed_f); static ConVar fps_max_gfx("fps_max_nvn", "0", FCVAR_RELEASE, "Frame rate limiter using NVIDIA Reflex Low Latency SDK. -1 indicates the use of desktop refresh. 0 is disabled.", true, -1.f, true, 295.f, GFX_NVN_Changed_f);
static ConVar gfx_nvnUseLowLatency("gfx_nvnUseLowLatency", "1", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency SDK.", GFX_NVN_Changed_f); static ConVar gfx_nvnUseLowLatency("gfx_nvnUseLowLatency", "1", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency SDK.", GFX_NVN_Changed_f);
static ConVar gfx_nvnUseLowLatencyBoost("gfx_nvnUseLowLatencyBoost", "0", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency Boost.", GFX_NVN_Changed_f); static ConVar gfx_nvnUseLowLatencyBoost("gfx_nvnUseLowLatencyBoost", "0", FCVAR_RELEASE | FCVAR_ARCHIVE, "Enables NVIDIA Reflex Low Latency Boost.", GFX_NVN_Changed_f);
@ -213,7 +213,7 @@ void CEngineAPI::UpdateLowLatencyParameters()
fpsMax = 0.0f; // Don't let NVIDIA limit the frame rate. fpsMax = 0.0f; // Don't let NVIDIA limit the frame rate.
} }
GFX_UpdateLowLatencyParameters(D3D11Device(), bUseLowLatencyMode, GeForce_UpdateLowLatencyParameters(D3D11Device(), bUseLowLatencyMode,
bUseLowLatencyBoost, bUseMarkersToOptimize, fpsMax); bUseLowLatencyBoost, bUseMarkersToOptimize, fpsMax);
#endif // !DEDICATED #endif // !DEDICATED
} }
@ -221,14 +221,14 @@ void CEngineAPI::UpdateLowLatencyParameters()
void CEngineAPI::RunLowLatencyFrame() void CEngineAPI::RunLowLatencyFrame()
{ {
#ifndef DEDICATED #ifndef DEDICATED
if (GFX_IsLowLatencySDKEnabled()) if (GeForce_IsLowLatencySDKEnabled())
{ {
if (GFX_HasPendingLowLatencyParameterUpdates()) if (GeForce_HasPendingLowLatencyParameterUpdates())
{ {
UpdateLowLatencyParameters(); UpdateLowLatencyParameters();
} }
GFX_RunLowLatencyFrame(D3D11Device()); GeForce_RunLowLatencyFrame(D3D11Device());
} }
#endif // !DEDICATED #endif // !DEDICATED
} }

View File

@ -20,7 +20,7 @@ static NvAPI_Status s_ReflexModeUpdateStatus = NvAPI_Status::NVAPI_OK;
// Purpose: enable/disable low latency SDK // Purpose: enable/disable low latency SDK
// Input : enable - // Input : enable -
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void GFX_EnableLowLatencySDK(const bool enable) void GeForce_EnableLowLatencySDK(const bool enable)
{ {
s_LowLatencySDKEnabled = enable; s_LowLatencySDKEnabled = enable;
} }
@ -28,7 +28,7 @@ void GFX_EnableLowLatencySDK(const bool enable)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: whether we should run the low latency SDK // Purpose: whether we should run the low latency SDK
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool GFX_IsLowLatencySDKEnabled(void) bool GeForce_IsLowLatencySDKEnabled(void)
{ {
if (!s_LowLatencySDKEnabled) if (!s_LowLatencySDKEnabled)
return false; return false;
@ -42,7 +42,7 @@ bool GFX_IsLowLatencySDKEnabled(void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: mark the parameters as out-of-date; force update next frame // Purpose: mark the parameters as out-of-date; force update next frame
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void GFX_MarkLowLatencyParametersOutOfDate(void) void GeForce_MarkLowLatencyParametersOutOfDate(void)
{ {
s_ReflexModeInfoUpToDate = false; s_ReflexModeInfoUpToDate = false;
} }
@ -50,7 +50,7 @@ void GFX_MarkLowLatencyParametersOutOfDate(void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: mark the parameters as up-to-date // Purpose: mark the parameters as up-to-date
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void GFX_MarkLowLatencyParametersUpToDate(void) void GeForce_MarkLowLatencyParametersUpToDate(void)
{ {
s_ReflexModeInfoUpToDate = true; s_ReflexModeInfoUpToDate = true;
} }
@ -58,7 +58,7 @@ void GFX_MarkLowLatencyParametersUpToDate(void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: has the user requested any changes to the low latency parameters? // Purpose: has the user requested any changes to the low latency parameters?
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool GFX_HasPendingLowLatencyParameterUpdates(void) bool GeForce_HasPendingLowLatencyParameterUpdates(void)
{ {
return s_ReflexModeInfoUpToDate == false; return s_ReflexModeInfoUpToDate == false;
} }
@ -66,7 +66,7 @@ bool GFX_HasPendingLowLatencyParameterUpdates(void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: returns whether the call to 'NvAPI_D3D_SetSleepMode' was successful // Purpose: returns whether the call to 'NvAPI_D3D_SetSleepMode' was successful
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool GFX_ParameterUpdateWasSuccessful(void) bool GeForce_ParameterUpdateWasSuccessful(void)
{ {
return s_ReflexModeUpdateStatus == NvAPI_Status::NVAPI_OK; return s_ReflexModeUpdateStatus == NvAPI_Status::NVAPI_OK;
} }
@ -79,7 +79,7 @@ bool GFX_ParameterUpdateWasSuccessful(void)
// useMarkersToOptimize - // useMarkersToOptimize -
// maxFramesPerSecond - // maxFramesPerSecond -
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void GFX_UpdateLowLatencyParameters(IUnknown* const device, const bool useLowLatencyMode, void GeForce_UpdateLowLatencyParameters(IUnknown* const device, const bool useLowLatencyMode,
const bool useLowLatencyBoost, const bool useMarkersToOptimize, const bool useLowLatencyBoost, const bool useMarkersToOptimize,
const float maxFramesPerSecond) const float maxFramesPerSecond)
{ {
@ -97,18 +97,18 @@ void GFX_UpdateLowLatencyParameters(IUnknown* const device, const bool useLowLat
params.bUseMarkersToOptimize = useMarkersToOptimize; params.bUseMarkersToOptimize = useMarkersToOptimize;
s_ReflexModeUpdateStatus = NvAPI_D3D_SetSleepMode(device, &params); s_ReflexModeUpdateStatus = NvAPI_D3D_SetSleepMode(device, &params);
GFX_MarkLowLatencyParametersUpToDate(); GeForce_MarkLowLatencyParametersUpToDate();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: runs a frame of the low latency sdk // Purpose: runs a frame of the low latency sdk
// Input : *device - // Input : *device -
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void GFX_RunLowLatencyFrame(IUnknown* const device) void GeForce_RunLowLatencyFrame(IUnknown* const device)
{ {
Assert(device); Assert(device);
if (GFX_ParameterUpdateWasSuccessful()) if (GeForce_ParameterUpdateWasSuccessful())
NvAPI_D3D_Sleep(device); NvAPI_D3D_Sleep(device);
} }
@ -118,12 +118,12 @@ void GFX_RunLowLatencyFrame(IUnknown* const device)
// frameNumber - // frameNumber -
// markerType - // markerType -
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void GFX_SetLatencyMarker(IUnknown* const device, void GeForce_SetLatencyMarker(IUnknown* const device,
const NV_LATENCY_MARKER_TYPE markerType, const NvU64 frameID) const NV_LATENCY_MARKER_TYPE markerType, const NvU64 frameID)
{ {
Assert(device); Assert(device);
if (GFX_ParameterUpdateWasSuccessful() && GFX_IsLowLatencySDKEnabled()) if (GeForce_ParameterUpdateWasSuccessful() && GeForce_IsLowLatencySDKEnabled())
{ {
NV_LATENCY_MARKER_PARAMS params = {}; NV_LATENCY_MARKER_PARAMS params = {};
params.version = NV_LATENCY_MARKER_PARAMS_VER1; params.version = NV_LATENCY_MARKER_PARAMS_VER1;

View File

@ -1,19 +1,19 @@
#ifndef GFSDK_REFLEX_H #ifndef GFSDK_REFLEX_H
#define GFSDK_REFLEX_H #define GFSDK_REFLEX_H
void GFX_EnableLowLatencySDK(const bool enable); void GeForce_EnableLowLatencySDK(const bool enable);
bool GFX_IsLowLatencySDKEnabled(void); bool GeForce_IsLowLatencySDKEnabled(void);
void GFX_MarkLowLatencyParametersOutOfDate(void); void GeForce_MarkLowLatencyParametersOutOfDate(void);
bool GFX_HasPendingLowLatencyParameterUpdates(void); bool GeForce_HasPendingLowLatencyParameterUpdates(void);
void GFX_UpdateLowLatencyParameters(IUnknown* device, const bool useLowLatencyMode, void GeForce_UpdateLowLatencyParameters(IUnknown* device, const bool useLowLatencyMode,
const bool useLowLatencyBoost, const bool useMarkersToOptimize, const bool useLowLatencyBoost, const bool useMarkersToOptimize,
const float maxFramesPerSecond); const float maxFramesPerSecond);
void GFX_RunLowLatencyFrame(IUnknown* device); void GeForce_RunLowLatencyFrame(IUnknown* device);
void GFX_SetLatencyMarker(IUnknown* device, void GeForce_SetLatencyMarker(IUnknown* device,
const NV_LATENCY_MARKER_TYPE markerType, const NvU64 frameID); const NV_LATENCY_MARKER_TYPE markerType, const NvU64 frameID);
#endif // GFSDK_REFLEX_H #endif // GFSDK_REFLEX_H

View File

@ -27,7 +27,7 @@ LRESULT CInputSystem::WindowProc(void* unused, HWND hwnd, UINT uMsg, WPARAM wPar
{ {
if (PCLSTATS_IS_PING_MSG_ID(uMsg)) if (PCLSTATS_IS_PING_MSG_ID(uMsg))
{ {
GFX_SetLatencyMarker(D3D11Device(), PC_LATENCY_PING, MaterialSystem()->GetCurrentFrameCount()); GeForce_SetLatencyMarker(D3D11Device(), PC_LATENCY_PING, MaterialSystem()->GetCurrentFrameCount());
} }
} }

View File

@ -49,9 +49,9 @@ InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr)
return INIT_FAILED; return INIT_FAILED;
#else #else
// Initialize as usual. // Initialize as usual.
GFX_EnableLowLatencySDK(!CommandLine()->CheckParm("-gfx_nvnDisableLowLatency")); GeForce_EnableLowLatencySDK(!CommandLine()->CheckParm("-gfx_nvnDisableLowLatency"));
if (GFX_IsLowLatencySDKEnabled()) if (GeForce_IsLowLatencySDKEnabled())
{ {
PCLSTATS_INIT(0); PCLSTATS_INIT(0);
} }
@ -66,7 +66,7 @@ InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr)
int CMaterialSystem::Shutdown(CMaterialSystem* thisptr) int CMaterialSystem::Shutdown(CMaterialSystem* thisptr)
{ {
#ifndef MATERIALSYSTEM_NODX #ifndef MATERIALSYSTEM_NODX
if (GFX_IsLowLatencySDKEnabled()) if (GeForce_IsLowLatencySDKEnabled())
{ {
PCLSTATS_SHUTDOWN(); PCLSTATS_SHUTDOWN();
} }

View File

@ -119,11 +119,11 @@ HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT n
// for simulation start/end and render submit start. The render thread (here) // for simulation start/end and render submit start. The render thread (here)
// continues after to finish the frame. // continues after to finish the frame.
const NvU64 frameID = (NvU64)MaterialSystem()->GetCurrentFrameCount() - 1; const NvU64 frameID = (NvU64)MaterialSystem()->GetCurrentFrameCount() - 1;
GFX_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_END, frameID); GeForce_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_END, frameID);
GFX_SetLatencyMarker(D3D11Device(), PRESENT_START, frameID); GeForce_SetLatencyMarker(D3D11Device(), PRESENT_START, frameID);
const HRESULT result = s_fnSwapChainPresent(pSwapChain, nSyncInterval, nFlags); const HRESULT result = s_fnSwapChainPresent(pSwapChain, nSyncInterval, nFlags);
GFX_SetLatencyMarker(D3D11Device(), PRESENT_END, frameID); GeForce_SetLatencyMarker(D3D11Device(), PRESENT_END, frameID);
return result; return result;
} }