VideoCommon: merge debug test generators
This commit is contained in:
parent
ffa014dd48
commit
fb177ca04e
|
@ -913,9 +913,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||||
D3D::context->RSSetViewports(1, &vp);
|
D3D::context->RSSetViewports(1, &vp);
|
||||||
|
|
||||||
Renderer::DrawDebugText();
|
Renderer::DrawDebugText();
|
||||||
std::string debug_info = GetDebugText();
|
|
||||||
if (debug_info != "")
|
|
||||||
D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, debug_info);
|
|
||||||
|
|
||||||
OSD::DrawMessages();
|
OSD::DrawMessages();
|
||||||
D3D::EndFrame();
|
D3D::EndFrame();
|
||||||
|
|
|
@ -722,11 +722,8 @@ void Renderer::Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create On-Screen-Messages
|
// Create On-Screen-Messages
|
||||||
void Renderer::DrawDebugInfo()
|
void Renderer::ShowEfbCopyRegions()
|
||||||
{
|
{
|
||||||
// Reset viewport for drawing text
|
|
||||||
glViewport(0, 0, GLInterface->GetBackBufferWidth(), GLInterface->GetBackBufferHeight());
|
|
||||||
|
|
||||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL && g_ActiveConfig.bShowEFBCopyRegions)
|
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL && g_ActiveConfig.bShowEFBCopyRegions)
|
||||||
{
|
{
|
||||||
// Set Line Size
|
// Set Line Size
|
||||||
|
@ -844,14 +841,6 @@ void Renderer::DrawDebugInfo()
|
||||||
// Clear stored regions
|
// Clear stored regions
|
||||||
stats.efb_regions.clear();
|
stats.efb_regions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string debug_info = GetDebugText();
|
|
||||||
if (!debug_info.empty())
|
|
||||||
{
|
|
||||||
// Render a shadow, and then the text.
|
|
||||||
Renderer::RenderText(debug_info, 21, 21, 0xDD000000);
|
|
||||||
Renderer::RenderText(debug_info, 20, 20, 0xFF00FFFF);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::RenderText(const std::string& text, int left, int top, u32 color)
|
void Renderer::RenderText(const std::string& text, int left, int top, u32 color)
|
||||||
|
@ -1682,7 +1671,10 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
DrawDebugInfo();
|
// Reset viewport for drawing text
|
||||||
|
glViewport(0, 0, GLInterface->GetBackBufferWidth(), GLInterface->GetBackBufferHeight());
|
||||||
|
|
||||||
|
ShowEfbCopyRegions();
|
||||||
DrawDebugText();
|
DrawDebugText();
|
||||||
|
|
||||||
// Do our OSD callbacks
|
// Do our OSD callbacks
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
void RestoreState() override {}
|
void RestoreState() override {}
|
||||||
|
|
||||||
void RenderText(const std::string& text, int left, int top, u32 color) override;
|
void RenderText(const std::string& text, int left, int top, u32 color) override;
|
||||||
void DrawDebugInfo();
|
void ShowEfbCopyRegions();
|
||||||
void FlipImageData(u8 *data, int w, int h, int pixel_width = 3);
|
void FlipImageData(u8 *data, int w, int h, int pixel_width = 3);
|
||||||
|
|
||||||
u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override;
|
u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override;
|
||||||
|
|
|
@ -289,6 +289,39 @@ void Renderer::SetScreenshot(const std::string& filename)
|
||||||
// Create On-Screen-Messages
|
// Create On-Screen-Messages
|
||||||
void Renderer::DrawDebugText()
|
void Renderer::DrawDebugText()
|
||||||
{
|
{
|
||||||
|
std::string final_yellow, final_cyan;
|
||||||
|
|
||||||
|
if (g_ActiveConfig.bShowFPS || SConfig::GetInstance().m_ShowFrameCount)
|
||||||
|
{
|
||||||
|
std::string fps = "";
|
||||||
|
if (g_ActiveConfig.bShowFPS)
|
||||||
|
final_cyan += StringFromFormat("FPS: %d", g_renderer->m_fps_counter.m_fps);
|
||||||
|
|
||||||
|
if (g_ActiveConfig.bShowFPS && SConfig::GetInstance().m_ShowFrameCount)
|
||||||
|
final_cyan += " - ";
|
||||||
|
if (SConfig::GetInstance().m_ShowFrameCount)
|
||||||
|
{
|
||||||
|
final_cyan += StringFromFormat("Frame: %llu", (unsigned long long) Movie::g_currentFrame);
|
||||||
|
if (Movie::IsPlayingInput())
|
||||||
|
final_cyan += StringFromFormat(" / %llu", (unsigned long long) Movie::g_totalFrames);
|
||||||
|
}
|
||||||
|
|
||||||
|
final_cyan += "\n";
|
||||||
|
final_yellow += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SConfig::GetInstance().m_ShowLag)
|
||||||
|
{
|
||||||
|
final_cyan += StringFromFormat("Lag: %" PRIu64 "\n", Movie::g_currentLagCount);
|
||||||
|
final_yellow += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SConfig::GetInstance().m_ShowInputDisplay)
|
||||||
|
{
|
||||||
|
final_cyan += Movie::GetInputDisplay();
|
||||||
|
final_yellow += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// OSD Menu messages
|
// OSD Menu messages
|
||||||
if (OSDChoice > 0)
|
if (OSDChoice > 0)
|
||||||
{
|
{
|
||||||
|
@ -296,92 +329,93 @@ void Renderer::DrawDebugText()
|
||||||
OSDChoice = -OSDChoice;
|
OSDChoice = -OSDChoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((u32)OSDTime <= Common::Timer::GetTimeMs())
|
if ((u32)OSDTime > Common::Timer::GetTimeMs())
|
||||||
return;
|
|
||||||
|
|
||||||
const char* res_text = "";
|
|
||||||
switch (g_ActiveConfig.iEFBScale)
|
|
||||||
{
|
{
|
||||||
case SCALE_AUTO:
|
|
||||||
res_text = "Auto (fractional)";
|
const char* res_text = "";
|
||||||
break;
|
switch (g_ActiveConfig.iEFBScale)
|
||||||
case SCALE_AUTO_INTEGRAL:
|
{
|
||||||
res_text = "Auto (integral)";
|
case SCALE_AUTO:
|
||||||
break;
|
res_text = "Auto (fractional)";
|
||||||
case SCALE_1X:
|
break;
|
||||||
res_text = "Native";
|
case SCALE_AUTO_INTEGRAL:
|
||||||
break;
|
res_text = "Auto (integral)";
|
||||||
case SCALE_1_5X:
|
break;
|
||||||
res_text = "1.5x";
|
case SCALE_1X:
|
||||||
break;
|
res_text = "Native";
|
||||||
case SCALE_2X:
|
break;
|
||||||
res_text = "2x";
|
case SCALE_1_5X:
|
||||||
break;
|
res_text = "1.5x";
|
||||||
case SCALE_2_5X:
|
break;
|
||||||
res_text = "2.5x";
|
case SCALE_2X:
|
||||||
break;
|
res_text = "2x";
|
||||||
case SCALE_3X:
|
break;
|
||||||
res_text = "3x";
|
case SCALE_2_5X:
|
||||||
break;
|
res_text = "2.5x";
|
||||||
case SCALE_4X:
|
break;
|
||||||
res_text = "4x";
|
case SCALE_3X:
|
||||||
break;
|
res_text = "3x";
|
||||||
|
break;
|
||||||
|
case SCALE_4X:
|
||||||
|
res_text = "4x";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* ar_text = "";
|
||||||
|
switch (g_ActiveConfig.iAspectRatio)
|
||||||
|
{
|
||||||
|
case ASPECT_AUTO:
|
||||||
|
ar_text = "Auto";
|
||||||
|
break;
|
||||||
|
case ASPECT_FORCE_16_9:
|
||||||
|
ar_text = "16:9";
|
||||||
|
break;
|
||||||
|
case ASPECT_FORCE_4_3:
|
||||||
|
ar_text = "4:3";
|
||||||
|
break;
|
||||||
|
case ASPECT_STRETCH:
|
||||||
|
ar_text = "Stretch";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ?
|
||||||
|
(g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled";
|
||||||
|
|
||||||
|
// The rows
|
||||||
|
const std::string lines[] =
|
||||||
|
{
|
||||||
|
std::string("Internal Resolution: ") + res_text,
|
||||||
|
std::string("Aspect Ratio: ") + ar_text + (g_ActiveConfig.bCrop ? " (crop)" : ""),
|
||||||
|
std::string("Copy EFB: ") + efbcopy_text,
|
||||||
|
std::string("Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { lines_count = sizeof(lines)/sizeof(*lines) };
|
||||||
|
|
||||||
|
// The latest changed setting in yellow
|
||||||
|
for (int i = 0; i != lines_count; ++i)
|
||||||
|
{
|
||||||
|
if (OSDChoice == -i - 1)
|
||||||
|
final_yellow += lines[i];
|
||||||
|
final_yellow += '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
// The other settings in cyan
|
||||||
|
for (int i = 0; i != lines_count; ++i)
|
||||||
|
{
|
||||||
|
if (OSDChoice != -i - 1)
|
||||||
|
final_cyan += lines[i];
|
||||||
|
final_cyan += '\n';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ar_text = "";
|
final_cyan += Profiler::ToString();
|
||||||
switch (g_ActiveConfig.iAspectRatio)
|
|
||||||
{
|
|
||||||
case ASPECT_AUTO:
|
|
||||||
ar_text = "Auto";
|
|
||||||
break;
|
|
||||||
case ASPECT_FORCE_16_9:
|
|
||||||
ar_text = "16:9";
|
|
||||||
break;
|
|
||||||
case ASPECT_FORCE_4_3:
|
|
||||||
ar_text = "4:3";
|
|
||||||
break;
|
|
||||||
case ASPECT_STRETCH:
|
|
||||||
ar_text = "Stretch";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ?
|
if (g_ActiveConfig.bOverlayStats)
|
||||||
(g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled";
|
final_cyan += Statistics::ToString();
|
||||||
|
|
||||||
// The rows
|
if (g_ActiveConfig.bOverlayProjStats)
|
||||||
const std::string lines[] =
|
final_cyan += Statistics::ToStringProj();
|
||||||
{
|
|
||||||
std::string("3: Internal Resolution: ") + res_text,
|
|
||||||
std::string("4: Aspect Ratio: ") + ar_text + (g_ActiveConfig.bCrop ? " (crop)" : ""),
|
|
||||||
std::string("5: Copy EFB: ") + efbcopy_text,
|
|
||||||
std::string("6: Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"),
|
|
||||||
};
|
|
||||||
|
|
||||||
enum { lines_count = sizeof(lines)/sizeof(*lines) };
|
|
||||||
|
|
||||||
std::string final_yellow, final_cyan;
|
|
||||||
|
|
||||||
// If there is more text than this we will have a collision
|
|
||||||
if (g_ActiveConfig.bShowFPS)
|
|
||||||
{
|
|
||||||
final_yellow = final_cyan = "\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// The latest changed setting in yellow
|
|
||||||
for (int i = 0; i != lines_count; ++i)
|
|
||||||
{
|
|
||||||
if (OSDChoice == -i - 1)
|
|
||||||
final_yellow += lines[i];
|
|
||||||
final_yellow += '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
// The other settings in cyan
|
|
||||||
for (int i = 0; i != lines_count; ++i)
|
|
||||||
{
|
|
||||||
if (OSDChoice != -i - 1)
|
|
||||||
final_cyan += lines[i];
|
|
||||||
final_cyan += '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render a shadow
|
// Render a shadow
|
||||||
g_renderer->RenderText(final_cyan, 21, 21, 0xDD000000);
|
g_renderer->RenderText(final_cyan, 21, 21, 0xDD000000);
|
||||||
|
@ -391,47 +425,6 @@ void Renderer::DrawDebugText()
|
||||||
g_renderer->RenderText(final_yellow, 20, 20, 0xFFFFFF00);
|
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)
|
void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
|
||||||
{
|
{
|
||||||
float FloatGLWidth = (float)backbuffer_width;
|
float FloatGLWidth = (float)backbuffer_width;
|
||||||
|
|
|
@ -96,7 +96,6 @@ public:
|
||||||
// Random utilities
|
// Random utilities
|
||||||
static void SetScreenshot(const std::string& filename);
|
static void SetScreenshot(const std::string& filename);
|
||||||
static void DrawDebugText();
|
static void DrawDebugText();
|
||||||
static std::string GetDebugText();
|
|
||||||
|
|
||||||
virtual void RenderText(const std::string& text, int left, int top, u32 color) = 0;
|
virtual void RenderText(const std::string& text, int left, int top, u32 color) = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue