From 4cb302c8aeb86bdb7c7bd6f9e5d716e140868075 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Wed, 27 May 2015 16:20:46 +0200 Subject: citra-qt: Improve shader debugger. Now supports dumping the current shader and recognizes a larger number of output semantics. --- src/citra_qt/debugger/graphics_vertex_shader.cpp | 21 ++++++++++++++++++--- src/citra_qt/debugger/graphics_vertex_shader.h | 2 ++ 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index b7882741d..92d3a8323 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include "video_core/shader/shader_interpreter.h" @@ -253,18 +255,27 @@ void GraphicsVertexShaderModel::OnUpdate() info.Clear(); - for (auto instr : Pica::g_state.vs.program_code) + auto& shader_setup = Pica::g_state.vs; + for (auto instr : shader_setup.program_code) info.code.push_back({instr}); - for (auto pattern : Pica::g_state.vs.swizzle_data) + for (auto pattern : shader_setup.swizzle_data) info.swizzle_info.push_back({pattern}); - info.labels.insert({ Pica::g_state.regs.vs.main_offset, "main" }); + u32 entry_point = Pica::g_state.regs.vs.main_offset; + info.labels.insert({ entry_point, "main" }); endResetModel(); } +void GraphicsVertexShaderModel::DumpShader() { + auto& setup = Pica::g_state.vs; + auto& config = Pica::g_state.regs.vs; + Pica::DebugUtils::DumpShader(setup.program_code.data(), setup.program_code.size(), + setup.swizzle_data.data(), setup.swizzle_data.size(), + config.main_offset, Pica::g_state.regs.vs_output_attributes); +} GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(std::shared_ptr< Pica::DebugContext > debug_context, QWidget* parent) : BreakPointObserverDock(debug_context, "Pica Vertex Shader", parent) { @@ -276,6 +287,9 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(std::shared_ptr< Pica::De binary_list->setRootIsDecorated(false); binary_list->setAlternatingRowColors(true); + auto dump_shader = new QPushButton(tr("Dump")); + + connect(dump_shader, SIGNAL(clicked()), binary_model, SLOT(DumpShader())); connect(this, SIGNAL(Update()), binary_model, SLOT(OnUpdate())); auto main_widget = new QWidget; @@ -285,6 +299,7 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(std::shared_ptr< Pica::De sub_layout->addWidget(binary_list); main_layout->addLayout(sub_layout); } + main_layout->addWidget(dump_shader); main_widget->setLayout(main_layout); setWidget(main_widget); } diff --git a/src/citra_qt/debugger/graphics_vertex_shader.h b/src/citra_qt/debugger/graphics_vertex_shader.h index 38339dc05..5dc9e3703 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.h +++ b/src/citra_qt/debugger/graphics_vertex_shader.h @@ -26,6 +26,8 @@ public: public slots: void OnUpdate(); + void DumpShader(); + private: nihstro::ShaderInfo info; }; -- cgit v1.2.3