mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
devtools: better window names
This commit is contained in:
parent
ca0ca4913f
commit
02f42b8e0a
@ -102,6 +102,10 @@ void DebugStateImpl::RequestFrameDump(s32 count) {
|
||||
gnm_frame_dump_request_count = count;
|
||||
frame_dump_list.clear();
|
||||
frame_dump_list.resize(count);
|
||||
const auto f = gnm_frame_count.load() + 1;
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
frame_dump_list[i].frame_id = f + i;
|
||||
}
|
||||
waiting_submit_pause = true;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ struct RegDump {
|
||||
};
|
||||
|
||||
struct FrameDump {
|
||||
u32 frame_id;
|
||||
std::vector<QueueDump> queues;
|
||||
std::unordered_map<uintptr_t, RegDump> regs; // address -> reg dump
|
||||
};
|
||||
|
@ -1310,10 +1310,10 @@ void CmdListViewer::Draw() {
|
||||
auto data = frame_dump->regs.at(batch.command_addr);
|
||||
if (GetIO().KeyShift) {
|
||||
auto& pop = extra_batch_view.emplace_back();
|
||||
pop.SetData(data, batch_id);
|
||||
pop.SetData(data, name, batch_id);
|
||||
pop.open = true;
|
||||
} else {
|
||||
batch_view.SetData(data, batch_id);
|
||||
batch_view.SetData(data, name, batch_id);
|
||||
batch_view.open = true;
|
||||
}
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ FrameDumpViewer::FrameDumpViewer(const FrameDump& _frame_dump)
|
||||
|
||||
cmd_list_viewer.reserve(frame_dump->queues.size());
|
||||
for (const auto& cmd : frame_dump->queues) {
|
||||
const auto fname =
|
||||
fmt::format("{}_{}_{:02}_{:02}", id, magic_enum::enum_name(selected_queue_type),
|
||||
selected_submit_num, selected_queue_num2);
|
||||
const auto fname = fmt::format("F{} {}_{:02}_{:02}", frame_dump->frame_id,
|
||||
magic_enum::enum_name(selected_queue_type),
|
||||
selected_submit_num, selected_queue_num2);
|
||||
cmd_list_viewer.emplace_back(frame_dump.get(), cmd.data, cmd.base_addr, fname);
|
||||
if (cmd.type == QueueType::dcb && cmd.submit_num == 0 && cmd.num2 == 0) {
|
||||
selected_cmd = static_cast<s32>(cmd_list_viewer.size() - 1);
|
||||
@ -65,7 +65,7 @@ void FrameDumpViewer::Draw() {
|
||||
}
|
||||
|
||||
char name[32];
|
||||
snprintf(name, sizeof(name), "Frame #%d dump", id);
|
||||
snprintf(name, sizeof(name), "Frame #%d dump", frame_dump->frame_id);
|
||||
if (Begin(name, &is_open, ImGuiWindowFlags_NoSavedSettings)) {
|
||||
if (IsWindowAppearing()) {
|
||||
auto window = GetCurrentWindow();
|
||||
|
@ -142,22 +142,25 @@ RegPopup::RegPopup() {
|
||||
id = unique_id++;
|
||||
}
|
||||
|
||||
void RegPopup::SetData(AmdGpu::Liverpool::ColorBuffer color_buffer, u32 batch_id, u32 cb_id) {
|
||||
void RegPopup::SetData(const std::string& base_title, AmdGpu::Liverpool::ColorBuffer color_buffer,
|
||||
u32 cb_id) {
|
||||
this->data = color_buffer;
|
||||
this->title = fmt::format("Batch #{} CB #{}###reg_popup_%d", batch_id, cb_id, id);
|
||||
this->title = fmt::format("{}/CB #{}", base_title, cb_id);
|
||||
}
|
||||
|
||||
void RegPopup::SetData(AmdGpu::Liverpool::DepthBuffer depth_buffer,
|
||||
AmdGpu::Liverpool::DepthControl depth_control, u32 batch_id) {
|
||||
void RegPopup::SetData(const std::string& base_title, AmdGpu::Liverpool::DepthBuffer depth_buffer,
|
||||
AmdGpu::Liverpool::DepthControl depth_control) {
|
||||
this->data = std::make_tuple(depth_buffer, depth_control);
|
||||
this->title = fmt::format("Batch #{} Depth###reg_popup_%d", batch_id, id);
|
||||
this->title = fmt::format("{}/Depth", base_title);
|
||||
}
|
||||
|
||||
void RegPopup::Draw(bool auto_resize) {
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name), "%s###reg_popup_%d", title.c_str(), id);
|
||||
if (Begin(title.c_str(), &open, flags)) {
|
||||
if (const auto* buffer = std::get_if<AmdGpu::Liverpool::ColorBuffer>(&data)) {
|
||||
if (auto_resize) {
|
||||
SetWindowSize({589.0f, 522.0f});
|
||||
SetWindowSize({365.0f, 520.0f});
|
||||
KeepWindowInside();
|
||||
}
|
||||
DrawColorBuffer(*buffer);
|
||||
|
@ -30,10 +30,11 @@ public:
|
||||
|
||||
RegPopup();
|
||||
|
||||
void SetData(AmdGpu::Liverpool::ColorBuffer color_buffer, u32 batch_id, u32 cb_id);
|
||||
void SetData(const std::string& base_title, AmdGpu::Liverpool::ColorBuffer color_buffer,
|
||||
u32 cb_id);
|
||||
|
||||
void SetData(AmdGpu::Liverpool::DepthBuffer depth_buffer,
|
||||
AmdGpu::Liverpool::DepthControl depth_control, u32 batch_id);
|
||||
void SetData(const std::string& base_title, AmdGpu::Liverpool::DepthBuffer depth_buffer,
|
||||
AmdGpu::Liverpool::DepthControl depth_control);
|
||||
|
||||
void Draw(bool auto_resize = false);
|
||||
};
|
||||
|
@ -111,14 +111,14 @@ void RegView::DrawRegs() {
|
||||
const auto open_new_popup = [&](int cb, auto... args) {
|
||||
if (GetIO().KeyShift) {
|
||||
auto& pop = extra_reg_popup.emplace_back();
|
||||
pop.SetData(args...);
|
||||
pop.SetData(title, args...);
|
||||
pop.open = true;
|
||||
pop.Draw(true);
|
||||
} else if (last_selected_cb == cb && default_reg_popup.open) {
|
||||
default_reg_popup.open = false;
|
||||
} else {
|
||||
last_selected_cb = cb;
|
||||
default_reg_popup.SetData(args...);
|
||||
default_reg_popup.SetData(title, args...);
|
||||
if (!default_reg_popup.open) {
|
||||
default_reg_popup.open = true;
|
||||
const auto pos = GImGui->LastItemData.Rect.Max + ImVec2(5.0f, 0.0f);
|
||||
@ -143,7 +143,7 @@ void RegView::DrawRegs() {
|
||||
} else {
|
||||
const char* text = last_selected_cb == cb && default_reg_popup.open ? "x" : "->";
|
||||
if (SmallButton(text)) {
|
||||
open_new_popup(cb, buffer, batch_id, cb);
|
||||
open_new_popup(cb, buffer, cb);
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ void RegView::DrawRegs() {
|
||||
constexpr auto depth_id = 0xF3;
|
||||
const char* text = last_selected_cb == depth_id && default_reg_popup.open ? "x" : "->";
|
||||
if (SmallButton(text)) {
|
||||
open_new_popup(depth_id, regs.depth_buffer, regs.depth_control, batch_id);
|
||||
open_new_popup(depth_id, regs.depth_buffer, regs.depth_control);
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ RegView::RegView() {
|
||||
id = unique_id++;
|
||||
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name), "BatchView###reg_dump_%d", id);
|
||||
snprintf(name, sizeof(name), "###reg_dump_%d", id);
|
||||
SetNextWindowPos({400.0f, 200.0f});
|
||||
SetNextWindowSize({450.0f, 500.0f});
|
||||
ImGuiID root_dock_id;
|
||||
@ -203,9 +203,10 @@ RegView::RegView() {
|
||||
DockBuilderFinish(root_dock_id);
|
||||
}
|
||||
|
||||
void RegView::SetData(DebugStateType::RegDump data, u32 batch_id) {
|
||||
void RegView::SetData(DebugStateType::RegDump data, const std::string& base_title, u32 batch_id) {
|
||||
this->data = std::move(data);
|
||||
this->batch_id = batch_id;
|
||||
this->title = fmt::format("{}/Batch {}", base_title, batch_id);
|
||||
// clear cache
|
||||
selected_shader = -1;
|
||||
shader_decomp.clear();
|
||||
@ -214,9 +215,9 @@ void RegView::SetData(DebugStateType::RegDump data, u32 batch_id) {
|
||||
}
|
||||
|
||||
void RegView::Draw() {
|
||||
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name), "BatchView %u###reg_dump_%d", batch_id, id);
|
||||
snprintf(name, sizeof(name), "%s###reg_dump_%d", title.c_str(), id);
|
||||
|
||||
if (Begin(name, &open, ImGuiWindowFlags_MenuBar)) {
|
||||
const char* names[] = {"vs", "ps", "gs", "es", "hs", "ls"};
|
||||
|
||||
@ -270,7 +271,7 @@ void RegView::Draw() {
|
||||
if (Begin(name, &show_user_data)) {
|
||||
auto shader = get_shader();
|
||||
if (!shader) {
|
||||
Text("Select a stage");
|
||||
Text("Stage not selected");
|
||||
} else {
|
||||
shader->hex_view.DrawContents(shader->user_data.data(), shader->user_data.size());
|
||||
}
|
||||
@ -283,7 +284,7 @@ void RegView::Draw() {
|
||||
if (Begin(name, &show_disassembly)) {
|
||||
auto shader = get_shader();
|
||||
if (!shader) {
|
||||
Text("Select a stage");
|
||||
Text("Stage not selected");
|
||||
} else {
|
||||
shader->dis_view.Render("Disassembly", GetContentRegionAvail());
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ struct ShaderCache {
|
||||
class RegView {
|
||||
int id;
|
||||
|
||||
std::string title;
|
||||
DebugStateType::RegDump data;
|
||||
u32 batch_id{~0u};
|
||||
|
||||
@ -42,7 +43,7 @@ public:
|
||||
|
||||
RegView();
|
||||
|
||||
void SetData(DebugStateType::RegDump data, u32 batch_id);
|
||||
void SetData(DebugStateType::RegDump data, const std::string& base_title, u32 batch_id);
|
||||
|
||||
void Draw();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user