MCPcopy Create free account
hub / github.com/baldurk/renderdoc / updateWatchVariable

Method updateWatchVariable

qrenderdoc/Windows/ShaderViewer.cpp:4566–4873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4564}
4565
4566bool ShaderViewer::updateWatchVariable(RDTreeWidgetItem *watchItem, const RDTreeWidgetItem *varItem,
4567 const rdcstr &path, uint32_t swizzle,
4568 const SourceVariableMapping &mapping,
4569 const ShaderVariable &var, QChar regcast)
4570{
4571 if(!var.members.empty())
4572 {
4573 QSet<QString> existing, current;
4574
4575 // see which members we have already
4576 for(int i = 0; i < watchItem->childCount(); i++)
4577 existing.insert(watchItem->child(i)->text(0));
4578
4579 // see which members are in the variable
4580 for(int i = 0; i < var.members.count(); i++)
4581 current.insert(var.members[i].name);
4582
4583 // if there are no new members in the variable, the existing set will contain the current set
4584 if(!existing.contains(current))
4585 {
4586 // the current variable has some new members in its set - this may be a different structure.
4587 // Clear the existing watch before updating
4588 watchItem->clear();
4589 }
4590
4591 // iterate over every sub-variable we know about
4592 QVector<bool> valid;
4593 valid.resize(watchItem->childCount());
4594 for(int i = 0; i < var.members.count(); i++)
4595 {
4596 int idx = -1;
4597
4598 QString name = var.members[i].name;
4599
4600 for(int j = 0; j < watchItem->childCount(); j++)
4601 {
4602 if(name == watchItem->child(j)->text(0))
4603 {
4604 idx = j;
4605 break;
4606 }
4607 }
4608
4609 if(idx == -1)
4610 {
4611 idx = watchItem->childCount();
4612 RDTreeWidgetItem *item = new RDTreeWidgetItem({
4613 name,
4614 QVariant(),
4615 QVariant(),
4616 QVariant(),
4617 });
4618 VariableTag tag = VariableTag(DebugVariableType::Variable, path);
4619 tag.state = WatchVarState::Valid;
4620 tag.offset = i;
4621 item->setTag(QVariant::fromValue(tag));
4622 watchItem->addChild(item);
4623 valid.push_back(false);

Callers

nothing calls this directly

Calls 15

VariableTagClass · 0.85
fromValueFunction · 0.85
SortRDWidgetItemsFunction · 0.85
VarTypeByteSizeFunction · 0.85
ToStrFunction · 0.85
QLatin1CharClass · 0.85
MakeSwatchIconFunction · 0.85
setTagMethod · 0.80
takeChildMethod · 0.80
QVariantClass · 0.50
QStringFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected