diff --git a/gapis/api/vulkan/replay.go b/gapis/api/vulkan/replay.go index 3c488056e7..38ddea55ea 100644 --- a/gapis/api/vulkan/replay.go +++ b/gapis/api/vulkan/replay.go @@ -551,7 +551,7 @@ func (a API) Replay( if opt { // If we have not set up the dependency graph, do it now. if dceInfo.ft == nil { - ft, err := dependencygraph.GetFootprint(ctx, intent.Device) + ft, err := dependencygraph.GetFootprint(ctx, intent.Capture) if err != nil { return 0, err } diff --git a/gapis/resolve/dependencygraph/footprint.go b/gapis/resolve/dependencygraph/footprint.go index b6829cfb92..c63bdf5260 100644 --- a/gapis/resolve/dependencygraph/footprint.go +++ b/gapis/resolve/dependencygraph/footprint.go @@ -23,7 +23,6 @@ import ( "github.com/google/gapid/gapis/api" "github.com/google/gapid/gapis/capture" "github.com/google/gapid/gapis/database" - "github.com/google/gapid/gapis/replay" "github.com/google/gapid/gapis/resolve/initialcmds" "github.com/google/gapid/gapis/service/path" ) @@ -163,10 +162,9 @@ type FootprintBuilder interface { } // GetFootprint returns a pointer to the resolved Footprint. -func GetFootprint(ctx context.Context, device *path.Device) (*Footprint, error) { +func GetFootprint(ctx context.Context, c *path.Capture) (*Footprint, error) { r, err := database.Build(ctx, &FootprintResolvable{ - Capture: capture.Get(ctx), - Device: device, + Capture: c, }) if err != nil { return nil, fmt.Errorf("Counld not get execution foot print: %v", err) @@ -176,18 +174,12 @@ func GetFootprint(ctx context.Context, device *path.Device) (*Footprint, error) // Resolve implements the database.Resolver interface. func (r *FootprintResolvable) Resolve(ctx context.Context) (interface{}, error) { - ctx = capture.Put(ctx, r.Capture) - if d := r.Device; d != nil { - ctx = replay.PutDevice(ctx, d) - } - - c, err := capture.Resolve(ctx) + c, err := capture.ResolveFromPath(ctx, r.Capture) if err != nil { return nil, err } cmds := c.Commands // If the capture contains initial state, prepend the commands to build the state. - initialCmds, ranges, err := initialcmds.InitialCommands(ctx, r.Capture) if err != nil { return nil, err diff --git a/gapis/server/BUILD.bazel b/gapis/server/BUILD.bazel index f5f2c69d17..0141412606 100644 --- a/gapis/server/BUILD.bazel +++ b/gapis/server/BUILD.bazel @@ -43,6 +43,7 @@ go_library( "//gapis/replay:go_default_library", "//gapis/replay/devices:go_default_library", "//gapis/resolve:go_default_library", + "//gapis/resolve/dependencygraph:go_default_library", "//gapis/service:go_default_library", "//gapis/service/path:go_default_library", "//gapis/stringtable:go_default_library", diff --git a/gapis/server/server.go b/gapis/server/server.go index d92ccc903f..d2c49b0308 100644 --- a/gapis/server/server.go +++ b/gapis/server/server.go @@ -27,7 +27,9 @@ import ( "sync/atomic" "time" + "github.com/google/gapid/core/app/crash" "github.com/google/gapid/core/app/crash/reporting" + "github.com/google/gapid/core/context/keys" "github.com/google/gapid/core/app" "github.com/google/gapid/core/app/analytics" @@ -43,6 +45,7 @@ import ( "github.com/google/gapid/gapis/replay" "github.com/google/gapid/gapis/replay/devices" "github.com/google/gapid/gapis/resolve" + "github.com/google/gapid/gapis/resolve/dependencygraph" "github.com/google/gapid/gapis/service" "github.com/google/gapid/gapis/service/path" "github.com/google/gapid/gapis/stringtable" @@ -230,6 +233,14 @@ func (s *server) LoadCapture(ctx context.Context, path string) (*path.Capture, e if _, err = capture.ResolveFromPath(ctx, p); err != nil { return nil, err } + // Pre-resolve the dependency graph. + crash.Go(func() { + newCtx := keys.Clone(context.Background(), ctx) + _, err = dependencygraph.GetFootprint(newCtx, p) + if err != nil { + log.E(newCtx, "Error resolve dependency graph: %v", err) + } + }) return p, nil }