Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2016 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2016 Valve Corporation |
| 3 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2016 Google Inc. |
| 5 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 9 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 11 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 17 | * |
| 18 | * Author: Dustin Graves <dustin@lunarg.com> |
| 19 | */ |
| 20 | |
Mark Lobodzinski | 739391a | 2016-03-17 15:08:18 -0600 | [diff] [blame] | 21 | #ifndef PARAMETER_VALIDATION_UTILS_H |
| 22 | #define PARAMETER_VALIDATION_UTILS_H |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 23 | |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 24 | #include <algorithm> |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 25 | #include <cstdlib> |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 26 | #include <string> |
| 27 | |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 28 | #include "vulkan/vulkan.h" |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 29 | #include "vk_enum_string_helper.h" |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 30 | #include "vk_layer_logging.h" |
Karl Schultz | a9ef1e5 | 2016-10-06 17:53:48 -0600 | [diff] [blame] | 31 | #include "vk_validation_error_messages.h" |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 32 | |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 33 | #include "parameter_name.h" |
| 34 | |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 35 | namespace parameter_validation { |
| 36 | |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 37 | enum ErrorCode { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 38 | NONE, // Used for INFO & other non-error messages |
| 39 | INVALID_USAGE, // The value of a parameter is not consistent |
| 40 | // with the valid usage criteria defined in |
| 41 | // the Vulkan specification. |
| 42 | INVALID_STRUCT_STYPE, // The sType field of a Vulkan structure does |
| 43 | // not contain the value expected for a structure |
| 44 | // of that type. |
| 45 | INVALID_STRUCT_PNEXT, // The pNext field of a Vulkan structure references |
| 46 | // a value that is not compatible with a structure of |
| 47 | // that type or is not NULL when a structure of that |
| 48 | // type has no compatible pNext values. |
| 49 | REQUIRED_PARAMETER, // A required parameter was specified as 0 or NULL. |
| 50 | RESERVED_PARAMETER, // A parameter reserved for future use was not |
| 51 | // specified as 0 or NULL. |
| 52 | UNRECOGNIZED_VALUE, // A Vulkan enumeration, VkFlags, or VkBool32 parameter |
| 53 | // contains a value that is not recognized as valid for |
| 54 | // that type. |
| 55 | DEVICE_LIMIT, // A specified parameter exceeds the limits returned |
| 56 | // by the physical device |
| 57 | DEVICE_FEATURE, // Use of a requested feature is not supported by |
| 58 | // the device |
| 59 | FAILURE_RETURN_CODE, // A Vulkan return code indicating a failure condition |
| 60 | // was encountered. |
| 61 | EXTENSION_NOT_ENABLED, // An extension entrypoint was called, but the required |
| 62 | // extension was not enabled at CreateInstance or |
| 63 | // CreateDevice time. |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 64 | }; |
| 65 | |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 66 | struct GenericHeader { |
| 67 | VkStructureType sType; |
| 68 | const void *pNext; |
| 69 | }; |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 70 | |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 71 | // Layer name string to be logged with validation messages. |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 72 | const char LayerName[] = "ParameterValidation"; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 73 | |
| 74 | // String returned by string_VkStructureType for an unrecognized type. |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 75 | const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType"; |
| 76 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 77 | // String returned by string_VkResult for an unrecognized type. |
| 78 | const std::string UnsupportedResultString = "Unhandled VkResult"; |
| 79 | |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 80 | // The base value used when computing the offset for an enumeration token value that is added by an extension. |
| 81 | // When validating enumeration tokens, any value >= to this value is considered to be provided by an extension. |
| 82 | // See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification |
| 83 | const uint32_t ExtEnumBaseValue = 1000000000; |
| 84 | |
Cort Stratton | edbe9b8 | 2017-05-16 07:38:35 -0700 | [diff] [blame] | 85 | // The value of all VK_xxx_MAX_ENUM tokens |
| 86 | const uint32_t MaxEnumValue = 0x7FFFFFFF; |
| 87 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 88 | template <typename T> |
| 89 | bool is_extension_added_token(T value) { |
Cort Stratton | edbe9b8 | 2017-05-16 07:38:35 -0700 | [diff] [blame] | 90 | return (value != MaxEnumValue) && (static_cast<uint32_t>(std::abs(static_cast<int32_t>(value))) >= ExtEnumBaseValue); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | // VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE token is a special case that was converted from a core token to an |
| 94 | // extension added token. Its original value was intentionally preserved after the conversion, so it does not use |
| 95 | // the base value that other extension added tokens use, and it does not fall within the enum's begin/end range. |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 96 | template <> |
| 97 | bool is_extension_added_token(VkSamplerAddressMode value) { |
Cort Stratton | edbe9b8 | 2017-05-16 07:38:35 -0700 | [diff] [blame] | 98 | bool result = is_extension_added_token(static_cast<uint32_t>(value)); |
| 99 | return result || (value == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 100 | } |
| 101 | |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 102 | /** |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 103 | * Validate a minimum value. |
| 104 | * |
| 105 | * Verify that the specified value is greater than the specified lower bound. |
| 106 | * |
| 107 | * @param report_data debug_report_data object for routing validation messages. |
| 108 | * @param api_name Name of API call being validated. |
| 109 | * @param parameter_name Name of parameter being validated. |
| 110 | * @param value Value to validate. |
| 111 | * @param lower_bound Lower bound value to use for validation. |
| 112 | * @return Boolean value indicating that the call should be skipped. |
| 113 | */ |
| 114 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 115 | bool ValidateGreaterThan(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, T value, |
| 116 | T lower_bound) { |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 117 | bool skip_call = false; |
| 118 | |
| 119 | if (value <= lower_bound) { |
Mark Lobodzinski | eb9e73f | 2017-04-13 10:06:48 -0600 | [diff] [blame] | 120 | skip_call |= |
| 121 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, 1, LayerName, |
| 122 | "%s: parameter %s must be greater than %d", api_name, parameter_name.get_name().c_str(), lower_bound); |
Dustin Graves | f8032f2 | 2016-05-11 18:31:44 -0600 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | return skip_call; |
| 126 | } |
| 127 | |
| 128 | /** |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 129 | * Validate a required pointer. |
| 130 | * |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 131 | * Verify that a required pointer is not NULL. |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 132 | * |
| 133 | * @param report_data debug_report_data object for routing validation messages. |
| 134 | * @param apiName Name of API call being validated. |
| 135 | * @param parameterName Name of parameter being validated. |
| 136 | * @param value Pointer to validate. |
| 137 | * @return Boolean value indicating that the call should be skipped. |
| 138 | */ |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 139 | static bool validate_required_pointer(debug_report_data *report_data, const char *apiName, const ParameterName ¶meterName, |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 140 | const void *value) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 141 | bool skip_call = false; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 142 | |
| 143 | if (value == NULL) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 144 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 145 | REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, |
| 146 | parameterName.get_name().c_str()); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 147 | } |
| 148 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 149 | return skip_call; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Validate array count and pointer to array. |
| 154 | * |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 155 | * Verify that required count and array parameters are not 0 or NULL. If the |
| 156 | * count parameter is not optional, verify that it is not 0. If the array |
| 157 | * parameter is NULL, and it is not optional, verify that count is 0. |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 158 | * |
| 159 | * @param report_data debug_report_data object for routing validation messages. |
| 160 | * @param apiName Name of API call being validated. |
| 161 | * @param countName Name of count parameter. |
| 162 | * @param arrayName Name of array parameter. |
| 163 | * @param count Number of elements in the array. |
| 164 | * @param array Array to validate. |
| 165 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 166 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 167 | * @return Boolean value indicating that the call should be skipped. |
| 168 | */ |
| 169 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 170 | bool validate_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, |
| 171 | const ParameterName &arrayName, T count, const void *array, bool countRequired, bool arrayRequired) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 172 | bool skip_call = false; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 173 | |
| 174 | // Count parameters not tagged as optional cannot be 0 |
Józef Kucia | 20bb8fb | 2016-09-23 12:45:04 +0200 | [diff] [blame] | 175 | if (countRequired && (count == 0)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 176 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 177 | REQUIRED_PARAMETER, LayerName, "%s: parameter %s must be greater than 0", apiName, |
| 178 | countName.get_name().c_str()); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 179 | } |
| 180 | |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 181 | // Array parameters not tagged as optional cannot be NULL, unless the count is 0 |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 182 | if ((array == NULL) && arrayRequired && (count != 0)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 183 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 184 | REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, |
| 185 | arrayName.get_name().c_str()); |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 186 | } |
| 187 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 188 | return skip_call; |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Validate pointer to array count and pointer to array. |
| 193 | * |
| 194 | * Verify that required count and array parameters are not NULL. If count |
| 195 | * is not NULL and its value is not optional, verify that it is not 0. If the |
| 196 | * array parameter is NULL, and it is not optional, verify that count is 0. |
| 197 | * The array parameter will typically be optional for this case (where count is |
| 198 | * a pointer), allowing the caller to retrieve the available count. |
| 199 | * |
| 200 | * @param report_data debug_report_data object for routing validation messages. |
| 201 | * @param apiName Name of API call being validated. |
| 202 | * @param countName Name of count parameter. |
| 203 | * @param arrayName Name of array parameter. |
| 204 | * @param count Pointer to the number of elements in the array. |
| 205 | * @param array Array to validate. |
| 206 | * @param countPtrRequired The 'count' parameter may not be NULL when true. |
| 207 | * @param countValueRequired The '*count' value may not be 0 when true. |
| 208 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 209 | * @return Boolean value indicating that the call should be skipped. |
| 210 | */ |
| 211 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 212 | bool validate_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, |
| 213 | const ParameterName &arrayName, const T *count, const void *array, bool countPtrRequired, |
| 214 | bool countValueRequired, bool arrayRequired) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 215 | bool skip_call = false; |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 216 | |
| 217 | if (count == NULL) { |
| 218 | if (countPtrRequired) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 219 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 220 | REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, |
| 221 | countName.get_name().c_str()); |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 222 | } |
Mark Lobodzinski | 729a8d3 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 223 | } else { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 224 | skip_call |= validate_array(report_data, apiName, countName, arrayName, (*count), array, countValueRequired, arrayRequired); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 225 | } |
| 226 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 227 | return skip_call; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | /** |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 231 | * Validate a pointer to a Vulkan structure. |
| 232 | * |
| 233 | * Verify that a required pointer to a structure is not NULL. If the pointer is |
| 234 | * not NULL, verify that each structure's sType field is set to the correct |
| 235 | * VkStructureType value. |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 236 | * |
| 237 | * @param report_data debug_report_data object for routing validation messages. |
| 238 | * @param apiName Name of API call being validated. |
| 239 | * @param parameterName Name of struct parameter being validated. |
| 240 | * @param sTypeName Name of expected VkStructureType value. |
| 241 | * @param value Pointer to the struct to validate. |
| 242 | * @param sType VkStructureType for structure validation. |
| 243 | * @param required The parameter may not be NULL when true. |
| 244 | * @return Boolean value indicating that the call should be skipped. |
| 245 | */ |
| 246 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 247 | bool validate_struct_type(debug_report_data *report_data, const char *apiName, const ParameterName ¶meterName, |
| 248 | const char *sTypeName, const T *value, VkStructureType sType, bool required) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 249 | bool skip_call = false; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 250 | |
| 251 | if (value == NULL) { |
Dustin Graves | 080069b | 2016-04-05 13:48:15 -0600 | [diff] [blame] | 252 | if (required) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 253 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 254 | REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, |
| 255 | parameterName.get_name().c_str()); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 256 | } |
| 257 | } else if (value->sType != sType) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 258 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 259 | INVALID_STRUCT_STYPE, LayerName, "%s: parameter %s->sType must be %s", apiName, |
| 260 | parameterName.get_name().c_str(), sTypeName); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 261 | } |
| 262 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 263 | return skip_call; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | /** |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 267 | * Validate an array of Vulkan structures |
| 268 | * |
| 269 | * Verify that required count and array parameters are not 0 or NULL. If |
| 270 | * the array contains 1 or more structures, verify that each structure's |
| 271 | * sType field is set to the correct VkStructureType value. |
| 272 | * |
| 273 | * @param report_data debug_report_data object for routing validation messages. |
| 274 | * @param apiName Name of API call being validated. |
| 275 | * @param countName Name of count parameter. |
| 276 | * @param arrayName Name of array parameter. |
| 277 | * @param sTypeName Name of expected VkStructureType value. |
| 278 | * @param count Number of elements in the array. |
| 279 | * @param array Array to validate. |
| 280 | * @param sType VkStructureType for structure validation. |
| 281 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 282 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 283 | * @return Boolean value indicating that the call should be skipped. |
| 284 | */ |
| 285 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 286 | bool validate_struct_type_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, |
| 287 | const ParameterName &arrayName, const char *sTypeName, uint32_t count, const T *array, |
| 288 | VkStructureType sType, bool countRequired, bool arrayRequired) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 289 | bool skip_call = false; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 290 | |
| 291 | if ((count == 0) || (array == NULL)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 292 | skip_call |= validate_array(report_data, apiName, countName, arrayName, count, array, countRequired, arrayRequired); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 293 | } else { |
| 294 | // Verify that all structs in the array have the correct type |
| 295 | for (uint32_t i = 0; i < count; ++i) { |
| 296 | if (array[i].sType != sType) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 297 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 298 | __LINE__, INVALID_STRUCT_STYPE, LayerName, "%s: parameter %s[%d].sType must be %s", apiName, |
| 299 | arrayName.get_name().c_str(), i, sTypeName); |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 304 | return skip_call; |
Dustin Graves | 1e92cd7 | 2016-02-09 14:00:18 -0700 | [diff] [blame] | 305 | } |
| 306 | |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 307 | /** |
Mark Young | 3938987 | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 308 | * Validate an array of Vulkan structures. |
| 309 | * |
| 310 | * Verify that required count and array parameters are not NULL. If count |
| 311 | * is not NULL and its value is not optional, verify that it is not 0. |
| 312 | * If the array contains 1 or more structures, verify that each structure's |
| 313 | * sType field is set to the correct VkStructureType value. |
| 314 | * |
| 315 | * @param report_data debug_report_data object for routing validation messages. |
| 316 | * @param apiName Name of API call being validated. |
| 317 | * @param countName Name of count parameter. |
| 318 | * @param arrayName Name of array parameter. |
| 319 | * @param sTypeName Name of expected VkStructureType value. |
| 320 | * @param count Pointer to the number of elements in the array. |
| 321 | * @param array Array to validate. |
| 322 | * @param sType VkStructureType for structure validation. |
| 323 | * @param countPtrRequired The 'count' parameter may not be NULL when true. |
| 324 | * @param countValueRequired The '*count' value may not be 0 when true. |
| 325 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 326 | * @return Boolean value indicating that the call should be skipped. |
| 327 | */ |
| 328 | template <typename T> |
| 329 | bool validate_struct_type_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, |
| 330 | const ParameterName &arrayName, const char *sTypeName, uint32_t *count, const T *array, |
| 331 | VkStructureType sType, bool countPtrRequired, bool countValueRequired, bool arrayRequired) { |
| 332 | bool skip_call = false; |
| 333 | |
| 334 | if (count == NULL) { |
| 335 | if (countPtrRequired) { |
| 336 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 337 | REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as NULL", apiName, |
| 338 | countName.get_name().c_str()); |
| 339 | } |
| 340 | } else { |
| 341 | skip_call |= validate_struct_type_array(report_data, apiName, countName, arrayName, sTypeName, (*count), array, sType, |
| 342 | countValueRequired, arrayRequired); |
| 343 | } |
| 344 | |
| 345 | return skip_call; |
| 346 | } |
| 347 | |
| 348 | /** |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 349 | * Validate a Vulkan handle. |
| 350 | * |
| 351 | * Verify that the specified handle is not VK_NULL_HANDLE. |
| 352 | * |
| 353 | * @param report_data debug_report_data object for routing validation messages. |
| 354 | * @param api_name Name of API call being validated. |
| 355 | * @param parameter_name Name of struct parameter being validated. |
| 356 | * @param value Handle to validate. |
| 357 | * @return Boolean value indicating that the call should be skipped. |
| 358 | */ |
| 359 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 360 | bool validate_required_handle(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, T value) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 361 | bool skip_call = false; |
| 362 | |
| 363 | if (value == VK_NULL_HANDLE) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 364 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 365 | REQUIRED_PARAMETER, LayerName, "%s: required parameter %s specified as VK_NULL_HANDLE", api_name, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 366 | parameter_name.get_name().c_str()); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 367 | } |
| 368 | |
| 369 | return skip_call; |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * Validate an array of Vulkan handles. |
| 374 | * |
| 375 | * Verify that required count and array parameters are not NULL. If count |
| 376 | * is not NULL and its value is not optional, verify that it is not 0. |
| 377 | * If the array contains 1 or more handles, verify that no handle is set to |
| 378 | * VK_NULL_HANDLE. |
| 379 | * |
| 380 | * @note This function is only intended to validate arrays of handles when none |
| 381 | * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles |
| 382 | * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead. |
| 383 | * |
| 384 | * @param report_data debug_report_data object for routing validation messages. |
| 385 | * @param api_name Name of API call being validated. |
| 386 | * @param count_name Name of count parameter. |
| 387 | * @param array_name Name of array parameter. |
| 388 | * @param count Number of elements in the array. |
| 389 | * @param array Array to validate. |
| 390 | * @param count_required The 'count' parameter may not be 0 when true. |
| 391 | * @param array_required The 'array' parameter may not be NULL when true. |
| 392 | * @return Boolean value indicating that the call should be skipped. |
| 393 | */ |
| 394 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 395 | bool validate_handle_array(debug_report_data *report_data, const char *api_name, const ParameterName &count_name, |
| 396 | const ParameterName &array_name, uint32_t count, const T *array, bool count_required, |
| 397 | bool array_required) { |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 398 | bool skip_call = false; |
| 399 | |
| 400 | if ((count == 0) || (array == NULL)) { |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 401 | skip_call |= validate_array(report_data, api_name, count_name, array_name, count, array, count_required, array_required); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 402 | } else { |
| 403 | // Verify that no handles in the array are VK_NULL_HANDLE |
| 404 | for (uint32_t i = 0; i < count; ++i) { |
| 405 | if (array[i] == VK_NULL_HANDLE) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 406 | skip_call |= |
| 407 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 408 | REQUIRED_PARAMETER, LayerName, "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name, |
| 409 | array_name.get_name().c_str(), i); |
Dustin Graves | 20fd66f | 2016-04-18 18:33:21 -0600 | [diff] [blame] | 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | return skip_call; |
| 415 | } |
| 416 | |
| 417 | /** |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 418 | * Validate string array count and content. |
| 419 | * |
| 420 | * Verify that required count and array parameters are not 0 or NULL. If the |
| 421 | * count parameter is not optional, verify that it is not 0. If the array |
| 422 | * parameter is NULL, and it is not optional, verify that count is 0. If the |
| 423 | * array parameter is not NULL, verify that none of the strings are NULL. |
| 424 | * |
| 425 | * @param report_data debug_report_data object for routing validation messages. |
| 426 | * @param apiName Name of API call being validated. |
| 427 | * @param countName Name of count parameter. |
| 428 | * @param arrayName Name of array parameter. |
| 429 | * @param count Number of strings in the array. |
| 430 | * @param array Array of strings to validate. |
| 431 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 432 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 433 | * @return Boolean value indicating that the call should be skipped. |
| 434 | */ |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 435 | static bool validate_string_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, |
| 436 | const ParameterName &arrayName, uint32_t count, const char *const *array, bool countRequired, |
| 437 | bool arrayRequired) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 438 | bool skip_call = false; |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 439 | |
| 440 | if ((count == 0) || (array == NULL)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 441 | skip_call |= validate_array(report_data, apiName, countName, arrayName, count, array, countRequired, arrayRequired); |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 442 | } else { |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 443 | // Verify that strings in the array are not NULL |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 444 | for (uint32_t i = 0; i < count; ++i) { |
| 445 | if (array[i] == NULL) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 446 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 447 | __LINE__, REQUIRED_PARAMETER, LayerName, "%s: required parameter %s[%d] specified as NULL", |
| 448 | apiName, arrayName.get_name().c_str(), i); |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 449 | } |
| 450 | } |
| 451 | } |
| 452 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 453 | return skip_call; |
Dustin Graves | 58d114b | 2016-03-08 14:42:59 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 456 | /** |
| 457 | * Validate a structure's pNext member. |
| 458 | * |
| 459 | * Verify that the specified pNext value points to the head of a list of |
| 460 | * allowed extension structures. If no extension structures are allowed, |
| 461 | * verify that pNext is null. |
| 462 | * |
| 463 | * @param report_data debug_report_data object for routing validation messages. |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 464 | * @param api_name Name of API call being validated. |
| 465 | * @param parameter_name Name of parameter being validated. |
| 466 | * @param allowed_struct_names Names of allowed structs. |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 467 | * @param next Pointer to validate. |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 468 | * @param allowed_type_count Total number of allowed structure types. |
| 469 | * @param allowed_types Array of strcuture types allowed for pNext. |
| 470 | * @param header_version Version of header defining the pNext validation rules. |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 471 | * @return Boolean value indicating that the call should be skipped. |
| 472 | */ |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 473 | static bool validate_struct_pnext(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 474 | const char *allowed_struct_names, const void *next, size_t allowed_type_count, |
| 475 | const VkStructureType *allowed_types, uint32_t header_version) { |
| 476 | bool skip_call = false; |
Mark Lobodzinski | c9b74d3 | 2017-03-27 11:52:02 -0600 | [diff] [blame] | 477 | std::unordered_set<const void *> cycle_check; |
| 478 | std::unordered_set<VkStructureType, std::hash<int>> unique_stype_check; |
| 479 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 480 | const char disclaimer[] = |
| 481 | "This warning is based on the Valid Usage documentation for version %d of the Vulkan header. It " |
| 482 | "is possible that you are using a struct from a private extension or an extension that was added " |
| 483 | "to a later version of the Vulkan header, in which case your use of %s is perfectly valid but " |
| 484 | "is not guaranteed to work correctly with validation enabled"; |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 485 | |
Mark Lobodzinski | c9b74d3 | 2017-03-27 11:52:02 -0600 | [diff] [blame] | 486 | // TODO: The valid pNext structure types are not recursive. Each structure has its own list of valid sTypes for pNext. |
| 487 | // Codegen a map of vectors containing the allowable pNext types for each struct and use that here -- also simplifies parms. |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 488 | if (next != NULL) { |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 489 | if (allowed_type_count == 0) { |
| 490 | std::string message = "%s: value of %s must be NULL. "; |
| 491 | message += disclaimer; |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 492 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 493 | INVALID_STRUCT_PNEXT, LayerName, message.c_str(), api_name, parameter_name.get_name().c_str(), |
| 494 | header_version, parameter_name.get_name().c_str()); |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 495 | } else { |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 496 | const VkStructureType *start = allowed_types; |
| 497 | const VkStructureType *end = allowed_types + allowed_type_count; |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 498 | const GenericHeader *current = reinterpret_cast<const GenericHeader *>(next); |
| 499 | |
Mark Lobodzinski | c9b74d3 | 2017-03-27 11:52:02 -0600 | [diff] [blame] | 500 | cycle_check.insert(next); |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 501 | |
Mark Lobodzinski | c9b74d3 | 2017-03-27 11:52:02 -0600 | [diff] [blame] | 502 | |
| 503 | while (current != NULL) { |
| 504 | if (cycle_check.find(current->pNext) != cycle_check.end()) { |
| 505 | std::string message = "%s: %s chain contains a cycle -- pNext pointer " PRIx64 " is repeated."; |
| 506 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 507 | __LINE__, INVALID_STRUCT_PNEXT, LayerName, message.c_str(), api_name, |
| 508 | parameter_name.get_name().c_str(), reinterpret_cast<uint64_t>(next)); |
| 509 | break; |
| 510 | } else { |
| 511 | cycle_check.insert(current->pNext); |
| 512 | } |
| 513 | |
| 514 | std::string type_name = string_VkStructureType(current->sType); |
| 515 | if (unique_stype_check.find(current->sType) != unique_stype_check.end()) { |
| 516 | std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times."; |
| 517 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 518 | __LINE__, INVALID_STRUCT_PNEXT, LayerName, message.c_str(), api_name, |
| 519 | parameter_name.get_name().c_str(), type_name.c_str()); |
| 520 | } else { |
| 521 | unique_stype_check.insert(current->sType); |
| 522 | } |
| 523 | |
| 524 | if (std::find(start, end, current->sType) == end) { |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 525 | if (type_name == UnsupportedStructureTypeString) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 526 | std::string message = |
| 527 | "%s: %s chain includes a structure with unexpected VkStructureType (%d); Allowed " |
| 528 | "structures are [%s]. "; |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 529 | message += disclaimer; |
| 530 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, |
| 531 | 0, __LINE__, INVALID_STRUCT_PNEXT, LayerName, message.c_str(), api_name, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 532 | parameter_name.get_name().c_str(), current->sType, allowed_struct_names, |
| 533 | header_version, parameter_name.get_name().c_str()); |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 534 | } else { |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 535 | std::string message = |
| 536 | "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures are [%s]. "; |
| 537 | message += disclaimer; |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 538 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, |
| 539 | 0, __LINE__, INVALID_STRUCT_PNEXT, LayerName, message.c_str(), api_name, |
| 540 | parameter_name.get_name().c_str(), type_name.c_str(), allowed_struct_names, |
| 541 | header_version, parameter_name.get_name().c_str()); |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 542 | } |
| 543 | } |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 544 | current = reinterpret_cast<const GenericHeader *>(current->pNext); |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | |
Dustin Graves | af5c029 | 2016-07-19 13:43:53 -0600 | [diff] [blame] | 549 | return skip_call; |
Dustin Graves | 58c2f66 | 2016-03-08 17:48:20 -0700 | [diff] [blame] | 550 | } |
| 551 | |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 552 | /** |
| 553 | * Validate a VkBool32 value. |
| 554 | * |
| 555 | * Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE. |
| 556 | * |
| 557 | * @param report_data debug_report_data object for routing validation messages. |
| 558 | * @param apiName Name of API call being validated. |
| 559 | * @param parameterName Name of parameter being validated. |
| 560 | * @param value Boolean value to validate. |
| 561 | * @return Boolean value indicating that the call should be skipped. |
| 562 | */ |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 563 | static bool validate_bool32(debug_report_data *report_data, const char *apiName, const ParameterName ¶meterName, |
| 564 | VkBool32 value) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 565 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 566 | |
| 567 | if ((value != VK_TRUE) && (value != VK_FALSE)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 568 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 569 | UNRECOGNIZED_VALUE, LayerName, "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE", apiName, |
| 570 | parameterName.get_name().c_str(), value); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 571 | } |
| 572 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 573 | return skip_call; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 574 | } |
| 575 | |
| 576 | /** |
| 577 | * Validate a Vulkan enumeration value. |
| 578 | * |
| 579 | * Generate a warning if an enumeration token value does not fall within the core enumeration |
| 580 | * begin and end token values, and was not added to the enumeration by an extension. Extension |
| 581 | * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification, |
| 582 | * with 1,000,000,000 as the base token value. |
| 583 | * |
| 584 | * @note This function does not expect to process enumerations defining bitmask flag bits. |
| 585 | * |
| 586 | * @param report_data debug_report_data object for routing validation messages. |
| 587 | * @param apiName Name of API call being validated. |
| 588 | * @param parameterName Name of parameter being validated. |
| 589 | * @param enumName Name of the enumeration being validated. |
| 590 | * @param begin The begin range value for the enumeration. |
| 591 | * @param end The end range value for the enumeration. |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 592 | * @param value Enumeration value to validate. |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 593 | * @return Boolean value indicating that the call should be skipped. |
| 594 | */ |
| 595 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 596 | bool validate_ranged_enum(debug_report_data *report_data, const char *apiName, const ParameterName ¶meterName, |
| 597 | const char *enumName, T begin, T end, T value) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 598 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 599 | |
| 600 | if (((value < begin) || (value > end)) && !is_extension_added_token(value)) { |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 601 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 602 | UNRECOGNIZED_VALUE, LayerName, |
| 603 | "%s: value of %s (%d) does not fall within the begin..end range of the core %s " |
| 604 | "enumeration tokens and is not an extension added token", |
| 605 | apiName, parameterName.get_name().c_str(), value, enumName); |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 606 | } |
| 607 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 608 | return skip_call; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 609 | } |
| 610 | |
| 611 | /** |
| 612 | * Validate an array of Vulkan enumeration value. |
| 613 | * |
| 614 | * Process all enumeration token values in the specified array and generate a warning if a value |
| 615 | * does not fall within the core enumeration begin and end token values, and was not added to |
| 616 | * the enumeration by an extension. Extension provided enumerations use the equation specified |
| 617 | * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value. |
| 618 | * |
| 619 | * @note This function does not expect to process enumerations defining bitmask flag bits. |
| 620 | * |
| 621 | * @param report_data debug_report_data object for routing validation messages. |
| 622 | * @param apiName Name of API call being validated. |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 623 | * @param countName Name of count parameter. |
| 624 | * @param arrayName Name of array parameter. |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 625 | * @param enumName Name of the enumeration being validated. |
| 626 | * @param begin The begin range value for the enumeration. |
| 627 | * @param end The end range value for the enumeration. |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 628 | * @param count Number of enumeration values in the array. |
| 629 | * @param array Array of enumeration values to validate. |
| 630 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 631 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 632 | * @return Boolean value indicating that the call should be skipped. |
| 633 | */ |
| 634 | template <typename T> |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 635 | static bool validate_ranged_enum_array(debug_report_data *report_data, const char *apiName, const ParameterName &countName, |
| 636 | const ParameterName &arrayName, const char *enumName, T begin, T end, uint32_t count, |
| 637 | const T *array, bool countRequired, bool arrayRequired) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 638 | bool skip_call = false; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 639 | |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 640 | if ((count == 0) || (array == NULL)) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 641 | skip_call |= validate_array(report_data, apiName, countName, arrayName, count, array, countRequired, arrayRequired); |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 642 | } else { |
| 643 | for (uint32_t i = 0; i < count; ++i) { |
| 644 | if (((array[i] < begin) || (array[i] > end)) && !is_extension_added_token(array[i])) { |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 645 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 646 | __LINE__, UNRECOGNIZED_VALUE, LayerName, |
| 647 | "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s " |
| 648 | "enumeration tokens and is not an extension added token", |
| 649 | apiName, arrayName.get_name().c_str(), i, array[i], enumName); |
Dustin Graves | 0d15c6e | 2016-04-26 16:34:10 -0600 | [diff] [blame] | 650 | } |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 651 | } |
| 652 | } |
| 653 | |
Mark Lobodzinski | 72ecd91 | 2016-08-11 13:25:38 -0600 | [diff] [blame] | 654 | return skip_call; |
Dustin Graves | 29148ff | 2016-03-23 19:44:00 -0600 | [diff] [blame] | 655 | } |
| 656 | |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 657 | /** |
Dustin Graves | 78df851 | 2016-04-28 17:58:59 -0600 | [diff] [blame] | 658 | * Verify that a reserved VkFlags value is zero. |
| 659 | * |
| 660 | * Verify that the specified value is zero, to check VkFlags values that are reserved for |
| 661 | * future use. |
| 662 | * |
| 663 | * @param report_data debug_report_data object for routing validation messages. |
| 664 | * @param api_name Name of API call being validated. |
| 665 | * @param parameter_name Name of parameter being validated. |
| 666 | * @param value Value to validate. |
| 667 | * @return Boolean value indicating that the call should be skipped. |
| 668 | */ |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 669 | static bool validate_reserved_flags(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, |
Dustin Graves | 78df851 | 2016-04-28 17:58:59 -0600 | [diff] [blame] | 670 | VkFlags value) { |
| 671 | bool skip_call = false; |
| 672 | |
| 673 | if (value != 0) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 674 | skip_call |= |
| 675 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 676 | RESERVED_PARAMETER, LayerName, "%s: parameter %s must be 0", api_name, parameter_name.get_name().c_str()); |
Dustin Graves | 78df851 | 2016-04-28 17:58:59 -0600 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | return skip_call; |
| 680 | } |
| 681 | |
| 682 | /** |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 683 | * Validate a Vulkan bitmask value. |
| 684 | * |
| 685 | * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits |
| 686 | * for that type. |
| 687 | * |
| 688 | * @param report_data debug_report_data object for routing validation messages. |
| 689 | * @param api_name Name of API call being validated. |
| 690 | * @param parameter_name Name of parameter being validated. |
| 691 | * @param flag_bits_name Name of the VkFlags type being validated. |
| 692 | * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated. |
| 693 | * @param value VkFlags value to validate. |
| 694 | * @param flags_required The 'value' parameter may not be 0 when true. |
| 695 | * @return Boolean value indicating that the call should be skipped. |
| 696 | */ |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 697 | static bool validate_flags(debug_report_data *report_data, const char *api_name, const ParameterName ¶meter_name, |
Dustin Graves | 78df851 | 2016-04-28 17:58:59 -0600 | [diff] [blame] | 698 | const char *flag_bits_name, VkFlags all_flags, VkFlags value, bool flags_required) { |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 699 | bool skip_call = false; |
| 700 | |
| 701 | if (value == 0) { |
| 702 | if (flags_required) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 703 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 704 | REQUIRED_PARAMETER, LayerName, "%s: value of %s must not be 0", api_name, |
| 705 | parameter_name.get_name().c_str()); |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 706 | } |
| 707 | } else if ((value & (~all_flags)) != 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 708 | skip_call |= |
| 709 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 710 | UNRECOGNIZED_VALUE, LayerName, "%s: value of %s contains flag bits that are not recognized members of %s", |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 711 | api_name, parameter_name.get_name().c_str(), flag_bits_name); |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 712 | } |
| 713 | |
| 714 | return skip_call; |
| 715 | } |
| 716 | |
| 717 | /** |
| 718 | * Validate an array of Vulkan bitmask values. |
| 719 | * |
| 720 | * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits |
| 721 | * for that type. |
| 722 | * |
| 723 | * @param report_data debug_report_data object for routing validation messages. |
| 724 | * @param api_name Name of API call being validated. |
| 725 | * @param count_name Name of parameter being validated. |
| 726 | * @param array_name Name of parameter being validated. |
| 727 | * @param flag_bits_name Name of the VkFlags type being validated. |
| 728 | * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated. |
| 729 | * @param count Number of VkFlags values in the array. |
| 730 | * @param array Array of VkFlags value to validate. |
| 731 | * @param count_required The 'count' parameter may not be 0 when true. |
| 732 | * @param array_required The 'array' parameter may not be NULL when true. |
| 733 | * @return Boolean value indicating that the call should be skipped. |
| 734 | */ |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 735 | static bool validate_flags_array(debug_report_data *report_data, const char *api_name, const ParameterName &count_name, |
| 736 | const ParameterName &array_name, const char *flag_bits_name, VkFlags all_flags, uint32_t count, |
Dustin Graves | 78df851 | 2016-04-28 17:58:59 -0600 | [diff] [blame] | 737 | const VkFlags *array, bool count_required, bool array_required) { |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 738 | bool skip_call = false; |
| 739 | |
| 740 | if ((count == 0) || (array == NULL)) { |
| 741 | skip_call |= validate_array(report_data, api_name, count_name, array_name, count, array, count_required, array_required); |
| 742 | } else { |
| 743 | // Verify that all VkFlags values in the array |
| 744 | for (uint32_t i = 0; i < count; ++i) { |
Dustin Graves | 78df851 | 2016-04-28 17:58:59 -0600 | [diff] [blame] | 745 | if (array[i] == 0) { |
| 746 | // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if |
| 747 | // elements in the array are allowed be 0 |
| 748 | if (array_required) { |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 749 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 750 | __LINE__, REQUIRED_PARAMETER, LayerName, "%s: value of %s[%d] must not be 0", api_name, |
| 751 | array_name.get_name().c_str(), i); |
Dustin Graves | 78df851 | 2016-04-28 17:58:59 -0600 | [diff] [blame] | 752 | } |
| 753 | } else if ((array[i] & (~all_flags)) != 0) { |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 754 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 755 | __LINE__, UNRECOGNIZED_VALUE, LayerName, |
| 756 | "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name, |
Dustin Graves | 8ffbbf6 | 2016-07-22 13:19:46 -0600 | [diff] [blame] | 757 | array_name.get_name().c_str(), i, flag_bits_name); |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 758 | } |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | return skip_call; |
| 763 | } |
| 764 | |
| 765 | /** |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 766 | * Get VkResult code description. |
| 767 | * |
Dustin Graves | 9c6b62b | 2016-04-26 15:37:10 -0600 | [diff] [blame] | 768 | * Returns a string describing the specified VkResult code. The description is based on the language in the Vulkan API |
| 769 | * specification. |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 770 | * |
| 771 | * @param value VkResult code to process. |
| 772 | * @return String describing the specified VkResult code. |
| 773 | */ |
| 774 | static std::string get_result_description(VkResult result) { |
| 775 | // clang-format off |
| 776 | switch (result) { |
| 777 | case VK_SUCCESS: return "a command completed successfully"; |
| 778 | case VK_NOT_READY: return "a fence or query has not yet completed"; |
| 779 | case VK_TIMEOUT: return "a wait operation has not completed in the specified time"; |
| 780 | case VK_EVENT_SET: return "an event is signaled"; |
| 781 | case VK_EVENT_RESET: return "an event is unsignalled"; |
| 782 | case VK_INCOMPLETE: return "a return array was too small for the result"; |
| 783 | case VK_ERROR_OUT_OF_HOST_MEMORY: return "a host memory allocation has failed"; |
| 784 | case VK_ERROR_OUT_OF_DEVICE_MEMORY: return "a device memory allocation has failed"; |
Dustin Graves | 2adca84 | 2016-05-16 18:35:55 -0600 | [diff] [blame] | 785 | case VK_ERROR_INITIALIZATION_FAILED: return "initialization of an object has failed"; |
| 786 | case VK_ERROR_DEVICE_LOST: return "the logical device has been lost"; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 787 | case VK_ERROR_MEMORY_MAP_FAILED: return "mapping of a memory object has failed"; |
| 788 | case VK_ERROR_LAYER_NOT_PRESENT: return "the specified layer does not exist"; |
| 789 | case VK_ERROR_EXTENSION_NOT_PRESENT: return "the specified extension does not exist"; |
| 790 | case VK_ERROR_FEATURE_NOT_PRESENT: return "the requested feature is not available on this device"; |
| 791 | case VK_ERROR_INCOMPATIBLE_DRIVER: return "a Vulkan driver could not be found"; |
| 792 | case VK_ERROR_TOO_MANY_OBJECTS: return "too many objects of the type have already been created"; |
| 793 | case VK_ERROR_FORMAT_NOT_SUPPORTED: return "the requested format is not supported on this device"; |
| 794 | case VK_ERROR_SURFACE_LOST_KHR: return "a surface is no longer available"; |
| 795 | case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "the requested window is already connected to another " |
| 796 | "VkSurfaceKHR object, or some other non-Vulkan surface object"; |
| 797 | case VK_SUBOPTIMAL_KHR: return "an image became available, and the swapchain no longer " |
| 798 | "matches the surface properties exactly, but can still be used to " |
| 799 | "present to the surface successfully."; |
| 800 | case VK_ERROR_OUT_OF_DATE_KHR: return "a surface has changed in such a way that it is no " |
| 801 | "longer compatible with the swapchain"; |
| 802 | case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "the display used by a swapchain does not use the same " |
| 803 | "presentable image layout, or is incompatible in a way that prevents " |
| 804 | "sharing an image"; |
| 805 | case VK_ERROR_VALIDATION_FAILED_EXT: return "API validation has detected an invalid use of the API"; |
| 806 | case VK_ERROR_INVALID_SHADER_NV: return "one or more shaders failed to compile or link"; |
Eric Engestrom | bcbb0fd | 2016-04-02 22:06:13 +0100 | [diff] [blame] | 807 | default: return "an error has occurred"; |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 808 | }; |
| 809 | // clang-format on |
| 810 | } |
| 811 | |
| 812 | /** |
| 813 | * Validate return code. |
| 814 | * |
| 815 | * Print a message describing the reason for failure when an error code is returned. |
| 816 | * |
| 817 | * @param report_data debug_report_data object for routing validation messages. |
| 818 | * @param apiName Name of API call being validated. |
Mark Lobodzinski | b42e51b | 2017-05-09 13:49:59 -0600 | [diff] [blame] | 819 | * @param ignore vector of VkResult return codes to be ignored |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 820 | * @param value VkResult value to validate. |
| 821 | */ |
Mark Lobodzinski | b42e51b | 2017-05-09 13:49:59 -0600 | [diff] [blame] | 822 | static void validate_result(debug_report_data *report_data, const char *apiName, std::vector<VkResult> const &ignore, |
| 823 | VkResult result) { |
Chris Forbes | f1f4e38 | 2016-10-13 14:44:03 +1300 | [diff] [blame] | 824 | if (result < 0 && result != VK_ERROR_VALIDATION_FAILED_EXT) { |
Mark Lobodzinski | b42e51b | 2017-05-09 13:49:59 -0600 | [diff] [blame] | 825 | if (std::find(ignore.begin(), ignore.end(), result) != ignore.end()) { |
| 826 | return; |
| 827 | } |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 828 | std::string resultName = string_VkResult(result); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 829 | if (resultName == UnsupportedResultString) { |
| 830 | // Unrecognized result code |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 831 | log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 832 | FAILURE_RETURN_CODE, LayerName, "%s: returned a result code indicating that an error has occurred", apiName); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 833 | } else { |
| 834 | std::string resultDesc = get_result_description(result); |
Dustin Graves | f233e50 | 2016-05-05 13:44:21 -0600 | [diff] [blame] | 835 | log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, |
| 836 | FAILURE_RETURN_CODE, LayerName, "%s: returned %s, indicating that %s", apiName, resultName.c_str(), |
| 837 | resultDesc.c_str()); |
Dustin Graves | ca7aa7c | 2016-03-25 15:13:28 -0600 | [diff] [blame] | 838 | } |
| 839 | } |
| 840 | } |
| 841 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 842 | } // namespace parameter_validation |
Dustin Graves | b83fc2d | 2016-05-04 12:56:08 -0600 | [diff] [blame] | 843 | |
Mark Lobodzinski | 64318ba | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 844 | #endif // PARAMETER_VALIDATION_UTILS_H |