Various UI and documentation improvements to the GFX debugger.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7661 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2011-07-01 20:59:57 +00:00
parent cedda90477
commit 3c10f9f3e9
3 changed files with 56 additions and 35 deletions

View File

@ -141,31 +141,28 @@ void GFXDebuggerPanel::CreateGUIControls()
// Basic settings
CenterOnParent();
// MainPanel
m_MainPanel = new wxPanel(this, ID_MAINPANEL, wxDefaultPosition, wxDefaultSize);
m_pButtonPause = new wxButton(this, ID_PAUSE, _("Pause"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Pause"));
m_pButtonPauseAtNext = new wxButton(this, ID_PAUSE_AT_NEXT, _("Pause After"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Pause At Next"));
m_pButtonPauseAtNextFrame = new wxButton(this, ID_PAUSE_AT_NEXT_FRAME, _("Go to Next Frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Next Frame"));
m_pButtonCont = new wxButton(this, ID_CONT, _("Continue"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Continue"));
m_pButtonPause = new wxButton(m_MainPanel, ID_PAUSE, _("Pause"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Pause"));
m_pButtonPauseAtNext = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT, _("Pause At Next"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Pause At Next"));
m_pButtonPauseAtNextFrame = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT_FRAME, _("Next Frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Next Frame"));
m_pButtonCont = new wxButton(m_MainPanel, ID_CONT, _("Continue"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Continue"));
m_pCount = new wxTextCtrl(this, ID_COUNT, wxT("1"), wxDefaultPosition, wxSize(50,25), wxTE_RIGHT, wxDefaultValidator, _("Count"));
m_pPauseAtList = new wxChoice(m_MainPanel, ID_PAUSE_AT_LIST, wxDefaultPosition, wxSize(100,25), 0, NULL,0,wxDefaultValidator, _("PauseAtList"));
m_pPauseAtList = new wxChoice(this, ID_PAUSE_AT_LIST, wxDefaultPosition, wxSize(100,25), 0, NULL,0,wxDefaultValidator, _("PauseAtList"));
for (int i=0; i<numPauseEventMap; i++)
{
m_pPauseAtList->Append(pauseEventMap[i].ListStr);
}
m_pPauseAtList->SetSelection(0);
m_pButtonDump = new wxButton(m_MainPanel, ID_DUMP, _("Dump"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Dump"));
m_pButtonUpdateScreen = new wxButton(m_MainPanel, ID_UPDATE_SCREEN, _("Update Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Update Screen"));
m_pButtonClearScreen = new wxButton(m_MainPanel, ID_CLEAR_SCREEN, _("Clear Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear Screen"));
m_pButtonClearTextureCache = new wxButton(m_MainPanel, ID_CLEAR_TEXTURE_CACHE, _("Clear Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear Textures"));
m_pButtonClearVertexShaderCache = new wxButton(m_MainPanel, ID_CLEAR_VERTEX_SHADER_CACHE, _("Clear V Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear V Shaders"));
m_pButtonClearPixelShaderCache = new wxButton(m_MainPanel, ID_CLEAR_PIXEL_SHADER_CACHE, _("Clear P Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear P Shaders"));
m_pCount = new wxTextCtrl(m_MainPanel, ID_COUNT, wxT("1"), wxDefaultPosition, wxSize(50,25), 0, wxDefaultValidator, _("Count"));
m_pButtonDump = new wxButton(this, ID_DUMP, _("Dump"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Dump"));
m_pButtonUpdateScreen = new wxButton(this, ID_UPDATE_SCREEN, _("Update Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Update Screen"));
m_pButtonClearScreen = new wxButton(this, ID_CLEAR_SCREEN, _("Clear Screen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear Screen"));
m_pButtonClearTextureCache = new wxButton(this, ID_CLEAR_TEXTURE_CACHE, _("Clear Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear Textures"));
m_pButtonClearVertexShaderCache = new wxButton(this, ID_CLEAR_VERTEX_SHADER_CACHE, _("Clear V Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear V Shaders"));
m_pButtonClearPixelShaderCache = new wxButton(this, ID_CLEAR_PIXEL_SHADER_CACHE, _("Clear P Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Clear P Shaders"));
m_pDumpList = new wxChoice(m_MainPanel, ID_DUMP_LIST, wxDefaultPosition, wxSize(120,25), 0, NULL,0,wxDefaultValidator, _("DumpList"));
m_pDumpList = new wxChoice(this, ID_DUMP_LIST, wxDefaultPosition, wxSize(120,25), 0, NULL, 0 ,wxDefaultValidator, _("DumpList"));
m_pDumpList->Insert(_("Pixel Shader"),0);
m_pDumpList->Append(_("Vertex Shader"));
m_pDumpList->Append(_("Pixel Shader Constants"));
@ -181,21 +178,32 @@ void GFXDebuggerPanel::CreateGUIControls()
// Layout everything on m_MainPanel
wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_pButtonPause, 0, 0, 5);
sMain->Add(m_pButtonPauseAtNext, 0, 0, 5);
sMain->Add(m_pCount,0,0,5);
sMain->Add(m_pPauseAtList, 0, 0, 5);
sMain->Add(m_pButtonDump, 0, 0, 5);
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_pButtonCont, 0, 0, 5);
m_MainPanel->SetSizerAndFit(sMain);
Fit();
wxStaticBoxSizer* const pFlowCtrlBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Flow Control"));
wxBoxSizer* const pPauseAtNextSzr = new wxBoxSizer(wxHORIZONTAL);
pFlowCtrlBox->Add(m_pButtonPause);
pPauseAtNextSzr->Add(m_pButtonPauseAtNext);
pPauseAtNextSzr->Add(m_pCount);
pPauseAtNextSzr->Add(m_pPauseAtList);
pFlowCtrlBox->Add(pPauseAtNextSzr);
pFlowCtrlBox->Add(m_pButtonPauseAtNextFrame);
pFlowCtrlBox->Add(m_pButtonCont);
wxStaticBoxSizer* const pDebugBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Debugging"));
wxBoxSizer* const pDumpSzr = new wxBoxSizer(wxHORIZONTAL);
pDumpSzr->Add(m_pButtonDump);
pDumpSzr->Add(m_pDumpList);
pDebugBox->Add(pDumpSzr);
wxGridSizer* const pDbgGrid = new wxGridSizer(2, 5, 5);
pDbgGrid->Add(m_pButtonUpdateScreen);
pDbgGrid->Add(m_pButtonClearScreen);
pDbgGrid->Add(m_pButtonClearTextureCache);
pDbgGrid->Add(m_pButtonClearVertexShaderCache);
pDbgGrid->Add(m_pButtonClearPixelShaderCache);
pDebugBox->Add(pDbgGrid);
sMain->Add(pFlowCtrlBox, 0, 0, 5);
sMain->Add(pDebugBox, 0, 0, 5);
SetSizerAndFit(sMain);
OnContinue();
}
@ -203,6 +211,7 @@ void GFXDebuggerPanel::CreateGUIControls()
void GFXDebuggerPanel::OnPause()
{
m_pButtonDump->Enable(true);
m_pDumpList->Enable(true);
m_pButtonUpdateScreen->Enable(true);
m_pButtonClearScreen->Enable(true);
m_pButtonClearTextureCache->Enable(true);
@ -213,6 +222,7 @@ void GFXDebuggerPanel::OnPause()
void GFXDebuggerPanel::OnContinue()
{
m_pButtonDump->Enable(false);
m_pDumpList->Enable(false);
m_pButtonUpdateScreen->Enable(false);
m_pButtonClearScreen->Enable(false);
m_pButtonClearTextureCache->Enable(false);
@ -341,5 +351,6 @@ void GFXDebuggerPanel::OnClearPixelShaderCacheButton(wxCommandEvent& event)
void GFXDebuggerPanel::OnUpdateScreenButton(wxCommandEvent& event)
{
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
GFXDebuggerUpdateScreen();
}

View File

@ -44,6 +44,8 @@ public:
bool bSaveShaders;
void OnPause();
// Called from GFX thread once the GFXDebuggerPauseFlag spin lock has finished
void OnContinue();
private:
@ -89,11 +91,17 @@ private:
void CreateGUIControls();
void GeneralSettings(wxCommandEvent& event);
// These set GFXDebuggerPauseFlag to true (either immediately or once the specified event has occured)
void OnPauseButton(wxCommandEvent& event);
void OnPauseAtNextButton(wxCommandEvent& event);
void OnPauseAtNextFrameButton(wxCommandEvent& event);
void OnDumpButton(wxCommandEvent& event);
// sets GFXDebuggerPauseFlag to false
void OnContButton(wxCommandEvent& event);
void OnUpdateScreenButton(wxCommandEvent& event);
void OnClearScreenButton(wxCommandEvent& event);
void OnClearTextureCacheButton(wxCommandEvent& event);

View File

@ -30,9 +30,9 @@
extern NativeVertexFormat *g_nativeVertexFmt;
GFXDebuggerBase *g_pdebugger = NULL;
volatile bool GFXDebuggerPauseFlag = false;
volatile PauseEvent GFXDebuggerToPauseAtNext = NOT_PAUSE;
volatile int GFXDebuggerEventToPauseCount = 0;
volatile bool GFXDebuggerPauseFlag = false; // if true, the GFX thread will be spin locked until it's false again
volatile PauseEvent GFXDebuggerToPauseAtNext = NOT_PAUSE; // Event which will trigger spin locking the GFX thread
volatile int GFXDebuggerEventToPauseCount = 0; // Number of events to wait for until GFX thread will be paused
void GFXDebuggerUpdateScreen()
{
@ -62,6 +62,7 @@ void GFXDebuggerUpdateScreen()
}*/
}
// GFX thread
void GFXDebuggerCheckAndPause(bool update)
{
if (GFXDebuggerPauseFlag)
@ -78,6 +79,7 @@ void GFXDebuggerCheckAndPause(bool update)
}
}
// GFX thread
void GFXDebuggerToPause(bool update)
{
GFXDebuggerToPauseAtNext = NOT_PAUSE;
@ -97,7 +99,7 @@ void GFXDebuggerBase::DumpPixelShader(const char* path)
sprintf(filename, "%sdump_ps.txt", path);
std::string output;
bool useDstAlpha = bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
if (!useDstAlpha)
{
output = "Destination alpha disabled:\n";