Added more overlay stats options.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2268 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
omegadox 2009-02-15 20:49:59 +00:00
parent 94ac651544
commit 7a276e687e
8 changed files with 157 additions and 21 deletions

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "CommonTypes.h"
#ifndef _STATISTICS_H
#define _STATISTICS_H
@ -37,6 +39,22 @@ struct Statistics
int numVertexLoaders;
int logicOpMode;
int srcFactor;
int dstFactor;
int dither;
int alphaUpdate;
int colorUpdate;
int dstAlphaEnable;
u32 dstAlpha;
float proj_0, proj_1, proj_2, proj_3, proj_4, proj_5, proj_6;
float gproj_0, gproj_1, gproj_2, gproj_3, gproj_4, gproj_5;
float gproj_6, gproj_7, gproj_8, gproj_9, gproj_10, gproj_11, gproj_12, gproj_13, gproj_14, gproj_15;
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;
struct ThisFrame
{
int numBPLoads;
@ -71,6 +89,8 @@ extern Statistics stats;
#define INCSTAT(a) (a)++;
#define ADDSTAT(a,b) (a)+=(b);
#define SETSTAT(a,x) (a)=(int)(x);
#define SETSTAT_UINT(a,x) (a)=(u32)(x);
#define SETSTAT_FT(a,x) (a)=(float)(x);
#else
#define INCSTAT(a) ;
#define ADDSTAT(a,b) ;

View File

@ -198,6 +198,7 @@ void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
bProjectionChanged = false;
static float GC_ALIGNED16(g_fProjectionMatrix[16]);
if (xfregs.rawProjection[6] == 0) {
g_fProjectionMatrix[0] = xfregs.rawProjection[0];
g_fProjectionMatrix[1] = 0.0f;
@ -233,6 +234,23 @@ void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
// -(1 + epsilon) so objects are clipped as they are on the real HW
g_fProjectionMatrix[14] = -1.00000011921f;
g_fProjectionMatrix[15] = 0.0f;
SETSTAT_FT(stats.gproj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.gproj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.gproj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.gproj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.gproj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.gproj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.gproj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.gproj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.gproj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.gproj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.gproj_10, g_fProjectionMatrix[10]);
SETSTAT_FT(stats.gproj_11, g_fProjectionMatrix[11]);
SETSTAT_FT(stats.gproj_12, g_fProjectionMatrix[12]);
SETSTAT_FT(stats.gproj_13, g_fProjectionMatrix[13]);
SETSTAT_FT(stats.gproj_14, g_fProjectionMatrix[14]);
SETSTAT_FT(stats.gproj_15, g_fProjectionMatrix[15]);
}
else {
g_fProjectionMatrix[0] = xfregs.rawProjection[0];
@ -268,8 +286,33 @@ void VertexShaderManager::SetConstants(bool proj_hax_1, bool proj_hax_2)
g_fProjectionMatrix[13] = 0;
g_fProjectionMatrix[14] = 0.0f;
g_fProjectionMatrix[15] = 1.0f;
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
SETSTAT_FT(stats.g2proj_2, g_fProjectionMatrix[2]);
SETSTAT_FT(stats.g2proj_3, g_fProjectionMatrix[3]);
SETSTAT_FT(stats.g2proj_4, g_fProjectionMatrix[4]);
SETSTAT_FT(stats.g2proj_5, g_fProjectionMatrix[5]);
SETSTAT_FT(stats.g2proj_6, g_fProjectionMatrix[6]);
SETSTAT_FT(stats.g2proj_7, g_fProjectionMatrix[7]);
SETSTAT_FT(stats.g2proj_8, g_fProjectionMatrix[8]);
SETSTAT_FT(stats.g2proj_9, g_fProjectionMatrix[9]);
SETSTAT_FT(stats.g2proj_10, g_fProjectionMatrix[10]);
SETSTAT_FT(stats.g2proj_11, g_fProjectionMatrix[11]);
SETSTAT_FT(stats.g2proj_12, g_fProjectionMatrix[12]);
SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]);
SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]);
SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]);
}
SETSTAT_FT(stats.proj_0, xfregs.rawProjection[0]);
SETSTAT_FT(stats.proj_1, xfregs.rawProjection[1]);
SETSTAT_FT(stats.proj_2, xfregs.rawProjection[2]);
SETSTAT_FT(stats.proj_3, xfregs.rawProjection[3]);
SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]);
SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]);
SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]);
PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]);
SetVSConstant4fv(C_PROJECTION, &g_fProjectionMatrix[0]);
SetVSConstant4fv(C_PROJECTION+1, &g_fProjectionMatrix[4]);

View File

@ -21,6 +21,7 @@
#include "Globals.h"
#include "Profiler.h"
#include "Config.h"
#include "Statistics.h"
#include "VertexLoader.h"
#include "VertexManager.h"
@ -147,6 +148,8 @@ void BPWritten(int addr, int changes, int newval)
VertexManager::Flush();
((u32*)&bpmem)[addr] = newval;
PRIM_LOG("constalpha: alp=%d, en=%d\n", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
SETSTAT(stats.dstAlphaEnable, bpmem.dstalpha.enable);
SETSTAT_UINT(stats.dstAlpha, bpmem.dstalpha.alpha);
Renderer::SetBlendMode(false);
}
break;
@ -199,8 +202,9 @@ void BPWritten(int addr, int changes, int newval)
15: GL_SET
*/
// Do LogicOp Blending
// LogicOp Blending
if (changes & 2) {
SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode);
if (bpmem.blendmode.logicopenable)
{
glEnable(GL_COLOR_LOGIC_OP);
@ -211,16 +215,28 @@ void BPWritten(int addr, int changes, int newval)
glDisable(GL_COLOR_LOGIC_OP);
}
// Dithering
if (changes & 4) {
SETSTAT(stats.dither, bpmem.blendmode.dither);
if (bpmem.blendmode.dither) glEnable(GL_DITHER);
else glDisable(GL_DITHER);
}
// Blending
if (changes & 0xFE1)
{
SETSTAT(stats.srcFactor, bpmem.blendmode.srcfactor);
SETSTAT(stats.dstFactor, bpmem.blendmode.dstfactor);
Renderer::SetBlendMode(false);
}
if (changes & 0x18)
// Color Mask
if (changes & 0x18)
{
SETSTAT(stats.alphaUpdate, bpmem.blendmode.alphaupdate);
SETSTAT(stats.colorUpdate, bpmem.blendmode.colorupdate);
Renderer::SetColorMask();
}
}
break;

View File

@ -53,6 +53,8 @@ void Config::Load()
iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings
iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
iniFile.Get("Settings", "OverlayBlendStats", &bOverlayBlendStats, false);
iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false);
iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
@ -102,6 +104,8 @@ void Config::Save()
iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache);
iniFile.Set("Settings", "ShowFPS", bShowFPS);
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
iniFile.Set("Settings", "OverlayBlendStats", bOverlayBlendStats);
iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats);
iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);

View File

@ -50,6 +50,8 @@ struct Config
// Information
bool bShowFPS;
bool bOverlayStats;
bool bOverlayBlendStats;
bool bOverlayProjStats;
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;

View File

@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHECKBOX(ID_WIREFRAME, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_SHOWFPS, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_STATISTICS, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_BLENDSTATS, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_PROJSTATS, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_SHADERERRORS, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_TEXFMTOVERLAY, ConfigDialog::AdvancedSettingsChanged)
EVT_CHECKBOX(ID_TEXFMTCENTER, ConfigDialog::AdvancedSettingsChanged)
@ -195,6 +197,10 @@ void ConfigDialog::CreateGUIControls()
m_ShowFPS->SetValue(g_Config.bShowFPS);
m_Statistics = new wxCheckBox(m_PageAdvanced, ID_STATISTICS, wxT("Overlay some statistics"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Statistics->SetValue(g_Config.bOverlayStats);
m_BlendStats = new wxCheckBox(m_PageAdvanced, ID_BLENDSTATS, wxT("Overlay Blend Stats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
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_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);
@ -271,8 +277,10 @@ void ConfigDialog::CreateGUIControls()
sInfo->Add(m_ShowFPS, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sInfo->Add(m_ShaderErrors, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sInfo->Add(m_Statistics, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sInfo->Add(m_TexFmtOverlay, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 5);
sInfo->Add(m_TexFmtCenter, wxGBPosition(3, 1), wxGBSpan(1, 1), 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);
sbInfo->Add(sInfo);
sAdvanced->Add(sbInfo, 0, wxEXPAND|wxALL, 5);
@ -461,6 +469,13 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
case ID_RADIO_COPYEFBTOGL:
g_Config.bCopyEFBToRAM = false;
break;
case ID_BLENDSTATS:
g_Config.bOverlayBlendStats = m_BlendStats->IsChecked();
break;
case ID_PROJSTATS:
g_Config.bOverlayProjStats = m_ProjStats->IsChecked();
break;
default:
break;
}

View File

@ -92,6 +92,8 @@ class ConfigDialog : public wxDialog
wxCheckBox *m_ShowFPS;
wxCheckBox *m_ShaderErrors;
wxCheckBox *m_Statistics;
wxCheckBox *m_BlendStats;
wxCheckBox *m_ProjStats;
wxCheckBox *m_TexFmtOverlay;
wxCheckBox *m_TexFmtCenter;
wxCheckBox *m_UseXFB;
@ -137,6 +139,8 @@ class ConfigDialog : public wxDialog
ID_SHOWFPS,
ID_SHADERERRORS,
ID_STATISTICS,
ID_BLENDSTATS,
ID_PROJSTATS,
ID_TEXFMTOVERLAY,
ID_TEXFMTCENTER,

View File

@ -903,6 +903,9 @@ void Renderer::SwapBuffers()
static int fpscount;
static int s_fps;
static unsigned long lasttime;
char st[8192];
char* p = st;
++fpscount;
if (timeGetTime() - lasttime > 1000)
{
@ -911,11 +914,13 @@ void Renderer::SwapBuffers()
fpscount = 0;
}
if (g_Config.bShowFPS)
{
p+=sprintf(p, "%d\n", s_fps);
Renderer::RenderText(st, 20, 20, 0xFF00FFFF);
}
if (g_Config.bOverlayStats) {
char st[8192];
char *p = st;
if (g_Config.bShowFPS)
p+=sprintf(p, "FPS: %d\n", s_fps); // So it shows up before the stats and doesn't make anyting ugly
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);
@ -941,20 +946,47 @@ void Renderer::SwapBuffers()
p+=sprintf(p,"BP loads (DL): %i\n",stats.thisFrame.numBPLoadsInDL);
p+=sprintf(p,"vertex loaders: %i\n",stats.numVertexLoaders);
std::string text = st;
VertexLoaderManager::AppendListToString(&text);
Renderer::RenderText(text.c_str(), 20, 20, 0xFF00FFFF);
}
else
{
if (g_Config.bShowFPS)
{
char strfps[25];
sprintf(strfps, "%d\n", s_fps);
Renderer::RenderText(strfps, 20, 20, 0xFF00FFFF);
}
std::string text1;
VertexLoaderManager::AppendListToString(&text1);
p+=sprintf(p,"%s",text1.c_str());
}
if (g_Config.bOverlayBlendStats)
{
p+=sprintf(p,"LogicOp Mode: %i\n", stats.logicOpMode);
p+=sprintf(p,"Source Factor: %i\n", stats.srcFactor);
p+=sprintf(p,"Destination Factor: %i\n", stats.dstFactor);
p+=sprintf(p,"Dithering: %s\n", stats.dither==1 ? "Enabled" : "Disabled");
p+=sprintf(p,"Color Update: %s\n", stats.colorUpdate==1 ? "Enabled" : "Disabled");
p+=sprintf(p,"Alpha Update: %s\n", stats.alphaUpdate==1 ? "Enabled" : "Disabled");
p+=sprintf(p,"Dst Alpha Enabled: %s\n", stats.dstAlphaEnable==1 ? "Enabled" : "Disabled");
p+=sprintf(p,"Dst Alpha: %08x\n", stats.dstAlpha);
}
if (g_Config.bOverlayProjStats)
{
p+=sprintf(p,"Projection #: X for Raw 6=0 (X for Raw 6!=0)\n\n");
p+=sprintf(p,"Projection 0: %f (%f) Raw 0: %f\n", stats.gproj_0, stats.g2proj_0, stats.proj_0);
p+=sprintf(p,"Projection 1: %f (%f)\n", stats.gproj_1, stats.g2proj_1);
p+=sprintf(p,"Projection 2: %f (%f) Raw 1: %f\n", stats.gproj_2, stats.g2proj_2, stats.proj_1);
p+=sprintf(p,"Projection 3: %f (%f)\n\n", stats.gproj_3, stats.g2proj_3);
p+=sprintf(p,"Projection 4: %f (%f)\n", stats.gproj_4, stats.g2proj_4);
p+=sprintf(p,"Projection 5: %f (%f) Raw 2: %f\n", stats.gproj_5, stats.g2proj_5, stats.proj_2);
p+=sprintf(p,"Projection 6: %f (%f) Raw 3: %f\n", stats.gproj_6, stats.g2proj_6, stats.proj_3);
p+=sprintf(p,"Projection 7: %f (%f)\n\n", stats.gproj_7, stats.g2proj_7);
p+=sprintf(p,"Projection 8: %f (%f)\n", stats.gproj_8, stats.g2proj_8);
p+=sprintf(p,"Projection 9: %f (%f)\n", stats.gproj_9, stats.g2proj_9);
p+=sprintf(p,"Projection 10: %f (%f) Raw 4: %f\n\n", stats.gproj_10, stats.g2proj_10, stats.proj_4);
p+=sprintf(p,"Projection 11: %f (%f) Raw 5: %f\n\n", stats.gproj_11, stats.g2proj_11, stats.proj_5);
p+=sprintf(p,"Projection 12: %f (%f)\n", stats.gproj_12, stats.g2proj_12);
p+=sprintf(p,"Projection 13: %f (%f)\n", stats.gproj_13, stats.g2proj_13);
p+=sprintf(p,"Projection 14: %f (%f)\n", stats.gproj_14, stats.g2proj_14);
p+=sprintf(p,"Projection 15: %f (%f)\n", stats.gproj_15, stats.g2proj_15);
}
std::string text = st;
Renderer::RenderText(text.c_str(), 21, 21, 0xDD000000);
Renderer::RenderText(text.c_str(), 20, 20, 0xFF00FFFF);
Renderer::ProcessMessages();