mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-11 00:56:37 +00:00
Merge pull request #15338 from unknownbrackets/ge-debugger
Alow flushing at will via the GE debugger
This commit is contained in:
commit
5a6bf8b435
@ -210,6 +210,7 @@ public:
|
||||
// Needs to be called from the GPU thread.
|
||||
// Calling from a separate thread (e.g. UI) may fail.
|
||||
virtual void SetCmdValue(u32 op) = 0;
|
||||
virtual void DispatchFlush() = 0;
|
||||
|
||||
virtual bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) {
|
||||
return false;
|
||||
|
@ -36,6 +36,7 @@ enum PauseAction {
|
||||
PAUSE_GETTEX,
|
||||
PAUSE_GETCLUT,
|
||||
PAUSE_SETCMDVALUE,
|
||||
PAUSE_FLUSHDRAW,
|
||||
};
|
||||
|
||||
static bool isStepping;
|
||||
@ -119,6 +120,10 @@ static void RunPauseAction() {
|
||||
gpuDebug->SetCmdValue(pauseSetCmdValue);
|
||||
break;
|
||||
|
||||
case PAUSE_FLUSHDRAW:
|
||||
gpuDebug->DispatchFlush();
|
||||
break;
|
||||
|
||||
default:
|
||||
ERROR_LOG(G3D, "Unsupported pause action, forgot to add it to the switch.");
|
||||
}
|
||||
@ -239,6 +244,15 @@ bool GPU_SetCmdValue(u32 op) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GPU_FlushDrawing() {
|
||||
if (!isStepping && coreState != CORE_STEPPING) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SetPauseAction(PAUSE_FLUSHDRAW);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResumeFromStepping() {
|
||||
SetPauseAction(PAUSE_CONTINUE, false);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ namespace GPUStepping {
|
||||
bool GPU_GetCurrentTexture(const GPUDebugBuffer *&buffer, int level);
|
||||
bool GPU_GetCurrentClut(const GPUDebugBuffer *&buffer);
|
||||
bool GPU_SetCmdValue(u32 op);
|
||||
bool GPU_FlushDrawing();
|
||||
|
||||
void ResumeFromStepping();
|
||||
void ForceUnpause();
|
||||
|
@ -367,6 +367,10 @@ void GPUCommon::Flush() {
|
||||
drawEngineCommon_->DispatchFlush();
|
||||
}
|
||||
|
||||
void GPUCommon::DispatchFlush() {
|
||||
drawEngineCommon_->DispatchFlush();
|
||||
}
|
||||
|
||||
GPUCommon::GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw) :
|
||||
gfxCtx_(gfxCtx),
|
||||
draw_(draw)
|
||||
|
@ -171,6 +171,7 @@ public:
|
||||
|
||||
// Note: Not virtual!
|
||||
void Flush();
|
||||
void DispatchFlush() override;
|
||||
|
||||
#ifdef USE_CRT_DBG
|
||||
#undef new
|
||||
|
@ -61,6 +61,7 @@ SoftwareDrawEngine::~SoftwareDrawEngine() {
|
||||
}
|
||||
|
||||
void SoftwareDrawEngine::DispatchFlush() {
|
||||
transformUnit.Flush("debug");
|
||||
}
|
||||
|
||||
void SoftwareDrawEngine::DispatchSubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertTypeID, int cullMode, int *bytesRead) {
|
||||
|
@ -129,6 +129,8 @@ void CGEDebugger::Init() {
|
||||
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
||||
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent)
|
||||
, stepCountDlg(_hInstance, m_hDlg) {
|
||||
SetMenu(m_hDlg, LoadMenu(_hInstance, MAKEINTRESOURCE(IDR_GEDBG_MENU)));
|
||||
|
||||
// minimum size = a little more than the default
|
||||
RECT windowRect;
|
||||
GetWindowRect(m_hDlg, &windowRect);
|
||||
@ -185,8 +187,8 @@ CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
||||
// set window position
|
||||
int x = g_Config.iGEWindowX == -1 ? windowRect.left : g_Config.iGEWindowX;
|
||||
int y = g_Config.iGEWindowY == -1 ? windowRect.top : g_Config.iGEWindowY;
|
||||
int w = g_Config.iGEWindowW == -1 ? minWidth_ : g_Config.iGEWindowW;
|
||||
int h = g_Config.iGEWindowH == -1 ? minHeight_ : g_Config.iGEWindowH;
|
||||
int w = g_Config.iGEWindowW == -1 ? minWidth_ : std::max(minWidth_, g_Config.iGEWindowW);
|
||||
int h = g_Config.iGEWindowH == -1 ? minHeight_ : std::max(minHeight_, g_Config.iGEWindowH);
|
||||
MoveWindow(m_hDlg,x,y,w,h,FALSE);
|
||||
|
||||
SetTimer(m_hDlg, 1, USER_TIMER_MINIMUM, nullptr);
|
||||
@ -340,6 +342,8 @@ void CGEDebugger::UpdatePreviews() {
|
||||
}
|
||||
|
||||
updating_ = true;
|
||||
if (autoFlush_)
|
||||
GPU_FlushDrawing();
|
||||
UpdateTextureLevel(textureLevel_);
|
||||
UpdatePrimaryPreview(state);
|
||||
UpdateSecondPreview(state);
|
||||
@ -704,11 +708,10 @@ void CGEDebugger::UpdateSize(WORD width, WORD height) {
|
||||
MoveWindow(tabControl,tabRect.left,tabRect.top,tabRect.right-tabRect.left,tabRect.bottom-tabRect.top,TRUE);
|
||||
}
|
||||
|
||||
void CGEDebugger::SavePosition()
|
||||
{
|
||||
void CGEDebugger::SavePosition() {
|
||||
RECT rc;
|
||||
if (GetWindowRect(m_hDlg, &rc))
|
||||
{
|
||||
// Don't save while we're still loading.
|
||||
if (tabs && GetWindowRect(m_hDlg, &rc)) {
|
||||
g_Config.iGEWindowX = rc.left;
|
||||
g_Config.iGEWindowY = rc.top;
|
||||
g_Config.iGEWindowW = rc.right - rc.left;
|
||||
@ -783,6 +786,10 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MENUSELECT:
|
||||
UpdateMenus();
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_GEDBG_STEPDRAW:
|
||||
@ -880,6 +887,18 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
GPURecord::Activate();
|
||||
break;
|
||||
|
||||
case IDC_GEDBG_FLUSH:
|
||||
if (GPUDebug::IsActive() && gpuDebug != nullptr) {
|
||||
if (!autoFlush_)
|
||||
GPU_FlushDrawing();
|
||||
UpdatePreviews();
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_GEDBG_FLUSHAUTO:
|
||||
autoFlush_ = !autoFlush_;
|
||||
break;
|
||||
|
||||
case IDC_GEDBG_FORCEOPAQUE:
|
||||
if (GPUDebug::IsActive() && gpuDebug != nullptr) {
|
||||
forceOpaque_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_FORCEOPAQUE), BM_GETCHECK, 0, 0) != 0;
|
||||
@ -936,3 +955,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CGEDebugger::UpdateMenus() {
|
||||
CheckMenuItem(GetMenu(m_hDlg), IDC_GEDBG_FLUSHAUTO, MF_BYCOMMAND | (autoFlush_ ? MF_CHECKED : MF_UNCHECKED));
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ private:
|
||||
void PreviewExport(const GPUDebugBuffer *buffer);
|
||||
void DescribePixel(u32 pix, GPUDebugBufferFormat fmt, int x, int y, char desc[256]);
|
||||
void DescribePixelRGBA(u32 pix, GPUDebugBufferFormat fmt, int x, int y, char desc[256]);
|
||||
void UpdateMenus();
|
||||
|
||||
u32 TexturePreviewFlags(const GPUgstate &state);
|
||||
|
||||
@ -102,6 +103,7 @@ private:
|
||||
int textureLevel_ = 0;
|
||||
bool showClut_ = false;
|
||||
bool forceOpaque_ = false;
|
||||
bool autoFlush_ = false;
|
||||
// The most recent primary/framebuffer and texture buffers.
|
||||
const GPUDebugBuffer *primaryBuffer_ = nullptr;
|
||||
const GPUDebugBuffer *secondBuffer_ = nullptr;
|
||||
|
@ -203,15 +203,13 @@ CAPTION "GE"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
PUSHBUTTON "Step &Frame",IDC_GEDBG_STEPFRAME,10,2,44,14
|
||||
PUSHBUTTON "Step &Tex",IDC_GEDBG_STEPTEX,55,2,44,14
|
||||
PUSHBUTTON "Step &Draw",IDC_GEDBG_STEPDRAW,100,2,44,14
|
||||
PUSHBUTTON "Step &Prim",IDC_GEDBG_STEPPRIM,145,2,44,14
|
||||
PUSHBUTTON "Step &Curve",IDC_GEDBG_STEPCURVE,190,2,44,14
|
||||
PUSHBUTTON "Step &Into",IDC_GEDBG_STEP,235,2,44,14
|
||||
PUSHBUTTON "Step Cou&nt",IDC_GEDBG_STEPCOUNT,280,2,44,14
|
||||
EDITTEXT IDC_GEDBG_PRIMCOUNTER,325,4,50,12,ES_READONLY | NOT WS_BORDER
|
||||
PUSHBUTTON "&Resume",IDC_GEDBG_RESUME,396,2,44,14
|
||||
PUSHBUTTON "Rec&ord",IDC_GEDBG_RECORD,444,2,44,14
|
||||
PUSHBUTTON "Step &Tex",IDC_GEDBG_STEPTEX,60,2,44,14
|
||||
PUSHBUTTON "Step &Draw",IDC_GEDBG_STEPDRAW,105,2,44,14
|
||||
PUSHBUTTON "Step &Prim",IDC_GEDBG_STEPPRIM,150,2,44,14
|
||||
PUSHBUTTON "Step &Into",IDC_GEDBG_STEP,200,2,44,14
|
||||
PUSHBUTTON "Step Cou&nt",IDC_GEDBG_STEPCOUNT,245,2,44,14
|
||||
EDITTEXT IDC_GEDBG_PRIMCOUNTER,290,4,50,12,ES_READONLY | NOT WS_BORDER
|
||||
PUSHBUTTON "&Resume",IDC_GEDBG_RESUME,444,2,44,14
|
||||
CONTROL "",IDC_GEDBG_TEX,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,10,20,128,128
|
||||
CONTROL "",IDC_GEDBG_FRAME,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,148,20,256,136
|
||||
CONTROL "",IDC_GEDBG_MAINTAB,"SysTabControl32",TCS_TABS | TCS_FOCUSNEVER,10,216,480,180
|
||||
@ -219,11 +217,9 @@ BEGIN
|
||||
EDITTEXT IDC_GEDBG_TEXADDR,10,152,128,12,ES_READONLY | NOT WS_BORDER
|
||||
CONTROL "Force opaque",IDC_GEDBG_FORCEOPAQUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,164,60,12
|
||||
CONTROL "Show CLUT",IDC_GEDBG_SHOWCLUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,90,164,50,12
|
||||
PUSHBUTTON "Break on Te&xture...",IDC_GEDBG_BREAKTEX,24,176,100,14
|
||||
PUSHBUTTON "Level -",IDC_GEDBG_TEXLEVELDOWN,24,192,40,14
|
||||
PUSHBUTTON "Level +",IDC_GEDBG_TEXLEVELUP,84,192,40,14
|
||||
PUSHBUTTON "Level -",IDC_GEDBG_TEXLEVELDOWN,24,184,40,14
|
||||
PUSHBUTTON "Level +",IDC_GEDBG_TEXLEVELUP,84,184,40,14
|
||||
CONTROL "",IDC_GEDBG_FBTABS,"SysTabControl32",TCS_BUTTONS | TCS_FOCUSNEVER,384,192,110,12
|
||||
PUSHBUTTON "Break on Target...",IDC_GEDBG_BREAKTARGET,394,211,100,14
|
||||
END
|
||||
|
||||
IDD_GEDBG_STEPCOUNT DIALOGEX 0, 0, 124, 18
|
||||
@ -662,6 +658,36 @@ BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
IDR_GEDBG_MENU MENUEX
|
||||
BEGIN
|
||||
POPUP "&Actions", ID_GEDBG_ACTIONS_MENU
|
||||
BEGIN
|
||||
MENUITEM "Rec&ord Next Frame", IDC_GEDBG_RECORD
|
||||
MENUITEM "F&lush Pending Draws", IDC_GEDBG_FLUSH
|
||||
END
|
||||
|
||||
POPUP "&Step", ID_GEDBG_STEP_MENU
|
||||
BEGIN
|
||||
MENUITEM "Next &Instruction", IDC_GEDBG_STEP
|
||||
MENUITEM "To Cou&nter...", IDC_GEDBG_STEPCOUNT
|
||||
MENUITEM "Next &Primitive", IDC_GEDBG_STEPPRIM
|
||||
MENUITEM "Next &Curve", IDC_GEDBG_STEPCURVE
|
||||
MENUITEM "Next &Texture", IDC_GEDBG_STEPTEX
|
||||
MENUITEM "Next &Draw Flush", IDC_GEDBG_STEPDRAW
|
||||
MENUITEM "Next &Frame", IDC_GEDBG_STEPFRAME
|
||||
MENUITEM "", 0, MFT_SEPARATOR
|
||||
MENUITEM "&Auto Flush Pending", IDC_GEDBG_FLUSHAUTO
|
||||
END
|
||||
|
||||
POPUP "&Breakpoints", ID_GEDBG_BREAK_MENU
|
||||
BEGIN
|
||||
MENUITEM "&Resume", IDC_GEDBG_RESUME
|
||||
MENUITEM "", 0, MFT_SEPARATOR
|
||||
MENUITEM "Te&xture Pointer...", IDC_GEDBG_BREAKTEX
|
||||
MENUITEM "Render Tar&get Pointer...", IDC_GEDBG_BREAKTARGET
|
||||
END
|
||||
END
|
||||
|
||||
IDR_POPUPMENUS MENU
|
||||
BEGIN
|
||||
POPUP "memview"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define IDC_RAM 107
|
||||
#define IDC_STEPOVER 108
|
||||
#define IDC_TABDATATYPE 109
|
||||
#define IDR_GEDBG_MENU 110
|
||||
#define ID_MEMVIEW_GOTOINDISASM 112
|
||||
#define IDI_PPSSPP 115
|
||||
#define IDI_STOPDISABLE 118
|
||||
@ -318,6 +319,11 @@
|
||||
#define IDC_MEMVIEW_STATUS 40206
|
||||
#define ID_MEMVIEW_EXTENTBEGIN 40207
|
||||
#define ID_MEMVIEW_EXTENTEND 40208
|
||||
#define ID_GEDBG_ACTIONS_MENU 40209
|
||||
#define ID_GEDBG_STEP_MENU 40210
|
||||
#define ID_GEDBG_BREAK_MENU 40211
|
||||
#define IDC_GEDBG_FLUSH 40212
|
||||
#define IDC_GEDBG_FLUSHAUTO 40213
|
||||
|
||||
// Dummy option to let the buffered rendering hotkey cycle through all the options.
|
||||
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
|
||||
@ -330,7 +336,7 @@
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 256
|
||||
#define _APS_NEXT_COMMAND_VALUE 40209
|
||||
#define _APS_NEXT_COMMAND_VALUE 40214
|
||||
#define _APS_NEXT_CONTROL_VALUE 1202
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user