summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/graphics_cmdlists.cpp
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-05-18 17:52:22 +0200
committerGravatar bunnei2014-06-12 06:10:52 -0400
commit6893732348c3689b094c2e9749f8eb9e877028b8 (patch)
tree915e207f2607b85d5a65c9cf08d3cdc360b0adbe /src/citra_qt/debugger/graphics_cmdlists.cpp
parentGPU debugger: Add functionality to inspect command lists. (diff)
downloadyuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.gz
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.tar.xz
yuzu-6893732348c3689b094c2e9749f8eb9e877028b8.zip
citra-qt: Add command list view.
Diffstat (limited to 'src/citra_qt/debugger/graphics_cmdlists.cpp')
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp65
1 files changed, 65 insertions, 0 deletions
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
8extern GraphicsDebugger g_debugger;
9
10GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent), row_count(0)
11{
12 connect(this, SIGNAL(CommandListCalled()), this, SLOT(OnCommandListCalledInternal()), Qt::UniqueConnection);
13}
14
15int GPUCommandListModel::rowCount(const QModelIndex& parent) const
16{
17 return row_count;
18}
19
20QVariant 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
41void GPUCommandListModel::OnCommandListCalled(const GraphicsDebugger::PicaCommandList& lst, bool is_new)
42{
43 emit CommandListCalled();
44}
45
46
47void GPUCommandListModel::OnCommandListCalledInternal()
48{
49 beginResetModel();
50
51 command_list = GetDebugger()->GetCommandLists();
52 row_count = command_list.size();
53
54 endResetModel();
55}
56
57GPUCommandListWidget::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}