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

Method getRegNames

qrenderdoc/Windows/ShaderViewer.cpp:3232–3445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3230}
3231
3232QString ShaderViewer::getRegNames(const RDTreeWidgetItem *item, uint32_t swizzle, uint32_t child)
3233{
3234 VariableTag tag = item->tag().value<VariableTag>();
3235
3236 if(tag.absoluteRefPath.empty())
3237 return QString();
3238
3239 if(tag.debugVarType != DebugVariableType::Undefined)
3240 {
3241 DebugVariableReference debugVar;
3242 debugVar.type = tag.debugVarType;
3243 debugVar.name = tag.absoluteRefPath;
3244
3245 const ShaderVariable *reg = GetDebugVariable(debugVar);
3246
3247 return reg->name;
3248 }
3249
3250 SourceVariableMapping mapping;
3251
3252 VariableTag itemTag = tag;
3253
3254 // if this an expanded node (when a single source variable maps to a complex struct/array)
3255 // search up to the nearest parent which isn't
3256 const RDTreeWidgetItem *cur = item;
3257 while(tag.expanded)
3258 {
3259 cur = cur->parent();
3260 tag = cur->tag().value<VariableTag>();
3261 }
3262
3263 // check if it's a local or global source var and look up the mapping
3264 if(tag.globalSourceVar && tag.sourceVarIdx >= 0 && tag.sourceVarIdx < m_Trace->sourceVars.count())
3265 {
3266 mapping = m_Trace->sourceVars[tag.sourceVarIdx];
3267 }
3268 else if(!tag.globalSourceVar && tag.sourceVarIdx >= 0 &&
3269 tag.sourceVarIdx < GetCurrentInstInfo().sourceVars.count())
3270 {
3271 mapping = GetCurrentInstInfo().sourceVars[tag.sourceVarIdx];
3272 }
3273 else
3274 {
3275 // if there's no source mapping, we assume this is a root node of a struct, which has no reg
3276 // names
3277 return QString();
3278 }
3279
3280 QString ret;
3281
3282 // if we have a 'tail' referencing values inside this mapping, need to evaluate that
3283 if(cur != item)
3284 {
3285 // we don't support combining complex structs from multiple places, we should only have one
3286 // mapping here
3287 if(mapping.variables.size() != 1)
3288 return QString();
3289

Callers

nothing calls this directly

Calls 10

chopMethod · 0.80
QStringFunction · 0.50
tagMethod · 0.45
emptyMethod · 0.45
parentMethod · 0.45
countMethod · 0.45
sizeMethod · 0.45
substrMethod · 0.45
argMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected