layers: Add GetQueryPoolResults validation check
authorMark Lobodzinski <mark@lunarg.com>
Thu, 9 Nov 2017 23:43:06 +0000 (16:43 -0700)
committerMark Lobodzinski <mark@lunarg.com>
Tue, 21 Nov 2017 22:24:46 +0000 (15:24 -0700)
Added check for a pool of queryType TIMESTAMP having the RESULT PARTIAL
bit set and updated the error database.

Change-Id: I139733202c085a7d64d7359f659714b75a46ebf1

layers/core_validation.cpp
layers/vk_validation_error_database.txt

index c8eaf05db005fe8868a190f83386012a847831ba..0070bcfaaa84e1b876b440ad2064606540e5385b 100644 (file)
@@ -3390,6 +3390,19 @@ VKAPI_ATTR void VKAPI_CALL DestroyQueryPool(VkDevice device, VkQueryPool queryPo
 static bool PreCallValidateGetQueryPoolResults(layer_data *dev_data, VkQueryPool query_pool, uint32_t first_query,
                                                uint32_t query_count, VkQueryResultFlags flags,
                                                unordered_map<QueryObject, vector<VkCommandBuffer>> *queries_in_flight) {
+    bool skip = false;
+    auto query_pool_state = dev_data->queryPoolMap.find(query_pool);
+    if (query_pool_state != dev_data->queryPoolMap.end()) {
+        if ((query_pool_state->second.createInfo.queryType == VK_QUERY_TYPE_TIMESTAMP) && (flags & VK_QUERY_RESULT_PARTIAL_BIT)) {
+            skip |= log_msg(
+                dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0, __LINE__,
+                VALIDATION_ERROR_2fa00664, "DS",
+                "QueryPool 0x%" PRIx64
+                " was created with a queryType of VK_QUERY_TYPE_TIMESTAMP but flags contains VK_QUERY_RESULT_PARTIAL_BIT. %s",
+                HandleToUint64(query_pool), validation_error_map[VALIDATION_ERROR_2fa00664]);
+        }
+    }
+
     // TODO: clean this up, it's insanely wasteful.
     for (auto cmd_buffer : dev_data->commandBufferMap) {
         if (cmd_buffer.second->in_use.load()) {
@@ -3400,7 +3413,6 @@ static bool PreCallValidateGetQueryPoolResults(layer_data *dev_data, VkQueryPool
     }
 
     if (dev_data->instance_data->disabled.get_query_pool_results) return false;
-    bool skip = false;
     for (uint32_t i = 0; i < query_count; ++i) {
         QueryObject query = {query_pool, first_query + i};
         auto qif_pair = queries_in_flight->find(query);
index 100e9c38fc0cfd82df509735ecc32df7c2f6fe8b..e7bd94e791440eaf2da6982f90cdad81622cc8a0 100644 (file)
@@ -3207,7 +3207,7 @@ VALIDATION_ERROR_2fa0065c~^~N~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQuer
 VALIDATION_ERROR_2fa0065e~^~N~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-flags-00815~^~core~^~The spec valid usage text states 'If VK_QUERY_RESULT_64_BIT is set in flags then pData and stride must be multiples of 8' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-flags-00815)~^~
 VALIDATION_ERROR_2fa00660~^~N~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-firstQuery-00816~^~core~^~The spec valid usage text states 'The sum of firstQuery and queryCount must be less than or equal to the number of queries in queryPool' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-firstQuery-00816)~^~
 VALIDATION_ERROR_2fa00662~^~N~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-dataSize-00817~^~core~^~The spec valid usage text states 'dataSize must be large enough to contain the result of each query, as described here' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-dataSize-00817)~^~
-VALIDATION_ERROR_2fa00664~^~N~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-queryType-00818~^~core~^~The spec valid usage text states 'If the queryType used to create queryPool was VK_QUERY_TYPE_TIMESTAMP, flags must not contain VK_QUERY_RESULT_PARTIAL_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-queryType-00818)~^~
+VALIDATION_ERROR_2fa00664~^~Y~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-queryType-00818~^~core~^~The spec valid usage text states 'If the queryType used to create queryPool was VK_QUERY_TYPE_TIMESTAMP, flags must not contain VK_QUERY_RESULT_PARTIAL_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-queryType-00818)~^~
 VALIDATION_ERROR_2fa03c1b~^~Y~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-dataSize-arraylength~^~core~^~The spec valid usage text states 'dataSize must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-dataSize-arraylength)~^~implicit
 VALIDATION_ERROR_2fa05601~^~Y~^~None~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-device-parameter~^~core~^~The spec valid usage text states 'device must be a valid VkDevice handle' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-device-parameter)~^~implicit
 VALIDATION_ERROR_2fa09001~^~Y~^~Unknown~^~vkGetQueryPoolResults~^~VUID-vkGetQueryPoolResults-flags-parameter~^~core~^~The spec valid usage text states 'flags must be a valid combination of VkQueryResultFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkGetQueryPoolResults-flags-parameter)~^~implicit, TBD in parameter validation layer.