From 4ceffcba0a3e5054ee94b7f76add5bfee5b13357 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Mon, 18 Jul 2016 13:14:01 -0600 Subject: layers: Remove DRAWSTATE_INVALID_POOL check This check was only flagged when Allocating descriptor sets or resetting a descriptor pool, and in both cases object_tracker will be the first layer to identify and flag the error. Removing this as a redundant check and updating documentation. --- layers/core_validation.cpp | 26 ++++++++------------- layers/core_validation_error_enums.h | 1 - layers/descriptor_sets.cpp | 44 ++++++++++++++--------------------- layers/vk_validation_layer_details.md | 1 - 4 files changed, 28 insertions(+), 44 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b7946378..5cfef40b 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -3589,23 +3589,17 @@ static void deletePools(layer_data *my_data) { static void clearDescriptorPool(layer_data *my_data, const VkDevice device, const VkDescriptorPool pool, VkDescriptorPoolResetFlags flags) { DESCRIPTOR_POOL_NODE *pPool = getPoolNode(my_data, pool); - if (!pPool) { - log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, - (uint64_t)pool, __LINE__, DRAWSTATE_INVALID_POOL, "DS", - "Unable to find pool node for pool 0x%" PRIxLEAST64 " specified in vkResetDescriptorPool() call", (uint64_t)pool); - } else { - // TODO: validate flags - // For every set off of this pool, clear it, remove from setMap, and free cvdescriptorset::DescriptorSet - for (auto ds : pPool->sets) { - freeDescriptorSet(my_data, ds); - } - pPool->sets.clear(); - // Reset available count for each type and available sets for this pool - for (uint32_t i = 0; i < pPool->availableDescriptorTypeCount.size(); ++i) { - pPool->availableDescriptorTypeCount[i] = pPool->maxDescriptorTypeCount[i]; - } - pPool->availableSets = pPool->maxSets; + // TODO: validate flags + // For every set off of this pool, clear it, remove from setMap, and free cvdescriptorset::DescriptorSet + for (auto ds : pPool->sets) { + freeDescriptorSet(my_data, ds); + } + pPool->sets.clear(); + // Reset available count for each type and available sets for this pool + for (uint32_t i = 0; i < pPool->availableDescriptorTypeCount.size(); ++i) { + pPool->availableDescriptorTypeCount[i] = pPool->maxDescriptorTypeCount[i]; } + pPool->availableSets = pPool->maxSets; } // For given CB object, fetch associated CB Node from map diff --git a/layers/core_validation_error_enums.h b/layers/core_validation_error_enums.h index 265e8820..7103a30b 100644 --- a/layers/core_validation_error_enums.h +++ b/layers/core_validation_error_enums.h @@ -50,7 +50,6 @@ enum DRAW_STATE_ERROR { DRAWSTATE_NONE, // Used for INFO & other non-error messages DRAWSTATE_INTERNAL_ERROR, // Error with DrawState internal data structures DRAWSTATE_NO_PIPELINE_BOUND, // Unable to identify a bound pipeline - DRAWSTATE_INVALID_POOL, // Invalid DS pool DRAWSTATE_INVALID_SET, // Invalid DS DRAWSTATE_INVALID_RENDER_AREA, // Invalid renderArea DRAWSTATE_INVALID_LAYOUT, // Invalid DS layout diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 10463ab0..fa67b2cb 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -1304,34 +1304,26 @@ bool cvdescriptorset::ValidateAllocateDescriptorSets(const debug_report_data *re } } auto pool_node = getPoolNode(dev_data, p_alloc_info->descriptorPool); - if (!pool_node) { - skip_call |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, - reinterpret_cast(p_alloc_info->descriptorPool), __LINE__, DRAWSTATE_INVALID_POOL, "DS", - "Unable to find pool node for pool 0x%" PRIxLEAST64 " specified in vkAllocateDescriptorSets() call", - reinterpret_cast(p_alloc_info->descriptorPool)); - } else { // Make sure pool has all the available descriptors before calling down chain - // Track number of descriptorSets allowable in this pool - if (pool_node->availableSets < p_alloc_info->descriptorSetCount) { - skip_call |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, - reinterpret_cast(pool_node->pool), __LINE__, DRAWSTATE_DESCRIPTOR_POOL_EMPTY, "DS", - "Unable to allocate %u descriptorSets from pool 0x%" PRIxLEAST64 - ". This pool only has %d descriptorSets remaining.", - p_alloc_info->descriptorSetCount, reinterpret_cast(pool_node->pool), pool_node->availableSets); - } - // Determine whether descriptor counts are satisfiable - for (uint32_t i = 0; i < VK_DESCRIPTOR_TYPE_RANGE_SIZE; i++) { - if (ds_data->required_descriptors_by_type[i] > pool_node->availableDescriptorTypeCount[i]) { - skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, - reinterpret_cast(pool_node->pool), __LINE__, DRAWSTATE_DESCRIPTOR_POOL_EMPTY, - "DS", "Unable to allocate %u descriptors of type %s from pool 0x%" PRIxLEAST64 - ". This pool only has %d descriptors of this type remaining.", - ds_data->required_descriptors_by_type[i], string_VkDescriptorType(VkDescriptorType(i)), - reinterpret_cast(pool_node->pool), pool_node->availableDescriptorTypeCount[i]); - } + // Track number of descriptorSets allowable in this pool + if (pool_node->availableSets < p_alloc_info->descriptorSetCount) { + skip_call |= log_msg( + report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, + reinterpret_cast(pool_node->pool), __LINE__, DRAWSTATE_DESCRIPTOR_POOL_EMPTY, "DS", + "Unable to allocate %u descriptorSets from pool 0x%" PRIxLEAST64 ". This pool only has %d descriptorSets remaining.", + p_alloc_info->descriptorSetCount, reinterpret_cast(pool_node->pool), pool_node->availableSets); + } + // Determine whether descriptor counts are satisfiable + for (uint32_t i = 0; i < VK_DESCRIPTOR_TYPE_RANGE_SIZE; i++) { + if (ds_data->required_descriptors_by_type[i] > pool_node->availableDescriptorTypeCount[i]) { + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, + reinterpret_cast(pool_node->pool), __LINE__, DRAWSTATE_DESCRIPTOR_POOL_EMPTY, + "DS", "Unable to allocate %u descriptors of type %s from pool 0x%" PRIxLEAST64 + ". This pool only has %d descriptors of this type remaining.", + ds_data->required_descriptors_by_type[i], string_VkDescriptorType(VkDescriptorType(i)), + reinterpret_cast(pool_node->pool), pool_node->availableDescriptorTypeCount[i]); } } + return skip_call; } // Decrement allocated sets from the pool and insert new sets into set_map diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md index df0d6133..5f649fef 100644 --- a/layers/vk_validation_layer_details.md +++ b/layers/vk_validation_layer_details.md @@ -34,7 +34,6 @@ The Draw State portion of the core validation layer tracks state leading into Dr | Command Buffer Simultaneous Use | Violation of VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT rules. Most likely attempting to simultaneously use a CmdBuffer w/o having that bit set. This also warns if you add secondary command buffer w/o that bit set to a primary command buffer that does have that bit set. | INVALID_CB_SIMULTANEOUS_USE | vkQueueSubmit vkCmdExecuteCommands | CommandBufferTwoSubmits | TODO - Missing tests for 2 cases of this check, both in CmdExecuteCommands() | | Valid Command Buffer Reset | Can only reset individual command buffer that was allocated from a pool with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT set | INVALID_COMMAND_BUFFER_RESET | vkBeginCommandBuffer vkResetCommandBuffer | CommandBufferResetErrors | None | | PSO Bound | Verify that a properly created and valid pipeline object is bound to the CommandBuffer specified in these calls | NO_PIPELINE_BOUND | vkCmdBindDescriptorSets vkCmdBindVertexBuffers | PipelineNotBound | This check is currently more related to VK_LAYER_LUNARG_core_validation internal data structures and less about verifying that PSO is bound at all appropriate points in API. For API purposes, need to make sure this is checked at Draw time and any other relevant calls. | -| Valid DescriptorPool | Verifies that the descriptor set pool object was properly created and is valid | INVALID_POOL | vkResetDescriptorPool vkAllocateDescriptorSets | TODO | This is just an internal layer data structure check. VK_LAYER_LUNARG_parameter_validation or VK_LAYER_LUNARG_object_tracker should really catch bad DSPool | | Valid DescriptorSet | Validate that descriptor set was properly created and is currently valid | INVALID_SET | vkCmdBindDescriptorSets | InvalidDescriptorSet | Is this needed other places (like Update/Clear descriptors) | | Valid DescriptorSetLayout | Flag DescriptorSetLayout object that was not properly created | INVALID_LAYOUT | vkAllocateDescriptorSets | InvalidDescriptorSetLayout | Anywhere else to check this? | | Valid RenderArea | Flag renderArea field that is outside of the framebuffer | INVALID_RENDER_AREA | vkCmdBeginRenderPass | TODO | Anywhere else to check this? | -- cgit v1.2.3