From 509d46a36061728dacd4dc8169676d9f2f75a102 Mon Sep 17 00:00:00 2001 From: Qining Date: Wed, 4 Jul 2018 18:15:54 -0400 Subject: [PATCH] Vulkan: Fix the unit test failure due to nil query pool object (#2034) --- gapis/api/vulkan/api/query_pool.api | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/gapis/api/vulkan/api/query_pool.api b/gapis/api/vulkan/api/query_pool.api index 1c79553f0a..1316997e34 100644 --- a/gapis/api/vulkan/api/query_pool.api +++ b/gapis/api/vulkan/api/query_pool.api @@ -132,8 +132,10 @@ cmd VkResult vkGetQueryPoolResults( sub void dovkCmdBeginQuery(ref!vkCmdBeginQueryArgs args) { pool := QueryPools[args.QueryPool] - pool.Status[args.Query] = QUERY_STATUS_ACTIVE - pool.LastBoundQueue = LastBoundQueue + if pool != null { + pool.Status[args.Query] = QUERY_STATUS_ACTIVE + pool.LastBoundQueue = LastBoundQueue + } } @threadSafety("app") @@ -164,8 +166,10 @@ vkCmdEndQueryArgs { sub void dovkCmdEndQuery(ref!vkCmdEndQueryArgs args) { pool := QueryPools[args.QueryPool] - pool.Status[args.Query] = QUERY_STATUS_COMPLETE - pool.LastBoundQueue = LastBoundQueue + if pool != null { + pool.Status[args.Query] = QUERY_STATUS_COMPLETE + pool.LastBoundQueue = LastBoundQueue + } } @threadSafety("app") @@ -196,10 +200,12 @@ vkCmdResetQueryPoolArgs { sub void dovkCmdResetQueryPool(ref!vkCmdResetQueryPoolArgs args) { pool := QueryPools[args.QueryPool] - for i in (0 .. args.QueryCount) { - pool.Status[args.FirstQuery + i] = QUERY_STATUS_INACTIVE + if pool != null { + for i in (0 .. args.QueryCount) { + pool.Status[args.FirstQuery + i] = QUERY_STATUS_INACTIVE + } + pool.LastBoundQueue = LastBoundQueue } - pool.LastBoundQueue = LastBoundQueue } @threadSafety("app") @@ -230,7 +236,9 @@ cmd void vkCmdResetQueryPool( sub void dovkCmdWriteTimestamp(ref!vkCmdWriteTimestampArgs args) { pool := QueryPools[args.QueryPool] - pool.LastBoundQueue = LastBoundQueue + if pool != null { + pool.LastBoundQueue = LastBoundQueue + } } @threadSafety("app") @@ -266,7 +274,9 @@ class vkCmdCopyQueryPoolResultsArgs { sub void dovkCmdCopyQueryPoolResults(ref!vkCmdCopyQueryPoolResultsArgs args) { pool := QueryPools[args.QueryPool] - pool.LastBoundQueue = LastBoundQueue + if pool != null { + pool.LastBoundQueue = LastBoundQueue + } } @threadSafety("app")