summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wasserka <NeoBrainX@gmail.com>2014-05-18 17:52:22 +0200
committerbunnei <ericbunnie@gmail.com>2014-06-12 12:10:52 +0200
commit6893732348c3689b094c2e9749f8eb9e877028b8 (patch)
tree915e207f2607b85d5a65c9cf08d3cdc360b0adbe
parentGPU debugger: Add functionality to inspect command lists. (diff)
downloadyuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.gz
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.bz2
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.lz
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.xz
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.zst
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.zip
-rw-r--r--src/citra_qt/CMakeLists.txt2
-rw-r--r--src/citra_qt/citra_qt.vcxproj2
-rw-r--r--src/citra_qt/citra_qt.vcxproj.filters6
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp65
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.hxx44
-rw-r--r--src/citra_qt/main.cpp6
-rw-r--r--src/citra_qt/main.hxx2
-rw-r--r--src/video_core/gpu_debugger.h4
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
debugger/callstack.cpp
debugger/disassembler.cpp
debugger/graphics.cpp
+ debugger/graphics_cmdlists.cpp
debugger/ramview.cpp
debugger/registers.cpp
hotkeys.cpp
@@ -40,6 +41,7 @@ qt4_wrap_cpp(MOC_SRCS
debugger/callstack.hxx
debugger/disassembler.hxx
debugger/graphics.hxx
+ debugger/graphics_cmdlists.hxx
debugger/registers.hxx
debugger/ramview.hxx
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 @@
<ClCompile Include="config\controller_config_util.cpp" />
<ClCompile Include="debugger\callstack.cpp" />
<ClCompile Include="debugger\graphics.cpp" />
+ <ClCompile Include="debugger\graphics_cmdlists.cpp" />
<ClCompile Include="debugger\registers.cpp" />
<ClCompile Include="debugger\disassembler.cpp" />
<ClCompile Include="debugger\ramview.cpp" />
@@ -146,6 +147,7 @@
<MOC Include="debugger\callstack.hxx" />
<MOC Include="debugger\disassembler.hxx" />
<MOC Include="debugger\graphics.hxx" />
+ <MOC Include="debugger\graphics_cmdlists.hxx" />
<MOC Include="debugger\ramview.hxx" />
<MOC Include="debugger\registers.hxx" />
<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 @@
<ClCompile Include="debugger\graphics.cpp">
<Filter>debugger</Filter>
</ClCompile>
+ <ClCompile Include="debugger\graphics_cmdlists.cpp">
+ <Filter>debugger</Filter>
+ </ClCompile>
<ClCompile Include="debugger\ramview.cpp">
<Filter>debugger</Filter>
</ClCompile>
@@ -74,6 +77,9 @@
<MOC Include="debugger\graphics.hxx">
<Filter>debugger</Filter>
</MOC>
+ <MOC Include="debugger\graphics_cmdlists.hxx">
+ <Filter>debugger</Filter>
+ </MOC>
<MOC Include="debugger\ramview.hxx">
<Filter>debugger</Filter>
</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 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include "graphics_cmdlists.hxx"
+#include <QListView>
+
+extern GraphicsDebugger g_debugger;
+
+GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent), row_count(0)
+{
+ connect(this, SIGNAL(CommandListCalled()), this, SLOT(OnCommandListCalledInternal()), Qt::UniqueConnection);
+}
+
+int GPUCommandListModel::rowCount(const QModelIndex& parent) const
+{
+ return row_count;
+}
+
+QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ int idx = index.row();
+ if (role == Qt::DisplayRole)
+ {
+ QString content;
+ const GraphicsDebugger::PicaCommandList& cmdlist = command_list[idx].second;
+ for (int i = 0; i < cmdlist.size(); ++i)
+ {
+ const GraphicsDebugger::PicaCommand& cmd = cmdlist[i];
+ for (int j = 0; j < cmd.size(); ++j)
+ content.append(QString("%1 ").arg(cmd[j], 8, 16, QLatin1Char('0')));
+ }
+ return QVariant(content);
+ }
+ return QVariant();
+}
+
+void GPUCommandListModel::OnCommandListCalled(const GraphicsDebugger::PicaCommandList& lst, bool is_new)
+{
+ emit CommandListCalled();
+}
+
+
+void GPUCommandListModel::OnCommandListCalledInternal()
+{
+ beginResetModel();
+
+ command_list = GetDebugger()->GetCommandLists();
+ row_count = command_list.size();
+
+ endResetModel();
+}
+
+GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent)
+{
+ GPUCommandListModel* model = new GPUCommandListModel(this);
+ g_debugger.RegisterObserver(model);
+
+ QListView* list_widget = new QListView;
+ list_widget->setModel(model);
+ setWidget(list_widget);
+}
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 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <QAbstractListModel>
+#include <QDockWidget>
+
+#include "video_core/gpu_debugger.h"
+
+class GPUCommandListModel : public QAbstractListModel, public GraphicsDebugger::DebuggerObserver
+{
+ Q_OBJECT
+
+public:
+ GPUCommandListModel(QObject* parent);
+
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+
+public:
+ void OnCommandListCalled(const GraphicsDebugger::PicaCommandList& lst, bool is_new) override;
+
+public slots:
+ void OnCommandListCalledInternal();
+
+signals:
+ void CommandListCalled();
+
+private:
+ int row_count;
+ std::vector<std::pair<u32,GraphicsDebugger::PicaCommandList>> command_list;
+};
+
+class GPUCommandListWidget : public QDockWidget
+{
+ Q_OBJECT
+
+public:
+ GPUCommandListWidget(QWidget* parent = 0);
+
+private:
+};
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 @@
#include "debugger/callstack.hxx"
#include "debugger/ramview.hxx"
#include "debugger/graphics.hxx"
+#include "debugger/graphics_cmdlists.hxx"
#include "core/system.h"
#include "core/loader.h"
@@ -52,11 +53,16 @@ GMainWindow::GMainWindow()
addDockWidget(Qt::RightDockWidgetArea, graphicsWidget);
callstackWidget->hide();
+ graphicsCommandsWidget = new GPUCommandListWidget(this);
+ addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
+ callstackWidget->hide();
+
QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
debug_menu->addAction(disasmWidget->toggleViewAction());
debug_menu->addAction(registersWidget->toggleViewAction());
debug_menu->addAction(callstackWidget->toggleViewAction());
debug_menu->addAction(graphicsWidget->toggleViewAction());
+ debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
// Set default UI state
// 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;
class RegistersWidget;
class CallstackWidget;
class GPUCommandStreamWidget;
+class GPUCommandListWidget;
class GMainWindow : public QMainWindow
{
@@ -52,6 +53,7 @@ private:
RegistersWidget* registersWidget;
CallstackWidget* callstackWidget;
GPUCommandStreamWidget* graphicsWidget;
+ GPUCommandListWidget* graphicsCommandsWidget;
};
#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:
* @param is_new true if the command list was called for the first time
* @todo figure out how to make sure called functions don't keep references around beyond their life time
*/
- virtual void CommandListCalled(const PicaCommandList& lst, bool is_new)
+ virtual void OnCommandListCalled(const PicaCommandList& lst, bool is_new)
{
ERROR_LOG(GSP, "Command list called: %d", (int)is_new);
}
@@ -106,7 +106,7 @@ public:
command_lists.push_back(obj);
ForEachObserver([&](DebuggerObserver* observer) {
- observer->CommandListCalled(obj.second, is_new);
+ observer->OnCommandListCalled(obj.second, is_new);
} );
}