Add plumbing to show depth/stencil in ge debugger.

This commit is contained in:
Unknown W. Brackets 2013-10-05 17:27:28 -07:00
parent dcdf730407
commit c104c6dee8
2 changed files with 42 additions and 7 deletions

View File

@ -38,6 +38,8 @@
enum PauseAction { enum PauseAction {
PAUSE_CONTINUE, PAUSE_CONTINUE,
PAUSE_GETFRAMEBUF, PAUSE_GETFRAMEBUF,
PAUSE_GETDEPTHBUF,
PAUSE_GETSTENCILBUF,
PAUSE_GETTEX, PAUSE_GETTEX,
}; };
@ -60,6 +62,8 @@ static bool breakNextDraw = false;
static bool bufferResult; static bool bufferResult;
static GPUDebugBuffer bufferFrame; static GPUDebugBuffer bufferFrame;
static GPUDebugBuffer bufferDepth;
static GPUDebugBuffer bufferStencil;
static GPUDebugBuffer bufferTex; static GPUDebugBuffer bufferTex;
// TODO: Simplify and move out of windows stuff, just block in a common way for everyone. // TODO: Simplify and move out of windows stuff, just block in a common way for everyone.
@ -122,6 +126,14 @@ static void RunPauseAction() {
bufferResult = gpuDebug->GetCurrentFramebuffer(bufferFrame); bufferResult = gpuDebug->GetCurrentFramebuffer(bufferFrame);
break; break;
case PAUSE_GETDEPTHBUF:
bufferResult = gpuDebug->GetCurrentDepthbuffer(bufferDepth);
break;
case PAUSE_GETSTENCILBUF:
bufferResult = gpuDebug->GetCurrentStencilbuffer(bufferStencil);
break;
case PAUSE_GETTEX: case PAUSE_GETTEX:
bufferResult = gpuDebug->GetCurrentTexture(bufferTex); bufferResult = gpuDebug->GetCurrentTexture(bufferTex);
break; break;
@ -139,7 +151,7 @@ static void ForceUnpause() {
} }
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent) CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent), frameWindow(NULL), texWindow(NULL) { : Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent), primaryDisplay(PRIMARY_FRAMEBUF), frameWindow(NULL), texWindow(NULL) {
breakCmds.resize(256, false); breakCmds.resize(256, false);
Core_ListenShutdown(ForceUnpause); Core_ListenShutdown(ForceUnpause);
@ -218,14 +230,30 @@ void CGEDebugger::SetupPreviews() {
void CGEDebugger::UpdatePreviews() { void CGEDebugger::UpdatePreviews() {
// TODO: Do something different if not paused? // TODO: Do something different if not paused?
GPUDebugBuffer *primaryBuffer = NULL;
bufferResult = false; bufferResult = false;
SetPauseAction(PAUSE_GETFRAMEBUF); switch (primaryDisplay) {
case PRIMARY_FRAMEBUF:
SetPauseAction(PAUSE_GETFRAMEBUF);
primaryBuffer = &bufferFrame;
break;
if (bufferResult) { case PRIMARY_DEPTHBUF:
auto fmt = SimpleGLWindow::Format(bufferFrame.GetFormat()); SetPauseAction(PAUSE_GETDEPTHBUF);
frameWindow->Draw(bufferFrame.GetData(), bufferFrame.GetStride(), bufferFrame.GetHeight(), bufferFrame.GetFlipped(), fmt); primaryBuffer = &bufferDepth;
break;
case PRIMARY_STENCILBUF:
SetPauseAction(PAUSE_GETSTENCILBUF);
primaryBuffer = &bufferStencil;
break;
}
if (bufferResult && primaryBuffer != NULL) {
auto fmt = SimpleGLWindow::Format(primaryBuffer->GetFormat());
frameWindow->Draw(primaryBuffer->GetData(), primaryBuffer->GetStride(), primaryBuffer->GetHeight(), primaryBuffer->GetFlipped(), fmt);
} else { } else {
ERROR_LOG(COMMON, "Unable to get framebuffer."); ERROR_LOG(COMMON, "Unable to get buffer for main display.");
frameWindow->Clear(); frameWindow->Clear();
} }
@ -236,7 +264,7 @@ void CGEDebugger::UpdatePreviews() {
auto fmt = SimpleGLWindow::Format(bufferTex.GetFormat()); auto fmt = SimpleGLWindow::Format(bufferTex.GetFormat());
texWindow->Draw(bufferTex.GetData(), bufferTex.GetStride(), bufferTex.GetHeight(), bufferTex.GetFlipped(), fmt); texWindow->Draw(bufferTex.GetData(), bufferTex.GetStride(), bufferTex.GetHeight(), bufferTex.GetFlipped(), fmt);
} else { } else {
ERROR_LOG(COMMON, "Unable to get texture."); ERROR_LOG(COMMON, "Unable to get texture (may be no texture set.)");
texWindow->Clear(); texWindow->Clear();
} }

View File

@ -61,6 +61,13 @@ private:
void UpdateSize(WORD width, WORD height); void UpdateSize(WORD width, WORD height);
void SavePosition(); void SavePosition();
enum PrimaryDisplayType {
PRIMARY_FRAMEBUF,
PRIMARY_DEPTHBUF,
PRIMARY_STENCILBUF,
};
PrimaryDisplayType primaryDisplay;
CtrlDisplayListView *displayList; CtrlDisplayListView *displayList;
TabDisplayLists *lists; TabDisplayLists *lists;
TabStateFlags *flags; TabStateFlags *flags;