Skip to content

Commit

Permalink
Fix query_timestamps' commandpool allocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
hysw committed May 17, 2019
1 parent ddfc5fe commit 72d60f9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions gapis/api/vulkan/query_timestamps.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ type queryPoolInfo struct {
results []timestampRecord
}

// commandPoolKey is used to find a command pool suitable for a specific queue family
type commandPoolKey struct {
device VkDevice
queueFamily uint32
}

type queryTimestamps struct {
commandPools map[VkDevice]VkCommandPool
commandPools map[commandPoolKey]VkCommandPool
queryPools map[VkQueue]*queryPoolInfo
replayResult []replay.Result
timestamps []replay.Timestamp
Expand All @@ -64,7 +70,7 @@ type queryTimestamps struct {

func newQueryTimestamps(ctx context.Context, c *capture.GraphicsCapture, numInitialCmds int) *queryTimestamps {
transform := &queryTimestamps{
commandPools: make(map[VkDevice]VkCommandPool),
commandPools: make(map[commandPoolKey]VkCommandPool),
queryPools: make(map[VkQueue]*queryPoolInfo),
}
return transform
Expand Down Expand Up @@ -147,9 +153,10 @@ func (t *queryTimestamps) createCommandpoolIfNeeded(ctx context.Context,
out transform.Writer,
device VkDevice,
queueFamilyIndex uint32) VkCommandPool {
key := commandPoolKey{device, queueFamilyIndex}
s := out.State()

if cp, ok := t.commandPools[device]; ok {
if cp, ok := t.commandPools[key]; ok {
if GetState(s).CommandPools().Contains(VkCommandPool(cp)) {
return cp
}
Expand Down Expand Up @@ -182,7 +189,7 @@ func (t *queryTimestamps) createCommandpoolIfNeeded(ctx context.Context,
)
out.MutateAndWrite(ctx, api.CmdNoID, newCmd)

t.commandPools[device] = commandPoolID
t.commandPools[key] = commandPoolID
return commandPoolID
}

Expand Down

0 comments on commit 72d60f9

Please sign in to comment.