D3D: More not very interesting debugger fixes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4298 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
rice1964 2009-09-18 03:12:32 +00:00
parent 8b4839a4f4
commit 2bd989d4c8
3 changed files with 75 additions and 13 deletions

View File

@ -23,6 +23,9 @@
#include "../Globals.h"
#include "../D3DBase.h"
#include "../FramebufferManager.h"
#include "../TextureCache.h"
#include "../VertexShaderCache.h"
#include "../PixelShaderCache.h"
extern int g_Preset;
@ -41,8 +44,12 @@ BEGIN_EVENT_TABLE(GFXDebuggerDX9,wxDialog)
EVT_BUTTON(ID_DUMP,GFXDebuggerDX9::OnDumpButton)
EVT_BUTTON(ID_UPDATE_SCREEN,GFXDebuggerDX9::OnUpdateScreenButton)
EVT_BUTTON(ID_CLEAR_SCREEN,GFXDebuggerDX9::OnClearScreenButton)
EVT_BUTTON(ID_CLEAR_TEXTURE_CACHE,GFXDebuggerDX9::OnClearTextureCacheButton)
EVT_BUTTON(ID_CLEAR_VERTEX_SHADER_CACHE,GFXDebuggerDX9::OnClearVertexShaderCacheButton)
EVT_BUTTON(ID_CLEAR_PIXEL_SHADER_CACHE,GFXDebuggerDX9::OnClearPixelShaderCacheButton)
END_EVENT_TABLE()
GFXDebuggerDX9::GFXDebuggerDX9(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
@ -147,18 +154,17 @@ static PauseEventMap pauseEventMap[] = {
{NEXT_SET_TLUT, wxT("TLUT Cmd")},
{NEXT_FIFO, wxT("Fifo")},
{NEXT_DLIST, wxT("DList")},
{NEXT_UCODE, wxT("Ucode")},
{NEXT_ERROR, wxT("Error")}
};
static const int numPauseEventMap = sizeof(pauseEventMap)/sizeof(PauseEventMap);
static GFXDebuggerDX9 *g_pdebugger = NULL;
void GFXDebuggerDX9::CreateGUIControls()
{
g_pdebugger = this;
// Basic settings
SetIcon(wxNullIcon);
CenterOnParent();
@ -191,6 +197,9 @@ void GFXDebuggerDX9::CreateGUIControls()
m_pButtonDump = new wxButton(m_MainPanel, ID_DUMP, wxT("Dump"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Dump"));
m_pButtonUpdateScreen = new wxButton(m_MainPanel, ID_UPDATE_SCREEN, wxT("Update Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Update Screen"));
m_pButtonClearScreen = new wxButton(m_MainPanel, ID_CLEAR_SCREEN, wxT("Clear Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Clear Screen"));
m_pButtonClearTextureCache = new wxButton(m_MainPanel, ID_CLEAR_TEXTURE_CACHE, wxT("Clear Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Clear Textures"));
m_pButtonClearVertexShaderCache = new wxButton(m_MainPanel, ID_CLEAR_VERTEX_SHADER_CACHE, wxT("Clear V Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Clear V Shaders"));
m_pButtonClearPixelShaderCache = new wxButton(m_MainPanel, ID_CLEAR_PIXEL_SHADER_CACHE, wxT("Clear P Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Clear P Shaders"));
m_pCount = new wxTextCtrl(m_MainPanel, ID_COUNT, wxT("1"), wxDefaultPosition, wxSize(50,25), 0, wxDefaultValidator, wxT("Count"));
m_pDumpList = new wxChoice(m_MainPanel, ID_DUMP_LIST, wxDefaultPosition, wxSize(120,25), 0, NULL,0,wxDefaultValidator, wxT("DumpList"));
@ -228,12 +237,28 @@ void GFXDebuggerDX9::CreateGUIControls()
sMain->Add(m_pDumpList, 0, 0, 5);
sMain->Add(m_pButtonUpdateScreen, 0, 0, 5);
sMain->Add(m_pButtonClearScreen, 0, 0, 5);
sMain->Add(m_pButtonClearTextureCache, 0, 0, 5);
sMain->Add(m_pButtonClearVertexShaderCache, 0, 0, 5);
sMain->Add(m_pButtonClearPixelShaderCache, 0, 0, 5);
sMain->Add(m_pButtonPauseAtNextFrame, 0, 0, 5);
sMain->Add(m_pButtonGo, 0, 0, 5);
m_MainPanel->SetSizerAndFit(sMain);
Fit();
EnableButtons(false);
}
void GFXDebuggerDX9::EnableButtons(bool enable)
{
m_pButtonDump->Enable(enable);
m_pButtonUpdateScreen->Enable(enable);
m_pButtonClearScreen->Enable(enable);
m_pButtonClearTextureCache->Enable(enable);
m_pButtonClearVertexShaderCache->Enable(enable);
m_pButtonClearPixelShaderCache->Enable(enable);
}
// General settings
void GFXDebuggerDX9::GeneralSettings(wxCommandEvent& event)
{
@ -270,11 +295,11 @@ void GFXDebuggerDX9::OnPauseButton(wxCommandEvent& event)
void GFXDebuggerDX9::OnPauseAtNextButton(wxCommandEvent& event)
{
DX9DebuggerPauseFlag = false;
DX9DebuggerToPauseAtNext = (PauseEvent)(m_pPauseAtList->GetSelection());
DX9DebuggerToPauseAtNext = pauseEventMap[m_pPauseAtList->GetSelection()].event;
wxString val = m_pCount->GetValue();
long value;
if (val.ToLong(&value) )
DX9DebuggerEventToPauseCount = pauseEventMap[value].event;
DX9DebuggerEventToPauseCount = value;
else
DX9DebuggerEventToPauseCount = 1;
}
@ -296,13 +321,25 @@ void GFXDebuggerDX9::OnGoButton(wxCommandEvent& event)
DX9DebuggerPauseFlag = false;
}
void GFXDebuggerDX9::OnUpdateScreenButton(wxCommandEvent& event)
{
}
void GFXDebuggerDX9::OnClearScreenButton(wxCommandEvent& event)
{
}
void GFXDebuggerDX9::OnClearTextureCacheButton(wxCommandEvent& event)
{
TextureCache::Invalidate(false);
}
void GFXDebuggerDX9::OnClearVertexShaderCacheButton(wxCommandEvent& event)
{
VertexShaderCache::Clear();
}
void GFXDebuggerDX9::OnClearPixelShaderCacheButton(wxCommandEvent& event)
{
PixelShaderCache::Clear();
}
void UpdateFPSDisplay(const char *text);
extern bool D3D::bFrameInProgress;
@ -336,12 +373,18 @@ static void DX9DebuggerUpdateScreen()
void DX9DebuggerCheckAndPause(bool update)
{
while( DX9DebuggerPauseFlag )
if (DX9DebuggerPauseFlag)
{
UpdateFPSDisplay("Paused by Video Debugger");
g_pdebugger->EnableButtons(true);
while( DX9DebuggerPauseFlag )
{
if (update) DX9DebuggerUpdateScreen();
Sleep(5);
UpdateFPSDisplay("Paused by Video Debugger");
if (update) DX9DebuggerUpdateScreen();
Sleep(5);
}
g_pdebugger->EnableButtons(false);
}
}
@ -358,3 +401,7 @@ void ContinueDX9Debugger()
DX9DebuggerPauseFlag = false;
}
void GFXDebuggerDX9::OnUpdateScreenButton(wxCommandEvent& event)
{
DX9DebuggerUpdateScreen();
}

View File

@ -50,6 +50,8 @@ public:
bool bSaveTargets;
bool bSaveShaders;
void EnableButtons(bool enable);
private:
DECLARE_EVENT_TABLE();
@ -65,6 +67,9 @@ private:
wxChoice *m_pDumpList;
wxButton *m_pButtonUpdateScreen;
wxButton *m_pButtonClearScreen;
wxButton *m_pButtonClearTextureCache;
wxButton *m_pButtonClearVertexShaderCache;
wxButton *m_pButtonClearPixelShaderCache;
wxTextCtrl *m_pCount;
@ -88,6 +93,9 @@ private:
ID_DUMP_LIST,
ID_UPDATE_SCREEN,
ID_CLEAR_SCREEN,
ID_CLEAR_TEXTURE_CACHE,
ID_CLEAR_VERTEX_SHADER_CACHE,
ID_CLEAR_PIXEL_SHADER_CACHE,
ID_COUNT
};
@ -102,7 +110,11 @@ private:
void OnGoButton(wxCommandEvent& event);
void OnUpdateScreenButton(wxCommandEvent& event);
void OnClearScreenButton(wxCommandEvent& event);
void OnClearTextureCacheButton(wxCommandEvent& event);
void OnClearVertexShaderCacheButton(wxCommandEvent& event);
void OnClearPixelShaderCacheButton(wxCommandEvent& event);
void OnCountEnter(wxCommandEvent& event);
};
enum PauseEvent {

View File

@ -34,6 +34,8 @@
#include "TextureDecoder.h"
#include "TextureCache.h"
#include "debugger/debugger.h"
u8 *TextureCache::temp = NULL;
TextureCache::TexCache TextureCache::textures;
@ -254,6 +256,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
lastTexture[stage] = entry.texture;
DEBUGGER_PAUSE_LOG_AT(NEXT_NEW_TEXTURE,true,{printf("A new texture (%d x %d) is loaded", width, height);});
return &entry;
}