From 86330edc484b9689ff74b728ca48c1af26f2ac1b Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 23 Nov 2016 09:41:12 -0700 Subject: layers:Separate two error checks There's separate valid usage language for VkPushConstantRange size being non-zero and being multiple of 4. Breaking the validation callbacks to flag these two errors separately along with their respective unique error enums. --- layers/core_validation.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index bf6d2627..5d690d73 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -7007,13 +7007,20 @@ 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__, - 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]); + if (size == 0) { + 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. %s", + caller_name, index, size, validation_error_map[VALIDATION_ERROR_00878]); + } + if (size & 0x3) { + skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, + __LINE__, VALIDATION_ERROR_00879, "DS", "%s call has push constants index %u with " + "size %u. Size must be a multiple of 4. %s", + caller_name, index, size, validation_error_map[VALIDATION_ERROR_00879]); + } } 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__, -- cgit v1.2.3