layers:Update enums for cmdbuffer in-use cases
authorTobin Ehlis <tobine@google.com>
Thu, 20 Oct 2016 13:43:15 +0000 (07:43 -0600)
committerTobin Ehlis <tobine@google.com>
Wed, 26 Oct 2016 03:20:16 +0000 (21:20 -0600)
Add 4 unique enums for cmd buffer & pool free and reset cases.
Update the database file as well.

layers/core_validation.cpp
layers/vk_validation_error_database.txt

index 968ab2c..e59e214 100644 (file)
@@ -6146,28 +6146,30 @@ DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const Vk
 //  If this is a secondary command buffer, then make sure its primary is also in-flight
 //  If primary is not in-flight, then remove secondary from global in-flight set
 // This function is only valid at a point when cmdBuffer is being reset or freed
-static bool checkCommandBufferInFlight(layer_data *dev_data, const GLOBAL_CB_NODE *cb_node, const char *action) {
+static bool checkCommandBufferInFlight(layer_data *dev_data, const GLOBAL_CB_NODE *cb_node, const char *action,
+                                       UNIQUE_VALIDATION_ERROR_CODE error_code) {
     bool skip_call = false;
     if (dev_data->globalInFlightCmdBuffers.count(cb_node->commandBuffer)) {
         // Primary CB or secondary where primary is also in-flight is an error
         if ((cb_node->createInfo.level != VK_COMMAND_BUFFER_LEVEL_SECONDARY) ||
             (dev_data->globalInFlightCmdBuffers.count(cb_node->primaryCommandBuffer))) {
-            skip_call |= log_msg(
-                dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
-                reinterpret_cast<const uint64_t &>(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER_RESET, "DS",
-                "Attempt to %s command buffer (0x%" PRIxLEAST64 ") which is in use.", action,
-                reinterpret_cast<const uint64_t &>(cb_node->commandBuffer));
+            skip_call |=
+                log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+                        reinterpret_cast<const uint64_t &>(cb_node->commandBuffer), __LINE__, error_code, "DS",
+                        "Attempt to %s command buffer (0x%" PRIxLEAST64 ") which is in use. %s", action,
+                        reinterpret_cast<const uint64_t &>(cb_node->commandBuffer), validation_error_map[error_code]);
         }
     }
     return skip_call;
 }
 
 // Iterate over all cmdBuffers in given commandPool and verify that each is not in use
-static bool checkCommandBuffersInFlight(layer_data *dev_data, COMMAND_POOL_NODE *pPool, const char *action) {
+static bool checkCommandBuffersInFlight(layer_data *dev_data, COMMAND_POOL_NODE *pPool, const char *action,
+                                        UNIQUE_VALIDATION_ERROR_CODE error_code) {
     bool skip_call = false;
     for (auto cmd_buffer : pPool->commandBuffers) {
         if (dev_data->globalInFlightCmdBuffers.count(cmd_buffer)) {
-            skip_call |= checkCommandBufferInFlight(dev_data, getCBNode(dev_data, cmd_buffer), action);
+            skip_call |= checkCommandBufferInFlight(dev_data, getCBNode(dev_data, cmd_buffer), action, error_code);
         }
     }
     return skip_call;
@@ -6189,7 +6191,7 @@ FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandB
         auto cb_node = getCBNode(dev_data, pCommandBuffers[i]);
         // Delete CB information structure, and remove from commandBufferMap
         if (cb_node) {
-            skip_call |= checkCommandBufferInFlight(dev_data, cb_node, "free");
+            skip_call |= checkCommandBufferInFlight(dev_data, cb_node, "free", VALIDATION_ERROR_00096);
         }
     }
 
@@ -6253,7 +6255,7 @@ DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocatio
     std::unique_lock<std::mutex> lock(global_lock);
     // Verify that command buffers in pool are complete (not in-flight)
     auto pPool = getCommandPoolNode(dev_data, commandPool);
-    skip_call |= checkCommandBuffersInFlight(dev_data, pPool, "destroy command pool with");
+    skip_call |= checkCommandBuffersInFlight(dev_data, pPool, "destroy command pool with", VALIDATION_ERROR_00077);
 
     if (skip_call)
         return;
@@ -6288,7 +6290,7 @@ ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetF
 
     std::unique_lock<std::mutex> lock(global_lock);
     auto pPool = getCommandPoolNode(dev_data, commandPool);
-    skip_call |= checkCommandBuffersInFlight(dev_data, pPool, "reset command pool with");
+    skip_call |= checkCommandBuffersInFlight(dev_data, pPool, "reset command pool with", VALIDATION_ERROR_00072);
     lock.unlock();
 
     if (skip_call)
@@ -7306,7 +7308,7 @@ ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flag
                              ") that does NOT have the VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT bit set.",
                              (uint64_t)commandBuffer, (uint64_t)cmdPool);
     }
-    skip_call |= checkCommandBufferInFlight(dev_data, pCB, "reset");
+    skip_call |= checkCommandBufferInFlight(dev_data, pCB, "reset", VALIDATION_ERROR_00092);
     lock.unlock();
     if (skip_call)
         return VK_ERROR_VALIDATION_FAILED_EXT;
index e37c66e..db74eb3 100644 (file)
@@ -75,12 +75,12 @@ VALIDATION_ERROR_00068~^~U~^~Unknown~^~vkCreateCommandPool~^~For more informatio
 VALIDATION_ERROR_00069~^~U~^~Unknown~^~vkCreateCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'sType must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolCreateFlagBits)~^~
 VALIDATION_ERROR_00070~^~U~^~Unknown~^~vkCreateCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'pNext must be NULL' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolCreateFlagBits)~^~
 VALIDATION_ERROR_00071~^~U~^~Unknown~^~vkCreateCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'flags must be a valid combination of VkCommandPoolCreateFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolCreateFlagBits)~^~
-VALIDATION_ERROR_00072~^~U~^~Unknown~^~vkResetCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'All VkCommandBuffer objects allocated from commandPool must not currently be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolResetFlagBits)~^~
+VALIDATION_ERROR_00072~^~Y~^~None~^~vkResetCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'All VkCommandBuffer objects allocated from commandPool must not currently be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolResetFlagBits)~^~
 VALIDATION_ERROR_00073~^~Y~^~Unknown~^~vkResetCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'device must be a valid VkDevice handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolResetFlagBits)~^~
 VALIDATION_ERROR_00074~^~Y~^~Unknown~^~vkResetCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'commandPool must be a valid VkCommandPool handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolResetFlagBits)~^~
 VALIDATION_ERROR_00075~^~U~^~Unknown~^~vkResetCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'flags must be a valid combination of VkCommandPoolResetFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolResetFlagBits)~^~
 VALIDATION_ERROR_00076~^~U~^~Unknown~^~vkResetCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'commandPool must have been created, allocated, or retrieved from device' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandPoolResetFlagBits)~^~
-VALIDATION_ERROR_00077~^~U~^~Unknown~^~vkDestroyCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'All VkCommandBuffer objects allocated from commandPool must not be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyCommandPool)~^~
+VALIDATION_ERROR_00077~^~Y~^~None~^~vkDestroyCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'All VkCommandBuffer objects allocated from commandPool must not be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyCommandPool)~^~
 VALIDATION_ERROR_00078~^~U~^~Unknown~^~vkDestroyCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'If VkAllocationCallbacks were provided when commandPool was created, a compatible set of callbacks must be provided here' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyCommandPool)~^~
 VALIDATION_ERROR_00079~^~U~^~Unknown~^~vkDestroyCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'If no VkAllocationCallbacks were provided when commandPool was created, pAllocator must be NULL' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyCommandPool)~^~
 VALIDATION_ERROR_00080~^~Y~^~Unknown~^~vkDestroyCommandPool~^~For more information refer to Vulkan Spec Section '5.1. Command Pools' which states 'device must be a valid VkDevice handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyCommandPool)~^~
@@ -95,11 +95,11 @@ VALIDATION_ERROR_00088~^~U~^~Unknown~^~vkAllocateCommandBuffers~^~For more infor
 VALIDATION_ERROR_00089~^~U~^~Unknown~^~vkAllocateCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'pNext must be NULL' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferLevel)~^~
 VALIDATION_ERROR_00090~^~Y~^~Unknown~^~vkAllocateCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'commandPool must be a valid VkCommandPool handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferLevel)~^~
 VALIDATION_ERROR_00091~^~U~^~Unknown~^~vkAllocateCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'level must be a valid VkCommandBufferLevel value' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferLevel)~^~
-VALIDATION_ERROR_00092~^~U~^~Unknown~^~vkResetCommandBuffer~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'commandBuffer must not currently be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferResetFlagBits)~^~
+VALIDATION_ERROR_00092~^~Y~^~CommandBufferResetErrors~^~vkResetCommandBuffer~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'commandBuffer must not currently be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferResetFlagBits)~^~
 VALIDATION_ERROR_00093~^~U~^~Unknown~^~vkResetCommandBuffer~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'commandBuffer must have been allocated from a pool that was created with the VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferResetFlagBits)~^~
 VALIDATION_ERROR_00094~^~U~^~Unknown~^~vkResetCommandBuffer~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'commandBuffer must be a valid VkCommandBuffer handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferResetFlagBits)~^~
 VALIDATION_ERROR_00095~^~U~^~Unknown~^~vkResetCommandBuffer~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'flags must be a valid combination of VkCommandBufferResetFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkCommandBufferResetFlagBits)~^~
-VALIDATION_ERROR_00096~^~U~^~Unknown~^~vkFreeCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'All elements of pCommandBuffers must not be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeCommandBuffers)~^~
+VALIDATION_ERROR_00096~^~Y~^~None~^~vkFreeCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'All elements of pCommandBuffers must not be pending execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeCommandBuffers)~^~
 VALIDATION_ERROR_00097~^~U~^~Unknown~^~vkFreeCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'pCommandBuffers must be a pointer to an array of commandBufferCount VkCommandBuffer handles, each element of which must either be a valid handle or NULL' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeCommandBuffers)~^~
 VALIDATION_ERROR_00098~^~Y~^~Unknown~^~vkFreeCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'device must be a valid VkDevice handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeCommandBuffers)~^~
 VALIDATION_ERROR_00099~^~Y~^~Unknown~^~vkFreeCommandBuffers~^~For more information refer to Vulkan Spec Section '5.2. Command Buffer Allocation and Management' which states 'commandPool must be a valid VkCommandPool handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeCommandBuffers)~^~
@@ -610,7 +610,7 @@ VALIDATION_ERROR_00616~^~U~^~Unknown~^~vkAllocateMemory~^~For more information r
 VALIDATION_ERROR_00617~^~U~^~Unknown~^~vkAllocateMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'allocationSize must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMemoryAllocateInfo)~^~
 VALIDATION_ERROR_00618~^~U~^~Unknown~^~vkAllocateMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'sType must be VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMemoryAllocateInfo)~^~
 VALIDATION_ERROR_00619~^~U~^~Unknown~^~vkAllocateMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'pNext must be NULL, or a pointer to a valid instance of VkDedicatedAllocationMemoryAllocateInfoNV' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkMemoryAllocateInfo)~^~
-VALIDATION_ERROR_00620~^~U~^~Unknown~^~vkFreeMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'All submitted commands that refer to memory (via images or buffers) must have completed execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeMemory)~^~
+VALIDATION_ERROR_00620~^~Y~^~None~^~vkFreeMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'All submitted commands that refer to memory (via images or buffers) must have completed execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeMemory)~^~
 VALIDATION_ERROR_00621~^~Y~^~Unknown~^~vkFreeMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'device must be a valid VkDevice handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeMemory)~^~
 VALIDATION_ERROR_00622~^~Y~^~Unknown~^~vkFreeMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'If memory is not VK_NULL_HANDLE, memory must be a valid VkDeviceMemory handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeMemory)~^~
 VALIDATION_ERROR_00623~^~U~^~Unknown~^~vkFreeMemory~^~For more information refer to Vulkan Spec Section '10.2. Device Memory' which states 'If pAllocator is not NULL, pAllocator must be a pointer to a valid VkAllocationCallbacks structure' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkFreeMemory)~^~