Skip to content

Commit 95e8efa

Browse files
committed
Sorting array members in the watch window correctly
This sets the offset of the VariableTag for array members in the watch window. This ensures they are sorted correctly when displayed. Sorting array members in the watch window correctly This sets the offset of the VariableTag for array members in the watch window. This ensures they are sorted correctly when displayed. Sorting array members in the watch window correctly This sets the offset of the VariableTag for array members in the watch window. This ensures they are sorted correctly when displayed.
1 parent f333d08 commit 95e8efa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

qrenderdoc/Windows/ShaderViewer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,6 +3139,8 @@ void ShaderViewer::combineStructures(RDTreeWidgetItem *root, int skipPrefixLengt
31393139
VariableTag bt = b->tag().value<VariableTag>();
31403140
if(at.offset != bt.offset)
31413141
return at.offset < bt.offset;
3142+
if(at.globalSourceVar && bt.globalSourceVar)
3143+
return at.sourceVarIdx < bt.sourceVarIdx;
31423144
return a->text(0) < b->text(0);
31433145
});
31443146

@@ -4560,6 +4562,7 @@ bool ShaderViewer::updateWatchVariable(RDTreeWidgetItem *watchItem, const RDTree
45604562
});
45614563
VariableTag tag = VariableTag(DebugVariableType::Variable, path);
45624564
tag.state = WatchVarState::Valid;
4565+
tag.offset = i;
45634566
item->setTag(QVariant::fromValue(tag));
45644567
watchItem->addChild(item);
45654568
valid.push_back(false);
@@ -4592,6 +4595,8 @@ bool ShaderViewer::updateWatchVariable(RDTreeWidgetItem *watchItem, const RDTree
45924595
VariableTag bt = b->tag().value<VariableTag>();
45934596
if(at.offset != bt.offset)
45944597
return at.offset < bt.offset;
4598+
if(at.globalSourceVar && bt.globalSourceVar)
4599+
return at.sourceVarIdx < bt.sourceVarIdx;
45954600
return a->text(0) < b->text(0);
45964601
});
45974602

@@ -4604,6 +4609,7 @@ bool ShaderViewer::updateWatchVariable(RDTreeWidgetItem *watchItem, const RDTree
46044609

46054610
VariableTag tag = VariableTag(DebugVariableType::Variable, path);
46064611
tag.state = WatchVarState::Valid;
4612+
tag.offset = watchItem->tag().value<VariableTag>().offset;
46074613
watchItem->setTag(QVariant::fromValue(tag));
46084614

46094615
return true;
@@ -4803,6 +4809,9 @@ bool ShaderViewer::updateWatchVariable(RDTreeWidgetItem *watchItem, const RDTree
48034809

48044810
VariableTag tag = VariableTag(DebugVariableType::Variable, path);
48054811
tag.state = WatchVarState::Valid;
4812+
// Grab the offset that is already set
4813+
uint32_t offset = watchItem->tag().value<VariableTag>().offset;
4814+
tag.offset = offset;
48064815
watchItem->setTag(QVariant::fromValue(tag));
48074816

48084817
return true;

0 commit comments

Comments
 (0)