From 09a6a36d04942a785e8b8ac8b27c239413c0e23c Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Fri, 15 Apr 2022 10:33:48 -0700 Subject: [PATCH] Fixes an issue with MEC resources' creation command reference. 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 21f0184e9, but together with e313301e3 caused a regression in the pipeline view, which now was no longer properly referring to shader resources due to the now negative creation reference. --- gapis/resolve/resources.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gapis/resolve/resources.go b/gapis/resolve/resources.go index b2b2a2c98..a96cec604 100644 --- a/gapis/resolve/resources.go +++ b/gapis/resolve/resources.go @@ -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}) @@ -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) @@ -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 }