Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert the threadId when a command is reverted. #1853

Merged
merged 1 commit into from
May 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gapis/replay/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type Builder struct {
resourceIDToIdx map[id.ID]uint32
threadIDToIdx map[uint64]uint32
currentThreadID uint64
pendingThreadID uint64
resources []protocol.ResourceInfo
reservedMemory memory.RangeList // Reserved memory ranges for regular data.
pointerMemory memory.RangeList // Reserved memory ranges for the pointer table.
Expand Down Expand Up @@ -227,7 +228,7 @@ func (b *Builder) BeginCommand(cmdID, threadID uint64) {
}

if b.currentThreadID != threadID {
b.currentThreadID = threadID
b.pendingThreadID = threadID
index, ok := b.threadIDToIdx[threadID]
if !ok {
index = uint32(len(b.threadIDToIdx)) + 1
Expand All @@ -245,6 +246,7 @@ func (b *Builder) CommitCommand() {
panic("CommitCommand called without a call to BeginCommand")
}
b.lastLabel, b.pendingLabel = b.pendingLabel, 0
b.currentThreadID = b.pendingThreadID
b.inCmd = false
b.temp.reset()
pop := uint32(len(b.stack))
Expand Down Expand Up @@ -286,6 +288,7 @@ func (b *Builder) RevertCommand(err error) {
panic("RevertCommand called without a call to BeginCommand")
}
b.pendingLabel = 0
b.pendingThreadID = b.currentThreadID
b.inCmd = false
// TODO: Revert calls to: AllocateMemory, Buffer, String, ReserveMemory, MapMemory, UnmapMemory, Write.
b.temp.reset()
Expand Down