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

@ -3,6 +3,7 @@ set(SRCS Src/BPMemory.cpp
Src/BPStructs.cpp
Src/CommandProcessor.cpp
Src/CPMemory.cpp
Src/Debugger.cpp
Src/DLCache.cpp
Src/Fifo.cpp
Src/FramebufferManagerBase.cpp

View File

@ -0,0 +1,173 @@
// 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 "FileUtil.h"
#include "VideoConfig.h"
#include "TextureCacheBase.h"
#include "PixelShaderGen.h"
#include "VertexShaderGen.h"
#include "NativeVertexFormat.h"
GFXDebuggerBase *g_pdebugger = NULL;
volatile bool GFXDebuggerPauseFlag = false;
volatile PauseEvent GFXDebuggerToPauseAtNext = NOT_PAUSE;
volatile int GFXDebuggerEventToPauseCount = 0;
void UpdateFPSDisplay(const char *text);
extern NativeVertexFormat *g_nativeVertexFmt;
void GFXDebuggerUpdateScreen()
{
// TODO: Implement this in a plugin-independent way
/* // update screen
if (D3D::bFrameInProgress)
{
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
D3D::dev->SetDepthStencilSurface(NULL);
D3D::dev->StretchRect(FramebufferManager::GetEFBColorRTSurface(), NULL,
D3D::GetBackBufferSurface(), NULL,
D3DTEXF_LINEAR);
D3D::dev->EndScene();
D3D::dev->Present(NULL, NULL, NULL, NULL);
D3D::dev->SetRenderTarget(0, FramebufferManager::GetEFBColorRTSurface());
D3D::dev->SetDepthStencilSurface(FramebufferManager::GetEFBDepthRTSurface());
D3D::dev->BeginScene();
}
else
{
D3D::dev->EndScene();
D3D::dev->Present(NULL, NULL, NULL, NULL);
D3D::dev->BeginScene();
}*/
}
void GFXDebuggerCheckAndPause(bool update)
{
if (GFXDebuggerPauseFlag)
{
g_pdebugger->OnPause();
while( GFXDebuggerPauseFlag )
{
UpdateFPSDisplay("Paused by Video Debugger");
if (update) GFXDebuggerUpdateScreen();
Sleep(5);
}
g_pdebugger->OnContinue();
}
}
void GFXDebuggerToPause(bool update)
{
GFXDebuggerToPauseAtNext = NOT_PAUSE;
GFXDebuggerPauseFlag = true;
GFXDebuggerCheckAndPause(update);
}
void ContinueGFXDebugger()
{
GFXDebuggerPauseFlag = false;
}
void GFXDebuggerBase::DumpPixelShader(const char* path)
{
char filename[MAX_PATH];
sprintf(filename, "%s/dump_ps.txt", path);
std::string output;
bool useDstAlpha = bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
if (!useDstAlpha)
{
output = "Destination alpha disabled:\n";
output += GeneratePixelShaderCode(DSTALPHA_NONE, g_ActiveConfig.backend_info.APIType, g_nativeVertexFmt->m_components);
}
else
{
if(g_ActiveConfig.backend_info.bSupportsDualSourceBlend)
{
output = "Using dual source blending for destination alpha:\n";
output += GeneratePixelShaderCode(DSTALPHA_DUAL_SOURCE_BLEND, g_ActiveConfig.backend_info.APIType, g_nativeVertexFmt->m_components);
}
else
{
output = "Using two passes for emulating destination alpha:\n";
output += GeneratePixelShaderCode(DSTALPHA_NONE, g_ActiveConfig.backend_info.APIType, g_nativeVertexFmt->m_components);
output += "\n\nDestination alpha pass shader:\n";
output += GeneratePixelShaderCode(DSTALPHA_ALPHA_PASS, g_ActiveConfig.backend_info.APIType, g_nativeVertexFmt->m_components);
}
}
File::CreateEmptyFile(filename);
File::WriteStringToFile(true, output.c_str(), filename);
}
void GFXDebuggerBase::DumpVertexShader(const char* path)
{
char filename[MAX_PATH];
sprintf(filename, "%s/dump_vs_consts.txt", path);
File::CreateEmptyFile(filename);
File::WriteStringToFile(true, GenerateVertexShaderCode(g_nativeVertexFmt->m_components, g_ActiveConfig.backend_info.APIType), filename);
}
void GFXDebuggerBase::DumpPixelShaderConstants(const char* path)
{
// TODO
}
void GFXDebuggerBase::DumpVertexShaderConstants(const char* path)
{
// TODO
}
void GFXDebuggerBase::DumpTextures(const char* path)
{
// TODO
}
void GFXDebuggerBase::DumpFrameBuffer(const char* path)
{
// TODO
}
void GFXDebuggerBase::DumpGeometry(const char* path)
{
// TODO
}
void GFXDebuggerBase::DumpVertexDecl(const char* path)
{
// TODO
}
void GFXDebuggerBase::DumpMatrices(const char* path)
{
// TODO
}
void GFXDebuggerBase::DumpStats(const char* path)
{
// TODO
}

View File

@ -0,0 +1,90 @@
// 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 _GFX_DEBUGGER_H_
#define _GFX_DEBUGGER_H_
class GFXDebuggerBase
{
public:
// if paused, debugging functions can be enabled
virtual void OnPause() {};
virtual void OnContinue() {};
void DumpPixelShader(const char* path);
void DumpVertexShader(const char* path);
void DumpPixelShaderConstants(const char* path);
void DumpVertexShaderConstants(const char* path);
void DumpTextures(const char* path);
void DumpFrameBuffer(const char* path);
void DumpGeometry(const char* path);
void DumpVertexDecl(const char* path);
void DumpMatrices(const char* path);
void DumpStats(const char* path);
};
enum PauseEvent {
NOT_PAUSE = 0,
NEXT_FRAME = 1<<0,
NEXT_FLUSH = 1<<1,
NEXT_PIXEL_SHADER_CHANGE = 1<<2,
NEXT_VERTEX_SHADER_CHANGE = 1<<3,
NEXT_TEXTURE_CHANGE = 1<<4,
NEXT_NEW_TEXTURE = 1<<5,
NEXT_XFB_CMD = 1<<6, // TODO
NEXT_EFB_CMD = 1<<7, // TODO
NEXT_MATRIX_CMD = 1<<8, // TODO
NEXT_VERTEX_CMD = 1<<9, // TODO
NEXT_TEXTURE_CMD = 1<<10, // TODO
NEXT_LIGHT_CMD = 1<<11, // TODO
NEXT_FOG_CMD = 1<<12, // TODO
NEXT_SET_TLUT = 1<<13, // TODO
NEXT_ERROR = 1<<14, // TODO
};
extern GFXDebuggerBase *g_pdebugger;
extern volatile bool GFXDebuggerPauseFlag;
extern volatile PauseEvent GFXDebuggerToPauseAtNext;
extern volatile int GFXDebuggerEventToPauseCount;
void ContinueGFXDebugger();
void GFXDebuggerCheckAndPause(bool update);
void GFXDebuggerToPause(bool update);
void GFXDebuggerUpdateScreen();
#undef ENABLE_GFX_DEBUGGER
#if defined(_DEBUG) || defined(DEBUGFAST)
#define ENABLE_GFX_DEBUGGER
#endif
#ifdef ENABLE_GFX_DEBUGGER
#define GFX_DEBUGGER_PAUSE_AT(event,update) {if (((GFXDebuggerToPauseAtNext & event) && --GFXDebuggerEventToPauseCount<=0) || GFXDebuggerPauseFlag) GFXDebuggerToPause(update);}
#define GFX_DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc) {if (((GFXDebuggerToPauseAtNext & event) && --GFXDebuggerEventToPauseCount<=0) || GFXDebuggerPauseFlag) {{dumpfunc};GFXDebuggerToPause(update);}}
#define GFX_DEBUGGER_LOG_AT(event,dumpfunc) {if (( GFXDebuggerToPauseAtNext & event ) ) {{dumpfunc};}}
#else
// Disable debugging calls in Release build
#define GFX_DEBUGGER_PAUSE_AT(event,update)
#define GFX_DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc)
#define GFX_DEBUGGER_LOG_AT(event,dumpfunc)
#endif ENABLE_GFX_DEBUGGER
#endif // _GFX_DEBUGGER_H_

View File

@ -8,6 +8,7 @@ files = [
'BPStructs.cpp',
'CPMemory.cpp',
'CommandProcessor.cpp',
'DebuggerPanel.cpp',
'DLCache.cpp',
'Fifo.cpp',
'FramebufferManagerBase.cpp',

View File

@ -11,6 +11,7 @@
#include "PluginSpecs.h"
#include "TextureCacheBase.h"
#include "Debugger.h"
// ugly
extern int frameCount;
@ -261,7 +262,6 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
hash_value = 0;
}
// TODO: Is the mipLevels check needed?
if (((entry->isRenderTarget || entry->isDynamic) && hash_value == entry->hash && address == entry->addr)
|| ((address == entry->addr) && (hash_value == entry->hash) && full_format == entry->format && entry->mipLevels == maxlevel))
{
@ -275,7 +275,6 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
// Might speed up movie playback very, very slightly.
texture_is_dynamic = (entry->isRenderTarget || entry->isDynamic) && !g_ActiveConfig.bCopyEFBToTexture;
// TODO: Is the mipLevels check needed?
if (!entry->isRenderTarget &&
((!entry->isDynamic && width == entry->realW && height == entry->realH && full_format == entry->format && entry->mipLevels == maxlevel)
|| (entry->isDynamic && entry->realW == width && entry->realH == height)))
@ -331,6 +330,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
// e.g. if our texture cache entry got too many mipmap levels we can limit the number of used levels by setting the appropriate render states
// Thus, we don't update this member for every Load, but just whenever the texture gets recreated
entry->mipLevels = maxlevel;
GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true);
}
entry->addr = address;
@ -412,6 +413,8 @@ return_entry:
entry->frameCount = frameCount;
entry->Bind(stage);
GFX_DEBUGGER_PAUSE_AT(NEXT_TEXTURE_CHANGE, true);
return entry;
}

View File

@ -158,6 +158,7 @@ struct VideoConfig
bool bSupportsRealXFB;
bool bSupports3DVision;
bool bAllowSignedBytes; // D3D9 doesn't support signed bytes (?)
bool bSupportsDualSourceBlend; // only supported by D3D11 and OpenGL
} backend_info;
};

View File

@ -734,6 +734,14 @@
<Filter
Name="Base"
>
<File
RelativePath=".\Src\Debugger.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger.h"
>
</File>
<File
RelativePath=".\Src\FramebufferManagerBase.cpp"
>

View File

@ -1,4 +1,5 @@
set(SRCS Src/VideoConfigDiag.cpp)
set(SRCS Src/VideoConfigDiag.cpp
Src/DebuggerPanel.cpp)
add_library(videouicommon STATIC ${SRCS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

View File

@ -0,0 +1,341 @@
// 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 "DebuggerPanel.h"
#include "FileUtil.h"
#include "VideoConfig.h"
#include "TextureCacheBase.h"
#include "PixelShaderGen.h"
#include "VertexShaderGen.h"
#include "NativeVertexFormat.h"
extern PLUGIN_GLOBALS* globals;
BEGIN_EVENT_TABLE(GFXDebuggerPanel, wxPanel)
EVT_CLOSE(GFXDebuggerPanel::OnClose)
EVT_BUTTON(ID_PAUSE,GFXDebuggerPanel::OnPauseButton)
EVT_BUTTON(ID_PAUSE_AT_NEXT,GFXDebuggerPanel::OnPauseAtNextButton)
EVT_BUTTON(ID_PAUSE_AT_NEXT_FRAME,GFXDebuggerPanel::OnPauseAtNextFrameButton)
EVT_BUTTON(ID_CONT,GFXDebuggerPanel::OnContButton)
EVT_BUTTON(ID_DUMP,GFXDebuggerPanel::OnDumpButton)
EVT_BUTTON(ID_UPDATE_SCREEN,GFXDebuggerPanel::OnUpdateScreenButton)
EVT_BUTTON(ID_CLEAR_SCREEN,GFXDebuggerPanel::OnClearScreenButton)
EVT_BUTTON(ID_CLEAR_TEXTURE_CACHE,GFXDebuggerPanel::OnClearTextureCacheButton)
EVT_BUTTON(ID_CLEAR_VERTEX_SHADER_CACHE,GFXDebuggerPanel::OnClearVertexShaderCacheButton)
EVT_BUTTON(ID_CLEAR_PIXEL_SHADER_CACHE,GFXDebuggerPanel::OnClearPixelShaderCacheButton)
END_EVENT_TABLE()
GFXDebuggerPanel::GFXDebuggerPanel(wxWindow *parent, wxWindowID id, const wxPoint &position,
const wxSize& size, long style, const wxString &title)
: wxPanel(parent, id, position, size, style, title)
{
CreateGUIControls();
LoadSettings();
}
GFXDebuggerPanel::~GFXDebuggerPanel()
{
SaveSettings();
}
void GFXDebuggerPanel::OnClose(wxCloseEvent& event)
{
// save the window position when we hide the window
SaveSettings();
event.Skip(); // This means wxDialog's Destroy is used
}
void GFXDebuggerPanel::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.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
}
void GFXDebuggerPanel::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);
}
struct PauseEventMap
{
PauseEvent event;
const wxString ListStr;
};
static PauseEventMap pauseEventMap[] = {
{NEXT_FRAME, wxT("Frame")},
{NEXT_FLUSH, wxT("Flush")},
{NEXT_PIXEL_SHADER_CHANGE, wxT("Pixel Shader")},
{NEXT_VERTEX_SHADER_CHANGE, wxT("Vertex Shader")},
{NEXT_TEXTURE_CHANGE, wxT("Texture")},
{NEXT_NEW_TEXTURE, wxT("New Texture")},
{NEXT_XFB_CMD, wxT("XFB Cmd")},
{NEXT_EFB_CMD, wxT("EFB Cmd")},
{NEXT_MATRIX_CMD, wxT("Matrix Cmd")},
{NEXT_VERTEX_CMD, wxT("Vertex Cmd")},
{NEXT_TEXTURE_CMD, wxT("Texture Cmd")},
{NEXT_LIGHT_CMD, wxT("Light Cmd")},
{NEXT_FOG_CMD, wxT("Fog Cmd")},
{NEXT_SET_TLUT, wxT("TLUT Cmd")},
{NEXT_ERROR, wxT("Error")}
};
static const int numPauseEventMap = sizeof(pauseEventMap)/sizeof(PauseEventMap);
void GFXDebuggerPanel::CreateGUIControls()
{
g_pdebugger = this;
// Basic settings
CenterOnParent();
// MainPanel
m_MainPanel = new wxPanel(this, ID_MAINPANEL, wxDefaultPosition, wxDefaultSize);
m_pButtonPause = new wxButton(m_MainPanel, ID_PAUSE, wxT("Pause"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Pause"));
m_pButtonPauseAtNext = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT, wxT("Pause At Next"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Pause At Next"));
m_pButtonPauseAtNextFrame = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT_FRAME, wxT("Next Frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Next Frame"));
m_pButtonCont = new wxButton(m_MainPanel, ID_CONT, wxT("Continue"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Continue"));
m_pPauseAtList = new wxChoice(m_MainPanel, ID_PAUSE_AT_LIST, wxDefaultPosition, wxSize(100,25), 0, NULL,0,wxDefaultValidator, wxT("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, 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"));
m_pDumpList->Insert(wxT("Pixel Shader"),0);
m_pDumpList->Append(wxT("Vertex Shader"));
m_pDumpList->Append(wxT("Pixel Shader Constants"));
m_pDumpList->Append(wxT("Vertex Shader Constants"));
m_pDumpList->Append(wxT("Textures"));
m_pDumpList->Append(wxT("Frame Buffer"));
m_pDumpList->Append(wxT("Geometry data"));
m_pDumpList->Append(wxT("Vertex Description"));
m_pDumpList->Append(wxT("Vertex Matrices"));
m_pDumpList->Append(wxT("Statistics"));
m_pDumpList->SetSelection(0);
// 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();
OnContinue();
}
void GFXDebuggerPanel::OnPause()
{
m_pButtonDump->Enable(true);
m_pButtonUpdateScreen->Enable(true);
m_pButtonClearScreen->Enable(true);
m_pButtonClearTextureCache->Enable(true);
m_pButtonClearVertexShaderCache->Enable(true);
m_pButtonClearPixelShaderCache->Enable(true);
}
void GFXDebuggerPanel::OnContinue()
{
m_pButtonDump->Enable(false);
m_pButtonUpdateScreen->Enable(false);
m_pButtonClearScreen->Enable(false);
m_pButtonClearTextureCache->Enable(false);
m_pButtonClearVertexShaderCache->Enable(false);
m_pButtonClearPixelShaderCache->Enable(false);
}
// General settings
void GFXDebuggerPanel::GeneralSettings(wxCommandEvent& event)
{
SaveSettings();
}
void GFXDebuggerPanel::OnPauseButton(wxCommandEvent& event)
{
GFXDebuggerPauseFlag = true;
}
void GFXDebuggerPanel::OnPauseAtNextButton(wxCommandEvent& event)
{
GFXDebuggerPauseFlag = false;
GFXDebuggerToPauseAtNext = pauseEventMap[m_pPauseAtList->GetSelection()].event;
wxString val = m_pCount->GetValue();
long value;
if (val.ToLong(&value))
GFXDebuggerEventToPauseCount = value;
else
GFXDebuggerEventToPauseCount = 1;
}
void GFXDebuggerPanel::OnPauseAtNextFrameButton(wxCommandEvent& event)
{
GFXDebuggerPauseFlag = false;
GFXDebuggerToPauseAtNext = NEXT_FRAME;
GFXDebuggerEventToPauseCount = 1;
}
void GFXDebuggerPanel::OnDumpButton(wxCommandEvent& event)
{
char dump_path[MAX_PATH];
sprintf(dump_path, "%sDebug/%s", File::GetUserPath(D_DUMP_IDX), globals->unique_id);
if (!File::Exists(dump_path) || !File::IsDirectory(dump_path))
if (!File::CreateDir(dump_path))
return;
switch (m_pDumpList->GetSelection())
{
case 0: // Pixel Shader
DumpPixelShader(dump_path);
break;
case 1: // Vertex Shader
DumpVertexShader(dump_path);
break;
case 2: // Pixel Shader Constants
DumpPixelShaderConstants(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
case 3: // Vertex Shader Constants
DumpVertexShaderConstants(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
case 4: // Textures
DumpTextures(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
case 5: // Frame Buffer
DumpFrameBuffer(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
case 6: // Geometry
DumpGeometry(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
case 7: // Vertex Description
DumpVertexDecl(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
case 8: // Vertex Matrices
DumpMatrices(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
case 9: // Statistics
DumpStats(dump_path);
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
break;
}
}
void GFXDebuggerPanel::OnContButton(wxCommandEvent& event)
{
GFXDebuggerToPauseAtNext = NOT_PAUSE;
GFXDebuggerPauseFlag = false;
}
void GFXDebuggerPanel::OnClearScreenButton(wxCommandEvent& event)
{
// TODO
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
}
void GFXDebuggerPanel::OnClearTextureCacheButton(wxCommandEvent& event)
{
TextureCache::Invalidate(false);
}
void GFXDebuggerPanel::OnClearVertexShaderCacheButton(wxCommandEvent& event)
{
// TODO
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
}
void GFXDebuggerPanel::OnClearPixelShaderCacheButton(wxCommandEvent& event)
{
// TODO
wxMessageBox(wxT("Not implemented"), wxT("Error"), wxOK);
}
void GFXDebuggerPanel::OnUpdateScreenButton(wxCommandEvent& event)
{
GFXDebuggerUpdateScreen();
}

View File

@ -15,27 +15,24 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _DX_DEBUGGER_H_
#define _DX_DEBUGGER_H_
#ifndef _GFX_DEBUGGER_PANEL_H_
#define _GFX_DEBUGGER_PANEL_H_
#include <wx/wx.h>
#include <wx/notebook.h>
#include "Debugger.h"
#include "../Globals.h"
class IniFile;
class GFXDebuggerDX9 : public wxPanel
class GFXDebuggerPanel : public wxPanel, public GFXDebuggerBase
{
public:
GFXDebuggerDX9(wxWindow *parent,
GFXDebuggerPanel(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString &title = wxT("DX9 Debugger"));
const wxString &title = wxT("GFX Debugger"));
virtual ~GFXDebuggerDX9();
virtual ~GFXDebuggerPanel();
void SaveSettings() const;
void LoadSettings();
@ -46,18 +43,18 @@ public:
bool bSaveTargets;
bool bSaveShaders;
void EnableButtons(bool enable);
void OnPause();
void OnContinue();
private:
DECLARE_EVENT_TABLE();
wxPanel *m_MainPanel;
wxCheckBox *m_Check[6];
wxButton *m_pButtonPause;
wxButton *m_pButtonPauseAtNext;
wxButton *m_pButtonPauseAtNextFrame;
wxButton *m_pButtonGo;
wxButton *m_pButtonCont;
wxChoice *m_pPauseAtList;
wxButton *m_pButtonDump;
wxChoice *m_pDumpList;
@ -69,18 +66,11 @@ private:
wxTextCtrl *m_pCount;
// WARNING: Make sure these are not also elsewhere
// TODO: Prefix with GFX_
enum
{
ID_MAINPANEL = 3900,
ID_SAVETOFILE,
ID_INFOLOG,
ID_PRIMLOG,
ID_SAVETEXTURES,
ID_SAVETARGETS,
ID_SAVESHADERS,
NUM_OPTIONS,
ID_GO,
ID_CONT,
ID_PAUSE,
ID_PAUSE_AT_NEXT,
ID_PAUSE_AT_NEXT_FRAME,
@ -103,65 +93,13 @@ private:
void OnPauseAtNextButton(wxCommandEvent& event);
void OnPauseAtNextFrameButton(wxCommandEvent& event);
void OnDumpButton(wxCommandEvent& event);
void OnGoButton(wxCommandEvent& event);
void OnContButton(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 {
NOT_PAUSE = 0,
NEXT_FRAME = 1<<0,
NEXT_FLUSH = 1<<1,
NEXT_PIXEL_SHADER_CHANGE = 1<<2,
NEXT_VERTEX_SHADER_CHANGE = 1<<3,
NEXT_TEXTURE_CHANGE = 1<<4,
NEXT_NEW_TEXTURE = 1<<5,
NEXT_XFB_CMD = 1<<6,
NEXT_EFB_CMD = 1<<7,
NEXT_MATRIX_CMD = 1<<8,
NEXT_VERTEX_CMD = 1<<9,
NEXT_TEXTURE_CMD = 1<<10,
NEXT_LIGHT_CMD = 1<<11,
NEXT_FOG_CMD = 1<<12,
NEXT_SET_TLUT = 1<<13,
NEXT_ERROR = 1<<14,
};
extern volatile bool DX9DebuggerPauseFlag;
extern volatile PauseEvent DX9DebuggerToPauseAtNext;
extern volatile int DX9DebuggerEventToPauseCount;
void ContinueDX9Debugger();
void DX9DebuggerCheckAndPause(bool update);
void DX9DebuggerToPause(bool update);
#undef ENABLE_DX_DEBUGGER
#if defined(_DEBUG) || defined(DEBUGFAST)
#define ENABLE_DX_DEBUGGER
#endif
#ifdef ENABLE_DX_DEBUGGER
#define DEBUGGER_PAUSE_AT(event,update) {if (((DX9DebuggerToPauseAtNext & event) && --DX9DebuggerEventToPauseCount<=0) || DX9DebuggerPauseFlag) DX9DebuggerToPause(update);}
#define DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc) {if (((DX9DebuggerToPauseAtNext & event) && --DX9DebuggerEventToPauseCount<=0) || DX9DebuggerPauseFlag) {{dumpfunc};DX9DebuggerToPause(update);}}
#define DEBUGGER_LOG_AT(event,dumpfunc) {if (( DX9DebuggerToPauseAtNext & event ) ) {{dumpfunc};}}
#else
// Not to use debugger in release build
#define DEBUGGER_PAUSE_AT(event,update)
#define DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc)
#define DEBUGGER_LOG_AT(event,dumpfunc)
#endif ENABLE_DX_DEBUGGER
#endif // _DX_DEBUGGER_H_
#endif // _GFX_DEBUGGER_PANEL_H_

View File

@ -7,6 +7,7 @@ if not env['HAVE_WX']:
files = [
'VideoConfigDiag.cpp',
'DebuggerPanel.cpp',
]
env.StaticLibrary(env['local_libs'] + 'videouicommon', files)

View File

@ -404,6 +404,14 @@
<References>
</References>
<Files>
<File
RelativePath=".\Src\DebuggerPanel.cpp"
>
</File>
<File
RelativePath=".\Src\DebuggerPanel.h"
>
</File>
<File
RelativePath=".\Src\VideoConfigDiag.cpp"
>

View File

@ -32,6 +32,7 @@
#include "BPMemory.h"
#include "XFMemory.h"
#include "ImageWrite.h"
#include "Debugger.h"
extern int frameCount;
@ -331,6 +332,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
if (uid == last_pixel_shader_uid && PixelShaders[uid].frameCount == frameCount)
{
PSCache::const_iterator iter = PixelShaders.find(uid);
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
return (iter != PixelShaders.end() && iter->second.shader);
}
@ -346,6 +348,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
last_entry = &entry;
D3D::gfxstate->SetPShader(entry.shader);
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
return (entry.shader != NULL);
}
@ -356,6 +359,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
if (!D3D::CompilePixelShader(code, strlen(code), &pbytecode))
{
PanicAlert("Failed to compile Pixel Shader:\n\n%s", code);
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
return false;
}
@ -366,6 +370,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
bool result = InsertByteCode(uid, pbytecode->Data(), pbytecode->Size());
D3D::gfxstate->SetPShader(last_entry->shader);
pbytecode->Release();
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
return result;
}

View File

@ -47,6 +47,8 @@
#include "Fifo.h"
#include "DLCache.h"
#include "Debugger.h"
#include <strsafe.h>
static int s_fps = 0;
@ -919,6 +921,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
OSD::DrawMessages();
D3D::EndFrame();
frameCount++;
GFX_DEBUGGER_PAUSE_AT(NEXT_FRAME, true);
DLCache::ProgressiveCleanup();
TextureCache::Cleanup();

View File

@ -40,6 +40,7 @@
#include "XFStructs.h"
#include "Globals.h"
#include "Debugger.h"
// internal state for loading vertices
extern NativeVertexFormat *g_nativeVertexFmt;
@ -218,9 +219,15 @@ void VertexManager::vFlush()
if (!PixelShaderCache::SetShader(
useDstAlpha ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE,
g_nativeVertexFmt->m_components))
{
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
goto shader_fail;
}
if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components))
{
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
goto shader_fail;
}
unsigned int stride = g_nativeVertexFmt->GetVertexStride();
g_nativeVertexFmt->SetupVertexPointers();
@ -230,6 +237,8 @@ void VertexManager::vFlush()
D3D::gfxstate->Reset();
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
shader_fail:
ResetBuffer();
}

View File

@ -31,6 +31,7 @@
#include "VertexLoader.h"
#include "BPMemory.h"
#include "XFMemory.h"
#include "Debugger.h"
VertexShaderCache::VSCache VertexShaderCache::vshaders;
const VertexShaderCache::VSCacheEntry *VertexShaderCache::last_entry;
@ -207,7 +208,10 @@ bool 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 (vshaders[uid].shader != NULL);
}
memcpy(&last_vertex_shader_uid, &uid, sizeof(VERTEXSHADERUID));
@ -219,6 +223,7 @@ bool VertexShaderCache::SetShader(u32 components)
last_entry = &entry;
if (entry.shader) D3D::gfxstate->SetVShader(entry.shader, iter->second.bytecode);
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
return (entry.shader != NULL);
}
@ -230,6 +235,7 @@ bool VertexShaderCache::SetShader(u32 components)
if (pbytecode == NULL)
{
PanicAlert("Failed to compile Vertex Shader %s %d:\n\n%s", __FILE__, __LINE__, code);
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
return false;
}
g_vs_disk_cache.Append(uid, pbytecode->Data(), pbytecode->Size());
@ -238,6 +244,7 @@ bool VertexShaderCache::SetShader(u32 components)
bool result = InsertByteCode(uid, pbytecode);
D3D::gfxstate->SetVShader(last_entry->shader, last_entry->bytecode);
pbytecode->Release();
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
return result;
}

View File

@ -54,6 +54,7 @@
#include "EmuWindow.h"
#include "FramebufferManager.h"
#include "DLCache.h"
#include "DebuggerPanel.h"
HINSTANCE g_hInstance = NULL;
@ -64,7 +65,11 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
void *DllDebugger(void *_hParent, bool Show)
{
#if defined(HAVE_WX) && HAVE_WX
return new GFXDebuggerPanel((wxWindow*)_hParent);
#else
return NULL;
#endif
}
#if defined(HAVE_WX) && HAVE_WX
@ -150,6 +155,7 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsRealXFB = false;
g_Config.backend_info.bSupports3DVision = false;
g_Config.backend_info.bAllowSignedBytes = true;
g_Config.backend_info.bSupportsDualSourceBlend = true;
}
void DllConfig(void *_hParent)

View File

@ -775,18 +775,6 @@
>
</File>
</Filter>
<Filter
Name="Debugger"
>
<File
RelativePath=".\Src\Debugger\Debugger.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\Debugger.h"
>
</File>
</Filter>
<File
RelativePath=".\Src\Globals.h"
>

View File

@ -1,670 +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 "FileUtil.h"
#include "VideoConfig.h"
#include "IndexGenerator.h"
#include "../Globals.h"
#include "../D3DBase.h"
#include "../FramebufferManager.h"
#include "../TextureCache.h"
#include "../VertexShaderCache.h"
#include "../PixelShaderCache.h"
#include "../VertexManager.h"
extern int g_Preset;
extern NativeVertexFormat *g_nativeVertexFmt;
BEGIN_EVENT_TABLE(GFXDebuggerDX9, wxPanel)
EVT_CLOSE(GFXDebuggerDX9::OnClose)
EVT_CHECKBOX(ID_SAVETOFILE,GFXDebuggerDX9::GeneralSettings)
EVT_CHECKBOX(ID_INFOLOG,GFXDebuggerDX9::GeneralSettings)
EVT_CHECKBOX(ID_PRIMLOG,GFXDebuggerDX9::GeneralSettings)
EVT_CHECKBOX(ID_SAVETEXTURES,GFXDebuggerDX9::GeneralSettings)
EVT_CHECKBOX(ID_SAVETARGETS,GFXDebuggerDX9::GeneralSettings)
EVT_CHECKBOX(ID_SAVESHADERS,GFXDebuggerDX9::GeneralSettings)
EVT_BUTTON(ID_PAUSE,GFXDebuggerDX9::OnPauseButton)
EVT_BUTTON(ID_PAUSE_AT_NEXT,GFXDebuggerDX9::OnPauseAtNextButton)
EVT_BUTTON(ID_PAUSE_AT_NEXT_FRAME,GFXDebuggerDX9::OnPauseAtNextFrameButton)
EVT_BUTTON(ID_GO,GFXDebuggerDX9::OnGoButton)
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 wxPoint &position,
const wxSize& size, long style, const wxString &title)
: wxPanel(parent, id, position, size, style, title)
{
CreateGUIControls();
LoadSettings();
}
GFXDebuggerDX9::~GFXDebuggerDX9()
{
SaveSettings();
}
void GFXDebuggerDX9::OnClose(wxCloseEvent& event)
{
// save the window position when we hide the window
SaveSettings();
event.Skip(); // This means wxDialog's Destroy is used
}
void GFXDebuggerDX9::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 GFXDebuggerDX9::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);
}
struct PauseEventMap
{
PauseEvent event;
const wxString ListStr;
};
static PauseEventMap pauseEventMap[] = {
{NEXT_FRAME, wxT("Frame")},
{NEXT_FLUSH, wxT("Flush")},
{NEXT_PIXEL_SHADER_CHANGE, wxT("Pixel Shader")},
{NEXT_VERTEX_SHADER_CHANGE, wxT("Vertex Shader")},
{NEXT_TEXTURE_CHANGE, wxT("Texture")},
{NEXT_NEW_TEXTURE, wxT("New Texture")},
{NEXT_XFB_CMD, wxT("XFB Cmd")},
{NEXT_EFB_CMD, wxT("EFB Cmd")},
{NEXT_MATRIX_CMD, wxT("Matrix Cmd")},
{NEXT_VERTEX_CMD, wxT("Vertex Cmd")},
{NEXT_TEXTURE_CMD, wxT("Texture Cmd")},
{NEXT_LIGHT_CMD, wxT("Light Cmd")},
{NEXT_FOG_CMD, wxT("Fog Cmd")},
{NEXT_SET_TLUT, wxT("TLUT Cmd")},
{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
CenterOnParent();
// MainPanel
m_MainPanel = new wxPanel(this, ID_MAINPANEL, wxDefaultPosition, wxDefaultSize);
// Options
wxStaticBoxSizer *sOptions = new wxStaticBoxSizer(wxVERTICAL, m_MainPanel, wxT("Options"));
m_Check[0] = new wxCheckBox(m_MainPanel, ID_SAVETOFILE, wxT("Save to file"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[1] = new wxCheckBox(m_MainPanel, ID_INFOLOG, wxT("Info log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[2] = new wxCheckBox(m_MainPanel, ID_PRIMLOG, wxT("Primary log"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[3] = new wxCheckBox(m_MainPanel, ID_SAVETEXTURES, wxT("Save Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[4] = new wxCheckBox(m_MainPanel, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[5] = new wxCheckBox(m_MainPanel, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_pButtonPause = new wxButton(m_MainPanel, ID_PAUSE, wxT("Pause"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Pause"));
m_pButtonPauseAtNext = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT, wxT("Pause At Next"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Pause At Next"));
m_pButtonPauseAtNextFrame = new wxButton(m_MainPanel, ID_PAUSE_AT_NEXT_FRAME, wxT("Next Frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Next Frame"));
m_pButtonGo = new wxButton(m_MainPanel, ID_GO, wxT("Go"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("Go"));
m_pPauseAtList = new wxChoice(m_MainPanel, ID_PAUSE_AT_LIST, wxDefaultPosition, wxSize(100,25), 0, NULL,0,wxDefaultValidator, wxT("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, 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"));
m_pDumpList->Insert(wxT("Pixel Shader"),0);
m_pDumpList->Append(wxT("Vertex Shader"));
m_pDumpList->Append(wxT("Pixel Shader Constants"));
m_pDumpList->Append(wxT("Vertex Shader Constants"));
m_pDumpList->Append(wxT("Texture 0"));
m_pDumpList->Append(wxT("Texture 1"));
m_pDumpList->Append(wxT("Texture 2"));
m_pDumpList->Append(wxT("Texture 3"));
m_pDumpList->Append(wxT("Texture 4"));
m_pDumpList->Append(wxT("Texture 5"));
m_pDumpList->Append(wxT("Texture 6"));
m_pDumpList->Append(wxT("Texture 7"));
m_pDumpList->Append(wxT("Frame Buffer"));
m_pDumpList->Append(wxT("Vertices"));
m_pDumpList->Append(wxT("Vertex Description"));
m_pDumpList->Append(wxT("Vertex Matrices"));
m_pDumpList->Append(wxT("Statistics"));
m_pDumpList->SetSelection(0);
for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i)
sOptions->Add(m_Check[i], 0, 0, 5);
// Layout everything on m_MainPanel
wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(sOptions);
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_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)
{
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();
}
volatile bool DX9DebuggerPauseFlag = false;
volatile PauseEvent DX9DebuggerToPauseAtNext = NOT_PAUSE;
volatile int DX9DebuggerEventToPauseCount = 0;
void GFXDebuggerDX9::OnPauseButton(wxCommandEvent& event)
{
DX9DebuggerPauseFlag = true;
}
void GFXDebuggerDX9::OnPauseAtNextButton(wxCommandEvent& event)
{
DX9DebuggerPauseFlag = false;
DX9DebuggerToPauseAtNext = pauseEventMap[m_pPauseAtList->GetSelection()].event;
wxString val = m_pCount->GetValue();
long value;
if (val.ToLong(&value) )
DX9DebuggerEventToPauseCount = value;
else
DX9DebuggerEventToPauseCount = 1;
}
void GFXDebuggerDX9::OnPauseAtNextFrameButton(wxCommandEvent& event)
{
DX9DebuggerPauseFlag = false;
DX9DebuggerToPauseAtNext = NEXT_FRAME;
DX9DebuggerEventToPauseCount = 1;
}
void GFXDebuggerDX9::OnDumpButton(wxCommandEvent& event)
{
char dump_path[MAX_PATH];
sprintf(dump_path, "%sDebug/%s", File::GetUserPath(D_DUMP_IDX), globals->unique_id);
if (!File::Exists(dump_path) || !File::IsDirectory(dump_path))
if (!File::CreateDir(dump_path))
return;
switch (m_pDumpList->GetSelection())
{
case 0: // Pixel Shader
{
char filename[MAX_PATH];
sprintf(filename, "%s/dump_ps.txt", dump_path);
File::CreateEmptyFile(filename);
File::WriteStringToFile(true, PixelShaderCache::GetCurrentShaderCode(), filename);
break;
}
case 1: // Vertex Shader
{
char filename[MAX_PATH];
sprintf(filename, "%s/dump_vs.txt", dump_path);
File::CreateEmptyFile(filename);
File::WriteStringToFile(true, VertexShaderCache::GetCurrentShaderCode(), filename);
break;
}
case 2: // Pixel Shader Constants
{
char filename[MAX_PATH];
sprintf(filename, "%s/dump_ps_consts.txt", dump_path);
FILE* file = fopen(filename, "w");
float constants[4*C_PENVCONST_END];
D3D::dev->GetVertexShaderConstantF(0, constants, C_PENVCONST_END);
for(unsigned int i = C_COLORS;i < C_KCOLORS; i++)
fprintf(file, "Constant POSNORMALMATRIX %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_KCOLORS;i < C_ALPHA; i++)
fprintf(file, "Constant KCOLORS %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_ALPHA;i < C_TEXDIMS; i++)
fprintf(file, "Constant ALPHA %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_TEXDIMS;i < C_ZBIAS; i++)
fprintf(file, "Constant TEXDIMS %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_ZBIAS;i < C_INDTEXSCALE; i++)
fprintf(file, "Constant ZBIAS %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_INDTEXSCALE;i < C_INDTEXMTX; i++)
fprintf(file, "Constant INDTEXSCALE %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_INDTEXMTX;i < C_FOG; i++)
fprintf(file, "Constant INDTEXMTX %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_FOG;i < C_COLORMATRIX; i++)
fprintf(file, "Constant FOG %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_COLORMATRIX;i < C_PENVCONST_END; i++)
fprintf(file, "Constant COLORMATRIX %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
fclose(file);
break;
}
case 3: // Vertex Shader Constants
{
char filename[MAX_PATH];
sprintf(filename, "%s/dump_vs_consts.txt", dump_path);
FILE* file = fopen(filename, "w");
float constants[4*C_VENVCONST_END];
D3D::dev->GetVertexShaderConstantF(0, constants, C_VENVCONST_END);
for(unsigned int i = C_POSNORMALMATRIX;i < C_PROJECTION; i++)
fprintf(file, "Constant POSNORMALMATRIX %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_PROJECTION;i < C_MATERIALS; i++)
fprintf(file, "Constant PROJECTION %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_MATERIALS;i < C_LIGHTS; i++)
fprintf(file, "Constant MATERIALS %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_LIGHTS;i < C_TEXMATRICES; i++)
fprintf(file, "Constant LIGHTS %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_TEXMATRICES;i < C_TRANSFORMMATRICES; i++)
fprintf(file, "Constant TEXMATRICES %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_TRANSFORMMATRICES;i < C_NORMALMATRICES; i++)
fprintf(file, "Constant TRANSFORMMATRICES %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_NORMALMATRICES;i < C_POSTTRANSFORMMATRICES; i++)
fprintf(file, "Constant NORMALMATRICES %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_POSTTRANSFORMMATRICES;i < C_DEPTHPARAMS; i++)
fprintf(file, "Constant POSTTRANSFORMMATRICES %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
for(unsigned int i = C_DEPTHPARAMS;i < C_VENVCONST_END; i++)
fprintf(file, "Constant DEPTHPARAMS %d: %f %f %f %f\n", i, constants[4*i], constants[4*i+1], constants[4*i+2], constants[4*i+3]);
fclose(file);
break;
}
case 4: // Texture 0
case 5: // Texture 1
case 6: // Texture 2
case 7: // Texture 3
case 8: // Texture 4
case 9: // Texture 5
case 10: // Texture 6
case 11: // Texture 7
{
int stage = m_pDumpList->GetSelection() - 4;
IDirect3DTexture9* texture;
D3D::dev->GetTexture(stage, (IDirect3DBaseTexture9**)&texture);
if(!texture) break;
char filename[MAX_PATH];
sprintf(filename, "%s/dump_tex%d.png", dump_path, stage);
IDirect3DSurface9* surface;
texture->GetSurfaceLevel(0, &surface);
HRESULT hr = PD3DXSaveSurfaceToFileA(filename, D3DXIFF_PNG, surface, NULL, NULL);
if (FAILED(hr)) {
MessageBoxA(NULL, "Failed to dump texture...", "Error", MB_OK);
}
surface->Release();
texture->Release();
break;
}
case 12: // Frame Buffer
break;
case 13: // Vertices
{
D3DVERTEXELEMENT9* elements;
int num_elements;
((DX9::VertexManager*)g_vertex_manager)->GetElements(g_nativeVertexFmt, &elements, &num_elements);
if (elements == NULL || num_elements == 0)
return;
char filename[MAX_PATH];
sprintf(filename, "%s/vertex_dump.txt", dump_path);
FILE* file = fopen(filename, "w");
u8* vertices = g_vertex_manager->GetVertexBuffer();
u16* tri_indices = g_vertex_manager->GetTriangleIndexBuffer();
u16* line_indices = g_vertex_manager->GetLineIndexBuffer();
u16* point_indices = g_vertex_manager->GetPointIndexBuffer();
fprintf(file, "VERTICES\n");
for (int i = 0; i < IndexGenerator::GetNumVerts(); ++i)
{
u8* cur_vertex = vertices + i * g_nativeVertexFmt->GetVertexStride();
for (int elem = 0; elem < num_elements; elem++)
{
switch (elements[elem].Type)
{
case D3DDECLTYPE_FLOAT1:
fprintf(file, "%f\t", *(float*)&cur_vertex[elements[elem].Offset]);
break;
case D3DDECLTYPE_FLOAT2:
fprintf(file, "%f ", *(float*)&cur_vertex[elements[elem].Offset]);
fprintf(file, "%f\t", *(float*)&cur_vertex[4+elements[elem].Offset]);
break;
case D3DDECLTYPE_FLOAT3:
fprintf(file, "%f ", *(float*)&cur_vertex[elements[elem].Offset]);
fprintf(file, "%f ", *(float*)&cur_vertex[4+elements[elem].Offset]);
fprintf(file, "%f\t", *(float*)&cur_vertex[8+elements[elem].Offset]);
break;
case D3DDECLTYPE_FLOAT4:
fprintf(file, "%f ", *(float*)&cur_vertex[elements[elem].Offset]);
fprintf(file, "%f ", *(float*)&cur_vertex[4+elements[elem].Offset]);
fprintf(file, "%f ", *(float*)&cur_vertex[8+elements[elem].Offset]);
fprintf(file, "%f\t", *(float*)&cur_vertex[12+elements[elem].Offset]);
break;
case D3DDECLTYPE_UBYTE4N:
fprintf(file, "%f ", (float)(*(u8*)&cur_vertex[elements[elem].Offset])/255.f);
fprintf(file, "%f ", (float)(*(u8*)&cur_vertex[1+elements[elem].Offset])/255.f);
fprintf(file, "%f ", (float)(*(u8*)&cur_vertex[2+elements[elem].Offset])/255.f);
fprintf(file, "%f\t", (float)(*(u8*)&cur_vertex[3+elements[elem].Offset])/255.f);
break;
case D3DDECLTYPE_SHORT2N:
fprintf(file, "%f ", (float)(*(s16*)&cur_vertex[elements[elem].Offset])/32767.f);
fprintf(file, "%f\t", (float)(*(s16*)&cur_vertex[2+elements[elem].Offset])/32767.f);
break;
case D3DDECLTYPE_SHORT4N:
fprintf(file, "%f ", (float)(*(s16*)&cur_vertex[elements[elem].Offset])/32767.f);
fprintf(file, "%f ", (float)(*(s16*)&cur_vertex[2+elements[elem].Offset])/32767.f);
fprintf(file, "%f ", (float)(*(s16*)&cur_vertex[4+elements[elem].Offset])/32767.f);
fprintf(file, "%f\t", (float)(*(s16*)&cur_vertex[6+elements[elem].Offset])/32767.f);
break;
case D3DDECLTYPE_USHORT2N:
fprintf(file, "%f ", (float)(*(u16*)&cur_vertex[elements[elem].Offset])/65535.f);
fprintf(file, "%f\t", (float)(*(u16*)&cur_vertex[2+elements[elem].Offset])/65535.f);
break;
case D3DDECLTYPE_USHORT4N:
fprintf(file, "%f ", (float)(*(u16*)&cur_vertex[elements[elem].Offset])/65535.f);
fprintf(file, "%f ", (float)(*(u16*)&cur_vertex[2+elements[elem].Offset])/65535.f);
fprintf(file, "%f ", (float)(*(u16*)&cur_vertex[4+elements[elem].Offset])/65535.f);
fprintf(file, "%f\t", (float)(*(u16*)&cur_vertex[6+elements[elem].Offset])/65535.f);
break;
}
fprintf(file, "\t");
}
fprintf(file, "\n");
}
fprintf(file, "\nTRIANGLE INDICES\n");
for (int i = 0; i < IndexGenerator::GetNumTriangles(); ++i)
fprintf(file, "%d\t%d\t%d\n", tri_indices[3*i], tri_indices[3*i+1], tri_indices[3*i+2]);
fprintf(file, "\nLINE INDICES\n");
for (int i = 0; i < IndexGenerator::GetNumLines(); ++i)
fprintf(file, "%d\t%d\n", line_indices[2*i], line_indices[2*i+1]);
fprintf(file, "\nPOINT INDICES\n");
for (int i = 0; i < IndexGenerator::GetNumPoints(); ++i)
fprintf(file, "%d\n", point_indices[i]);
fclose(file);
break;
}
case 14: // Vertex Description
{
D3DVERTEXELEMENT9* elements;
int num_elements;
((DX9::VertexManager*)g_vertex_manager)->GetElements(g_nativeVertexFmt, &elements, &num_elements);
if (elements == NULL || num_elements == 0)
return;
char filename[MAX_PATH];
sprintf(filename, "%s/vertex_decl.txt", dump_path);
FILE* file = fopen(filename, "w");
fprintf(file, "Index\tOffset\tType\t\tUsage\t\tUsageIndex\n");
for (int i = 0; i < num_elements; ++i)
{
const char* types[] = {
"FLOAT1 " , "FLOAT2 ", "FLOAT3 ", "FLOAT4 ", "D3DCOLOR", "UBYTE4 ", "SHORT2 ", "SHORT4 ",
"UBYTE4N " , "SHORT2N ", "SHORT4N ", "USHORT2N", "USHORT4N", "UDEC3 ", "DEC3N ", "FLOAT16_2",
"FLOAT16_4", "UNUSED ",
};
const char* usages[] = {
"POSITION ", "BLENDWEIGHT ", "BLENDINDICES", "NORMAL ", "PSIZE ", "TEXCOORD ", "TANGENT ", "BINORMAL ",
"TESSFACTOR ", "POSITIONT ", "COLOR ", "FOG ", "DEPTH ", "SAMPLE ",
};
fprintf(file, "%d\t%d\t%s\t%s\t%d\n", i, elements[i].Offset, types[elements[i].Type], usages[elements[i].Usage], elements[i].UsageIndex);
}
fclose(file);
break;
}
case 15: // Vertex Matrices
break;
case 16: // Statistics
break;
}
}
void GFXDebuggerDX9::OnGoButton(wxCommandEvent& event)
{
DX9DebuggerToPauseAtNext = NOT_PAUSE;
DX9DebuggerPauseFlag = false;
}
void GFXDebuggerDX9::OnClearScreenButton(wxCommandEvent& event)
{
}
void GFXDebuggerDX9::OnClearTextureCacheButton(wxCommandEvent& event)
{
TextureCache::Invalidate(false);
}
void GFXDebuggerDX9::OnClearVertexShaderCacheButton(wxCommandEvent& event)
{
}
void GFXDebuggerDX9::OnClearPixelShaderCacheButton(wxCommandEvent& event)
{
}
void UpdateFPSDisplay(const char *text);
extern bool D3D::bFrameInProgress;
static void DX9DebuggerUpdateScreen()
{
// update screen
if (D3D::bFrameInProgress)
{
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
D3D::dev->SetDepthStencilSurface(NULL);
D3D::dev->StretchRect(FramebufferManager::GetEFBColorRTSurface(), NULL,
D3D::GetBackBufferSurface(), NULL,
D3DTEXF_LINEAR);
D3D::dev->EndScene();
D3D::dev->Present(NULL, NULL, NULL, NULL);
D3D::dev->SetRenderTarget(0, FramebufferManager::GetEFBColorRTSurface());
D3D::dev->SetDepthStencilSurface(FramebufferManager::GetEFBDepthRTSurface());
D3D::dev->BeginScene();
}
else
{
D3D::dev->EndScene();
D3D::dev->Present(NULL, NULL, NULL, NULL);
D3D::dev->BeginScene();
}
}
void DX9DebuggerCheckAndPause(bool update)
{
if (DX9DebuggerPauseFlag)
{
g_pdebugger->EnableButtons(true);
while( DX9DebuggerPauseFlag )
{
UpdateFPSDisplay("Paused by Video Debugger");
if (update) DX9DebuggerUpdateScreen();
Sleep(5);
}
g_pdebugger->EnableButtons(false);
}
}
void DX9DebuggerToPause(bool update)
{
DX9DebuggerToPauseAtNext = NOT_PAUSE;
DX9DebuggerPauseFlag = true;
DX9DebuggerCheckAndPause(update);
}
void ContinueDX9Debugger()
{
DX9DebuggerPauseFlag = false;
}
void GFXDebuggerDX9::OnUpdateScreenButton(wxCommandEvent& event)
{
DX9DebuggerUpdateScreen();
}

View File

@ -35,8 +35,7 @@
#include "BPMemory.h"
#include "XFMemory.h"
#include "ImageWrite.h"
#include "Debugger/Debugger.h"
#include "Debugger.h"
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
const PixelShaderCache::PSCacheEntry *PixelShaderCache::last_entry;
@ -277,6 +276,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
if (uid == last_pixel_shader_uid && PixelShaders[uid].frameCount == frameCount)
{
PSCache::const_iterator iter = PixelShaders.find(uid);
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
return (iter != PixelShaders.end() && iter->second.shader);
}
@ -291,21 +291,9 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
const PSCacheEntry &entry = iter->second;
last_entry = &entry;
#if defined(_DEBUG) || defined(DEBUGFAST)
if(iter->second.code.empty()) {
iter->second.code = std::string(GeneratePixelShaderCode(dstAlphaMode, API_D3D9, components));
}
#endif
DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
if (entry.shader)
{
D3D::SetPixelShader(entry.shader);
return true;
}
else
return false;
if (entry.shader) D3D::SetPixelShader(entry.shader);
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
return (entry.shader != NULL);
}
// Need to compile a new shader
@ -336,6 +324,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
sprintf(szTemp, "%sBADps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++);
SaveData(szTemp, code);
}
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
return false;
}
@ -345,15 +334,9 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
// And insert it into the shader cache.
bool result = InsertByteCode(uid, bytecode, bytecodelen, true);
#if defined(_DEBUG) || defined(DEBUGFAST)
iter = PixelShaders.find(uid);
if(iter->second.code.empty()) {
iter->second.code = std::string(code);
}
#endif
delete [] bytecode;
DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE, true);
return result;
}
@ -381,14 +364,3 @@ bool PixelShaderCache::InsertByteCode(const PIXELSHADERUID &uid, const u8 *bytec
}
return true;
}
std::string PixelShaderCache::GetCurrentShaderCode()
{
#if defined(_DEBUG) || defined(DEBUGFAST)
if (last_entry)
return last_entry->code;
else
#endif
return "(not available)\n";
}

View File

@ -39,9 +39,7 @@ private:
LPDIRECT3DPIXELSHADER9 shader;
bool owns_shader;
int frameCount;
#if defined(_DEBUG) || defined(DEBUGFAST)
std::string code;
#endif
PSCacheEntry() : shader(NULL), owns_shader(true), frameCount(0) {}
void Destroy()
{
@ -66,8 +64,6 @@ public:
static LPDIRECT3DPIXELSHADER9 GetColorCopyProgram(int SSAAMode);
static LPDIRECT3DPIXELSHADER9 GetDepthMatrixProgram(int SSAAMode);
static LPDIRECT3DPIXELSHADER9 GetClearProgram();
static std::string GetCurrentShaderCode();
};

View File

@ -49,8 +49,7 @@
#include "Fifo.h"
#include "TextureConverter.h"
#include "DLCache.h"
#include "debugger/debugger.h"
#include "Debugger.h"
static int s_fps = 0;
@ -1097,10 +1096,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
OSD::DrawMessages();
D3D::EndFrame();
DEBUGGER_PAUSE_AT(NEXT_FRAME,true);
frameCount++;
GFX_DEBUGGER_PAUSE_AT(NEXT_FRAME, true);
DLCache::ProgressiveCleanup();
TextureCache::Cleanup();

View File

@ -40,8 +40,7 @@
#include "TextureCache.h"
#include "HiresTextures.h"
#include "TextureConverter.h"
#include "debugger/debugger.h"
#include "Debugger.h"
extern int frameCount;
@ -66,7 +65,6 @@ bool TextureCache::TCacheEntry::Save(const char filename[])
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level, bool autogen_mips)
{
DEBUGGER_PAUSE_AT(NEXT_TEXTURE_CHANGE,true);
D3D::ReplaceTexture2D(texture, temp, width, height, expanded_width, d3d_fmt, swap_r_b, level);
// D3D9 will automatically generate mip maps if necessary
}
@ -214,8 +212,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width, u
TCacheEntry* entry = new TCacheEntry(D3D::CreateTexture2D(temp, width, height, expanded_width, d3d_fmt, swap_r_b, tex_levels));
entry->swap_r_b = swap_r_b;
entry->d3d_fmt = d3d_fmt;
DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE,true);
return entry;
}

View File

@ -35,8 +35,8 @@
#include "BPStructs.h"
#include "XFStructs.h"
#include "debugger/debugger.h"
#include "Debugger.h"
#include "VideoConfig.h"
// internal state for loading vertices
extern NativeVertexFormat *g_nativeVertexFmt;
@ -47,7 +47,8 @@ namespace DX9
inline void DumpBadShaders()
{
#if defined(_DEBUG) || defined(DEBUGFAST)
std::string error_shaders;
// TODO: Reimplement!
/* std::string error_shaders;
error_shaders.append(VertexShaderCache::GetCurrentShaderCode());
error_shaders.append(PixelShaderCache::GetCurrentShaderCode());
char filename[512] = "bad_shader_combo_0.txt";
@ -58,7 +59,7 @@ inline void DumpBadShaders()
sprintf(filename, "bad_shader_combo_%i.txt", which);
}
File::WriteStringToFile(true, error_shaders, filename);
PanicAlert("DrawIndexedPrimitiveUP failed. Shaders written to %s", filename);
PanicAlert("DrawIndexedPrimitiveUP failed. Shaders written to %s", filename);*/
#endif
}
@ -157,12 +158,12 @@ void VertexManager::vFlush()
if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components))
{
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
goto shader_fail;
}
if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components))
{
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");});
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");});
goto shader_fail;
}
@ -177,7 +178,7 @@ void VertexManager::vFlush()
DWORD write = 0;
if (!PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS, g_nativeVertexFmt->m_components))
{
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
goto shader_fail;
}
// update alpha only
@ -189,7 +190,7 @@ void VertexManager::vFlush()
D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE);
D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE);
}
DEBUGGER_PAUSE_AT(NEXT_FLUSH,true);
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
shader_fail:
ResetBuffer();

View File

@ -31,8 +31,7 @@
#include "VertexLoader.h"
#include "BPMemory.h"
#include "XFMemory.h"
#include "debugger/debugger.h"
#include "Debugger.h"
VertexShaderCache::VSCache VertexShaderCache::vshaders;
const VertexShaderCache::VSCacheEntry *VertexShaderCache::last_entry;
@ -211,7 +210,10 @@ bool 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 (vshaders[uid].shader != NULL);
}
memcpy(&last_vertex_shader_uid, &uid, sizeof(VERTEXSHADERUID));
@ -222,20 +224,9 @@ bool VertexShaderCache::SetShader(u32 components)
const VSCacheEntry &entry = iter->second;
last_entry = &entry;
#if defined(_DEBUG) || defined(DEBUGFAST)
if(iter->second.code.empty()) {
iter->second.code = std::string(GenerateVertexShaderCode(components, API_D3D9));
}
#endif
DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE,true);
if (entry.shader)
{
D3D::SetVertexShader(entry.shader);
return true;
}
else
return false;
if (entry.shader) D3D::SetVertexShader(entry.shader);
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
return (entry.shader != NULL);
}
const char *code = GenerateVertexShaderCode(components, API_D3D9);
@ -247,20 +238,15 @@ bool VertexShaderCache::SetShader(u32 components)
{
PanicAlert("Failed to compile Vertex Shader:\n\n%s", code);
}
GFX_DEBUGGER_PAUSE_AT(NEXT_ERROR, true);
return false;
}
g_vs_disk_cache.Append(uid, bytecode, bytecodelen);
g_vs_disk_cache.Sync();
bool result = InsertByteCode(uid, bytecode, bytecodelen, true);
#if defined(_DEBUG) || defined(DEBUGFAST)
iter = vshaders.find(uid);
if(iter->second.code.empty()) {
iter->second.code = std::string(code);
}
#endif
delete [] bytecode;
DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE,true);
GFX_DEBUGGER_PAUSE_AT(NEXT_VERTEX_SHADER_CHANGE, true);
return result;
}
@ -286,13 +272,3 @@ bool VertexShaderCache::InsertByteCode(const VERTEXSHADERUID &uid, const u8 *byt
}
return false;
}
std::string VertexShaderCache::GetCurrentShaderCode()
{
#if defined(_DEBUG) || defined(DEBUGFAST)
if (last_entry)
return last_entry->code;
else
#endif
return "(not available)\n";
}

View File

@ -19,14 +19,13 @@
#include "Atomic.h"
#include "Thread.h"
#include "LogManager.h"
#include "debugger/debugger.h"
#if defined(HAVE_WX) && HAVE_WX
#include "VideoConfigDiag.h"
#endif // HAVE_WX
#if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h"
#include "DebuggerPanel.h"
#endif // HAVE_WX
#include "MainBase.h"
@ -64,7 +63,7 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
void *DllDebugger(void *_hParent, bool Show)
{
#if defined(HAVE_WX) && HAVE_WX
return new GFXDebuggerDX9((wxWindow *)_hParent);
return new GFXDebuggerPanel((wxWindow*)_hParent);
#else
return NULL;
#endif
@ -158,6 +157,7 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsRealXFB = true;
g_Config.backend_info.bSupports3DVision = true;
g_Config.backend_info.bAllowSignedBytes = false;
g_Config.backend_info.bSupportsDualSourceBlend = false;
}
void DllConfig(void *_hParent)

View File

@ -19,8 +19,6 @@ set(LIBS videocommon
${X11_LIBRARIES})
if(wxWidgets_FOUND)
set(SRCS ${SRCS}
Src/Debugger/Debugger.cpp)
set(LIBS videouicommon ${LIBS} ${wxWidgets_LIBRARIES})
endif(wxWidgets_FOUND)

View File

@ -782,18 +782,6 @@
>
</File>
</Filter>
<Filter
Name="Debugger"
>
<File
RelativePath=".\Src\Debugger\Debugger.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\Debugger.h"
>
</File>
</Filter>
<Filter
Name="Logging"
>

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)