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

Method updateWatchVariables

qrenderdoc/Windows/ShaderViewer.cpp:4875–4944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4873}
4874
4875void ShaderViewer::updateWatchVariables()
4876{
4877 QSignalBlocker block(ui->watch);
4878
4879 RDTreeViewExpansionState expansion;
4880 ui->watch->saveExpansion(expansion, 0);
4881
4882 ui->watch->beginUpdate();
4883
4884 for(int i = 0; i < ui->watch->topLevelItemCount() - 1; i++)
4885 {
4886 RDTreeWidgetItem *item = ui->watch->topLevelItem(i);
4887
4888 QString expr = item->text(0).trimmed();
4889
4890 QRegularExpression exprRE(
4891 lit("^" // beginning of the line
4892 "([^,]+)" // variable path
4893 "(,[iduxbocf])?" // optional typecast
4894 "$")); // end of the line
4895
4896 QRegularExpressionMatch match = exprRE.match(expr);
4897
4898 QString error = tr("Error evaluating expression");
4899
4900 if(match.hasMatch())
4901 {
4902 QString path = match.captured(1);
4903 QChar regcast = QLatin1Char(' ');
4904 if(!match.captured(2).isEmpty())
4905 regcast = match.captured(2)[1];
4906
4907 SourceVariableMapping mapping;
4908 ShaderVariable var;
4909 uint32_t swizzle = ~0U;
4910 const RDTreeWidgetItem *varItem = getVarFromPath(path, &var, &swizzle, &mapping);
4911 if(varItem)
4912 {
4913 if(updateWatchVariable(item, varItem, path, swizzle, mapping, var, regcast))
4914 continue;
4915
4916 error = tr("Couldn't evaluate watch for '%1'").arg(expr);
4917 }
4918 else if(item->childCount())
4919 {
4920 markWatchStale(item);
4921 continue;
4922 }
4923 else
4924 {
4925 error = tr("Couldn't find variable for '%1'").arg(path);
4926 }
4927 }
4928
4929 // if we got here, something went wrong.
4930 VariableTag tag;
4931 item->setItalic(false);
4932 item->setText(1, QString());

Callers

nothing calls this directly

Calls 15

QLatin1CharClass · 0.85
fromValueFunction · 0.85
saveExpansionMethod · 0.80
beginUpdateMethod · 0.80
topLevelItemCountMethod · 0.80
topLevelItemMethod · 0.80
trimmedMethod · 0.80
setTagMethod · 0.80
resizeSectionMethod · 0.80
headerMethod · 0.80
endUpdateMethod · 0.80
trFunction · 0.50

Tested by

no test coverage detected