From 2853029847511acfda1b944c77ba2e3629d0c057 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 4 Feb 2019 14:23:56 +0000 Subject: [PATCH] Don't make overly-general matches when looking for constants by name --- qrenderdoc/Windows/ShaderViewer.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp index e15d8bb4c..55781a7b9 100644 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ b/qrenderdoc/Windows/ShaderViewer.cpp @@ -3103,8 +3103,17 @@ void ShaderViewer::updateVariableTooltip() QString cname = c.name; // this is a hack for now :(. - if(cname.startsWith(m_TooltipName) || cname.contains(bracketedName) || - cname.contains(commaName)) + if(cname == m_TooltipName) + constants.push_back(c); + + int idx = cname.indexOf(bracketedName); + if(idx >= 0 && (cname.at(idx + bracketedName.length()) == QLatin1Char(',') || + cname.at(idx + bracketedName.length()) == QLatin1Char(')'))) + constants.push_back(c); + + idx = cname.indexOf(commaName); + if(idx >= 0 && (cname.at(idx + commaName.length()) == QLatin1Char(',') || + cname.at(idx + commaName.length()) == QLatin1Char(')'))) constants.push_back(c); } }