mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-04 22:01:07 +00:00
SPIRV debug mapping change the superseding detection
Loop over the scope downwards (parent -> child) then inside that loop iterate upwards from the current scope (child -> parent) to detect mappings which might be superseded
This commit is contained in:
committed by
Baldur Karlsson
parent
cf66943092
commit
6532eb65f0
@@ -1562,8 +1562,22 @@ void Debugger::FillDebugSourceVars(rdcarray<InstructionSourceInfo> &instInfo)
|
||||
// we only pick the innermost.
|
||||
rdcarray<LocalMapping> processed;
|
||||
|
||||
// capture the scopes upwards (from child to parent)
|
||||
rdcarray<const ScopeData *> scopes;
|
||||
while(scope)
|
||||
{
|
||||
scopes.push_back(scope);
|
||||
// if we reach a function scope, don't go up any further.
|
||||
if(scope->type == DebugScope::Function)
|
||||
break;
|
||||
|
||||
scope = scope->parent;
|
||||
}
|
||||
|
||||
// Iterate over the scopes downwards (parent->child)
|
||||
for(size_t s = 0; s < scopes.size(); ++s)
|
||||
{
|
||||
scope = scopes[scopes.size() - 1 - s];
|
||||
for(size_t m = 0; m < scope->localMappings.size(); m++)
|
||||
{
|
||||
const LocalMapping &mapping = scope->localMappings[m];
|
||||
@@ -1572,50 +1586,28 @@ void Debugger::FillDebugSourceVars(rdcarray<InstructionSourceInfo> &instInfo)
|
||||
if(mapping.instIndex > i.instruction)
|
||||
break;
|
||||
|
||||
// see if this mapping is superceded by a later mapping that is in scope for this
|
||||
// instruction. This is a bit inefficient but simple. The alternative would be to do record
|
||||
// see if this mapping is superceded by a later mapping in this scope for this instruction.
|
||||
// This is a bit inefficient but simple. The alternative would be to do record
|
||||
// start and end points for each mapping and update the end points, but this is simple and
|
||||
// should be limited since it's only per-scope
|
||||
bool supercede = false;
|
||||
const ScopeData *supercedeScope = scope;
|
||||
while(supercedeScope)
|
||||
for(size_t n = m + 1; n < scope->localMappings.size(); n++)
|
||||
{
|
||||
for(size_t n = m + 1; n < supercedeScope->localMappings.size(); n++)
|
||||
{
|
||||
const LocalMapping &laterMapping = supercedeScope->localMappings[n];
|
||||
const LocalMapping &laterMapping = scope->localMappings[n];
|
||||
|
||||
// if this mapping is past the current instruction, stop here.
|
||||
if(laterMapping.instIndex > i.instruction)
|
||||
break;
|
||||
|
||||
// if this mapping will supercede and starts later
|
||||
if(laterMapping.isSourceSupersetOf(mapping) && laterMapping.instIndex > mapping.instIndex)
|
||||
{
|
||||
supercede = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(supercede)
|
||||
// if this mapping is past the current instruction, stop here.
|
||||
if(laterMapping.instIndex > i.instruction)
|
||||
break;
|
||||
|
||||
// if we reach a function scope, don't go up any further.
|
||||
if(supercedeScope->type == DebugScope::Function)
|
||||
break;
|
||||
|
||||
supercedeScope = supercedeScope->parent;
|
||||
}
|
||||
|
||||
for(size_t n = 0; n < processed.size(); n++)
|
||||
{
|
||||
if(processed[n].isSourceSupersetOf(mapping))
|
||||
// if this mapping will supercede and starts later
|
||||
if(laterMapping.isSourceSupersetOf(mapping) && laterMapping.instIndex > mapping.instIndex)
|
||||
{
|
||||
supercede = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// don't add the current mapping if it's going to be superceded.
|
||||
// don't add the current mapping if it's going to be superceded by something later
|
||||
if(supercede)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user