diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-10-06 12:58:06 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-10-07 12:01:41 -0600 |
| commit | 335e331c1edb42d069c05326432baba26d90e085 (patch) | |
| tree | 3554dffb9d421114ed58f7531c3bdaa5c3c415a9 /layers/core_validation.cpp | |
| parent | 9d674c3b3079fb50fef0925a9fa36af97864939c (diff) | |
| download | usermoji-335e331c1edb42d069c05326432baba26d90e085.tar.xz | |
layers: Updating descriptor checks to use unique enums
Initial batch of updates to use unique validation error enums and
messages for a few checks. Updated the database file and flagged
some other checks that are missing along with "TODO" notes in the
code.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b31f6da2..33a7106a 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -61,7 +61,6 @@ #include "vk_layer_extension_utils.h" #include "vk_layer_utils.h" #include "spirv-tools/libspirv.h" -#include "vk_validation_error_messages.h" #if defined __ANDROID__ #include <android/log.h> @@ -3861,11 +3860,13 @@ static bool validateIdleDescriptorSet(const layer_data *my_data, VkDescriptorSet "Cannot call %s() on descriptor set 0x%" PRIxLEAST64 " that has not been allocated.", func_str.c_str(), (uint64_t)(set)); } else { + // TODO : This covers various error cases so should pass error enum into this function and use passed in enum here if (set_node->second->in_use.load()) { - skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, (uint64_t)(set), __LINE__, DRAWSTATE_OBJECT_INUSE, - "DS", "Cannot call %s() on descriptor set 0x%" PRIxLEAST64 " that is in use by a command buffer.", - func_str.c_str(), (uint64_t)(set)); + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, + (uint64_t)(set), __LINE__, VALIDATION_ERROR_00919, "DS", + "Cannot call %s() on descriptor set 0x%" PRIxLEAST64 " that is in use by a command buffer. %s", + func_str.c_str(), (uint64_t)(set), validation_error_map[VALIDATION_ERROR_00919]); } } return skip_call; @@ -6055,6 +6056,7 @@ DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetL VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) { + // TODO : Add checks for VALIDATION_ERROR_00901 // TODO : Clean up any internal data structures using this obj. get_my_data_ptr(get_dispatch_key(device), layer_data_map) ->dispatch_table.DestroyDescriptorPool(device, descriptorPool, pAllocator); @@ -6632,14 +6634,15 @@ static bool validatePushConstantRange(const layer_data *dev_data, const uint32_t bool skip_call = false; // Check that offset + size don't exceed the max. // Prevent arithetic overflow here by avoiding addition and testing in this order. + // TODO : This check combines VALIDATION_ERROR_00877 & 880, need to break out separately if ((offset >= maxPushConstantsSize) || (size > maxPushConstantsSize - offset)) { // This is a pain just to adapt the log message to the caller, but better to sort it out only when there is a problem. if (0 == strcmp(caller_name, "vkCreatePipelineLayout()")) { skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "%s call has push constants index %u with offset %u and size %u that " - "exceeds this device's maxPushConstantSize of %u.", - caller_name, index, offset, size, maxPushConstantsSize); + VALIDATION_ERROR_00877, "DS", "%s call has push constants index %u with offset %u and size %u that " + "exceeds this device's maxPushConstantSize of %u. %s", + caller_name, index, offset, size, maxPushConstantsSize, validation_error_map[VALIDATION_ERROR_00877]); } else if (0 == strcmp(caller_name, "vkCmdPushConstants()")) { skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "%s call has push constants with offset %u and size %u that " @@ -6651,13 +6654,13 @@ static bool validatePushConstantRange(const layer_data *dev_data, const uint32_t } } // size needs to be non-zero and a multiple of 4. + // TODO : This check combines VALIDATION_ERROR_00878 & 879, need to break out separately if ((size == 0) || ((size & 0x3) != 0)) { if (0 == strcmp(caller_name, "vkCreatePipelineLayout()")) { - skip_call |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - DRAWSTATE_PUSH_CONSTANTS_ERROR, "DS", "%s call has push constants index %u with " - "size %u. Size must be greater than zero and a multiple of 4.", - caller_name, index, size); + skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + VALIDATION_ERROR_00878, "DS", "%s call has push constants index %u with " + "size %u. Size must be greater than zero and a multiple of 4. %s", + caller_name, index, size, validation_error_map[VALIDATION_ERROR_00878]); } else if (0 == strcmp(caller_name, "vkCmdPushConstants()")) { skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, @@ -6693,6 +6696,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPip const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) { bool skip_call = false; layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); + // TODO : Add checks for VALIDATION_ERRORS 865-871 // Push Constant Range checks uint32_t i, j; for (i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) { @@ -6827,9 +6831,10 @@ static bool PreCallValidateFreeDescriptorSets(const layer_data *dev_data, VkDesc if (pool_node && !(VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT & pool_node->createInfo.flags)) { // Can't Free from a NON_FREE pool skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, - reinterpret_cast<uint64_t &>(pool), __LINE__, DRAWSTATE_CANT_FREE_FROM_NON_FREE_POOL, "DS", + reinterpret_cast<uint64_t &>(pool), __LINE__, VALIDATION_ERROR_00922, "DS", "It is invalid to call vkFreeDescriptorSets() with a pool created without setting " - "VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT."); + "VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT. %s", + validation_error_map[VALIDATION_ERROR_00922]); } return skip_call; } |
