From 51c984dde396d2612c6832df863f898af176d4c6 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Thu, 5 Nov 2015 18:15:46 +1300 Subject: [PATCH] Remove the "Show EFB Copy Regions" debug option. It was only implemented in OpenGL, though the option was visible in both backends, leading to memory leaks if you enabled it in DirectX. And it wasn't particularly useful as a debug feature as it only showed where in the EFB the copies were taken from, not what format it was, or what the copy was used for, or what content was in the EFB at that point in time. Also, it stretched the copy regions relative to the window, so the on-screen regions don't even line up with the window unless the game used the full EFB (some pal games) and you game image stretched to the full window. --- Source/Core/DolphinWX/VideoConfigDiag.cpp | 2 - Source/Core/VideoBackends/OGL/Render.cpp | 157 ---------------------- Source/Core/VideoBackends/OGL/Render.h | 1 - Source/Core/VideoCommon/BPStructs.cpp | 3 - Source/Core/VideoCommon/Statistics.h | 2 - Source/Core/VideoCommon/VideoConfig.cpp | 2 - Source/Core/VideoCommon/VideoConfig.h | 1 - 7 files changed, 168 deletions(-) diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index f24305db61..a82446b7fa 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -124,7 +124,6 @@ static wxString show_fps_desc = wxTRANSLATE("Show the number of frames rendered static wxString log_render_time_to_file_desc = wxTRANSLATE("Log the render time of every frame to User/Logs/render_time.txt. Use this feature when you want to measure the performance of Dolphin.\n\nIf unsure, leave this unchecked."); static wxString show_stats_desc = wxTRANSLATE("Show various rendering statistics.\n\nIf unsure, leave this unchecked."); static wxString texfmt_desc = wxTRANSLATE("Modify textures to show the format they're encoded in. Needs an emulation reset in most cases.\n\nIf unsure, leave this unchecked."); -static wxString efb_copy_regions_desc = wxTRANSLATE("[BROKEN]\nHighlight regions the EFB was copied from.\n\nIf unsure, leave this unchecked."); static wxString xfb_desc = wxTRANSLATE("Disable any XFB emulation.\nSpeeds up emulation a lot but causes heavy glitches in many games which rely on them (especially homebrew applications).\n\nIf unsure, leave this checked."); static wxString xfb_virtual_desc = wxTRANSLATE("Emulate XFBs using GPU texture objects.\nFixes many games which don't work without XFB emulation while not being as slow as real XFB emulation. However, it may still fail for a lot of other games (especially homebrew applications).\n\nIf unsure, leave this checked."); static wxString xfb_real_desc = wxTRANSLATE("Emulate XFBs accurately.\nSlows down emulation a lot and prohibits high-resolution rendering but is necessary to emulate a number of games properly.\n\nIf unsure, check virtual XFB emulation instead."); @@ -547,7 +546,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con wxGridSizer* const szr_debug = new wxGridSizer(2, 5, 5); szr_debug->Add(CreateCheckBox(page_advanced, _("Enable Wireframe"), wxGetTranslation(wireframe_desc), vconfig.bWireFrame)); - szr_debug->Add(CreateCheckBox(page_advanced, _("Show EFB Copy Regions"), wxGetTranslation(efb_copy_regions_desc), vconfig.bShowEFBCopyRegions)); szr_debug->Add(CreateCheckBox(page_advanced, _("Show Statistics"), wxGetTranslation(show_stats_desc), vconfig.bOverlayStats)); szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"), wxGetTranslation(texfmt_desc), vconfig.bTexFmtOverlayEnable)); diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index f59f527354..4c45fa6701 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -78,10 +78,6 @@ VideoConfig g_ogl_config; // Declarations and definitions // ---------------------------- -static GLuint s_ShowEFBCopyRegions_VBO = 0; -static GLuint s_ShowEFBCopyRegions_VAO = 0; -static SHADER s_ShowEFBCopyRegions; - static RasterFont* s_pfont = nullptr; // 1 for no MSAA. Use s_MSAASamples > 1 to check for MSAA. @@ -321,7 +317,6 @@ Renderer::Renderer() OSDInternalW = 0; OSDInternalH = 0; - s_ShowEFBCopyRegions_VBO = 0; s_blendMode = 0; bool bSuccess = true; @@ -718,13 +713,8 @@ void Renderer::Shutdown() g_Config.bRunning = false; UpdateActiveConfig(); - glDeleteBuffers(1, &s_ShowEFBCopyRegions_VBO); - glDeleteVertexArrays(1, &s_ShowEFBCopyRegions_VAO); - s_ShowEFBCopyRegions_VBO = 0; - delete s_pfont; s_pfont = nullptr; - s_ShowEFBCopyRegions.Destroy(); delete m_post_processor; m_post_processor = nullptr; @@ -742,153 +732,7 @@ void Renderer::Init() s_pfont = new RasterFont(); - ProgramShaderCache::CompileShader(s_ShowEFBCopyRegions, - "in vec2 rawpos;\n" - "in vec3 color0;\n" - "out vec4 c;\n" - "void main(void) {\n" - " gl_Position = vec4(rawpos, 0.0, 1.0);\n" - " c = vec4(color0, 1.0);\n" - "}\n", - "in vec4 c;\n" - "out vec4 ocol0;\n" - "void main(void) {\n" - " ocol0 = c;\n" - "}\n"); - OpenGL_CreateAttributelessVAO(); - - // creating buffers - glGenBuffers(1, &s_ShowEFBCopyRegions_VBO); - glGenVertexArrays(1, &s_ShowEFBCopyRegions_VAO); - glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO); - glBindVertexArray( s_ShowEFBCopyRegions_VAO ); - glEnableVertexAttribArray(SHADER_POSITION_ATTRIB); - glVertexAttribPointer(SHADER_POSITION_ATTRIB, 2, GL_FLOAT, 0, sizeof(GLfloat)*5, nullptr); - glEnableVertexAttribArray(SHADER_COLOR0_ATTRIB); - glVertexAttribPointer(SHADER_COLOR0_ATTRIB, 3, GL_FLOAT, 0, sizeof(GLfloat)*5, (GLfloat*)nullptr+2); -} - -// Create On-Screen-Messages -void Renderer::ShowEfbCopyRegions() -{ - if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL && g_ActiveConfig.bShowEFBCopyRegions) - { - // Set Line Size - glLineWidth(3.0f); - - // 2*Coords + 3*Color - GLsizeiptr length = stats.efb_regions.size() * sizeof(GLfloat) * (2 + 3) * 2 * 6; - glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO); - glBufferData(GL_ARRAY_BUFFER, length, nullptr, GL_STREAM_DRAW); - GLfloat *Vertices = (GLfloat*)glMapBufferRange(GL_ARRAY_BUFFER, 0, length, GL_MAP_WRITE_BIT); - - // Draw EFB copy regions rectangles - int a = 0; - GLfloat color[3] = {0.0f, 1.0f, 1.0f}; - - for (const EFBRectangle& rect : stats.efb_regions) - { - GLfloat halfWidth = EFB_WIDTH / 2.0f; - GLfloat halfHeight = EFB_HEIGHT / 2.0f; - GLfloat x = (GLfloat) -1.0f + ((GLfloat)rect.left / halfWidth); - GLfloat y = (GLfloat) 1.0f - ((GLfloat)rect.top / halfHeight); - GLfloat x2 = (GLfloat) -1.0f + ((GLfloat)rect.right / halfWidth); - GLfloat y2 = (GLfloat) 1.0f - ((GLfloat)rect.bottom / halfHeight); - - Vertices[a++] = x; - Vertices[a++] = y; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - Vertices[a++] = x2; - Vertices[a++] = y; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - - Vertices[a++] = x2; - Vertices[a++] = y; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - Vertices[a++] = x2; - Vertices[a++] = y2; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - - Vertices[a++] = x2; - Vertices[a++] = y2; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - Vertices[a++] = x; - Vertices[a++] = y2; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - - Vertices[a++] = x; - Vertices[a++] = y2; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - Vertices[a++] = x; - Vertices[a++] = y; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - - Vertices[a++] = x; - Vertices[a++] = y; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - Vertices[a++] = x2; - Vertices[a++] = y2; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - - Vertices[a++] = x2; - Vertices[a++] = y; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - Vertices[a++] = x; - Vertices[a++] = y2; - Vertices[a++] = color[0]; - Vertices[a++] = color[1]; - Vertices[a++] = color[2]; - - // TO DO: build something nicer here - GLfloat temp = color[0]; - color[0] = color[1]; - color[1] = color[2]; - color[2] = temp; - } - glUnmapBuffer(GL_ARRAY_BUFFER); - - s_ShowEFBCopyRegions.Bind(); - glBindVertexArray(s_ShowEFBCopyRegions_VAO); - GLsizei count = static_cast(stats.efb_regions.size() * 2*6); - glDrawArrays(GL_LINES, 0, count); - - // Clear stored regions - stats.efb_regions.clear(); - } } void Renderer::RenderText(const std::string& text, int left, int top, u32 color) @@ -1719,7 +1563,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co // 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 a99438533b..35bf14e75c 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -87,7 +87,6 @@ public: void RestoreState() override {} void RenderText(const std::string& text, int left, int top, u32 color) override; - 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/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 549ad19b08..0b94fcc2cc 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -223,9 +223,6 @@ static void BPWritten(const BPCmd& bp) // Check if we are to copy from the EFB or draw to the XFB if (PE_copy.copy_to_xfb == 0) { - if (g_ActiveConfig.bShowEFBCopyRegions) - stats.efb_regions.push_back(srcRect); - // bpmem.zcontrol.pixel_format to PEControl::Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format) TextureCache::CopyRenderTargetToTexture(destAddr, PE_copy.tp_realFormat(), destStride, bpmem.zcontrol.pixel_format, srcRect, diff --git a/Source/Core/VideoCommon/Statistics.h b/Source/Core/VideoCommon/Statistics.h index cfb8891152..edd70bdf97 100644 --- a/Source/Core/VideoCommon/Statistics.h +++ b/Source/Core/VideoCommon/Statistics.h @@ -30,8 +30,6 @@ struct Statistics float g2proj_0, g2proj_1, g2proj_2, g2proj_3, g2proj_4, g2proj_5; float g2proj_6, g2proj_7, g2proj_8, g2proj_9, g2proj_10, g2proj_11, g2proj_12, g2proj_13, g2proj_14, g2proj_15; - std::vector efb_regions; - struct ThisFrame { int numBPLoads; diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 5b2cf6c487..874e8f2ddb 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -67,7 +67,6 @@ void VideoConfig::Load(const std::string& ini_file) settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false); settings->Get("OverlayStats", &bOverlayStats, false); settings->Get("OverlayProjStats", &bOverlayProjStats, false); - settings->Get("ShowEFBCopyRegions", &bShowEFBCopyRegions, false); settings->Get("DumpTextures", &bDumpTextures, 0); settings->Get("HiresTextures", &bHiresTextures, 0); settings->Get("ConvertHiresTextures", &bConvertHiresTextures, 0); @@ -294,7 +293,6 @@ void VideoConfig::Save(const std::string& ini_file) settings->Set("UseFFV1", bUseFFV1); settings->Set("EnablePixelLighting", bEnablePixelLighting); settings->Set("FastDepthCalc", bFastDepthCalc); - settings->Set("ShowEFBCopyRegions", bShowEFBCopyRegions); settings->Set("MSAA", iMultisampleMode); settings->Set("SSAA", bSSAA); settings->Set("EFBScale", iEFBScale); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 6504353004..e1681ca291 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -101,7 +101,6 @@ struct VideoConfig final bool bOverlayProjStats; bool bTexFmtOverlayEnable; bool bTexFmtOverlayCenter; - bool bShowEFBCopyRegions; bool bLogRenderTimeToFile; // Render