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.cpp54
1 files changed, 19 insertions, 35 deletions
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp
index 4f58e9a90..ed51f97f3 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics_cmdlists.cpp
@@ -124,59 +124,49 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo
124 setWidget(main_widget); 124 setWidget(main_widget);
125} 125}
126 126
127void TextureInfoDockWidget::OnAddressChanged(qint64 value) 127void TextureInfoDockWidget::OnAddressChanged(qint64 value) {
128{
129 info.address = value; 128 info.address = value;
130 emit UpdatePixmap(ReloadPixmap()); 129 emit UpdatePixmap(ReloadPixmap());
131} 130}
132 131
133void TextureInfoDockWidget::OnFormatChanged(int value) 132void TextureInfoDockWidget::OnFormatChanged(int value) {
134{
135 info.format = static_cast<Pica::Regs::TextureFormat>(value); 133 info.format = static_cast<Pica::Regs::TextureFormat>(value);
136 emit UpdatePixmap(ReloadPixmap()); 134 emit UpdatePixmap(ReloadPixmap());
137} 135}
138 136
139void TextureInfoDockWidget::OnWidthChanged(int value) 137void TextureInfoDockWidget::OnWidthChanged(int value) {
140{
141 info.width = value; 138 info.width = value;
142 emit UpdatePixmap(ReloadPixmap()); 139 emit UpdatePixmap(ReloadPixmap());
143} 140}
144 141
145void TextureInfoDockWidget::OnHeightChanged(int value) 142void TextureInfoDockWidget::OnHeightChanged(int value) {
146{
147 info.height = value; 143 info.height = value;
148 emit UpdatePixmap(ReloadPixmap()); 144 emit UpdatePixmap(ReloadPixmap());
149} 145}
150 146
151void TextureInfoDockWidget::OnStrideChanged(int value) 147void TextureInfoDockWidget::OnStrideChanged(int value) {
152{
153 info.stride = value; 148 info.stride = value;
154 emit UpdatePixmap(ReloadPixmap()); 149 emit UpdatePixmap(ReloadPixmap());
155} 150}
156 151
157QPixmap TextureInfoDockWidget::ReloadPixmap() const 152QPixmap TextureInfoDockWidget::ReloadPixmap() const {
158{
159 u8* src = Memory::GetPointer(info.address); 153 u8* src = Memory::GetPointer(info.address);
160 return QPixmap::fromImage(LoadTexture(src, info)); 154 return QPixmap::fromImage(LoadTexture(src, info));
161} 155}
162 156
163GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) 157GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {
164{
165 158
166} 159}
167 160
168int GPUCommandListModel::rowCount(const QModelIndex& parent) const 161int GPUCommandListModel::rowCount(const QModelIndex& parent) const {
169{
170 return pica_trace.writes.size(); 162 return pica_trace.writes.size();
171} 163}
172 164
173int GPUCommandListModel::columnCount(const QModelIndex& parent) const 165int GPUCommandListModel::columnCount(const QModelIndex& parent) const {
174{
175 return 2; 166 return 2;
176} 167}
177 168
178QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const 169QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
179{
180 if (!index.isValid()) 170 if (!index.isValid())
181 return QVariant(); 171 return QVariant();
182 172
@@ -202,8 +192,7 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const
202 return QVariant(); 192 return QVariant();
203} 193}
204 194
205QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const 195QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const {
206{
207 switch(role) { 196 switch(role) {
208 case Qt::DisplayRole: 197 case Qt::DisplayRole:
209 { 198 {
@@ -220,8 +209,7 @@ QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientatio
220 return QVariant(); 209 return QVariant();
221} 210}
222 211
223void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace) 212void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace) {
224{
225 beginResetModel(); 213 beginResetModel();
226 214
227 pica_trace = trace; 215 pica_trace = trace;
@@ -233,20 +221,19 @@ void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&
233 (cmd_id >= PICA_REG_INDEX(reg_name) && \ 221 (cmd_id >= PICA_REG_INDEX(reg_name) && \
234 cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::registers.reg_name)) / 4) 222 cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::registers.reg_name)) / 4)
235 223
236void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) 224void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
237{
238
239 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); 225 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
240 if (COMMAND_IN_RANGE(command_id, texture0)) { 226 if (COMMAND_IN_RANGE(command_id, texture0)) {
241 auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0, 227 auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0,
242 Pica::registers.texture0_format); 228 Pica::registers.texture0_format);
243 QMainWindow* main_window = (QMainWindow*)parent(); 229
230 // TODO: Instead, emit a signal here to be caught by the main window widget.
231 auto main_window = static_cast<QMainWindow*>(parent());
244 main_window->tabifyDockWidget(this, new TextureInfoDockWidget(info, main_window)); 232 main_window->tabifyDockWidget(this, new TextureInfoDockWidget(info, main_window));
245 } 233 }
246} 234}
247 235
248void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) 236void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
249{
250 QWidget* new_info_widget; 237 QWidget* new_info_widget;
251 238
252 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); 239 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
@@ -266,8 +253,7 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index)
266} 253}
267#undef COMMAND_IN_RANGE 254#undef COMMAND_IN_RANGE
268 255
269GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent) 256GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent) {
270{
271 setObjectName("Pica Command List"); 257 setObjectName("Pica Command List");
272 GPUCommandListModel* model = new GPUCommandListModel(this); 258 GPUCommandListModel* model = new GPUCommandListModel(this);
273 259
@@ -283,7 +269,6 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
283 connect(list_widget, SIGNAL(doubleClicked(const QModelIndex&)), 269 connect(list_widget, SIGNAL(doubleClicked(const QModelIndex&)),
284 this, SLOT(OnCommandDoubleClicked(const QModelIndex&))); 270 this, SLOT(OnCommandDoubleClicked(const QModelIndex&)));
285 271
286
287 toggle_tracing = new QPushButton(tr("Start Tracing")); 272 toggle_tracing = new QPushButton(tr("Start Tracing"));
288 273
289 connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing())); 274 connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing()));
@@ -301,8 +286,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
301 setWidget(main_widget); 286 setWidget(main_widget);
302} 287}
303 288
304void GPUCommandListWidget::OnToggleTracing() 289void GPUCommandListWidget::OnToggleTracing() {
305{
306 if (!Pica::DebugUtils::IsPicaTracing()) { 290 if (!Pica::DebugUtils::IsPicaTracing()) {
307 Pica::DebugUtils::StartPicaTracing(); 291 Pica::DebugUtils::StartPicaTracing();
308 toggle_tracing->setText(tr("Stop Tracing")); 292 toggle_tracing->setText(tr("Stop Tracing"));