Merged the D3D9 debugger into VideoCommon/VideoUICommon:

Separated UI from debugger functionality. Generally cleaned up that stuff.
Most functionality needs to be reimplemented now, but will be available to D3D9, D3D11 as well as OpenGL then.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6523 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-12-05 14:15:36 +00:00
parent 9da4fe086b
commit 7854bd7109
36 changed files with 735 additions and 1112 deletions

View File

@ -1,161 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "IniFile.h"
#include "Debugger.h"
#include "VideoConfig.h"
#include "../Globals.h"
#include "FileUtil.h"
extern int g_Preset;
BEGIN_EVENT_TABLE(GFXDebuggerOGL,wxPanel)
EVT_CLOSE(GFXDebuggerOGL::OnClose)
EVT_CHECKBOX(ID_SAVETOFILE,GFXDebuggerOGL::GeneralSettings)
EVT_CHECKBOX(ID_INFOLOG,GFXDebuggerOGL::GeneralSettings)
EVT_CHECKBOX(ID_PRIMLOG,GFXDebuggerOGL::GeneralSettings)
EVT_CHECKBOX(ID_SAVETEXTURES,GFXDebuggerOGL::GeneralSettings)
EVT_CHECKBOX(ID_SAVETARGETS,GFXDebuggerOGL::GeneralSettings)
EVT_CHECKBOX(ID_SAVESHADERS,GFXDebuggerOGL::GeneralSettings)
END_EVENT_TABLE()
GFXDebuggerOGL::GFXDebuggerOGL(wxWindow *parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style, const wxString &title)
: wxPanel(parent, id, pos, size, style, title)
{
CreateGUIControls();
LoadSettings();
}
GFXDebuggerOGL::~GFXDebuggerOGL()
{
}
void GFXDebuggerOGL::OnClose(wxCloseEvent& event)
{
// Save the window position
SaveSettings();
event.Skip();
}
void GFXDebuggerOGL::SaveSettings() const
{
IniFile file;
file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window
// TODO: get the screen resolution and make limits from that
if (GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000
&& GetSize().GetHeight() < 1000)
{
file.Set("VideoWindow", "x", GetPosition().x);
file.Set("VideoWindow", "y", GetPosition().y);
file.Set("VideoWindow", "w", GetSize().GetWidth());
file.Set("VideoWindow", "h", GetSize().GetHeight());
}
file.Set("VideoWindow", "WriteToFile", m_Check[0]->IsChecked());
g_Config.iLog = bInfoLog ? CONF_LOG : 0;
g_Config.iLog |= bPrimLog ? CONF_PRIMLOG : 0;
g_Config.iLog |= bSaveTextures ? CONF_SAVETEXTURES : 0;
g_Config.iLog |= bSaveTargets ? CONF_SAVETARGETS : 0;
g_Config.iLog |= bSaveShaders ? CONF_SAVESHADERS : 0;
file.Set("VideoWindow", "ConfBits", g_Config.iLog);
file.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
}
void GFXDebuggerOGL::LoadSettings()
{
IniFile file;
file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
int x = 100, y = 100, w = 100, h = 100;
file.Get("VideoWindow", "x", &x, GetPosition().x);
file.Get("VideoWindow", "y", &y, GetPosition().y);
file.Get("VideoWindow", "w", &w, GetSize().GetWidth());
file.Get("VideoWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h);
file.Get("VideoWindow", "ConfBits", &g_Config.iLog, 0);
bInfoLog = (g_Config.iLog & CONF_LOG) ? true : false;
bPrimLog = (g_Config.iLog & CONF_PRIMLOG) ? true : false;
bSaveTextures = (g_Config.iLog & CONF_SAVETEXTURES) ? true : false;
bSaveTargets = (g_Config.iLog & CONF_SAVETARGETS) ? true : false;
bSaveShaders = (g_Config.iLog & CONF_SAVESHADERS) ? true : false;
m_Check[1]->SetValue(bInfoLog);
m_Check[2]->SetValue(bPrimLog);
m_Check[3]->SetValue(bSaveTextures);
m_Check[4]->SetValue(bSaveTargets);
m_Check[5]->SetValue(bSaveShaders);
}
void GFXDebuggerOGL::CreateGUIControls()
{
// Basic settings
CenterOnParent();
// Options
wxStaticBoxSizer *sOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Options"));
m_Check[0] = new wxCheckBox(this, ID_SAVETOFILE, wxT("Save to file"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1] = new wxCheckBox(this, ID_INFOLOG, wxT("Info log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[2] = new wxCheckBox(this, ID_PRIMLOG, wxT("Primary log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[3] = new wxCheckBox(this, ID_SAVETEXTURES, wxT("Save Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[4] = new wxCheckBox(this, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[5] = new wxCheckBox(this, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i)
sOptions->Add(m_Check[i], 0, 0, 5);
// Layout everything
wxBoxSizer *sMain = new wxBoxSizer(wxHORIZONTAL);
sMain->Add(sOptions);
SetSizerAndFit(sMain);
Fit();
}
// General settings
void GFXDebuggerOGL::GeneralSettings(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_INFOLOG:
bInfoLog = event.IsChecked();
break;
case ID_PRIMLOG:
bPrimLog = event.IsChecked();
break;
case ID_SAVETEXTURES:
bSaveTextures = event.IsChecked();
break;
case ID_SAVETARGETS:
bSaveTargets = event.IsChecked();
break;
case ID_SAVESHADERS:
bSaveShaders = event.IsChecked();
break;
}
SaveSettings();
}

View File

@ -1,73 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _CDEBUGGER_H_
#define _CDEBUGGER_H_
#include <wx/wx.h>
#include <wx/notebook.h>
#include "../Globals.h"
class IniFile;
class GFXDebuggerOGL : public wxPanel
{
public:
GFXDebuggerOGL(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString &title = wxT("OpenGL Debugger"));
virtual ~GFXDebuggerOGL();
void SaveSettings() const;
void LoadSettings();
bool bInfoLog;
bool bPrimLog;
bool bSaveTextures;
bool bSaveTargets;
bool bSaveShaders;
private:
DECLARE_EVENT_TABLE();
wxCheckBox* m_Check[6];
// WARNING: Make sure these are not also elsewhere
enum
{
ID_MAINPANEL = 2000,
ID_SAVETOFILE,
ID_INFOLOG,
ID_PRIMLOG,
ID_SAVETEXTURES,
ID_SAVETARGETS,
ID_SAVESHADERS,
NUM_OPTIONS
};
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
void GeneralSettings(wxCommandEvent& event);
};
#endif // _CDEBUGGER_H_

View File

@ -31,6 +31,7 @@
#include "PixelShaderCache.h"
#include "PixelShaderManager.h"
#include "FileUtil.h"
#include "Debugger.h"
static int s_nMaxPixelInstructions;
static GLuint s_ColorMatrixProgram = 0;
@ -193,6 +194,7 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp
// Check if the shader is already set
if (uid == last_pixel_shader_uid && PixelShaders[uid].frameCount == frameCount)
{
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
return pShaderLast;
}
@ -209,10 +211,11 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp
pShaderLast = &entry.shader;
}
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
return pShaderLast;
}
//Make an entry in the table
// Make an entry in the table
PSCacheEntry& newentry = PixelShaders[uid];
newentry.frameCount = frameCount;
pShaderLast = &newentry.shader;
@ -235,11 +238,13 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp
char szTemp[MAX_PATH];
sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++);
SaveData(szTemp, code);
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
return NULL;
}
INCSTAT(stats.numPixelShadersCreated);
SETSTAT(stats.numPixelShadersAlive, PixelShaders.size());
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
return pShaderLast;
}

View File

@ -57,6 +57,7 @@
#include "StringUtil.h"
#include "FramebufferManager.h"
#include "Fifo.h"
#include "Debugger.h"
#include "main.h" // Local
#ifdef _WIN32
@ -1310,6 +1311,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
frameCount++;
GFX_DEBUGGER_PAUSE_AT(NEXT_FRAME, true);
// Begin new frame
// Set default viewport and scissor, for the clear to work correctly
// New frame

View File

@ -23,11 +23,6 @@ files = [
libs = [ 'videocommon', 'videouicommon', 'GLEW', 'SOIL', 'common' ]
if env['HAVE_WX']:
files += [
'Debugger/Debugger.cpp',
]
if sys.platform == 'darwin' and not env['HAVE_WX']:
files += [ 'cocoaGL.m' ]
elif sys.platform == 'win32':

View File

@ -40,6 +40,7 @@
#include "IndexGenerator.h"
#include "OpcodeDecoding.h"
#include "FileUtil.h"
#include "Debugger.h"
#include "main.h"
@ -239,6 +240,8 @@ void VertexManager::vFlush()
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
glEnable(GL_BLEND);
}
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
//s_nCurVBOIndex = (s_nCurVBOIndex + 1) % ARRAYSIZE(s_vboBuffers);
s_pCurBufferPointer = LocalVBuffer;
IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer);

View File

@ -33,6 +33,7 @@
#include "XFMemory.h"
#include "ImageWrite.h"
#include "FileUtil.h"
#include "Debugger.h"
VertexShaderCache::VSCache VertexShaderCache::vshaders;
bool VertexShaderCache::s_displayCompileAlert;
@ -107,7 +108,10 @@ VERTEXSHADER* VertexShaderCache::SetShader(u32 components)
VERTEXSHADERUID uid;
GetVertexShaderId(&uid, components);
if (uid == last_vertex_shader_uid && vshaders[uid].frameCount == frameCount)
{
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
return pShaderLast;
}
memcpy(&last_vertex_shader_uid, &uid, sizeof(VERTEXSHADERUID));
VSCache::iterator iter = vshaders.find(uid);
@ -119,10 +123,11 @@ VERTEXSHADER* VertexShaderCache::SetShader(u32 components)
pShaderLast = &entry.shader;
}
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
return pShaderLast;
}
//Make an entry in the table
// Make an entry in the table
VSCacheEntry& entry = vshaders[uid];
entry.frameCount = frameCount;
pShaderLast = &entry.shader;
@ -140,11 +145,13 @@ VERTEXSHADER* VertexShaderCache::SetShader(u32 components)
if (!code || !VertexShaderCache::CompileVertexShader(entry.shader, code)) {
ERROR_LOG(VIDEO, "failed to create vertex shader");
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
return NULL;
}
INCSTAT(stats.numVertexShadersCreated);
SETSTAT(stats.numVertexShadersAlive, vshaders.size());
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
return pShaderLast;
}

View File

@ -62,7 +62,7 @@ Make AA apply instantly during gameplay if possible
#if defined(HAVE_WX) && HAVE_WX
#include "VideoConfigDiag.h"
#include "Debugger/Debugger.h"
#include "DebuggerPanel.h"
#endif // HAVE_WX
#include "MainBase.h"
@ -131,7 +131,7 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
void *DllDebugger(void *_hParent, bool Show)
{
#if defined(HAVE_WX) && HAVE_WX
return new GFXDebuggerOGL((wxWindow *)_hParent);
return new GFXDebuggerPanel((wxWindow *)_hParent);
#else
return NULL;
#endif
@ -166,6 +166,7 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsRealXFB = true;
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bAllowSignedBytes = true;
g_Config.backend_info.bSupportsDualSourceBlend = false; // supported, but broken
}
void DllConfig(void *_hParent)