Devtools improvements I (#1392)

* devtools: fix showing entire depth instead of bits

* devtools: show button for stage instead of menu bar

- fix batch view dockspace not rendering when window collapsed

* devtools: removed useless "Batch" collapse & don't collapse last batch

* devtools: refactor DrawRow to templating

* devtools: reg popup size adjusted to the content

* devtools: better window names

* devtools: regview layout compacted

* devtools: option to show collapsed frame dump

keep most popups open when selection changes
best popup windows positioning

* devtools: show compute shader regs

* devtools: tips popup
This commit is contained in:
Vinicius Rangel 2024-10-16 07:12:46 -03:00 committed by GitHub
parent 877cda9b9a
commit 25de4d6b65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 474 additions and 203 deletions

View file

@ -31,6 +31,12 @@ static float debug_popup_timing = 3.0f;
static bool just_opened_options = false;
// clang-format off
static std::string help_text =
#include "help.txt"
;
// clang-format on
void L::DrawMenuBar() {
const auto& ctx = *GImGui;
const auto& io = ctx.IO;
@ -38,6 +44,7 @@ void L::DrawMenuBar() {
auto isSystemPaused = DebugState.IsGuestThreadsPaused();
bool open_popup_options = false;
bool open_popup_help = false;
if (BeginMainMenuBar()) {
if (BeginMenu("Options")) {
@ -60,6 +67,7 @@ void L::DrawMenuBar() {
ImGui::EndMenu();
}
open_popup_options = MenuItem("Options");
open_popup_help = MenuItem("Help & Tips");
ImGui::EndMenu();
}
EndMainMenuBar();
@ -84,6 +92,9 @@ void L::DrawMenuBar() {
OpenPopup("GPU Tools Options");
just_opened_options = true;
}
if (open_popup_help) {
OpenPopup("HelpTips");
}
}
void L::DrawAdvanced() {
@ -154,25 +165,49 @@ void L::DrawAdvanced() {
if (BeginPopupModal("GPU Tools Options", &close_popup_options,
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings)) {
static char disassembly_cli[512];
static bool frame_dump_render_on_collapse;
if (just_opened_options) {
just_opened_options = false;
auto s = Options.disassembly_cli.copy(disassembly_cli, sizeof(disassembly_cli) - 1);
disassembly_cli[s] = '\0';
frame_dump_render_on_collapse = Options.frame_dump_render_on_collapse;
}
InputText("Shader disassembler: ", disassembly_cli, sizeof(disassembly_cli));
if (IsItemHovered()) {
SetTooltip(R"(Command to disassemble shaders. Example "dis.exe" --raw "{src}")");
}
Checkbox("Show frame dump popups even when collapsed", &frame_dump_render_on_collapse);
if (IsItemHovered()) {
SetTooltip("When a frame dump is collapsed, it will keep\n"
"showing all opened popups related to it");
}
if (Button("Save")) {
Options.disassembly_cli = disassembly_cli;
Options.frame_dump_render_on_collapse = frame_dump_render_on_collapse;
SaveIniSettingsToDisk(io.IniFilename);
CloseCurrentPopup();
}
EndPopup();
}
if (BeginPopup("HelpTips", ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove)) {
CentralizeWindow();
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{10.0f});
PushTextWrapPos(600.0f);
const char* begin = help_text.data();
TextUnformatted(begin, begin + help_text.size());
PopTextWrapPos();
PopStyleVar();
EndPopup();
}
}
void L::DrawSimple() {