summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-08-25 06:45:29 -0300
committerGravatar Yuri Kunde Schlesner2015-09-07 16:46:31 -0300
commit2bdf9ede9195ab99252094b6a04cab8eebdaafcc (patch)
tree63caeb651379117201522bc84567a396ec99fb59 /src
parentShader Debugger: Remove useless signal (diff)
downloadyuzu-2bdf9ede9195ab99252094b6a04cab8eebdaafcc.tar.gz
yuzu-2bdf9ede9195ab99252094b6a04cab8eebdaafcc.tar.xz
yuzu-2bdf9ede9195ab99252094b6a04cab8eebdaafcc.zip
Shader Debugger: Highlight current instruction instead of focusing
This avoid some annoying focus stealing in some situations, and looks nicer in general.
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/debugger/graphics_vertex_shader.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp
index 64a3569d4..f01be71cc 100644
--- a/src/citra_qt/debugger/graphics_vertex_shader.cpp
+++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp
@@ -292,12 +292,23 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
292 return GetMonospaceFont(); 292 return GetMonospaceFont();
293 293
294 case Qt::BackgroundRole: 294 case Qt::BackgroundRole:
295 // Highlight instructions which have no debug data associated to them 295 {
296 // Highlight current instruction
297 int current_record_index = par->cycle_index->value();
298 if (current_record_index < par->debug_data.records.size()) {
299 const auto& current_record = par->debug_data.records[current_record_index];
300 if (index.row() == current_record.instruction_offset) {
301 return QColor(255, 255, 63);
302 }
303 }
304
305 // Use a grey background for instructions which have no debug data associated to them
296 for (const auto& record : par->debug_data.records) 306 for (const auto& record : par->debug_data.records)
297 if (index.row() == record.instruction_offset) 307 if (index.row() == record.instruction_offset)
298 return QVariant(); 308 return QVariant();
299 309
300 return QBrush(QColor(255, 255, 127)); 310 return QBrush(QColor(192, 192, 192));
311 }
301 312
302 313
303 // TODO: Draw arrows for each "reachable" instruction to visualize control flow 314 // TODO: Draw arrows for each "reachable" instruction to visualize control flow
@@ -546,8 +557,8 @@ void GraphicsVertexShaderWidget::OnCycleIndexChanged(int index) {
546 557
547 instruction_description->setText(text); 558 instruction_description->setText(text);
548 559
549 // Scroll to current instruction 560 // Emit model update notification and scroll to current instruction
550 QModelIndex instr_index = model->index(record.instruction_offset, 0); 561 QModelIndex instr_index = model->index(record.instruction_offset, 0);
551 binary_list->selectionModel()->select(instr_index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); 562 emit model->dataChanged(instr_index, model->index(record.instruction_offset, model->columnCount()));
552 binary_list->scrollTo(instr_index, QAbstractItemView::EnsureVisible); 563 binary_list->scrollTo(instr_index, QAbstractItemView::EnsureVisible);
553} 564}