summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/graphics_cmdlists.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/debugger/graphics_cmdlists.cpp')
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp125
1 files changed, 4 insertions, 121 deletions
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp
index 5186d2b44..3e0a0a145 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics_cmdlists.cpp
@@ -50,123 +50,6 @@ public:
50 } 50 }
51}; 51};
52 52
53TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo& info, QWidget* parent)
54 : QDockWidget(tr("Texture 0x%1").arg(info.physical_address, 8, 16, QLatin1Char('0'))),
55 info(info) {
56
57 QWidget* main_widget = new QWidget;
58
59 QLabel* image_widget = new QLabel;
60
61 connect(this, SIGNAL(UpdatePixmap(const QPixmap&)), image_widget, SLOT(setPixmap(const QPixmap&)));
62
63 CSpinBox* phys_address_spinbox = new CSpinBox;
64 phys_address_spinbox->SetBase(16);
65 phys_address_spinbox->SetRange(0, 0xFFFFFFFF);
66 phys_address_spinbox->SetPrefix("0x");
67 phys_address_spinbox->SetValue(info.physical_address);
68 connect(phys_address_spinbox, SIGNAL(ValueChanged(qint64)), this, SLOT(OnAddressChanged(qint64)));
69
70 QComboBox* format_choice = new QComboBox;
71 format_choice->addItem(tr("RGBA8"));
72 format_choice->addItem(tr("RGB8"));
73 format_choice->addItem(tr("RGB5A1"));
74 format_choice->addItem(tr("RGB565"));
75 format_choice->addItem(tr("RGBA4"));
76 format_choice->addItem(tr("IA8"));
77 format_choice->addItem(tr("RG8"));
78 format_choice->addItem(tr("I8"));
79 format_choice->addItem(tr("A8"));
80 format_choice->addItem(tr("IA4"));
81 format_choice->addItem(tr("I4"));
82 format_choice->addItem(tr("A4"));
83 format_choice->addItem(tr("ETC1"));
84 format_choice->addItem(tr("ETC1A4"));
85 format_choice->setCurrentIndex(static_cast<int>(info.format));
86 connect(format_choice, SIGNAL(currentIndexChanged(int)), this, SLOT(OnFormatChanged(int)));
87
88 QSpinBox* width_spinbox = new QSpinBox;
89 width_spinbox->setMaximum(65535);
90 width_spinbox->setValue(info.width);
91 connect(width_spinbox, SIGNAL(valueChanged(int)), this, SLOT(OnWidthChanged(int)));
92
93 QSpinBox* height_spinbox = new QSpinBox;
94 height_spinbox->setMaximum(65535);
95 height_spinbox->setValue(info.height);
96 connect(height_spinbox, SIGNAL(valueChanged(int)), this, SLOT(OnHeightChanged(int)));
97
98 QSpinBox* stride_spinbox = new QSpinBox;
99 stride_spinbox->setMaximum(65535 * 4);
100 stride_spinbox->setValue(info.stride);
101 connect(stride_spinbox, SIGNAL(valueChanged(int)), this, SLOT(OnStrideChanged(int)));
102
103 QVBoxLayout* main_layout = new QVBoxLayout;
104 main_layout->addWidget(image_widget);
105
106 {
107 QHBoxLayout* sub_layout = new QHBoxLayout;
108 sub_layout->addWidget(new QLabel(tr("Source Address:")));
109 sub_layout->addWidget(phys_address_spinbox);
110 main_layout->addLayout(sub_layout);
111 }
112
113 {
114 QHBoxLayout* sub_layout = new QHBoxLayout;
115 sub_layout->addWidget(new QLabel(tr("Format")));
116 sub_layout->addWidget(format_choice);
117 main_layout->addLayout(sub_layout);
118 }
119
120 {
121 QHBoxLayout* sub_layout = new QHBoxLayout;
122 sub_layout->addWidget(new QLabel(tr("Width:")));
123 sub_layout->addWidget(width_spinbox);
124 sub_layout->addStretch();
125 sub_layout->addWidget(new QLabel(tr("Height:")));
126 sub_layout->addWidget(height_spinbox);
127 sub_layout->addStretch();
128 sub_layout->addWidget(new QLabel(tr("Stride:")));
129 sub_layout->addWidget(stride_spinbox);
130 main_layout->addLayout(sub_layout);
131 }
132
133 main_widget->setLayout(main_layout);
134
135 emit UpdatePixmap(ReloadPixmap());
136
137 setWidget(main_widget);
138}
139
140void TextureInfoDockWidget::OnAddressChanged(qint64 value) {
141 info.physical_address = value;
142 emit UpdatePixmap(ReloadPixmap());
143}
144
145void TextureInfoDockWidget::OnFormatChanged(int value) {
146 info.format = static_cast<Pica::Regs::TextureFormat>(value);
147 emit UpdatePixmap(ReloadPixmap());
148}
149
150void TextureInfoDockWidget::OnWidthChanged(int value) {
151 info.width = value;
152 emit UpdatePixmap(ReloadPixmap());
153}
154
155void TextureInfoDockWidget::OnHeightChanged(int value) {
156 info.height = value;
157 emit UpdatePixmap(ReloadPixmap());
158}
159
160void TextureInfoDockWidget::OnStrideChanged(int value) {
161 info.stride = value;
162 emit UpdatePixmap(ReloadPixmap());
163}
164
165QPixmap TextureInfoDockWidget::ReloadPixmap() const {
166 u8* src = Memory::GetPhysicalPointer(info.physical_address);
167 return QPixmap::fromImage(LoadTexture(src, info));
168}
169
170GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) { 53GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {
171 54
172} 55}
@@ -249,16 +132,16 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
249 index = 0; 132 index = 0;
250 } else if (COMMAND_IN_RANGE(command_id, texture1)) { 133 } else if (COMMAND_IN_RANGE(command_id, texture1)) {
251 index = 1; 134 index = 1;
252 } else { 135 } else if (COMMAND_IN_RANGE(command_id, texture2)) {
253 index = 2; 136 index = 2;
137 } else {
138 UNREACHABLE_MSG("Unknown texture command");
254 } 139 }
255 auto config = Pica::g_state.regs.GetTextures()[index].config; 140 auto config = Pica::g_state.regs.GetTextures()[index].config;
256 auto format = Pica::g_state.regs.GetTextures()[index].format; 141 auto format = Pica::g_state.regs.GetTextures()[index].format;
257 auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); 142 auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
258 143
259 // TODO: Instead, emit a signal here to be caught by the main window widget. 144 // TODO: Open a surface debugger
260 auto main_window = static_cast<QMainWindow*>(parent());
261 main_window->tabifyDockWidget(this, new TextureInfoDockWidget(info, main_window));
262 } 145 }
263} 146}
264 147