Skip to content

Commit

Permalink
Merge pull request #3106 from lioncash/fps
Browse files Browse the repository at this point in the history
FPSCounter: Minor changes
  • Loading branch information
Tilka committed Sep 29, 2015
2 parents 6a27f1b + d6ff75d commit e278587
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
1 change: 0 additions & 1 deletion Source/Core/VideoBackends/OGL/Render.cpp
Expand Up @@ -41,7 +41,6 @@
#include "VideoCommon/BPStructs.h"
#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/FPSCounter.h"
#include "VideoCommon/ImageWrite.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/PixelEngine.h"
Expand Down
8 changes: 2 additions & 6 deletions Source/Core/VideoCommon/FPSCounter.cpp
Expand Up @@ -10,12 +10,9 @@
#include "VideoCommon/FPSCounter.h"
#include "VideoCommon/VideoConfig.h"

#define FPS_REFRESH_INTERVAL 1000
static constexpr u64 FPS_REFRESH_INTERVAL = 1000;

FPSCounter::FPSCounter()
: m_fps(0)
, m_counter(0)
, m_fps_last_counter(0)
{
m_update_time.Update();
m_render_time.Update();
Expand All @@ -29,7 +26,7 @@ void FPSCounter::LogRenderTimeToFile(u64 val)
m_bench_file << val << std::endl;
}

int FPSCounter::Update()
void FPSCounter::Update()
{
if (m_update_time.GetTimeDifference() >= FPS_REFRESH_INTERVAL)
{
Expand All @@ -46,5 +43,4 @@ int FPSCounter::Update()
}

m_counter++;
return m_fps;
}
14 changes: 7 additions & 7 deletions Source/Core/VideoCommon/FPSCounter.h
Expand Up @@ -11,18 +11,18 @@
class FPSCounter
{
public:
unsigned int m_fps;

// Initializes the FPS counter.
FPSCounter();

// Called when a frame is rendered. Returns the value to be displayed on
// screen as the FPS counter (updated every second).
int Update();
// Called when a frame is rendered (updated every second).
void Update();

unsigned int GetFPS() const { return m_fps; }

private:
unsigned int m_counter;
unsigned int m_fps_last_counter;
unsigned int m_fps = 0;
unsigned int m_counter = 0;
unsigned int m_fps_last_counter = 0;
Common::Timer m_update_time;

Common::Timer m_render_time;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/RenderBase.cpp
Expand Up @@ -295,7 +295,7 @@ void Renderer::DrawDebugText()
if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount)
{
if (g_ActiveConfig.bShowFPS)
final_cyan += StringFromFormat("FPS: %d", g_renderer->m_fps_counter.m_fps);
final_cyan += StringFromFormat("FPS: %u", g_renderer->m_fps_counter.GetFPS());

if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount)
final_cyan += " - ";
Expand Down

0 comments on commit e278587

Please sign in to comment.