diff options
| author | 2014-05-18 17:52:22 +0200 | |
|---|---|---|
| committer | 2014-06-12 06:10:52 -0400 | |
| commit | 6893732348c3689b094c2e9749f8eb9e877028b8 (patch) | |
| tree | 915e207f2607b85d5a65c9cf08d3cdc360b0adbe | |
| parent | GPU debugger: Add functionality to inspect command lists. (diff) | |
| download | yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.gz yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.xz yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.zip | |
citra-qt: Add command list view.
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/citra_qt/citra_qt.vcxproj | 2 | ||||
| -rw-r--r-- | src/citra_qt/citra_qt.vcxproj.filters | 6 | ||||
| -rw-r--r-- | src/citra_qt/debugger/graphics_cmdlists.cpp | 65 | ||||
| -rw-r--r-- | src/citra_qt/debugger/graphics_cmdlists.hxx | 44 | ||||
| -rw-r--r-- | src/citra_qt/main.cpp | 6 | ||||
| -rw-r--r-- | src/citra_qt/main.hxx | 2 | ||||
| -rw-r--r-- | src/video_core/gpu_debugger.h | 4 |
8 files changed, 129 insertions, 2 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 1968e34d3..7f880df8b 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -3,6 +3,7 @@ set(SRCS | |||
| 3 | debugger/callstack.cpp | 3 | debugger/callstack.cpp |
| 4 | debugger/disassembler.cpp | 4 | debugger/disassembler.cpp |
| 5 | debugger/graphics.cpp | 5 | debugger/graphics.cpp |
| 6 | debugger/graphics_cmdlists.cpp | ||
| 6 | debugger/ramview.cpp | 7 | debugger/ramview.cpp |
| 7 | debugger/registers.cpp | 8 | debugger/registers.cpp |
| 8 | hotkeys.cpp | 9 | hotkeys.cpp |
| @@ -40,6 +41,7 @@ qt4_wrap_cpp(MOC_SRCS | |||
| 40 | debugger/callstack.hxx | 41 | debugger/callstack.hxx |
| 41 | debugger/disassembler.hxx | 42 | debugger/disassembler.hxx |
| 42 | debugger/graphics.hxx | 43 | debugger/graphics.hxx |
| 44 | debugger/graphics_cmdlists.hxx | ||
| 43 | debugger/registers.hxx | 45 | debugger/registers.hxx |
| 44 | debugger/ramview.hxx | 46 | debugger/ramview.hxx |
| 45 | hotkeys.hxx | 47 | hotkeys.hxx |
diff --git a/src/citra_qt/citra_qt.vcxproj b/src/citra_qt/citra_qt.vcxproj index a1b24f676..c99c8eeee 100644 --- a/src/citra_qt/citra_qt.vcxproj +++ b/src/citra_qt/citra_qt.vcxproj | |||
| @@ -131,6 +131,7 @@ | |||
| 131 | <ClCompile Include="config\controller_config_util.cpp" /> | 131 | <ClCompile Include="config\controller_config_util.cpp" /> |
| 132 | <ClCompile Include="debugger\callstack.cpp" /> | 132 | <ClCompile Include="debugger\callstack.cpp" /> |
| 133 | <ClCompile Include="debugger\graphics.cpp" /> | 133 | <ClCompile Include="debugger\graphics.cpp" /> |
| 134 | <ClCompile Include="debugger\graphics_cmdlists.cpp" /> | ||
| 134 | <ClCompile Include="debugger\registers.cpp" /> | 135 | <ClCompile Include="debugger\registers.cpp" /> |
| 135 | <ClCompile Include="debugger\disassembler.cpp" /> | 136 | <ClCompile Include="debugger\disassembler.cpp" /> |
| 136 | <ClCompile Include="debugger\ramview.cpp" /> | 137 | <ClCompile Include="debugger\ramview.cpp" /> |
| @@ -146,6 +147,7 @@ | |||
| 146 | <MOC Include="debugger\callstack.hxx" /> | 147 | <MOC Include="debugger\callstack.hxx" /> |
| 147 | <MOC Include="debugger\disassembler.hxx" /> | 148 | <MOC Include="debugger\disassembler.hxx" /> |
| 148 | <MOC Include="debugger\graphics.hxx" /> | 149 | <MOC Include="debugger\graphics.hxx" /> |
| 150 | <MOC Include="debugger\graphics_cmdlists.hxx" /> | ||
| 149 | <MOC Include="debugger\ramview.hxx" /> | 151 | <MOC Include="debugger\ramview.hxx" /> |
| 150 | <MOC Include="debugger\registers.hxx" /> | 152 | <MOC Include="debugger\registers.hxx" /> |
| 151 | <MOC Include="bootmanager.hxx" /> | 153 | <MOC Include="bootmanager.hxx" /> |
diff --git a/src/citra_qt/citra_qt.vcxproj.filters b/src/citra_qt/citra_qt.vcxproj.filters index faa4d9f52..903082c3c 100644 --- a/src/citra_qt/citra_qt.vcxproj.filters +++ b/src/citra_qt/citra_qt.vcxproj.filters | |||
| @@ -42,6 +42,9 @@ | |||
| 42 | <ClCompile Include="debugger\graphics.cpp"> | 42 | <ClCompile Include="debugger\graphics.cpp"> |
| 43 | <Filter>debugger</Filter> | 43 | <Filter>debugger</Filter> |
| 44 | </ClCompile> | 44 | </ClCompile> |
| 45 | <ClCompile Include="debugger\graphics_cmdlists.cpp"> | ||
| 46 | <Filter>debugger</Filter> | ||
| 47 | </ClCompile> | ||
| 45 | <ClCompile Include="debugger\ramview.cpp"> | 48 | <ClCompile Include="debugger\ramview.cpp"> |
| 46 | <Filter>debugger</Filter> | 49 | <Filter>debugger</Filter> |
| 47 | </ClCompile> | 50 | </ClCompile> |
| @@ -74,6 +77,9 @@ | |||
| 74 | <MOC Include="debugger\graphics.hxx"> | 77 | <MOC Include="debugger\graphics.hxx"> |
| 75 | <Filter>debugger</Filter> | 78 | <Filter>debugger</Filter> |
| 76 | </MOC> | 79 | </MOC> |
| 80 | <MOC Include="debugger\graphics_cmdlists.hxx"> | ||
| 81 | <Filter>debugger</Filter> | ||
| 82 | </MOC> | ||
| 77 | <MOC Include="debugger\ramview.hxx"> | 83 | <MOC Include="debugger\ramview.hxx"> |
| 78 | <Filter>debugger</Filter> | 84 | <Filter>debugger</Filter> |
| 79 | </MOC> | 85 | </MOC> |
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp new file mode 100644 index 000000000..576882e8a --- /dev/null +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "graphics_cmdlists.hxx" | ||
| 6 | #include <QListView> | ||
| 7 | |||
| 8 | extern GraphicsDebugger g_debugger; | ||
| 9 | |||
| 10 | GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent), row_count(0) | ||
| 11 | { | ||
| 12 | connect(this, SIGNAL(CommandListCalled()), this, SLOT(OnCommandListCalledInternal()), Qt::UniqueConnection); | ||
| 13 | } | ||
| 14 | |||
| 15 | int GPUCommandListModel::rowCount(const QModelIndex& parent) const | ||
| 16 | { | ||
| 17 | return row_count; | ||
| 18 | } | ||
| 19 | |||
| 20 | QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const | ||
| 21 | { | ||
| 22 | if (!index.isValid()) | ||
| 23 | return QVariant(); | ||
| 24 | |||
| 25 | int idx = index.row(); | ||
| 26 | if (role == Qt::DisplayRole) | ||
| 27 | { | ||
| 28 | QString content; | ||
| 29 | const GraphicsDebugger::PicaCommandList& cmdlist = command_list[idx].second; | ||
| 30 | for (int i = 0; i < cmdlist.size(); ++i) | ||
| 31 | { | ||
| 32 | const GraphicsDebugger::PicaCommand& cmd = cmdlist[i]; | ||
| 33 | for (int j = 0; j < cmd.size(); ++j) | ||
| 34 | content.append(QString("%1 ").arg(cmd[j], 8, 16, QLatin1Char('0'))); | ||
| 35 | } | ||
| 36 | return QVariant(content); | ||
| 37 | } | ||
| 38 | return QVariant(); | ||
| 39 | } | ||
| 40 | |||
| 41 | void GPUCommandListModel::OnCommandListCalled(const GraphicsDebugger::PicaCommandList& lst, bool is_new) | ||
| 42 | { | ||
| 43 | emit CommandListCalled(); | ||
| 44 | } | ||
| 45 | |||
| 46 | |||
| 47 | void GPUCommandListModel::OnCommandListCalledInternal() | ||
| 48 | { | ||
| 49 | beginResetModel(); | ||
| 50 | |||
| 51 | command_list = GetDebugger()->GetCommandLists(); | ||
| 52 | row_count = command_list.size(); | ||
| 53 | |||
| 54 | endResetModel(); | ||
| 55 | } | ||
| 56 | |||
| 57 | GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent) | ||
| 58 | { | ||
| 59 | GPUCommandListModel* model = new GPUCommandListModel(this); | ||
| 60 | g_debugger.RegisterObserver(model); | ||
| 61 | |||
| 62 | QListView* list_widget = new QListView; | ||
| 63 | list_widget->setModel(model); | ||
| 64 | setWidget(list_widget); | ||
| 65 | } | ||
diff --git a/src/citra_qt/debugger/graphics_cmdlists.hxx b/src/citra_qt/debugger/graphics_cmdlists.hxx new file mode 100644 index 000000000..bac23c643 --- /dev/null +++ b/src/citra_qt/debugger/graphics_cmdlists.hxx | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <QAbstractListModel> | ||
| 8 | #include <QDockWidget> | ||
| 9 | |||
| 10 | #include "video_core/gpu_debugger.h" | ||
| 11 | |||
| 12 | class GPUCommandListModel : public QAbstractListModel, public GraphicsDebugger::DebuggerObserver | ||
| 13 | { | ||
| 14 | Q_OBJECT | ||
| 15 | |||
| 16 | public: | ||
| 17 | GPUCommandListModel(QObject* parent); | ||
| 18 | |||
| 19 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||
| 20 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||
| 21 | |||
| 22 | public: | ||
| 23 | void OnCommandListCalled(const GraphicsDebugger::PicaCommandList& lst, bool is_new) override; | ||
| 24 | |||
| 25 | public slots: | ||
| 26 | void OnCommandListCalledInternal(); | ||
| 27 | |||
| 28 | signals: | ||
| 29 | void CommandListCalled(); | ||
| 30 | |||
| 31 | private: | ||
| 32 | int row_count; | ||
| 33 | std::vector<std::pair<u32,GraphicsDebugger::PicaCommandList>> command_list; | ||
| 34 | }; | ||
| 35 | |||
| 36 | class GPUCommandListWidget : public QDockWidget | ||
| 37 | { | ||
| 38 | Q_OBJECT | ||
| 39 | |||
| 40 | public: | ||
| 41 | GPUCommandListWidget(QWidget* parent = 0); | ||
| 42 | |||
| 43 | private: | ||
| 44 | }; | ||
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 79367c3ed..087716c01 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include "debugger/callstack.hxx" | 20 | #include "debugger/callstack.hxx" |
| 21 | #include "debugger/ramview.hxx" | 21 | #include "debugger/ramview.hxx" |
| 22 | #include "debugger/graphics.hxx" | 22 | #include "debugger/graphics.hxx" |
| 23 | #include "debugger/graphics_cmdlists.hxx" | ||
| 23 | 24 | ||
| 24 | #include "core/system.h" | 25 | #include "core/system.h" |
| 25 | #include "core/loader.h" | 26 | #include "core/loader.h" |
| @@ -52,11 +53,16 @@ GMainWindow::GMainWindow() | |||
| 52 | addDockWidget(Qt::RightDockWidgetArea, graphicsWidget); | 53 | addDockWidget(Qt::RightDockWidgetArea, graphicsWidget); |
| 53 | callstackWidget->hide(); | 54 | callstackWidget->hide(); |
| 54 | 55 | ||
| 56 | graphicsCommandsWidget = new GPUCommandListWidget(this); | ||
| 57 | addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget); | ||
| 58 | callstackWidget->hide(); | ||
| 59 | |||
| 55 | QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); | 60 | QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); |
| 56 | debug_menu->addAction(disasmWidget->toggleViewAction()); | 61 | debug_menu->addAction(disasmWidget->toggleViewAction()); |
| 57 | debug_menu->addAction(registersWidget->toggleViewAction()); | 62 | debug_menu->addAction(registersWidget->toggleViewAction()); |
| 58 | debug_menu->addAction(callstackWidget->toggleViewAction()); | 63 | debug_menu->addAction(callstackWidget->toggleViewAction()); |
| 59 | debug_menu->addAction(graphicsWidget->toggleViewAction()); | 64 | debug_menu->addAction(graphicsWidget->toggleViewAction()); |
| 65 | debug_menu->addAction(graphicsCommandsWidget->toggleViewAction()); | ||
| 60 | 66 | ||
| 61 | // Set default UI state | 67 | // Set default UI state |
| 62 | // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half | 68 | // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half |
diff --git a/src/citra_qt/main.hxx b/src/citra_qt/main.hxx index 100bdbd00..6bcb37a30 100644 --- a/src/citra_qt/main.hxx +++ b/src/citra_qt/main.hxx | |||
| @@ -11,6 +11,7 @@ class DisassemblerWidget; | |||
| 11 | class RegistersWidget; | 11 | class RegistersWidget; |
| 12 | class CallstackWidget; | 12 | class CallstackWidget; |
| 13 | class GPUCommandStreamWidget; | 13 | class GPUCommandStreamWidget; |
| 14 | class GPUCommandListWidget; | ||
| 14 | 15 | ||
| 15 | class GMainWindow : public QMainWindow | 16 | class GMainWindow : public QMainWindow |
| 16 | { | 17 | { |
| @@ -52,6 +53,7 @@ private: | |||
| 52 | RegistersWidget* registersWidget; | 53 | RegistersWidget* registersWidget; |
| 53 | CallstackWidget* callstackWidget; | 54 | CallstackWidget* callstackWidget; |
| 54 | GPUCommandStreamWidget* graphicsWidget; | 55 | GPUCommandStreamWidget* graphicsWidget; |
| 56 | GPUCommandListWidget* graphicsCommandsWidget; | ||
| 55 | }; | 57 | }; |
| 56 | 58 | ||
| 57 | #endif // _CITRA_QT_MAIN_HXX_ | 59 | #endif // _CITRA_QT_MAIN_HXX_ |
diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index 4dafd3146..7ad595493 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h | |||
| @@ -57,7 +57,7 @@ public: | |||
| 57 | * @param is_new true if the command list was called for the first time | 57 | * @param is_new true if the command list was called for the first time |
| 58 | * @todo figure out how to make sure called functions don't keep references around beyond their life time | 58 | * @todo figure out how to make sure called functions don't keep references around beyond their life time |
| 59 | */ | 59 | */ |
| 60 | virtual void CommandListCalled(const PicaCommandList& lst, bool is_new) | 60 | virtual void OnCommandListCalled(const PicaCommandList& lst, bool is_new) |
| 61 | { | 61 | { |
| 62 | ERROR_LOG(GSP, "Command list called: %d", (int)is_new); | 62 | ERROR_LOG(GSP, "Command list called: %d", (int)is_new); |
| 63 | } | 63 | } |
| @@ -106,7 +106,7 @@ public: | |||
| 106 | command_lists.push_back(obj); | 106 | command_lists.push_back(obj); |
| 107 | 107 | ||
| 108 | ForEachObserver([&](DebuggerObserver* observer) { | 108 | ForEachObserver([&](DebuggerObserver* observer) { |
| 109 | observer->CommandListCalled(obj.second, is_new); | 109 | observer->OnCommandListCalled(obj.second, is_new); |
| 110 | } ); | 110 | } ); |
| 111 | } | 111 | } |
| 112 | 112 | ||