Add barebones GE state display window

This commit is contained in:
Henrik Rydgård committed 2024-12-05 10:25:40 +01:00
1 parent 6d33408da6
commit 47c98a9135
4 files changed
+47 -16

No files matched your search

+39 -11
View File
@@ -2,13 +2,14 @@
#include "ext/imgui/imgui_impl_thin3d.h"
#include "UI/ImDebugger/ImGe.h"
#include "UI/ImDebugger/ImDebugger.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/Common/FramebufferManagerCommon.h"
#include "GPU/Common/TextureCacheCommon.h"
#include "Core/HLE/sceDisplay.h"
#include "Core/HW/Display.h"
#include "GPU/Debugger/State.h"
#include "GPU/GPUState.h"
void DrawFramebuffersWindow(ImConfig &cfg, FramebufferManagerCommon *framebufferManager) {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
@@ -89,24 +90,51 @@ void DrawGeDebuggerWindow(ImConfig &cfg) {
}
// TODO: Separate window or merge into Ge debugger?
void DrawGeRegistersWindow(ImConfig &cfg) {
void DrawGeStateWindow(ImConfig &cfg, GPUDebugInterface *gpuDebug) {
ImGui::SetNextWindowSize(ImVec2(300, 500), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Debug Stats", &cfg.geRegistersOpen)) {
if (!ImGui::Begin("GE State", &cfg.geStateOpen)) {
ImGui::End();
return;
}
if (ImGui::BeginTabBar("GeRegs", ImGuiTabBarFlags_None)) {
if (ImGui::BeginTabItem("Control")) {
if (ImGui::BeginTable("fpr", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("bkpt", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("name", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("value", ImGuiTableColumnFlags_WidthStretch);
auto buildStateTab = [&](const char *tabName, const TabStateRow *rows, size_t numRows) {
if (ImGui::BeginTabItem(tabName)) {
if (ImGui::BeginTable("fpr", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("bkpt", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("State", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
ImGui::EndTable();
for (size_t i = 0; i < numRows; i++) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("-"); // breakpoint
ImGui::TableNextColumn();
ImGui::TextUnformatted(rows[i].title.data(), rows[i].title.data() + rows[i].title.size());
ImGui::TableNextColumn();
char temp[256];
auto &info = rows[i];
const bool enabled = info.enableCmd == 0 || (gstate.cmdmem[info.enableCmd] & 1) == 1;
const u32 value = gstate.cmdmem[info.cmd] & 0xFFFFFF;
const u32 otherValue = gstate.cmdmem[info.otherCmd] & 0xFFFFFF;
const u32 otherValue2 = gstate.cmdmem[info.otherCmd2] & 0xFFFFFF;
FormatStateRow(gpuDebug, temp, sizeof(temp), info.fmt, value, enabled, otherValue, otherValue2);
ImGui::TextUnformatted(temp);
}
ImGui::EndTable();
}
ImGui::EndTabItem();
}
ImGui::EndTabItem();
}
};
buildStateTab("Flags", g_stateFlagsRows, g_stateFlagsRowsSize);
buildStateTab("Lighting", g_stateLightingRows, g_stateLightingRowsSize);
buildStateTab("Texture", g_stateTextureRows, g_stateTextureRowsSize);
buildStateTab("Settings", g_stateSettingsRows, g_stateSettingsRowsSize);
ImGui::EndTabBar();
}
ImGui::End();