# If this is an input handle array that is not allowed to contain NULL handles, verify that none of the handles are VK_NULL_HANDLE
elif value.type in self.handleTypes and value.isconst and not self.isHandleOptional(value, lenParam):
usedLines += self.makeHandleCheck(valuePrefix, value, lenParam, req, cvReq, funcName, lenDisplayName, valueDisplayName)
+ elif value.isbool and value.isconst:
+ usedLines.append('skipCall |= validate_bool32_array(report_data, "{}", "{}", "{}", {pf}{}, {pf}{}, {}, {});\n'.format(funcName, lenDisplayName, valueDisplayName, lenParam.name, value.name, cvReq, req, pf=valuePrefix))
+ elif value.israngedenum and value.isconst:
+ enumRange = self.enumRanges[value.type]
+ usedLines.append('skipCall |= validate_ranged_enum_array(report_data, "{}", "{}", "{}", "{}", {}, {}, {pf}{}, {pf}{}, {}, {});\n'.format(funcName, lenDisplayName, valueDisplayName, value.type, enumRange[0], enumRange[1], lenParam.name, value.name, cvReq, req, pf=valuePrefix))
elif value.name == 'pNext':
# We need to ignore VkDeviceCreateInfo and VkInstanceCreateInfo, as the loader manipulates them in a way that is not documented in vk.xml
if not structTypeName in ['VkDeviceCreateInfo', 'VkInstanceCreateInfo']:
# If this is a pointer to a struct (input), see if it contains members that need to be checked
if value.type in self.validatedStructs and value.isconst:
usedLines.append(self.expandStructPointerCode(valuePrefix, value, lenParam, funcName, valueDisplayName))
- elif value.isbool and value.isconst:
- usedLines.append('skipCall |= validate_bool32_array(report_data, "{}", "{}", {pf}{}, {pf}{});\n'.format(funcName, valueDisplayName, lenParam.name, value.name, pf=valuePrefix))
- elif value.israngedenum and value.isconst:
- enumRange = self.enumRanges[value.type]
- usedLines.append('skipCall |= validate_ranged_enum_array(report_data, "{}", "{}", "{}", {}, {}, {pf}{}, {pf}{});\n'.format(funcName, valueDisplayName, value.type, enumRange[0], enumRange[1], lenParam.name, value.name, pf=valuePrefix))
# Non-pointer types
elif (value.type in self.structTypes) or (value.type in self.validatedStructs):
if value.type in self.structTypes:
// Count parameters not tagged as optional cannot be 0
if ((count == 0) && countRequired) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: value of %s must be greater than 0", apiName, countName);
+ ParameterValidationName, "%s: parameter %s must be greater than 0", apiName, countName);
}
- // Array parameters not tagged as optional cannot be NULL,
- // unless the count is 0
+ // Array parameters not tagged as optional cannot be NULL, unless the count is 0
if ((array == NULL) && arrayRequired && (count != 0)) {
skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, arrayName);
bool skipCall = false;
if ((count == 0) || (array == NULL)) {
- // Count parameters not tagged as optional cannot be 0
- if ((count == 0) && countRequired) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: parameter %s must be greater than 0", apiName, countName);
- }
-
- // Array parameters not tagged as optional cannot be NULL,
- // unless the count is 0
- if ((array == NULL) && arrayRequired && (count != 0)) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, arrayName);
- }
+ skipCall |= validate_array(report_data, apiName, countName, arrayName, count, array, countRequired, arrayRequired);
} else {
// Verify that all structs in the array have the correct type
for (uint32_t i = 0; i < count; ++i) {
bool skip_call = false;
if ((count == 0) || (array == NULL)) {
- // Count parameters not tagged as optional cannot be 0
- if ((count == 0) && count_required) {
- skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: parameter %s must be greater than 0", api_name, count_name);
- }
-
- // Array parameters not tagged as optional cannot be NULL, unless the count is 0
- if ((array == NULL) && array_required && (count != 0)) {
- skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: required parameter %s specified as NULL", api_name, array_name);
- }
+ skip_call |= validate_array(report_data, api_name, count_name, array_name, count, array, count_required, array_required);
} else {
// Verify that no handles in the array are VK_NULL_HANDLE
for (uint32_t i = 0; i < count; ++i) {
bool skipCall = false;
if ((count == 0) || (array == NULL)) {
- // Count parameters not tagged as optional cannot be 0
- if ((count == 0) && countRequired) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: parameter %s must be greater than 0", apiName, countName);
- }
-
- // Array parameters not tagged as optional cannot be NULL,
- // unless the count is 0
- if ((array == NULL) && arrayRequired && (count != 0)) {
- skipCall |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: required parameter %s specified as NULL", apiName, arrayName);
- }
+ skipCall |= validate_array(report_data, apiName, countName, arrayName, count, array, countRequired, arrayRequired);
} else {
- // Verify that strings in the array not NULL
+ // Verify that strings in the array are not NULL
for (uint32_t i = 0; i < count; ++i) {
if (array[i] == NULL) {
skipCall |=
*
* @param report_data debug_report_data object for routing validation messages.
* @param apiName Name of API call being validated.
-* @param parameterName Name of parameter being validated.
+* @param countName Name of count parameter.
+* @param arrayName Name of array parameter.
* @param enumName Name of the enumeration being validated.
* @param begin The begin range value for the enumeration.
* @param end The end range value for the enumeration.
-* @param value Boolean value to validate.
+* @param count Number of enumeration values in the array.
+* @param array Array of enumeration values to validate.
+* @param countRequired The 'count' parameter may not be 0 when true.
+* @param arrayRequired The 'array' parameter may not be NULL when true.
* @return Boolean value indicating that the call should be skipped.
*/
template <typename T>
-static bool validate_ranged_enum_array(debug_report_data *report_data, const char *apiName, const char *parameterName,
- const char *enumName, T begin, T end, uint32_t count, const T *pValues) {
+static bool validate_ranged_enum_array(debug_report_data *report_data, const char *apiName, const char *countName,
+ const char *arrayName, const char *enumName, T begin, T end, uint32_t count, const T *array,
+ bool countRequired, bool arrayRequired) {
bool skipCall = false;
- for (uint32_t i = 0; i < count; ++i) {
- if (((pValues[i] < begin) || (pValues[i] > end)) && !is_extension_added_token(pValues[i])) {
- skipCall |=
- log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
- ParameterValidationName, "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
- "enumeration tokens and is not an extension added token",
- apiName, parameterName, i, pValues[i], enumName);
+ if ((count == 0) || (array == NULL)) {
+ skipCall |= validate_array(report_data, apiName, countName, arrayName, count, array, countRequired, arrayRequired);
+ } else {
+ for (uint32_t i = 0; i < count; ++i) {
+ if (((array[i] < begin) || (array[i] > end)) && !is_extension_added_token(array[i])) {
+ skipCall |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1,
+ ParameterValidationName,
+ "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
+ "enumeration tokens and is not an extension added token",
+ apiName, arrayName, i, array[i], enumName);
+ }
}
}