mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-20 23:54:48 +00:00
Add a preview for the current texture as well.
This commit is contained in:
parent
81e71dd8d7
commit
d734b59904
@ -35,7 +35,7 @@ const UINT WM_GEDBG_BREAK_DRAW = WM_USER + 201;
|
||||
enum PauseAction {
|
||||
PAUSE_CONTINUE,
|
||||
PAUSE_GETFRAMEBUF,
|
||||
// textures, etc.
|
||||
PAUSE_GETTEX,
|
||||
};
|
||||
|
||||
static bool attached = false;
|
||||
@ -53,12 +53,13 @@ static bool breakNextOp = false;
|
||||
static bool breakNextDraw = false;
|
||||
|
||||
static bool bufferResult;
|
||||
static GPUDebugBuffer buffer;
|
||||
static GPUDebugBuffer bufferFrame;
|
||||
static GPUDebugBuffer bufferTex;
|
||||
|
||||
// TODO: Simplify and move out of windows stuff, just block in a common way for everyone.
|
||||
|
||||
void CGEDebugger::init() {
|
||||
SimpleGLWindow::registerClass();
|
||||
void CGEDebugger::Init() {
|
||||
SimpleGLWindow::RegisterClass();
|
||||
CtrlDisplayListView::registerClass();
|
||||
}
|
||||
|
||||
@ -83,7 +84,11 @@ static void RunPauseAction() {
|
||||
return;
|
||||
|
||||
case PAUSE_GETFRAMEBUF:
|
||||
bufferResult = gpuDebug->GetCurrentFramebuffer(buffer);
|
||||
bufferResult = gpuDebug->GetCurrentFramebuffer(bufferFrame);
|
||||
break;
|
||||
|
||||
case PAUSE_GETTEX:
|
||||
bufferResult = gpuDebug->GetCurrentTexture(bufferTex);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -92,7 +97,7 @@ static void RunPauseAction() {
|
||||
}
|
||||
|
||||
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
||||
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent), frameWindow(NULL) {
|
||||
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent), frameWindow(NULL), texWindow(NULL) {
|
||||
breakCmds.resize(256, false);
|
||||
|
||||
// it's ugly, but .rc coordinates don't match actual pixels and it screws
|
||||
@ -108,15 +113,48 @@ CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
||||
|
||||
CGEDebugger::~CGEDebugger() {
|
||||
delete frameWindow;
|
||||
delete texWindow;
|
||||
}
|
||||
|
||||
void CGEDebugger::SetupFrameWindow() {
|
||||
void CGEDebugger::SetupPreviews() {
|
||||
if (frameWindow == NULL) {
|
||||
frameWindow = SimpleGLWindow::getFrom(GetDlgItem(m_hDlg,IDC_GEDBG_FRAME));
|
||||
frameWindow = SimpleGLWindow::GetFrom(GetDlgItem(m_hDlg, IDC_GEDBG_FRAME));
|
||||
frameWindow->Initialize();
|
||||
// TODO: Why doesn't this work?
|
||||
frameWindow->Clear();
|
||||
}
|
||||
if (texWindow == NULL) {
|
||||
texWindow = SimpleGLWindow::GetFrom(GetDlgItem(m_hDlg, IDC_GEDBG_TEX));
|
||||
texWindow->Initialize();
|
||||
// TODO: Why doesn't this work?
|
||||
texWindow->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void CGEDebugger::UpdatePreviews() {
|
||||
// TODO: Do something different if not paused?
|
||||
|
||||
bufferResult = false;
|
||||
SetPauseAction(PAUSE_GETFRAMEBUF);
|
||||
|
||||
if (bufferResult) {
|
||||
auto fmt = SimpleGLWindow::Format(bufferFrame.GetFormat());
|
||||
frameWindow->Draw(bufferFrame.GetData(), bufferFrame.GetStride(), bufferFrame.GetHeight(), bufferFrame.GetFlipped(), fmt, SimpleGLWindow::RESIZE_SHRINK_CENTER);
|
||||
} else {
|
||||
ERROR_LOG(COMMON, "Unable to get framebuffer.");
|
||||
frameWindow->Clear();
|
||||
}
|
||||
|
||||
bufferResult = false;
|
||||
SetPauseAction(PAUSE_GETTEX);
|
||||
|
||||
if (bufferResult) {
|
||||
auto fmt = SimpleGLWindow::Format(bufferTex.GetFormat());
|
||||
texWindow->Draw(bufferTex.GetData(), bufferTex.GetStride(), bufferTex.GetHeight(), bufferTex.GetFlipped(), fmt, SimpleGLWindow::RESIZE_SHRINK_CENTER);
|
||||
} else {
|
||||
ERROR_LOG(COMMON, "Unable to get texture.");
|
||||
texWindow->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
@ -135,14 +173,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
return TRUE;
|
||||
|
||||
case WM_SHOWWINDOW:
|
||||
SetupFrameWindow();
|
||||
SetupPreviews();
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_GEDBG_BREAK:
|
||||
attached = true;
|
||||
SetupFrameWindow();
|
||||
SetupPreviews();
|
||||
|
||||
DisplayList list;
|
||||
// todo: for some reason this sometimes fails when hitting break
|
||||
@ -159,6 +197,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
case IDC_GEDBG_RESUME:
|
||||
frameWindow->Clear();
|
||||
texWindow->Clear();
|
||||
// TODO: detach? Should probably have separate UI, or just on activate?
|
||||
//breakNextOp = false;
|
||||
breakNextDraw = false;
|
||||
@ -172,22 +211,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
u32 pc = (u32)wParam;
|
||||
auto info = gpuDebug->DissassembleOp(pc);
|
||||
NOTICE_LOG(COMMON, "Waiting at %08x, %s", pc, info.desc.c_str());
|
||||
UpdatePreviews();
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_GEDBG_BREAK_DRAW:
|
||||
{
|
||||
NOTICE_LOG(COMMON, "Waiting at a draw");
|
||||
|
||||
bufferResult = false;
|
||||
SetPauseAction(PAUSE_GETFRAMEBUF);
|
||||
|
||||
if (bufferResult) {
|
||||
auto fmt = SimpleGLWindow::Format(buffer.GetFormat());
|
||||
frameWindow->Draw(buffer.GetData(), buffer.GetStride(), buffer.GetHeight(), buffer.GetFlipped(), fmt, SimpleGLWindow::RESIZE_SHRINK_CENTER);
|
||||
} else {
|
||||
ERROR_LOG(COMMON, "Unable to get buffer.");
|
||||
}
|
||||
UpdatePreviews();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -28,12 +28,14 @@ public:
|
||||
CGEDebugger(HINSTANCE _hInstance, HWND _hParent);
|
||||
~CGEDebugger();
|
||||
|
||||
static void init();
|
||||
static void Init();
|
||||
protected:
|
||||
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
private:
|
||||
void SetupFrameWindow();
|
||||
void SetupPreviews();
|
||||
void UpdatePreviews();
|
||||
|
||||
SimpleGLWindow *frameWindow;
|
||||
SimpleGLWindow *texWindow;
|
||||
};
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
const PTCHAR SimpleGLWindow::windowClass = _T("SimpleGLWindow");
|
||||
|
||||
void SimpleGLWindow::registerClass() {
|
||||
void SimpleGLWindow::RegisterClass() {
|
||||
WNDCLASSEX wndClass;
|
||||
|
||||
wndClass.cbSize = sizeof(wndClass);
|
||||
wndClass.lpszClassName = windowClass;
|
||||
wndClass.hInstance = GetModuleHandle(0);
|
||||
wndClass.lpfnWndProc = wndProc;
|
||||
wndClass.lpfnWndProc = WndProc;
|
||||
wndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||
wndClass.hIcon = 0;
|
||||
wndClass.lpszMenuName = 0;
|
||||
@ -273,12 +273,12 @@ void SimpleGLWindow::Clear() {
|
||||
Swap();
|
||||
}
|
||||
|
||||
SimpleGLWindow *SimpleGLWindow::getFrom(HWND hwnd) {
|
||||
SimpleGLWindow *SimpleGLWindow::GetFrom(HWND hwnd) {
|
||||
return (SimpleGLWindow*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK SimpleGLWindow::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
SimpleGLWindow *win = SimpleGLWindow::getFrom(hwnd);
|
||||
LRESULT CALLBACK SimpleGLWindow::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
SimpleGLWindow *win = SimpleGLWindow::GetFrom(hwnd);
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
|
@ -43,14 +43,14 @@ struct SimpleGLWindow {
|
||||
void Clear();
|
||||
void Draw(u8 *data, int w, int h, bool flipped = false, Format = FORMAT_8888, ResizeType resize = RESIZE_NONE);
|
||||
void Initialize();
|
||||
static SimpleGLWindow* getFrom(HWND hwnd);
|
||||
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
static SimpleGLWindow *GetFrom(HWND hwnd);
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void Swap() {
|
||||
SwapBuffers(hDC_);
|
||||
}
|
||||
|
||||
static void registerClass();
|
||||
static void RegisterClass();
|
||||
protected:
|
||||
void SetupGL();
|
||||
void ResizeGL(int w, int h);
|
||||
|
@ -190,7 +190,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
CtrlDisAsmView::init();
|
||||
CtrlMemView::init();
|
||||
CtrlRegisterList::init();
|
||||
CGEDebugger::init();
|
||||
CGEDebugger::Init();
|
||||
|
||||
DialogManager::AddDlg(memoryWindow[0] = new CMemoryDlg(_hInstance, hwndMain, currentDebugMIPS));
|
||||
DialogManager::AddDlg(vfpudlg = new CVFPUDlg(_hInstance, hwndMain, currentDebugMIPS));
|
||||
|
@ -171,8 +171,9 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
PUSHBUTTON "Break",IDC_GEDBG_BREAK,0,0,48,14
|
||||
PUSHBUTTON "Resume",IDC_GEDBG_RESUME,52,0,48,14
|
||||
CONTROL "",IDC_GEDBG_FRAME,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,140,10,256,136
|
||||
CONTROL "",IDC_GEDBG_CURRENTDISPLAYLIST,"CtrlDisplayListView",WS_BORDER | WS_VISIBLE,10,185,456,200
|
||||
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_CURRENTDISPLAYLIST,"CtrlDisplayListView",WS_BORDER | WS_VISIBLE,10,195,456,200
|
||||
END
|
||||
|
||||
#include "aboutbox.rc"
|
||||
|
@ -263,6 +263,7 @@
|
||||
#define IDC_GEDBG_RESUME 40118
|
||||
#define IDC_GEDBG_FRAME 40119
|
||||
#define IDC_GEDBG_CURRENTDISPLAYLIST 40120
|
||||
#define IDC_GEDBG_TEX 40121
|
||||
|
||||
// Dummy option to let the buffered rendering hotkey cycle through all the options.
|
||||
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
|
||||
@ -275,7 +276,7 @@
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 251
|
||||
#define _APS_NEXT_COMMAND_VALUE 40121
|
||||
#define _APS_NEXT_COMMAND_VALUE 40122
|
||||
#define _APS_NEXT_CONTROL_VALUE 1181
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user