Skip to content

Commit 3634fdf

Browse files
committed
Ensure resource IDs for MEC resources are unique.
If the first command in the trace creates resources, their IDs would match the IDs generated for the resources serialized as part of the MEC state. This happened because the command ID used to generate the resource IDs for the MEC resources was the same as that of the first command. This would result in the first MEC resource to get ID 0xdd3d... and the first resource of the traced commands to get a matching ID. This change fixes this, by ensuring the MEC resources get gen'ed off a unique command ID.
1 parent 5975a39 commit 3634fdf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

gapis/resolve/resource_data.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func buildResources(ctx context.Context, p *path.Command, t path.ResourceType, r
7878
return nil, err
7979
}
8080
state := capture.NewUninitializedState(ctx).ReserveMemory(ranges)
81-
var currentCmdIndex uint64
81+
var currentCmdIndex uint64 = 0xffffffffffffffff
8282
var currentCmdResourceCount int
8383
idMap := api.ResourceMap{}
8484

@@ -230,7 +230,7 @@ func ResourceExtras(ctx context.Context, p *path.ResourceExtras, r *path.Resolve
230230
return nil, err
231231
}
232232

233-
var currentCmdIndex uint64
233+
var currentCmdIndex uint64 = 0xffffffffffffffff
234234
var currentCmdResourceCount int
235235
var resource api.Resource
236236
state := capture.NewUninitializedState(ctx).ReserveMemory(ranges)

gapis/resolve/resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (r *ResourcesResolvable) Resolve(ctx context.Context) (interface{}, error)
5050
resourceTypes := map[string]path.ResourceType{}
5151
seen := map[api.Resource]int{}
5252

53-
var currentCmdIndex uint64
53+
var currentCmdIndex uint64 = 0xffffffffffffffff
5454
var currentCmdResourceCount int
5555
// If the capture contains initial state, build the necessary commands to recreate it.
5656
initialCmds, ranges, err := initialcmds.InitialCommands(ctx, r.Capture)

0 commit comments

Comments
 (0)