Skip to content

Commit

Permalink
Fix command tree grouping by frame.
Browse files Browse the repository at this point in the history
Fixes a bug introduced by commit 62fa80a, where the "last in
frame" events inferred from "start of frame" commands where added
after the "start of frame" event instead of before it, essentially
ending frames on the same command as starting them.
  • Loading branch information
pmuetschard committed Jun 4, 2018
1 parent e8819a5 commit 3656095
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions gapis/resolve/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ func Events(ctx context.Context, p *path.Events) (*service.Events, error) {
return nil
}

// Pending is only used for FirstInFrame and so it's safe to
// add them all at the start of the command.
for _, kind := range pending {
events = append(events, &service.Event{
Kind: kind,
Command: p.Capture.Command(uint64(id)),
})
}
pending = nil

// For a given command, if the command has a FirstInFrame
// event, we want that to come before all other events for that
// command, and likewise for a LastInFrame event, it should be
Expand All @@ -109,14 +99,34 @@ func Events(ctx context.Context, p *path.Events) (*service.Events, error) {
}

f := cmd.CmdFlags(ctx, id, s)

// Add LastInFrame event of a previous command first.
if p.LastInFrame && f.IsStartOfFrame() && lastCmd > 0 {
events = append(events, &service.Event{
Kind: service.EventKind_LastInFrame,
Command: p.Capture.Command(uint64(lastCmd)),
})
}

// Add any pending events (currently only FirstInFrame events).
for _, kind := range pending {
events = append(events, &service.Event{
Kind: kind,
Command: p.Capture.Command(uint64(id)),
})
}
pending = nil

// Add all first in frame events
if p.FirstInFrame && (f.IsStartOfFrame() || id == 0) {
events = append(events, &service.Event{
Kind: service.EventKind_FirstInFrame,
Command: p.Capture.Command(uint64(id)),
})
}
events = append(events, epFirstInFrame...)
if p.FirstInFrame {
events = append(events, epFirstInFrame...)
}
if p.FirstInFrame && f.IsEndOfFrame() {
pending = append(pending, service.EventKind_FirstInFrame)
}
Expand Down Expand Up @@ -165,19 +175,15 @@ func Events(ctx context.Context, p *path.Events) (*service.Events, error) {
})
}
// Add LastInFrame events after other events for a given command
if p.LastInFrame && f.IsStartOfFrame() && lastCmd > 0 {
events = append(events, &service.Event{
Kind: service.EventKind_LastInFrame,
Command: p.Capture.Command(uint64(lastCmd)),
})
}
if p.LastInFrame && f.IsEndOfFrame() && id > 0 {
events = append(events, &service.Event{
Kind: service.EventKind_LastInFrame,
Command: p.Capture.Command(uint64(id)),
})
}
events = append(events, epLastInFrame...)
if p.LastInFrame {
events = append(events, epLastInFrame...)
}
if p.FramebufferObservations {
// NOTE: gapit SxS video depends on FBO events coming after
// all other event types.
Expand Down

0 comments on commit 3656095

Please sign in to comment.