Skip to content

Commit

Permalink
Fixes an issue with MEC resources' creation command reference.
Browse files Browse the repository at this point in the history
We track at what command resources are created. Resources created before
the trace (in the MEC state) do not have a "creation command". In the past
they were associated with the first command in the trace, which has caused
some minor reporting type problems, but also later on a crash. This was
partially fixed in 21f0184, but together with e313301 caused a
regression in the pipeline view, which now was no longer properly referring
to shader resources due to the now negative creation reference.
  • Loading branch information
pmuetschard committed Apr 20, 2022
1 parent e408dd8 commit 09a6a36
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions gapis/resolve/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/google/gapid/gapis/service/path"
)

const resourceCreatedBeforeTrace = 0xffffffffffffffff

// Resources resolves all the resources used by the specified capture.
func Resources(ctx context.Context, c *path.Capture, r *path.ResolveConfig) (*service.Resources, error) {
obj, err := database.Build(ctx, &ResourcesResolvable{Capture: c, Config: r})
Expand All @@ -50,7 +52,7 @@ func (r *ResourcesResolvable) Resolve(ctx context.Context) (interface{}, error)
resourceTypes := map[string]path.ResourceType{}
seen := map[api.Resource]int{}

var currentCmdIndex uint64 = 0xffffffffffffffff
var currentCmdIndex uint64 = resourceCreatedBeforeTrace
var currentCmdResourceCount int
// If the capture contains initial state, build the necessary commands to recreate it.
initialCmds, ranges, err := initialcmds.InitialCommands(ctx, r.Capture)
Expand Down Expand Up @@ -154,16 +156,20 @@ func (r trackedResource) asService(p *path.Capture) *service.Resource {
Handle: r.resource.ResourceHandle(),
Label: r.resource.ResourceLabel(),
Order: r.resource.Order(),
Accesses: make([]*path.Command, len(r.accesses)),
Accesses: make([]*path.Command, 0, len(r.accesses)),
Type: r.resourceType,
}
for i, a := range r.accesses {
out.Accesses[i] = p.Command(a)
for _, a := range r.accesses {
if a != resourceCreatedBeforeTrace {
out.Accesses = append(out.Accesses, p.Command(a))
}
}
if r.deleted > 0 {
out.Deleted = p.Command(r.deleted)
}
out.Created = p.Command(r.created)
if r.created != resourceCreatedBeforeTrace {
out.Created = p.Command(r.created)
}
return out
}

Expand Down

0 comments on commit 09a6a36

Please sign in to comment.