From ffa014dd4853d231e3b380e12ccc96318e184f64 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 20 Dec 2014 12:14:33 +0100 Subject: [PATCH 1/3] VideoCommon: merge debug info generators --- Source/Core/VideoBackends/D3D/Render.cpp | 51 ++---------------------- Source/Core/VideoBackends/OGL/Render.cpp | 38 +----------------- Source/Core/VideoCommon/RenderBase.cpp | 44 ++++++++++++++++++++ Source/Core/VideoCommon/RenderBase.h | 1 + 4 files changed, 49 insertions(+), 85 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 9609fbf722..a07b2754da 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -8,13 +8,11 @@ #include #include -#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(); diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index aa5275b3f9..f7eaf5f281 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -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. diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 84c037c753..d287485da6 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -12,16 +12,19 @@ // Next frame, that one is scanned out and the other one gets the copy. = double buffering. // --------------------------------------------------------------------------------------------- +#include #include #include #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; diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index ef68d665a6..bb0c55cb02 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -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; From fb177ca04e4460801e19aa39e5868698b855aa83 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 20 Dec 2014 13:02:00 +0100 Subject: [PATCH 2/3] VideoCommon: merge debug test generators --- Source/Core/VideoBackends/D3D/Render.cpp | 3 - Source/Core/VideoBackends/OGL/Render.cpp | 18 +- Source/Core/VideoBackends/OGL/Render.h | 2 +- Source/Core/VideoCommon/RenderBase.cpp | 237 +++++++++++------------ Source/Core/VideoCommon/RenderBase.h | 1 - 5 files changed, 121 insertions(+), 140 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index a07b2754da..3cd64ba6a0 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -913,9 +913,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co D3D::context->RSSetViewports(1, &vp); Renderer::DrawDebugText(); - std::string debug_info = GetDebugText(); - if (debug_info != "") - D3D::font.DrawTextScaled(0, 0, 20, 0.0f, 0xFF00FFFF, debug_info); OSD::DrawMessages(); D3D::EndFrame(); diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index f7eaf5f281..5335533cf7 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -722,11 +722,8 @@ void Renderer::Init() } // 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) { // Set Line Size @@ -844,14 +841,6 @@ void Renderer::DrawDebugInfo() // Clear stored regions 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) @@ -1682,7 +1671,10 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - DrawDebugInfo(); + // Reset viewport for drawing text + glViewport(0, 0, GLInterface->GetBackBufferWidth(), GLInterface->GetBackBufferHeight()); + + ShowEfbCopyRegions(); DrawDebugText(); // Do our OSD callbacks diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index db843179a9..b536d1cecb 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -66,7 +66,7 @@ public: void RestoreState() 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); u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index d287485da6..6fe9261063 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -289,6 +289,39 @@ void Renderer::SetScreenshot(const std::string& filename) // Create On-Screen-Messages 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 if (OSDChoice > 0) { @@ -296,92 +329,93 @@ void Renderer::DrawDebugText() OSDChoice = -OSDChoice; } - if ((u32)OSDTime <= Common::Timer::GetTimeMs()) - return; - - const char* res_text = ""; - switch (g_ActiveConfig.iEFBScale) + if ((u32)OSDTime > Common::Timer::GetTimeMs()) { - case SCALE_AUTO: - res_text = "Auto (fractional)"; - break; - case SCALE_AUTO_INTEGRAL: - res_text = "Auto (integral)"; - break; - case SCALE_1X: - res_text = "Native"; - break; - case SCALE_1_5X: - res_text = "1.5x"; - break; - case SCALE_2X: - res_text = "2x"; - break; - case SCALE_2_5X: - res_text = "2.5x"; - break; - case SCALE_3X: - res_text = "3x"; - break; - case SCALE_4X: - res_text = "4x"; - break; + + const char* res_text = ""; + switch (g_ActiveConfig.iEFBScale) + { + case SCALE_AUTO: + res_text = "Auto (fractional)"; + break; + case SCALE_AUTO_INTEGRAL: + res_text = "Auto (integral)"; + break; + case SCALE_1X: + res_text = "Native"; + break; + case SCALE_1_5X: + res_text = "1.5x"; + break; + case SCALE_2X: + res_text = "2x"; + break; + case SCALE_2_5X: + res_text = "2.5x"; + break; + case SCALE_3X: + 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 = ""; - 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; - } + final_cyan += Profiler::ToString(); - const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ? - (g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled"; + if (g_ActiveConfig.bOverlayStats) + final_cyan += Statistics::ToString(); - // The rows - const std::string lines[] = - { - 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'; - } + if (g_ActiveConfig.bOverlayProjStats) + final_cyan += Statistics::ToStringProj(); // Render a shadow g_renderer->RenderText(final_cyan, 21, 21, 0xDD000000); @@ -391,47 +425,6 @@ 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; diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index bb0c55cb02..ef68d665a6 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -96,7 +96,6 @@ 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; From 3f9b52e555b860247cccfd21814a6ad7e8df4df8 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 20 Dec 2014 13:31:41 +0100 Subject: [PATCH 3/3] OGL: draw shadows within rasterfont itself --- Source/Core/VideoBackends/D3D/Render.cpp | 1 + Source/Core/VideoBackends/OGL/RasterFont.cpp | 18 ++++++++++-------- Source/Core/VideoBackends/OGL/RasterFont.h | 2 +- Source/Core/VideoCommon/OnScreenDisplay.cpp | 1 - Source/Core/VideoCommon/RenderBase.cpp | 3 --- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 3cd64ba6a0..84b83ef1f0 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -275,6 +275,7 @@ Renderer::~Renderer() void Renderer::RenderText(const std::string& text, int left, int top, u32 color) { + D3D::font.DrawTextScaled((float)(left+1), (float)(top+1), 20.f, 0.0f, color & 0xFF000000, text); D3D::font.DrawTextScaled((float)left, (float)top, 20.f, 0.0f, color, text); } diff --git a/Source/Core/VideoBackends/OGL/RasterFont.cpp b/Source/Core/VideoBackends/OGL/RasterFont.cpp index 265c444e45..d7fdacbfcb 100644 --- a/Source/Core/VideoBackends/OGL/RasterFont.cpp +++ b/Source/Core/VideoBackends/OGL/RasterFont.cpp @@ -118,11 +118,12 @@ static const u8 rasters[CHAR_COUNT][CHAR_HEIGHT] = { static const char *s_vertexShaderSrc = "uniform vec2 charSize;\n" + "uniform vec2 offset;" "in vec2 rawpos;\n" "in vec2 tex0;\n" "out vec2 uv0;\n" "void main(void) {\n" - " gl_Position = vec4(rawpos,0,1);\n" + " gl_Position = vec4(rawpos + offset,0,1);\n" " uv0 = tex0 * charSize;\n" "}\n"; @@ -166,7 +167,8 @@ RasterFont::RasterFont() glUniform2f(glGetUniformLocation(s_shader.glprogid,"charSize"), 1.0f / GLfloat(CHAR_COUNT), 1.0f); uniform_color_id = glGetUniformLocation(s_shader.glprogid,"color"); glUniform4f(uniform_color_id, 1.0f, 1.0f, 1.0f, 1.0f); - cached_color = -1; + uniform_offset_id = glGetUniformLocation(s_shader.glprogid, "offset"); + glUniform2f(uniform_offset_id, 0.0f, 0.0f); // generate VBO & VAO glGenBuffers(1, &VBO); @@ -263,13 +265,13 @@ void RasterFont::printMultilineText(const std::string& text, double start_x, dou s_shader.Bind(); - if (color != cached_color) - { - glUniform4f(uniform_color_id, GLfloat((color>>16)&0xff)/255.f,GLfloat((color>>8)&0xff)/255.f,GLfloat((color>>0)&0xff)/255.f,GLfloat((color>>24)&0xff)/255.f); - cached_color = color; - } + // shadows + glUniform2f(uniform_offset_id, 2.0f / GLfloat(bbWidth), -2.0f / GLfloat(bbHeight)); + glUniform4f(uniform_color_id, 0.0f, 0.0f, 0.0f, GLfloat((color>>24)&0xff)/255.f); + glDrawArrays(GL_TRIANGLES, 0, usage/4); - glActiveTexture(GL_TEXTURE0+8); + glUniform2f(uniform_offset_id, 0.0f, 0.0f); + glUniform4f(uniform_color_id, GLfloat((color>>16)&0xff)/255.f,GLfloat((color>>8)&0xff)/255.f,GLfloat((color>>0)&0xff)/255.f,GLfloat((color>>24)&0xff)/255.f); glDrawArrays(GL_TRIANGLES, 0, usage/4); } diff --git a/Source/Core/VideoBackends/OGL/RasterFont.h b/Source/Core/VideoBackends/OGL/RasterFont.h index ddf6884913..a18ed58175 100644 --- a/Source/Core/VideoBackends/OGL/RasterFont.h +++ b/Source/Core/VideoBackends/OGL/RasterFont.h @@ -25,7 +25,7 @@ private: u32 VAO; u32 texture; u32 uniform_color_id; - u32 cached_color; + u32 uniform_offset_id; }; } diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp index 0b553c12d2..b25f461336 100644 --- a/Source/Core/VideoCommon/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp @@ -56,7 +56,6 @@ void DrawMessages() alpha <<= 24; - g_renderer->RenderText(it->str, left + 1, top + 1, 0x000000 | alpha); g_renderer->RenderText(it->str, left, top, 0xffff30 | alpha); top += 15; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 6fe9261063..8db728842f 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -417,9 +417,6 @@ void Renderer::DrawDebugText() if (g_ActiveConfig.bOverlayProjStats) final_cyan += Statistics::ToStringProj(); - // Render a shadow - g_renderer->RenderText(final_cyan, 21, 21, 0xDD000000); - g_renderer->RenderText(final_yellow, 21, 21, 0xDD000000); //and then the text g_renderer->RenderText(final_cyan, 20, 20, 0xFF00FFFF); g_renderer->RenderText(final_yellow, 20, 20, 0xFFFFFF00);