summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/debugger/graphics.cpp')
-rw-r--r--src/citra_qt/debugger/graphics.cpp61
1 files changed, 27 insertions, 34 deletions
diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp
index eccd619ba..b79c063db 100644
--- a/src/citra_qt/debugger/graphics.cpp
+++ b/src/citra_qt/debugger/graphics.cpp
@@ -9,69 +9,62 @@
9 9
10extern GraphicsDebugger g_debugger; 10extern GraphicsDebugger g_debugger;
11 11
12GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent) : QAbstractListModel(parent), command_count(0) 12GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent)
13{ 13 : QAbstractListModel(parent), command_count(0) {
14 connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int))); 14 connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int)));
15} 15}
16 16
17int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const 17int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const {
18{
19 return command_count; 18 return command_count;
20} 19}
21 20
22QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const 21QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const {
23{
24 if (!index.isValid()) 22 if (!index.isValid())
25 return QVariant(); 23 return QVariant();
26 24
27 int command_index = index.row(); 25 int command_index = index.row();
28 const GSP_GPU::Command& command = GetDebugger()->ReadGXCommandHistory(command_index); 26 const GSP_GPU::Command& command = GetDebugger()->ReadGXCommandHistory(command_index);
29 if (role == Qt::DisplayRole) 27 if (role == Qt::DisplayRole) {
30 {
31 std::map<GSP_GPU::CommandId, const char*> command_names = { 28 std::map<GSP_GPU::CommandId, const char*> command_names = {
32 { GSP_GPU::CommandId::REQUEST_DMA, "REQUEST_DMA" }, 29 {GSP_GPU::CommandId::REQUEST_DMA, "REQUEST_DMA"},
33 { GSP_GPU::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST" }, 30 {GSP_GPU::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST"},
34 { GSP_GPU::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL" }, 31 {GSP_GPU::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL"},
35 { GSP_GPU::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER" }, 32 {GSP_GPU::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER"},
36 { GSP_GPU::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY" }, 33 {GSP_GPU::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY"},
37 { GSP_GPU::CommandId::CACHE_FLUSH, "CACHE_FLUSH" }, 34 {GSP_GPU::CommandId::CACHE_FLUSH, "CACHE_FLUSH"},
38 }; 35 };
39 const u32* command_data = reinterpret_cast<const u32*>(&command); 36 const u32* command_data = reinterpret_cast<const u32*>(&command);
40 QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9").arg(command_names[command.id]) 37 QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9")
41 .arg(command_data[0], 8, 16, QLatin1Char('0')) 38 .arg(command_names[command.id])
42 .arg(command_data[1], 8, 16, QLatin1Char('0')) 39 .arg(command_data[0], 8, 16, QLatin1Char('0'))
43 .arg(command_data[2], 8, 16, QLatin1Char('0')) 40 .arg(command_data[1], 8, 16, QLatin1Char('0'))
44 .arg(command_data[3], 8, 16, QLatin1Char('0')) 41 .arg(command_data[2], 8, 16, QLatin1Char('0'))
45 .arg(command_data[4], 8, 16, QLatin1Char('0')) 42 .arg(command_data[3], 8, 16, QLatin1Char('0'))
46 .arg(command_data[5], 8, 16, QLatin1Char('0')) 43 .arg(command_data[4], 8, 16, QLatin1Char('0'))
47 .arg(command_data[6], 8, 16, QLatin1Char('0')) 44 .arg(command_data[5], 8, 16, QLatin1Char('0'))
48 .arg(command_data[7], 8, 16, QLatin1Char('0')); 45 .arg(command_data[6], 8, 16, QLatin1Char('0'))
46 .arg(command_data[7], 8, 16, QLatin1Char('0'));
49 return QVariant(str); 47 return QVariant(str);
50 } 48 } else {
51 else
52 {
53 return QVariant(); 49 return QVariant();
54 } 50 }
55} 51}
56 52
57void GPUCommandStreamItemModel::GXCommandProcessed(int total_command_count) 53void GPUCommandStreamItemModel::GXCommandProcessed(int total_command_count) {
58{
59 emit GXCommandFinished(total_command_count); 54 emit GXCommandFinished(total_command_count);
60} 55}
61 56
62void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_count) 57void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_count) {
63{
64 if (total_command_count == 0) 58 if (total_command_count == 0)
65 return; 59 return;
66 60
67 int prev_command_count = command_count; 61 int prev_command_count = command_count;
68 command_count = total_command_count; 62 command_count = total_command_count;
69 emit dataChanged(index(prev_command_count,0), index(total_command_count-1,0)); 63 emit dataChanged(index(prev_command_count, 0), index(total_command_count - 1, 0));
70} 64}
71 65
72 66GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent)
73GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent) : QDockWidget(tr("Graphics Debugger"), parent) 67 : QDockWidget(tr("Graphics Debugger"), parent) {
74{
75 setObjectName("GraphicsDebugger"); 68 setObjectName("GraphicsDebugger");
76 69
77 GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this); 70 GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this);