diff options
| author | 2015-08-16 13:34:45 +0200 | |
|---|---|---|
| committer | 2015-08-16 13:34:45 +0200 | |
| commit | f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd (patch) | |
| tree | e74eb17add0b6e0c33f79b95f95d7561cad7eeae /src/citra_qt/debugger/graphics_cmdlists.cpp | |
| parent | Merge pull request #933 from neobrain/shader_debugger (diff) | |
| parent | citra-qt/debug_utils: Use lock_guard everywhere (diff) | |
| download | yuzu-f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd.tar.gz yuzu-f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd.tar.xz yuzu-f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd.zip | |
Merge pull request #997 from Lectem/cmdlist_full_debug
citra-qt: Improve pica command list widget (add mask, fix some issues)
Diffstat (limited to 'src/citra_qt/debugger/graphics_cmdlists.cpp')
| -rw-r--r-- | src/citra_qt/debugger/graphics_cmdlists.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 7ac3ea542..e51a4480f 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -175,29 +175,29 @@ int GPUCommandListModel::rowCount(const QModelIndex& parent) const { | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | int GPUCommandListModel::columnCount(const QModelIndex& parent) const { | 177 | int GPUCommandListModel::columnCount(const QModelIndex& parent) const { |
| 178 | return 3; | 178 | return 4; |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const { | 181 | QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const { |
| 182 | if (!index.isValid()) | 182 | if (!index.isValid()) |
| 183 | return QVariant(); | 183 | return QVariant(); |
| 184 | 184 | ||
| 185 | const auto& writes = pica_trace.writes; | 185 | const auto& write = pica_trace.writes[index.row()]; |
| 186 | const Pica::CommandProcessor::CommandHeader cmd{writes[index.row()].Id()}; | ||
| 187 | const u32 val{writes[index.row()].Value()}; | ||
| 188 | 186 | ||
| 189 | if (role == Qt::DisplayRole) { | 187 | if (role == Qt::DisplayRole) { |
| 190 | QString content; | 188 | QString content; |
| 191 | switch ( index.column() ) { | 189 | switch ( index.column() ) { |
| 192 | case 0: | 190 | case 0: |
| 193 | return QString::fromLatin1(Pica::Regs::GetCommandName(cmd.cmd_id).c_str()); | 191 | return QString::fromLatin1(Pica::Regs::GetCommandName(write.cmd_id).c_str()); |
| 194 | case 1: | 192 | case 1: |
| 195 | return QString("%1").arg(cmd.cmd_id, 3, 16, QLatin1Char('0')); | 193 | return QString("%1").arg(write.cmd_id, 3, 16, QLatin1Char('0')); |
| 196 | case 2: | 194 | case 2: |
| 197 | return QString("%1").arg(val, 8, 16, QLatin1Char('0')); | 195 | return QString("%1").arg(write.mask, 4, 2, QLatin1Char('0')); |
| 196 | case 3: | ||
| 197 | return QString("%1").arg(write.value, 8, 16, QLatin1Char('0')); | ||
| 198 | } | 198 | } |
| 199 | } else if (role == CommandIdRole) { | 199 | } else if (role == CommandIdRole) { |
| 200 | return QVariant::fromValue<int>(cmd.cmd_id.Value()); | 200 | return QVariant::fromValue<int>(write.cmd_id); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | return QVariant(); | 203 | return QVariant(); |
| @@ -213,6 +213,8 @@ QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientatio | |||
| 213 | case 1: | 213 | case 1: |
| 214 | return tr("Register"); | 214 | return tr("Register"); |
| 215 | case 2: | 215 | case 2: |
| 216 | return tr("Mask"); | ||
| 217 | case 3: | ||
| 216 | return tr("New Value"); | 218 | return tr("New Value"); |
| 217 | } | 219 | } |
| 218 | 220 | ||
| @@ -260,7 +262,7 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | |||
| 260 | } | 262 | } |
| 261 | 263 | ||
| 262 | void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | 264 | void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { |
| 263 | QWidget* new_info_widget; | 265 | QWidget* new_info_widget = nullptr; |
| 264 | 266 | ||
| 265 | const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); | 267 | const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); |
| 266 | if (COMMAND_IN_RANGE(command_id, texture0) || | 268 | if (COMMAND_IN_RANGE(command_id, texture0) || |
| @@ -281,14 +283,15 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | |||
| 281 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | 283 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); |
| 282 | u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); | 284 | u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); |
| 283 | new_info_widget = new TextureInfoWidget(src, info); | 285 | new_info_widget = new TextureInfoWidget(src, info); |
| 284 | } else { | ||
| 285 | new_info_widget = new QWidget; | ||
| 286 | } | 286 | } |
| 287 | 287 | if (command_info_widget) { | |
| 288 | widget()->layout()->removeWidget(command_info_widget); | 288 | delete command_info_widget; |
| 289 | delete command_info_widget; | 289 | command_info_widget = nullptr; |
| 290 | widget()->layout()->addWidget(new_info_widget); | 290 | } |
| 291 | command_info_widget = new_info_widget; | 291 | if (new_info_widget) { |
| 292 | widget()->layout()->addWidget(new_info_widget); | ||
| 293 | command_info_widget = new_info_widget; | ||
| 294 | } | ||
| 292 | } | 295 | } |
| 293 | #undef COMMAND_IN_RANGE | 296 | #undef COMMAND_IN_RANGE |
| 294 | 297 | ||
| @@ -300,7 +303,9 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 300 | 303 | ||
| 301 | list_widget = new QTreeView; | 304 | list_widget = new QTreeView; |
| 302 | list_widget->setModel(model); | 305 | list_widget->setModel(model); |
| 303 | list_widget->setFont(QFont("monospace")); | 306 | QFont font("monospace"); |
| 307 | font.setStyleHint(QFont::Monospace); // Automatic fallback to a monospace font on on platforms without a font called "monospace" | ||
| 308 | list_widget->setFont(font); | ||
| 304 | list_widget->setRootIsDecorated(false); | 309 | list_widget->setRootIsDecorated(false); |
| 305 | list_widget->setUniformRowHeights(true); | 310 | list_widget->setUniformRowHeights(true); |
| 306 | 311 | ||
| @@ -324,7 +329,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 324 | 329 | ||
| 325 | connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard())); | 330 | connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard())); |
| 326 | 331 | ||
| 327 | command_info_widget = new QWidget; | 332 | command_info_widget = nullptr; |
| 328 | 333 | ||
| 329 | QVBoxLayout* main_layout = new QVBoxLayout; | 334 | QVBoxLayout* main_layout = new QVBoxLayout; |
| 330 | main_layout->addWidget(list_widget); | 335 | main_layout->addWidget(list_widget); |
| @@ -334,7 +339,6 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 334 | sub_layout->addWidget(copy_all); | 339 | sub_layout->addWidget(copy_all); |
| 335 | main_layout->addLayout(sub_layout); | 340 | main_layout->addLayout(sub_layout); |
| 336 | } | 341 | } |
| 337 | main_layout->addWidget(command_info_widget); | ||
| 338 | main_widget->setLayout(main_layout); | 342 | main_widget->setLayout(main_layout); |
| 339 | 343 | ||
| 340 | setWidget(main_widget); | 344 | setWidget(main_widget); |