Skip to content

Commit

Permalink
Hide 'Limiter' from framegraph when not needed (PR #3723, Issue #3718)
Browse files Browse the repository at this point in the history
  • Loading branch information
PlatinMTA authored Sep 25, 2024
1 parent 81c939a commit 615ddba
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Client/core/CCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,13 @@ void CCore::RecalculateFrameRateLimit(uint uiServerFrameRateLimit, bool bLogToCo
if ((m_uiFrameRateLimit == 0 || uiClientScriptRate < m_uiFrameRateLimit) && uiClientScriptRate > 0)
m_uiFrameRateLimit = uiClientScriptRate;

// Removes Limiter from Frame Graph if limit is zero and skips frame limit
if (m_uiFrameRateLimit == 0)
{
m_bQueuedFrameRateValid = false;
GetGraphStats()->RemoveTimingPoint("Limiter");
}

// Print new limits to the console
if (bLogToConsole)
{
Expand Down
16 changes: 16 additions & 0 deletions Client/core/CGraphStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CGraphStats : public CGraphStatsInterface
virtual void SetEnabled(bool bEnabled);
virtual bool IsEnabled();
virtual void AddTimingPoint(const char* szName);
virtual void RemoveTimingPoint(const char* szName);

protected:
bool m_bEnabled;
Expand Down Expand Up @@ -189,6 +190,21 @@ void CGraphStats::AddTimingPoint(const char* szName)
pLine->dataHistory[pLine->iDataPos] = AvgData;
}

///////////////////////////////////////////////////////////////
//
// CGraphStats::RemoveTimingPoint
//
//
//
///////////////////////////////////////////////////////////////
void CGraphStats::RemoveTimingPoint(const char* szName)
{
if (!IsEnabled() || szName[0] == 0)
return;

MapRemove(m_LineList, szName);
}

///////////////////////////////////////////////////////////////
//
// CGraphStats::Draw
Expand Down
1 change: 1 addition & 0 deletions Client/core/CGraphStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CGraphStatsInterface
virtual void SetEnabled(bool bEnabled) = 0;
virtual bool IsEnabled() = 0;
virtual void AddTimingPoint(const char* szName) = 0;
virtual void RemoveTimingPoint(const char* szName) = 0;
};

CGraphStatsInterface* GetGraphStats();

0 comments on commit 615ddba

Please sign in to comment.