Devtools - Inspect regs/User data/Shader disassembly (#1358)

* devtools: pm4 - show markers

* SaveDataDialogLib: fix compile with mingw

* devtools: pm4 - show program state

* devtools: pm4 - show program disassembly

* devtools: pm4 - show frame regs

* devtools: pm4 - show color buffer info as popup

add ux improvements for open new windows with shift+click
better window titles

* imgui: skip all textures to avoid hanging with crash diagnostic enabled

not sure why this happens :c

* devtools: pm4 - show reg depth buffer
This commit is contained in:
Vinicius Rangel 2024-10-13 09:02:22 -03:00 committed by GitHub
parent 8776eba8c8
commit cf2e617f08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 4215 additions and 287 deletions

View file

@ -5,10 +5,14 @@
#include <atomic>
#include <mutex>
#include <shared_mutex>
#include <unordered_map>
#include <vector>
#include <queue>
#include "common/types.h"
#include "video_core/amdgpu/liverpool.h"
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
@ -42,10 +46,23 @@ struct QueueDump {
u32 submit_num;
u32 num2; // acb: queue_num; else: buffer_in_submit
std::vector<u32> data;
uintptr_t base_addr;
};
struct ShaderDump {
Vulkan::Liverpool::ShaderProgram user_data{};
std::vector<u32> code{};
};
struct RegDump {
static constexpr size_t MaxShaderStages = 5;
Vulkan::Liverpool::Regs regs{};
std::array<ShaderDump, MaxShaderStages> stages{};
};
struct FrameDump {
std::vector<QueueDump> queues;
std::unordered_map<uintptr_t, RegDump> regs; // address -> reg dump
};
class DebugStateImpl {
@ -61,15 +78,24 @@ class DebugStateImpl {
std::atomic_int32_t gnm_frame_count = 0;
s32 gnm_frame_dump_request_count = -1;
std::unordered_map<size_t, FrameDump*> waiting_reg_dumps;
std::unordered_map<size_t, std::string> waiting_reg_dumps_dbg;
bool waiting_submit_pause = false;
bool should_show_frame_dump = false;
std::mutex frame_dump_list_mutex;
std::shared_mutex frame_dump_list_mutex;
std::vector<FrameDump> frame_dump_list{};
std::queue<std::string> debug_message_popup;
public:
void ShowDebugMessage(std::string message) {
if (message.empty()) {
return;
}
debug_message_popup.push(std::move(message));
}
void AddCurrentThreadToGuestList();
void RemoveCurrentThreadFromGuestList();
@ -99,6 +125,11 @@ public:
return gnm_frame_dump_request_count > 0;
}
bool DumpingCurrentReg() {
std::shared_lock lock{frame_dump_list_mutex};
return !waiting_reg_dumps.empty();
}
bool ShouldPauseInSubmit() const {
return waiting_submit_pause && gnm_frame_dump_request_count == 0;
}
@ -109,17 +140,10 @@ public:
return frame_dump_list[frame_dump_list.size() - gnm_frame_dump_request_count];
}
void PushQueueDump(QueueDump dump) {
std::unique_lock lock{frame_dump_list_mutex};
GetFrameDump().queues.push_back(std::move(dump));
}
void PushQueueDump(QueueDump dump);
void ShowDebugMessage(std::string message) {
if (message.empty()) {
return;
}
debug_message_popup.push(std::move(message));
}
void PushRegsDump(uintptr_t base_addr, uintptr_t header_addr,
const AmdGpu::Liverpool::Regs& regs);
};
} // namespace DebugStateType