diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index e934c86554..4a16048ca8 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -13,6 +13,7 @@ #include +#include "ext/imgui/imgui.h" #include "Common/Profiler/Profiler.h" #include "Common/GraphicsContext.h" @@ -1975,3 +1976,14 @@ bool GPUCommon::DescribeCodePtr(const u8 *ptr, std::string &name) { // which is owned by the drawengine. return drawEngineCommon_->DescribeCodePtr(ptr, name); } + +void GPUCommon::DrawImGuiDebugger() { + // First, let's list any active display lists. + ImGui::Text("Next list ID: %d", nextListID); + for (auto index : dlQueue) { + const auto &list = dls[index]; + ImGui::Text("List %d", list.id); + ImGui::Text("pc: %08x (start: %08x)", list.pc, list.startpc); + ImGui::Text("bbox: %d", (int)list.bboxResult); + } +} diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 2328406165..62354af6fb 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -131,6 +131,8 @@ public: void SwitchToGe(); + void DrawImGuiDebugger() override; + uint32_t SetAddrTranslation(uint32_t value) override; uint32_t GetAddrTranslation() override; diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index 08ea90db82..beab46ab6c 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -221,6 +221,7 @@ public: // Tells the GPU to update the gpuStats structure. virtual void GetStats(char *buffer, size_t bufsize) = 0; + virtual void DrawImGuiDebugger() = 0; // Invalidate any cached content sourced from the specified range. // If size = -1, invalidate everything. diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index fd65a2bce4..49f4959960 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -821,6 +821,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu ImGui::EndMenu(); } if (ImGui::BeginMenu("Graphics")) { + ImGui::MenuItem("Ge Debugger", nullptr, &cfg_.geDebuggerOpen); ImGui::MenuItem("Display Output", nullptr, &cfg_.displayOpen); ImGui::MenuItem("Textures", nullptr, &cfg_.texturesOpen); ImGui::MenuItem("Framebuffers", nullptr, &cfg_.framebuffersOpen); @@ -919,6 +920,10 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu if (cfg_.structViewerOpen) { structViewer_.Draw(mipsDebug, &cfg_.structViewerOpen); } + + if (cfg_.geDebuggerOpen) { + DrawGeDebuggerWindow(cfg_); + } } void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState coreState) { diff --git a/UI/ImDebugger/ImDebugger.h b/UI/ImDebugger/ImDebugger.h index 0c4bc35981..9c774d72ec 100644 --- a/UI/ImDebugger/ImDebugger.h +++ b/UI/ImDebugger/ImDebugger.h @@ -78,6 +78,7 @@ struct ImConfig { bool kernelObjectsOpen; bool audioChannelsOpen; bool debugStatsOpen; + bool geDebuggerOpen; // HLE explorer settings // bool filterByUsed = true; diff --git a/UI/ImDebugger/ImGe.cpp b/UI/ImDebugger/ImGe.cpp index 54b1e648f1..d686cfc1fd 100644 --- a/UI/ImDebugger/ImGe.cpp +++ b/UI/ImDebugger/ImGe.cpp @@ -68,3 +68,15 @@ void DrawDebugStatsWindow(ImConfig &cfg) { ImGui::TextUnformatted(statbuf); ImGui::End(); } + +// Stub +void DrawGeDebuggerWindow(ImConfig &cfg) { + if (!ImGui::Begin("Debug Stats", &cfg.geDebuggerOpen)) { + ImGui::End(); + return; + } + + gpu->DrawImGuiDebugger(); + + ImGui::End(); +} diff --git a/UI/ImDebugger/ImGe.h b/UI/ImDebugger/ImGe.h index 849ec8e5a2..f75d1acf12 100644 --- a/UI/ImDebugger/ImGe.h +++ b/UI/ImDebugger/ImGe.h @@ -11,6 +11,7 @@ void DrawFramebuffersWindow(ImConfig &cfg, FramebufferManagerCommon *framebuffer void DrawTexturesWindow(ImConfig &cfg, TextureCacheCommon *textureCache); void DrawDisplayWindow(ImConfig &cfg, FramebufferManagerCommon *framebufferManager); void DrawDebugStatsWindow(ImConfig &cfg); +void DrawGeDebuggerWindow(ImConfig &cfg); class ImGeDebugger { public: