From 845204c2273cc39578d8c47367a978338e55c5a9 Mon Sep 17 00:00:00 2001 From: omegadox Date: Mon, 16 Mar 2009 07:54:44 +0000 Subject: [PATCH] Added option "Show EFB Copy Regions" to find out which games are heavy on EFB-Copy. Changed Dst Alpha Pass option to "Disable Dst Alpha Pass". git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2665 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/Statistics.h | 4 +++ .../Plugins/Plugin_VideoOGL/Src/BPStructs.cpp | 3 ++ Source/Plugins/Plugin_VideoOGL/Src/Config.cpp | 4 ++- Source/Plugins/Plugin_VideoOGL/Src/Config.h | 1 + .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 13 +++++-- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.h | 2 ++ Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 34 ++++++++++++++++++- .../Plugin_VideoOGL/Src/VertexManager.cpp | 2 +- 8 files changed, 57 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/Src/Statistics.h b/Source/Core/VideoCommon/Src/Statistics.h index 215bfa8b66..ae4d8e16b4 100644 --- a/Source/Core/VideoCommon/Src/Statistics.h +++ b/Source/Core/VideoCommon/Src/Statistics.h @@ -16,6 +16,8 @@ // http://code.google.com/p/dolphin-emu/ #include "CommonTypes.h" +#include "VideoCommon.h" +#include #ifndef _STATISTICS_H #define _STATISTICS_H @@ -55,6 +57,8 @@ 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/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp index 9c9b459222..18b7284de3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp @@ -392,6 +392,9 @@ void BPWritten(int addr, int changes, int newval) // -------------------------- if (PE_copy.copy_to_xfb == 0) { + if (g_Config.bShowEFBCopyRegions) + stats.efb_regions.push_back(rc); + // EFB to texture // for some reason it sets bpmem.zcontrol.pixel_format to PIXELFMT_Z24 every time a zbuffer format is given as a dest to GXSetTexCopyDst if (!g_Config.bEFBCopyDisable) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp index c905996044..d642d5b47d 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp @@ -56,6 +56,7 @@ void Config::Load() iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); iniFile.Get("Settings", "OverlayBlendStats", &bOverlayBlendStats, false); iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false); + iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false); iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0); iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0); iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0); @@ -101,9 +102,10 @@ void Config::Save() iniFile.Set("Settings", "OverlayBlendStats", bOverlayBlendStats); iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats); iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel); + iniFile.Set("Settings", "Show", iCompileDLsLevel); iniFile.Set("Settings", "DumpTextures", bDumpTextures); iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget); - iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors); + iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); iniFile.Set("Settings", "MSAA", iMultisampleMode); iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h index a435338c2d..1196fed812 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h @@ -72,6 +72,7 @@ struct Config bool bOverlayProjStats; bool bTexFmtOverlayEnable; bool bTexFmtOverlayCenter; + bool bShowEFBCopyRegions; // Render bool bWireFrame; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index 8006fcda01..05a6d6bd51 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -48,6 +48,7 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog) EVT_CHECKBOX(ID_STATISTICS, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_BLENDSTATS, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_PROJSTATS, ConfigDialog::AdvancedSettingsChanged) + EVT_CHECKBOX(ID_SHOWEFBCOPYREGIONS, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_SHADERERRORS, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_TEXFMTOVERLAY, ConfigDialog::AdvancedSettingsChanged) EVT_CHECKBOX(ID_TEXFMTCENTER, ConfigDialog::AdvancedSettingsChanged) @@ -281,6 +282,8 @@ void ConfigDialog::CreateGUIControls() m_BlendStats->SetValue(g_Config.bOverlayBlendStats); m_ProjStats = new wxCheckBox(m_PageAdvanced, ID_PROJSTATS, wxT("Overlay Projection Stats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_ProjStats->SetValue(g_Config.bOverlayProjStats); + m_ShowEFBCopyRegions = new wxCheckBox(m_PageAdvanced, ID_SHOWEFBCOPYREGIONS, wxT("Show EFB Copy Regions"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_ShowEFBCopyRegions->SetValue(g_Config.bShowEFBCopyRegions); m_ShaderErrors = new wxCheckBox(m_PageAdvanced, ID_SHADERERRORS, wxT("Show shader compilation issues"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); //m_ShaderErrors->SetValue(g_Config.bShowShaderErrors); m_ShaderErrors->Enable(false); @@ -301,7 +304,7 @@ void ConfigDialog::CreateGUIControls() m_DisableTexturing = new wxCheckBox(m_PageAdvanced, ID_DISABLETEXTURING, wxT("Disable Texturing"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_DisableTexturing->SetValue(g_Config.bDisableTexturing); m_DisableTexturing->Enable(true); - m_DstAlphaPass = new wxCheckBox(m_PageAdvanced, ID_DSTALPHAPASS, wxT("Destination Alpha Pass"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_DstAlphaPass = new wxCheckBox(m_PageAdvanced, ID_DSTALPHAPASS, wxT("Disable Destination Alpha Pass"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_DstAlphaPass->SetValue(g_Config.bDstAlphaPass); m_DstAlphaPass->Enable(true); @@ -366,8 +369,9 @@ void ConfigDialog::CreateGUIControls() sInfo->Add(m_Statistics, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5); sInfo->Add(m_BlendStats, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5); sInfo->Add(m_ProjStats, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5); - sInfo->Add(m_TexFmtOverlay, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5); - sInfo->Add(m_TexFmtCenter, wxGBPosition(5, 1), wxGBSpan(1, 1), wxALL, 5); + sInfo->Add(m_ShowEFBCopyRegions, wxGBPosition(5, 0), wxGBSpan(1, 2), wxALL, 5); + sInfo->Add(m_TexFmtOverlay, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALL, 5); + sInfo->Add(m_TexFmtCenter, wxGBPosition(6, 1), wxGBSpan(1, 1), wxALL, 5); sbInfo->Add(sInfo); wxBoxSizer *sRenderBoxRow1 = new wxBoxSizer(wxHORIZONTAL); @@ -500,6 +504,9 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event) g_Config.bTexFmtOverlayCenter = m_TexFmtCenter->IsChecked(); TextureMngr::Invalidate(false); break; + case ID_SHOWEFBCOPYREGIONS: + g_Config.bShowEFBCopyRegions = m_ShowEFBCopyRegions->IsChecked(); + break; case ID_WIREFRAME: g_Config.bWireFrame = m_Wireframe->IsChecked(); break; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index 362d5c6db5..26084d84d4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -97,6 +97,7 @@ class ConfigDialog : public wxDialog wxCheckBox *m_Statistics; wxCheckBox *m_BlendStats; wxCheckBox *m_ProjStats; + wxCheckBox *m_ShowEFBCopyRegions; wxCheckBox *m_TexFmtOverlay; wxCheckBox *m_TexFmtCenter; wxCheckBox *m_Wireframe; @@ -148,6 +149,7 @@ class ConfigDialog : public wxDialog ID_STATISTICS, ID_BLENDSTATS, ID_PROJSTATS, + ID_SHOWEFBCOPYREGIONS, ID_TEXFMTOVERLAY, ID_TEXFMTCENTER, diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 596284bc05..673d7451f4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1124,7 +1124,39 @@ void Renderer::DrawDebugText() p+=sprintf(p, "FPS: %d\n", s_fps); } - if (g_Config.bOverlayStats) { + if (g_Config.bShowEFBCopyRegions) + { + glLineWidth(8.0f); + + glBegin(GL_LINES); + + for (std::vector::const_iterator it = stats.efb_regions.begin(); it != stats.efb_regions.end(); ++it) + { + GLfloat x = (GLfloat) -1.0f + (it->left / Renderer::GetTargetWidth()); + GLfloat y = (GLfloat) 1.0f + (it->top / Renderer::GetTargetHeight()); + GLfloat x2 = (GLfloat) (x + it->GetWidth()) / Renderer::GetTargetWidth(); + GLfloat y2 = (GLfloat) (y - it->GetHeight()) / Renderer::GetTargetHeight(); + + glColor3f(0.0f, 0.0f, 0.0f); + glVertex2f(x, y - 0.01f); glVertex2f(x2 + 0.008f, y - 0.01f); + glVertex2f(x, y2 - 0.01f); glVertex2f(x2 + 0.008f, y2 - 0.01f); + glVertex2f(x - 0.01f, y); glVertex2f(x - 0.01f, y2 + 0.008f); + glVertex2f(x2 - 0.01f, y); glVertex2f(x2 - 0.01f, y2 + 0.008f); + + glColor3f(0.0f, 1.0f, 1.0f); + glVertex2f(x, y); glVertex2f(x2 + 0.008f, y); + glVertex2f(x, y2); glVertex2f(x2 + 0.008f, y2); + glVertex2f(x, y); glVertex2f(x, y2 + 0.008f); + glVertex2f(x2, y); glVertex2f(x2, y2 + 0.008f); + } + + glEnd(); + + stats.efb_regions.clear(); + } + + if (g_Config.bOverlayStats) + { p+=sprintf(p,"textures created: %i\n",stats.numTexturesCreated); p+=sprintf(p,"textures alive: %i\n",stats.numTexturesAlive); p+=sprintf(p,"pshaders created: %i\n",stats.numPixelShadersCreated); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index c532a344bc..3575a3088f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -285,7 +285,7 @@ void Flush() } // run through vertex groups again to set alpha - if (g_Config.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate) { + if (!g_Config.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate) { ps = PixelShaderCache::GetShader(true); if (ps) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps->glprogid);