summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/graphics.cpp
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-09-21 11:29:48 -0700
committerGravatar GitHub2016-09-21 11:29:48 -0700
commitd5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch)
tree8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/citra_qt/debugger/graphics.cpp
parentREADME: Specify master branch for Travis CI badge (diff)
parentFix Travis clang-format check (diff)
downloadyuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz
yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz
yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/citra_qt/debugger/graphics.cpp')
-rw-r--r--src/citra_qt/debugger/graphics.cpp62
1 files changed, 27 insertions, 35 deletions
diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp
index eccd619ba..ef6712bfa 100644
--- a/src/citra_qt/debugger/graphics.cpp
+++ b/src/citra_qt/debugger/graphics.cpp
@@ -3,75 +3,67 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QListView> 5#include <QListView>
6
7#include "citra_qt/debugger/graphics.h" 6#include "citra_qt/debugger/graphics.h"
8#include "citra_qt/util/util.h" 7#include "citra_qt/util/util.h"
9 8
10extern GraphicsDebugger g_debugger; 9extern GraphicsDebugger g_debugger;
11 10
12GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent) : QAbstractListModel(parent), command_count(0) 11GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent)
13{ 12 : QAbstractListModel(parent), command_count(0) {
14 connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int))); 13 connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int)));
15} 14}
16 15
17int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const 16int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const {
18{
19 return command_count; 17 return command_count;
20} 18}
21 19
22QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const 20QVariant GPUCommandStreamItemModel::data(const QModelIndex& index, int role) const {
23{
24 if (!index.isValid()) 21 if (!index.isValid())
25 return QVariant(); 22 return QVariant();
26 23
27 int command_index = index.row(); 24 int command_index = index.row();
28 const GSP_GPU::Command& command = GetDebugger()->ReadGXCommandHistory(command_index); 25 const GSP_GPU::Command& command = GetDebugger()->ReadGXCommandHistory(command_index);
29 if (role == Qt::DisplayRole) 26 if (role == Qt::DisplayRole) {
30 {
31 std::map<GSP_GPU::CommandId, const char*> command_names = { 27 std::map<GSP_GPU::CommandId, const char*> command_names = {
32 { GSP_GPU::CommandId::REQUEST_DMA, "REQUEST_DMA" }, 28 {GSP_GPU::CommandId::REQUEST_DMA, "REQUEST_DMA"},
33 { GSP_GPU::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST" }, 29 {GSP_GPU::CommandId::SUBMIT_GPU_CMDLIST, "SUBMIT_GPU_CMDLIST"},
34 { GSP_GPU::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL" }, 30 {GSP_GPU::CommandId::SET_MEMORY_FILL, "SET_MEMORY_FILL"},
35 { GSP_GPU::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER" }, 31 {GSP_GPU::CommandId::SET_DISPLAY_TRANSFER, "SET_DISPLAY_TRANSFER"},
36 { GSP_GPU::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY" }, 32 {GSP_GPU::CommandId::SET_TEXTURE_COPY, "SET_TEXTURE_COPY"},
37 { GSP_GPU::CommandId::CACHE_FLUSH, "CACHE_FLUSH" }, 33 {GSP_GPU::CommandId::CACHE_FLUSH, "CACHE_FLUSH"},
38 }; 34 };
39 const u32* command_data = reinterpret_cast<const u32*>(&command); 35 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]) 36 QString str = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9")
41 .arg(command_data[0], 8, 16, QLatin1Char('0')) 37 .arg(command_names[command.id])
42 .arg(command_data[1], 8, 16, QLatin1Char('0')) 38 .arg(command_data[0], 8, 16, QLatin1Char('0'))
43 .arg(command_data[2], 8, 16, QLatin1Char('0')) 39 .arg(command_data[1], 8, 16, QLatin1Char('0'))
44 .arg(command_data[3], 8, 16, QLatin1Char('0')) 40 .arg(command_data[2], 8, 16, QLatin1Char('0'))
45 .arg(command_data[4], 8, 16, QLatin1Char('0')) 41 .arg(command_data[3], 8, 16, QLatin1Char('0'))
46 .arg(command_data[5], 8, 16, QLatin1Char('0')) 42 .arg(command_data[4], 8, 16, QLatin1Char('0'))
47 .arg(command_data[6], 8, 16, QLatin1Char('0')) 43 .arg(command_data[5], 8, 16, QLatin1Char('0'))
48 .arg(command_data[7], 8, 16, QLatin1Char('0')); 44 .arg(command_data[6], 8, 16, QLatin1Char('0'))
45 .arg(command_data[7], 8, 16, QLatin1Char('0'));
49 return QVariant(str); 46 return QVariant(str);
50 } 47 } else {
51 else
52 {
53 return QVariant(); 48 return QVariant();
54 } 49 }
55} 50}
56 51
57void GPUCommandStreamItemModel::GXCommandProcessed(int total_command_count) 52void GPUCommandStreamItemModel::GXCommandProcessed(int total_command_count) {
58{
59 emit GXCommandFinished(total_command_count); 53 emit GXCommandFinished(total_command_count);
60} 54}
61 55
62void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_count) 56void GPUCommandStreamItemModel::OnGXCommandFinishedInternal(int total_command_count) {
63{
64 if (total_command_count == 0) 57 if (total_command_count == 0)
65 return; 58 return;
66 59
67 int prev_command_count = command_count; 60 int prev_command_count = command_count;
68 command_count = total_command_count; 61 command_count = total_command_count;
69 emit dataChanged(index(prev_command_count,0), index(total_command_count-1,0)); 62 emit dataChanged(index(prev_command_count, 0), index(total_command_count - 1, 0));
70} 63}
71 64
72 65GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent)
73GPUCommandStreamWidget::GPUCommandStreamWidget(QWidget* parent) : QDockWidget(tr("Graphics Debugger"), parent) 66 : QDockWidget(tr("Graphics Debugger"), parent) {
74{
75 setObjectName("GraphicsDebugger"); 67 setObjectName("GraphicsDebugger");
76 68
77 GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this); 69 GPUCommandStreamItemModel* command_model = new GPUCommandStreamItemModel(this);