From d399b486b6d97b4106ac08e4c1d0d9d56709e6af Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 13 Sep 2024 21:29:25 +0200 Subject: [PATCH] NVIDIA: rename Reflex function prefixes Prevent ambiguity when AMD Anti-Lag 2 is implemented. --- src/engine/client/cdll_engine_int.cpp | 2 +- src/engine/gl_rsurf.cpp | 2 +- src/engine/host.cpp | 2 +- src/engine/keys.cpp | 2 +- src/engine/sys_dll2.cpp | 12 ++++++------ src/geforce/reflex.cpp | 24 ++++++++++++------------ src/geforce/reflex.h | 14 +++++++------- src/inputsystem/inputsystem.cpp | 2 +- src/materialsystem/cmaterialsystem.cpp | 6 +++--- src/windows/id3dx.cpp | 6 +++--- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/engine/client/cdll_engine_int.cpp b/src/engine/client/cdll_engine_int.cpp index e92fa635..9cc39328 100644 --- a/src/engine/client/cdll_engine_int.cpp +++ b/src/engine/client/cdll_engine_int.cpp @@ -79,7 +79,7 @@ void FrameStageNotify_Post(const ClientFrameStage_t frameStage) case ClientFrameStage_t::FRAME_RENDER_START: break; case ClientFrameStage_t::FRAME_RENDER_END: - GFX_SetLatencyMarker(D3D11Device(), SIMULATION_END, MaterialSystem()->GetCurrentFrameCount()); + GeForce_SetLatencyMarker(D3D11Device(), SIMULATION_END, MaterialSystem()->GetCurrentFrameCount()); break; case ClientFrameStage_t::FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE: break; diff --git a/src/engine/gl_rsurf.cpp b/src/engine/gl_rsurf.cpp index b857cf45..3367d5c6 100644 --- a/src/engine/gl_rsurf.cpp +++ b/src/engine/gl_rsurf.cpp @@ -17,7 +17,7 @@ static ConVar r_drawWorldMeshesDepthAtTheEnd("r_drawWorldMeshesDepthAtTheEnd", " void* R_DrawDepthOfField(const float scalar) { - GFX_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_START, MaterialSystem()->GetCurrentFrameCount()); + GeForce_SetLatencyMarker(D3D11Device(), RENDERSUBMIT_START, MaterialSystem()->GetCurrentFrameCount()); return V_DrawDepthOfField(scalar); } diff --git a/src/engine/host.cpp b/src/engine/host.cpp index 4c4b119c..2828eeea 100644 --- a/src/engine/host.cpp +++ b/src/engine/host.cpp @@ -48,7 +48,7 @@ void Host_CountRealTimePackets() { v_Host_CountRealTimePackets(); #ifndef DEDICATED - GFX_SetLatencyMarker(D3D11Device(), SIMULATION_START, MaterialSystem()->GetCurrentFrameCount()); + GeForce_SetLatencyMarker(D3D11Device(), SIMULATION_START, MaterialSystem()->GetCurrentFrameCount()); #endif // !DEDICATED } diff --git a/src/engine/keys.cpp b/src/engine/keys.cpp index 92d4b43e..d712f8fe 100644 --- a/src/engine/keys.cpp +++ b/src/engine/keys.cpp @@ -23,7 +23,7 @@ bool Input_Event(const InputEvent_t& inputEvent, const int noKeyUpCheck) 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); diff --git a/src/engine/sys_dll2.cpp b/src/engine/sys_dll2.cpp index 0829d61d..16d10dbf 100644 --- a/src/engine/sys_dll2.cpp +++ b/src/engine/sys_dll2.cpp @@ -179,10 +179,10 @@ void CEngineAPI::PumpMessages() //----------------------------------------------------------------------------- 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_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. } - GFX_UpdateLowLatencyParameters(D3D11Device(), bUseLowLatencyMode, + GeForce_UpdateLowLatencyParameters(D3D11Device(), bUseLowLatencyMode, bUseLowLatencyBoost, bUseMarkersToOptimize, fpsMax); #endif // !DEDICATED } @@ -221,14 +221,14 @@ void CEngineAPI::UpdateLowLatencyParameters() void CEngineAPI::RunLowLatencyFrame() { #ifndef DEDICATED - if (GFX_IsLowLatencySDKEnabled()) + if (GeForce_IsLowLatencySDKEnabled()) { - if (GFX_HasPendingLowLatencyParameterUpdates()) + if (GeForce_HasPendingLowLatencyParameterUpdates()) { UpdateLowLatencyParameters(); } - GFX_RunLowLatencyFrame(D3D11Device()); + GeForce_RunLowLatencyFrame(D3D11Device()); } #endif // !DEDICATED } diff --git a/src/geforce/reflex.cpp b/src/geforce/reflex.cpp index 0c7b88cb..3fa593dc 100644 --- a/src/geforce/reflex.cpp +++ b/src/geforce/reflex.cpp @@ -20,7 +20,7 @@ static NvAPI_Status s_ReflexModeUpdateStatus = NvAPI_Status::NVAPI_OK; // Purpose: enable/disable low latency SDK // Input : enable - //----------------------------------------------------------------------------- -void GFX_EnableLowLatencySDK(const bool enable) +void GeForce_EnableLowLatencySDK(const bool enable) { s_LowLatencySDKEnabled = enable; } @@ -28,7 +28,7 @@ void GFX_EnableLowLatencySDK(const bool enable) //----------------------------------------------------------------------------- // Purpose: whether we should run the low latency SDK //----------------------------------------------------------------------------- -bool GFX_IsLowLatencySDKEnabled(void) +bool GeForce_IsLowLatencySDKEnabled(void) { if (!s_LowLatencySDKEnabled) return false; @@ -42,7 +42,7 @@ bool GFX_IsLowLatencySDKEnabled(void) //----------------------------------------------------------------------------- // Purpose: mark the parameters as out-of-date; force update next frame //----------------------------------------------------------------------------- -void GFX_MarkLowLatencyParametersOutOfDate(void) +void GeForce_MarkLowLatencyParametersOutOfDate(void) { s_ReflexModeInfoUpToDate = false; } @@ -50,7 +50,7 @@ void GFX_MarkLowLatencyParametersOutOfDate(void) //----------------------------------------------------------------------------- // Purpose: mark the parameters as up-to-date //----------------------------------------------------------------------------- -void GFX_MarkLowLatencyParametersUpToDate(void) +void GeForce_MarkLowLatencyParametersUpToDate(void) { s_ReflexModeInfoUpToDate = true; } @@ -58,7 +58,7 @@ void GFX_MarkLowLatencyParametersUpToDate(void) //----------------------------------------------------------------------------- // Purpose: has the user requested any changes to the low latency parameters? //----------------------------------------------------------------------------- -bool GFX_HasPendingLowLatencyParameterUpdates(void) +bool GeForce_HasPendingLowLatencyParameterUpdates(void) { return s_ReflexModeInfoUpToDate == false; } @@ -66,7 +66,7 @@ bool GFX_HasPendingLowLatencyParameterUpdates(void) //----------------------------------------------------------------------------- // 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; } @@ -79,7 +79,7 @@ bool GFX_ParameterUpdateWasSuccessful(void) // useMarkersToOptimize - // 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 float maxFramesPerSecond) { @@ -97,18 +97,18 @@ void GFX_UpdateLowLatencyParameters(IUnknown* const device, const bool useLowLat params.bUseMarkersToOptimize = useMarkersToOptimize; s_ReflexModeUpdateStatus = NvAPI_D3D_SetSleepMode(device, ¶ms); - GFX_MarkLowLatencyParametersUpToDate(); + GeForce_MarkLowLatencyParametersUpToDate(); } //----------------------------------------------------------------------------- // Purpose: runs a frame of the low latency sdk // Input : *device - //----------------------------------------------------------------------------- -void GFX_RunLowLatencyFrame(IUnknown* const device) +void GeForce_RunLowLatencyFrame(IUnknown* const device) { Assert(device); - if (GFX_ParameterUpdateWasSuccessful()) + if (GeForce_ParameterUpdateWasSuccessful()) NvAPI_D3D_Sleep(device); } @@ -118,12 +118,12 @@ void GFX_RunLowLatencyFrame(IUnknown* const device) // frameNumber - // markerType - //----------------------------------------------------------------------------- -void GFX_SetLatencyMarker(IUnknown* const device, +void GeForce_SetLatencyMarker(IUnknown* const device, const NV_LATENCY_MARKER_TYPE markerType, const NvU64 frameID) { Assert(device); - if (GFX_ParameterUpdateWasSuccessful() && GFX_IsLowLatencySDKEnabled()) + if (GeForce_ParameterUpdateWasSuccessful() && GeForce_IsLowLatencySDKEnabled()) { NV_LATENCY_MARKER_PARAMS params = {}; params.version = NV_LATENCY_MARKER_PARAMS_VER1; diff --git a/src/geforce/reflex.h b/src/geforce/reflex.h index acef73b4..567be185 100644 --- a/src/geforce/reflex.h +++ b/src/geforce/reflex.h @@ -1,19 +1,19 @@ #ifndef GFSDK_REFLEX_H #define GFSDK_REFLEX_H -void GFX_EnableLowLatencySDK(const bool enable); -bool GFX_IsLowLatencySDKEnabled(void); +void GeForce_EnableLowLatencySDK(const bool enable); +bool GeForce_IsLowLatencySDKEnabled(void); -void GFX_MarkLowLatencyParametersOutOfDate(void); -bool GFX_HasPendingLowLatencyParameterUpdates(void); +void GeForce_MarkLowLatencyParametersOutOfDate(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 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); #endif // GFSDK_REFLEX_H diff --git a/src/inputsystem/inputsystem.cpp b/src/inputsystem/inputsystem.cpp index 2ee69a32..858bf249 100644 --- a/src/inputsystem/inputsystem.cpp +++ b/src/inputsystem/inputsystem.cpp @@ -27,7 +27,7 @@ LRESULT CInputSystem::WindowProc(void* unused, HWND hwnd, UINT uMsg, WPARAM wPar { if (PCLSTATS_IS_PING_MSG_ID(uMsg)) { - GFX_SetLatencyMarker(D3D11Device(), PC_LATENCY_PING, MaterialSystem()->GetCurrentFrameCount()); + GeForce_SetLatencyMarker(D3D11Device(), PC_LATENCY_PING, MaterialSystem()->GetCurrentFrameCount()); } } diff --git a/src/materialsystem/cmaterialsystem.cpp b/src/materialsystem/cmaterialsystem.cpp index de2ef6aa..39cdda92 100644 --- a/src/materialsystem/cmaterialsystem.cpp +++ b/src/materialsystem/cmaterialsystem.cpp @@ -49,9 +49,9 @@ InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr) return INIT_FAILED; #else // Initialize as usual. - GFX_EnableLowLatencySDK(!CommandLine()->CheckParm("-gfx_nvnDisableLowLatency")); + GeForce_EnableLowLatencySDK(!CommandLine()->CheckParm("-gfx_nvnDisableLowLatency")); - if (GFX_IsLowLatencySDKEnabled()) + if (GeForce_IsLowLatencySDKEnabled()) { PCLSTATS_INIT(0); } @@ -66,7 +66,7 @@ InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr) int CMaterialSystem::Shutdown(CMaterialSystem* thisptr) { #ifndef MATERIALSYSTEM_NODX - if (GFX_IsLowLatencySDKEnabled()) + if (GeForce_IsLowLatencySDKEnabled()) { PCLSTATS_SHUTDOWN(); } diff --git a/src/windows/id3dx.cpp b/src/windows/id3dx.cpp index 23405aa3..4e3d2e38 100644 --- a/src/windows/id3dx.cpp +++ b/src/windows/id3dx.cpp @@ -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) // continues after to finish the frame. 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); - GFX_SetLatencyMarker(D3D11Device(), PRESENT_END, frameID); + GeForce_SetLatencyMarker(D3D11Device(), PRESENT_END, frameID); return result; }