mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
VideoCommon: merge debug info generators
This commit is contained in:
parent
a560d8f150
commit
ffa014dd48
@ -8,13 +8,11 @@
|
||||
#include <strsafe.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Common/Profiler.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Movie.h"
|
||||
|
||||
#include "VideoBackends/D3D/BoundingBox.h"
|
||||
#include "VideoBackends/D3D/D3DBase.h"
|
||||
@ -914,53 +912,10 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||
vp = CD3D11_VIEWPORT(0.0f, 0.0f, (float)GetBackbufferWidth(), (float)GetBackbufferHeight());
|
||||
D3D::context->RSSetViewports(1, &vp);
|
||||
|
||||
// Finish up the current frame, print some stats
|
||||
if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount)
|
||||
{
|
||||
std::string fps = "";
|
||||
if (g_ActiveConfig.bShowFPS)
|
||||
fps = StringFromFormat("FPS: %d", m_fps_counter.m_fps);
|
||||
|
||||
if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount)
|
||||
fps += " - ";
|
||||
if (SConfig::GetInstance().m_ShowFrameCount)
|
||||
{
|
||||
fps += StringFromFormat("Frame: %d", Movie::g_currentFrame);
|
||||
if (Movie::IsPlayingInput())
|
||||
fps += StringFromFormat(" / %d", Movie::g_totalFrames);
|
||||
}
|
||||
|
||||
fps += "\n";
|
||||
|
||||
D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, fps);
|
||||
}
|
||||
|
||||
if (SConfig::GetInstance().m_ShowLag)
|
||||
{
|
||||
std::string lag = StringFromFormat("Lag: %" PRIu64 "\n", Movie::g_currentLagCount);
|
||||
D3D::font.DrawTextScaled(0, 18, 20, 0.0f, 0xFF00FFFF, lag);
|
||||
}
|
||||
|
||||
if (SConfig::GetInstance().m_ShowInputDisplay)
|
||||
{
|
||||
D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, Movie::GetInputDisplay());
|
||||
}
|
||||
Renderer::DrawDebugText();
|
||||
|
||||
if (g_ActiveConfig.bOverlayStats)
|
||||
{
|
||||
D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, Statistics::ToString());
|
||||
}
|
||||
else if (g_ActiveConfig.bOverlayProjStats)
|
||||
{
|
||||
D3D::font.DrawTextScaled(0, 36, 20, 0.0f, 0xFF00FFFF, Statistics::ToStringProj());
|
||||
}
|
||||
|
||||
std::string profile_output = Profiler::ToString();
|
||||
if (!profile_output.empty())
|
||||
{
|
||||
D3D::font.DrawTextScaled(0, 44, 20, 0.0f, 0xFF00FFFF, profile_output);
|
||||
}
|
||||
std::string debug_info = GetDebugText();
|
||||
if (debug_info != "")
|
||||
D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, debug_info);
|
||||
|
||||
OSD::DrawMessages();
|
||||
D3D::EndFrame();
|
||||
|
@ -12,14 +12,12 @@
|
||||
#include "Common/Atomic.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Profiler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Thread.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Movie.h"
|
||||
|
||||
#include "VideoBackends/OGL/BoundingBox.h"
|
||||
#include "VideoBackends/OGL/FramebufferManager.h"
|
||||
@ -729,35 +727,6 @@ void Renderer::DrawDebugInfo()
|
||||
// Reset viewport for drawing text
|
||||
glViewport(0, 0, GLInterface->GetBackBufferWidth(), GLInterface->GetBackBufferHeight());
|
||||
|
||||
// Draw various messages on the screen, like FPS, statistics, etc.
|
||||
std::string debug_info;
|
||||
|
||||
if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount)
|
||||
{
|
||||
std::string fps = "";
|
||||
if (g_ActiveConfig.bShowFPS)
|
||||
debug_info += StringFromFormat("FPS: %d", m_fps_counter.m_fps);
|
||||
|
||||
if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount)
|
||||
debug_info += " - ";
|
||||
if (SConfig::GetInstance().m_ShowFrameCount)
|
||||
{
|
||||
debug_info += StringFromFormat("Frame: %llu", (unsigned long long) Movie::g_currentFrame);
|
||||
if (Movie::IsPlayingInput())
|
||||
debug_info += StringFromFormat(" / %llu", (unsigned long long) Movie::g_totalFrames);
|
||||
}
|
||||
|
||||
debug_info += "\n";
|
||||
}
|
||||
|
||||
if (SConfig::GetInstance().m_ShowLag)
|
||||
debug_info += StringFromFormat("Lag: %" PRIu64 "\n", Movie::g_currentLagCount);
|
||||
|
||||
if (SConfig::GetInstance().m_ShowInputDisplay)
|
||||
debug_info += Movie::GetInputDisplay();
|
||||
|
||||
debug_info += Profiler::ToString();
|
||||
|
||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL && g_ActiveConfig.bShowEFBCopyRegions)
|
||||
{
|
||||
// Set Line Size
|
||||
@ -876,12 +845,7 @@ void Renderer::DrawDebugInfo()
|
||||
stats.efb_regions.clear();
|
||||
}
|
||||
|
||||
if (g_ActiveConfig.bOverlayStats)
|
||||
debug_info += Statistics::ToString();
|
||||
|
||||
if (g_ActiveConfig.bOverlayProjStats)
|
||||
debug_info += Statistics::ToStringProj();
|
||||
|
||||
std::string debug_info = GetDebugText();
|
||||
if (!debug_info.empty())
|
||||
{
|
||||
// Render a shadow, and then the text.
|
||||
|
@ -12,16 +12,19 @@
|
||||
// Next frame, that one is scanned out and the other one gets the copy. = double buffering.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
#include <cinttypes>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Atomic.h"
|
||||
#include "Common/Profiler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Movie.h"
|
||||
#include "Core/FifoPlayer/FifoRecorder.h"
|
||||
|
||||
#include "VideoCommon/AVIDump.h"
|
||||
@ -388,6 +391,47 @@ void Renderer::DrawDebugText()
|
||||
g_renderer->RenderText(final_yellow, 20, 20, 0xFFFFFF00);
|
||||
}
|
||||
|
||||
std::string Renderer::GetDebugText()
|
||||
{
|
||||
// Draw various messages on the screen, like FPS, statistics, etc.
|
||||
std::string debug_info;
|
||||
|
||||
if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount)
|
||||
{
|
||||
std::string fps = "";
|
||||
if (g_ActiveConfig.bShowFPS)
|
||||
debug_info += StringFromFormat("FPS: %d", g_renderer->m_fps_counter.m_fps);
|
||||
|
||||
if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount)
|
||||
debug_info += " - ";
|
||||
if (SConfig::GetInstance().m_ShowFrameCount)
|
||||
{
|
||||
debug_info += StringFromFormat("Frame: %llu", (unsigned long long) Movie::g_currentFrame);
|
||||
if (Movie::IsPlayingInput())
|
||||
debug_info += StringFromFormat(" / %llu", (unsigned long long) Movie::g_totalFrames);
|
||||
}
|
||||
|
||||
debug_info += "\n";
|
||||
}
|
||||
|
||||
if (SConfig::GetInstance().m_ShowLag)
|
||||
debug_info += StringFromFormat("Lag: %" PRIu64 "\n", Movie::g_currentLagCount);
|
||||
|
||||
if (SConfig::GetInstance().m_ShowInputDisplay)
|
||||
debug_info += Movie::GetInputDisplay();
|
||||
|
||||
debug_info += Profiler::ToString();
|
||||
|
||||
|
||||
if (g_ActiveConfig.bOverlayStats)
|
||||
debug_info += Statistics::ToString();
|
||||
|
||||
if (g_ActiveConfig.bOverlayProjStats)
|
||||
debug_info += Statistics::ToStringProj();
|
||||
|
||||
return debug_info;
|
||||
}
|
||||
|
||||
void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
|
||||
{
|
||||
float FloatGLWidth = (float)backbuffer_width;
|
||||
|
@ -96,6 +96,7 @@ public:
|
||||
// Random utilities
|
||||
static void SetScreenshot(const std::string& filename);
|
||||
static void DrawDebugText();
|
||||
static std::string GetDebugText();
|
||||
|
||||
virtual void RenderText(const std::string& text, int left, int top, u32 color) = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user