Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 1 | /* Copyright (c) 2015-2019 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2019 Valve Corporation |
| 3 | * Copyright (c) 2015-2019 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2019 Google Inc. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5 | * |
| 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 |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 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. |
| 17 | * |
| 18 | * Author: Dustin Graves <dustin@lunarg.com> |
| 19 | * Author: Mark Lobodzinski <mark@lunarg.com> |
| 20 | */ |
| 21 | |
| 22 | #pragma once |
| 23 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 24 | #include "parameter_name.h" |
| 25 | #include "vk_typemap_helper.h" |
| 26 | |
| 27 | // Suppress unused warning on Linux |
| 28 | #if defined(__GNUC__) |
| 29 | #define DECORATE_UNUSED __attribute__((unused)) |
| 30 | #else |
| 31 | #define DECORATE_UNUSED |
| 32 | #endif |
| 33 | |
| 34 | static const char DECORATE_UNUSED *kVUID_PVError_NONE = "UNASSIGNED-GeneralParameterError-Info"; |
| 35 | static const char DECORATE_UNUSED *kVUID_PVError_InvalidUsage = "UNASSIGNED-GeneralParameterError-InvalidUsage"; |
| 36 | static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructSType = "UNASSIGNED-GeneralParameterError-InvalidStructSType"; |
| 37 | static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructPNext = "UNASSIGNED-GeneralParameterError-InvalidStructPNext"; |
| 38 | static const char DECORATE_UNUSED *kVUID_PVError_RequiredParameter = "UNASSIGNED-GeneralParameterError-RequiredParameter"; |
| 39 | static const char DECORATE_UNUSED *kVUID_PVError_ReservedParameter = "UNASSIGNED-GeneralParameterError-ReservedParameter"; |
| 40 | static const char DECORATE_UNUSED *kVUID_PVError_UnrecognizedValue = "UNASSIGNED-GeneralParameterError-UnrecognizedValue"; |
| 41 | static const char DECORATE_UNUSED *kVUID_PVError_DeviceLimit = "UNASSIGNED-GeneralParameterError-DeviceLimit"; |
| 42 | static const char DECORATE_UNUSED *kVUID_PVError_DeviceFeature = "UNASSIGNED-GeneralParameterError-DeviceFeature"; |
| 43 | static const char DECORATE_UNUSED *kVUID_PVError_FailureCode = "UNASSIGNED-GeneralParameterError-FailureCode"; |
| 44 | static const char DECORATE_UNUSED *kVUID_PVError_ExtensionNotEnabled = "UNASSIGNED-GeneralParameterError-ExtensionNotEnabled"; |
locke-lunarg | b1909cd | 2019-08-01 23:40:05 -0600 | [diff] [blame] | 45 | static const char DECORATE_UNUSED *kVUID_PVPerfWarn_SuboptimalSwapchain = "UNASSIGNED-GeneralParameterPerfWarn-SuboptimalSwapchain"; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 46 | |
| 47 | #undef DECORATE_UNUSED |
| 48 | |
| 49 | extern const uint32_t GeneratedVulkanHeaderVersion; |
| 50 | |
| 51 | extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits; |
| 52 | extern const VkColorComponentFlags AllVkColorComponentFlagBits; |
| 53 | extern const VkShaderStageFlags AllVkShaderStageFlagBits; |
| 54 | extern const VkQueryControlFlags AllVkQueryControlFlagBits; |
| 55 | extern const VkImageUsageFlags AllVkImageUsageFlagBits; |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 56 | extern const VkSampleCountFlags AllVkSampleCountFlagBits; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 57 | |
| 58 | extern const std::vector<VkCompareOp> AllVkCompareOpEnums; |
| 59 | extern const std::vector<VkStencilOp> AllVkStencilOpEnums; |
| 60 | extern const std::vector<VkBlendFactor> AllVkBlendFactorEnums; |
| 61 | extern const std::vector<VkBlendOp> AllVkBlendOpEnums; |
| 62 | extern const std::vector<VkLogicOp> AllVkLogicOpEnums; |
| 63 | extern const std::vector<VkBorderColor> AllVkBorderColorEnums; |
| 64 | extern const std::vector<VkImageLayout> AllVkImageLayoutEnums; |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 65 | extern const std::vector<VkFormat> AllVkFormatEnums; |
| 66 | extern const std::vector<VkVertexInputRate> AllVkVertexInputRateEnums; |
| 67 | extern const std::vector<VkPrimitiveTopology> AllVkPrimitiveTopologyEnums; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 68 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 69 | // String returned by string_VkStructureType for an unrecognized type. |
| 70 | const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType"; |
| 71 | |
| 72 | // String returned by string_VkResult for an unrecognized type. |
| 73 | const std::string UnsupportedResultString = "Unhandled VkResult"; |
| 74 | |
| 75 | // The base value used when computing the offset for an enumeration token value that is added by an extension. |
| 76 | // When validating enumeration tokens, any value >= to this value is considered to be provided by an extension. |
| 77 | // See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification |
| 78 | const uint32_t ExtEnumBaseValue = 1000000000; |
| 79 | |
| 80 | // The value of all VK_xxx_MAX_ENUM tokens |
| 81 | const uint32_t MaxEnumValue = 0x7FFFFFFF; |
| 82 | |
| 83 | // Misc parameters of log_msg that are likely constant per command (or low frequency change) |
| 84 | struct LogMiscParams { |
| 85 | VkDebugReportObjectTypeEXT objectType; |
| 86 | uint64_t srcObject; |
| 87 | const char *api_name; |
| 88 | }; |
| 89 | |
| 90 | class StatelessValidation : public ValidationObject { |
Petr Kraus | 4ed81e3 | 2019-09-02 23:41:19 +0200 | [diff] [blame] | 91 | public: |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 92 | VkPhysicalDeviceLimits device_limits = {}; |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 93 | safe_VkPhysicalDeviceFeatures2 physical_device_features2; |
| 94 | const VkPhysicalDeviceFeatures &physical_device_features = physical_device_features2.features; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 95 | |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 96 | // Override chassis read/write locks for this validation object |
| 97 | // This override takes a deferred lock. i.e. it is not acquired. |
Jeff Bolz | caeccc7 | 2019-10-15 15:35:26 -0500 | [diff] [blame] | 98 | virtual read_lock_guard_t read_lock() { return read_lock_guard_t(validation_object_mutex, std::defer_lock); } |
| 99 | virtual write_lock_guard_t write_lock() { return write_lock_guard_t(validation_object_mutex, std::defer_lock); } |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 100 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 101 | // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2KHR::pNext chain |
| 102 | struct DeviceExtensionProperties { |
| 103 | VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props; |
| 104 | VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 105 | VkPhysicalDeviceRayTracingPropertiesNV ray_tracing_props; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 106 | }; |
| 107 | DeviceExtensionProperties phys_dev_ext_props = {}; |
| 108 | |
| 109 | struct SubpassesUsageStates { |
| 110 | std::unordered_set<uint32_t> subpasses_using_color_attachment; |
| 111 | std::unordered_set<uint32_t> subpasses_using_depthstencil_attachment; |
| 112 | }; |
| 113 | |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 114 | // Though this validation object is predominantly statless, the Framebuffer checks are greatly simplified by creating and |
| 115 | // updating a map of the renderpass usage states, and these accesses need thread protection. Use a mutex separate from the |
| 116 | // parent object's to maintain that functionality. |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 117 | mutable std::mutex renderpass_map_mutex; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 118 | std::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states; |
| 119 | |
| 120 | // Constructor for stateles validation tracking |
| 121 | // StatelessValidation() : {} |
| 122 | /** |
| 123 | * Validate a minimum value. |
| 124 | * |
| 125 | * Verify that the specified value is greater than the specified lower bound. |
| 126 | * |
| 127 | * @param api_name Name of API call being validated. |
| 128 | * @param parameter_name Name of parameter being validated. |
| 129 | * @param value Value to validate. |
| 130 | * @param lower_bound Lower bound value to use for validation. |
| 131 | * @return Boolean value indicating that the call should be skipped. |
| 132 | */ |
| 133 | template <typename T> |
| 134 | bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName ¶meter_name, const std::string &vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 135 | const LogMiscParams &misc) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 136 | bool skip_call = false; |
| 137 | |
| 138 | if (value <= lower_bound) { |
| 139 | std::ostringstream ss; |
| 140 | ss << misc.api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is greater than " |
| 141 | << lower_bound; |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 142 | skip_call |= |
| 143 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, misc.objectType, misc.srcObject, vuid, "%s", ss.str().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | return skip_call; |
| 147 | } |
| 148 | |
| 149 | template <typename T> |
| 150 | bool ValidateGreaterThanZero(const T value, const ParameterName ¶meter_name, const std::string &vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 151 | const LogMiscParams &misc) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 152 | return ValidateGreaterThan(value, T{0}, parameter_name, vuid, misc); |
| 153 | } |
| 154 | /** |
| 155 | * Validate a required pointer. |
| 156 | * |
| 157 | * Verify that a required pointer is not NULL. |
| 158 | * |
| 159 | * @param apiName Name of API call being validated. |
| 160 | * @param parameterName Name of parameter being validated. |
| 161 | * @param value Pointer to validate. |
| 162 | * @return Boolean value indicating that the call should be skipped. |
| 163 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 164 | bool validate_required_pointer(const char *apiName, const ParameterName ¶meterName, const void *value, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 165 | const std::string &vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 166 | bool skip_call = false; |
| 167 | |
| 168 | if (value == NULL) { |
| 169 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 170 | "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str()); |
| 171 | } |
| 172 | |
| 173 | return skip_call; |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Validate array count and pointer to array. |
| 178 | * |
| 179 | * Verify that required count and array parameters are not 0 or NULL. If the |
| 180 | * count parameter is not optional, verify that it is not 0. If the array |
| 181 | * parameter is NULL, and it is not optional, verify that count is 0. |
| 182 | * |
| 183 | * @param apiName Name of API call being validated. |
| 184 | * @param countName Name of count parameter. |
| 185 | * @param arrayName Name of array parameter. |
| 186 | * @param count Number of elements in the array. |
| 187 | * @param array Array to validate. |
| 188 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 189 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 190 | * @return Boolean value indicating that the call should be skipped. |
| 191 | */ |
| 192 | template <typename T1, typename T2> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 193 | bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, T1 count, |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 194 | const T2 *array, bool countRequired, bool arrayRequired, const char *count_required_vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 195 | const char *array_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 196 | bool skip_call = false; |
| 197 | |
| 198 | // Count parameters not tagged as optional cannot be 0 |
| 199 | if (countRequired && (count == 0)) { |
| 200 | skip_call |= |
| 201 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, count_required_vuid, |
| 202 | "%s: parameter %s must be greater than 0.", apiName, countName.get_name().c_str()); |
| 203 | } |
| 204 | |
| 205 | // Array parameters not tagged as optional cannot be NULL, unless the count is 0 |
| 206 | if (arrayRequired && (count != 0) && (*array == NULL)) { |
| 207 | skip_call |= |
| 208 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, array_required_vuid, |
| 209 | "%s: required parameter %s specified as NULL.", apiName, arrayName.get_name().c_str()); |
| 210 | } |
| 211 | |
| 212 | return skip_call; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * Validate pointer to array count and pointer to array. |
| 217 | * |
| 218 | * Verify that required count and array parameters are not NULL. If count |
| 219 | * is not NULL and its value is not optional, verify that it is not 0. If the |
| 220 | * array parameter is NULL, and it is not optional, verify that count is 0. |
| 221 | * The array parameter will typically be optional for this case (where count is |
| 222 | * a pointer), allowing the caller to retrieve the available count. |
| 223 | * |
| 224 | * @param apiName Name of API call being validated. |
| 225 | * @param countName Name of count parameter. |
| 226 | * @param arrayName Name of array parameter. |
| 227 | * @param count Pointer to the number of elements in the array. |
| 228 | * @param array Array to validate. |
| 229 | * @param countPtrRequired The 'count' parameter may not be NULL when true. |
| 230 | * @param countValueRequired The '*count' value may not be 0 when true. |
| 231 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 232 | * @return Boolean value indicating that the call should be skipped. |
| 233 | */ |
| 234 | template <typename T1, typename T2> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 235 | bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T1 *count, |
| 236 | const T2 *array, bool countPtrRequired, bool countValueRequired, bool arrayRequired, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 237 | const char *count_required_vuid, const char *array_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 238 | bool skip_call = false; |
| 239 | |
| 240 | if (count == NULL) { |
| 241 | if (countPtrRequired) { |
| 242 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 243 | kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", apiName, |
| 244 | countName.get_name().c_str()); |
| 245 | } |
| 246 | } else { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 247 | skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array, countValueRequired, |
| 248 | arrayRequired, count_required_vuid, array_required_vuid); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 249 | } |
| 250 | |
| 251 | return skip_call; |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Validate a pointer to a Vulkan structure. |
| 256 | * |
| 257 | * Verify that a required pointer to a structure is not NULL. If the pointer is |
| 258 | * not NULL, verify that each structure's sType field is set to the correct |
| 259 | * VkStructureType value. |
| 260 | * |
| 261 | * @param apiName Name of API call being validated. |
| 262 | * @param parameterName Name of struct parameter being validated. |
| 263 | * @param sTypeName Name of expected VkStructureType value. |
| 264 | * @param value Pointer to the struct to validate. |
| 265 | * @param sType VkStructureType for structure validation. |
| 266 | * @param required The parameter may not be NULL when true. |
| 267 | * @return Boolean value indicating that the call should be skipped. |
| 268 | */ |
| 269 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 270 | bool validate_struct_type(const char *apiName, const ParameterName ¶meterName, const char *sTypeName, const T *value, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 271 | VkStructureType sType, bool required, const char *struct_vuid, const char *stype_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 272 | bool skip_call = false; |
| 273 | |
| 274 | if (value == NULL) { |
| 275 | if (required) { |
| 276 | skip_call |= |
| 277 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, struct_vuid, |
| 278 | "%s: required parameter %s specified as NULL", apiName, parameterName.get_name().c_str()); |
| 279 | } |
| 280 | } else if (value->sType != sType) { |
| 281 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, stype_vuid, |
| 282 | "%s: parameter %s->sType must be %s.", apiName, parameterName.get_name().c_str(), sTypeName); |
| 283 | } |
| 284 | |
| 285 | return skip_call; |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * Validate an array of Vulkan structures |
| 290 | * |
| 291 | * Verify that required count and array parameters are not 0 or NULL. If |
| 292 | * the array contains 1 or more structures, verify that each structure's |
| 293 | * sType field is set to the correct VkStructureType value. |
| 294 | * |
| 295 | * @param apiName Name of API call being validated. |
| 296 | * @param countName Name of count parameter. |
| 297 | * @param arrayName Name of array parameter. |
| 298 | * @param sTypeName Name of expected VkStructureType value. |
| 299 | * @param count Number of elements in the array. |
| 300 | * @param array Array to validate. |
| 301 | * @param sType VkStructureType for structure validation. |
| 302 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 303 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 304 | * @return Boolean value indicating that the call should be skipped. |
| 305 | */ |
| 306 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 307 | bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, |
| 308 | const char *sTypeName, uint32_t count, const T *array, VkStructureType sType, |
Jasper St. Pierre | 6c98f8c | 2019-01-22 15:18:03 -0800 | [diff] [blame] | 309 | bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 310 | const char *count_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 311 | bool skip_call = false; |
| 312 | |
| 313 | if ((count == 0) || (array == NULL)) { |
Jasper St. Pierre | 6c98f8c | 2019-01-22 15:18:03 -0800 | [diff] [blame] | 314 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, |
| 315 | count_required_vuid, param_vuid); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 316 | } else { |
| 317 | // Verify that all structs in the array have the correct type |
| 318 | for (uint32_t i = 0; i < count; ++i) { |
| 319 | if (array[i].sType != sType) { |
| 320 | skip_call |= |
| 321 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, stype_vuid, |
| 322 | "%s: parameter %s[%d].sType must be %s", apiName, arrayName.get_name().c_str(), i, sTypeName); |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | return skip_call; |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * Validate an array of Vulkan structures. |
| 332 | * |
| 333 | * Verify that required count and array parameters are not NULL. If count |
| 334 | * is not NULL and its value is not optional, verify that it is not 0. |
| 335 | * If the array contains 1 or more structures, verify that each structure's |
| 336 | * sType field is set to the correct VkStructureType value. |
| 337 | * |
| 338 | * @param apiName Name of API call being validated. |
| 339 | * @param countName Name of count parameter. |
| 340 | * @param arrayName Name of array parameter. |
| 341 | * @param sTypeName Name of expected VkStructureType value. |
| 342 | * @param count Pointer to the number of elements in the array. |
| 343 | * @param array Array to validate. |
| 344 | * @param sType VkStructureType for structure validation. |
| 345 | * @param countPtrRequired The 'count' parameter may not be NULL when true. |
| 346 | * @param countValueRequired The '*count' value may not be 0 when true. |
| 347 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 348 | * @return Boolean value indicating that the call should be skipped. |
| 349 | */ |
| 350 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 351 | bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, |
| 352 | const char *sTypeName, uint32_t *count, const T *array, VkStructureType sType, |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 353 | bool countPtrRequired, bool countValueRequired, bool arrayRequired, const char *stype_vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 354 | const char *param_vuid, const char *count_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 355 | bool skip_call = false; |
| 356 | |
| 357 | if (count == NULL) { |
| 358 | if (countPtrRequired) { |
| 359 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 360 | kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", apiName, |
| 361 | countName.get_name().c_str()); |
| 362 | } |
| 363 | } else { |
| 364 | skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType, |
Jasper St. Pierre | 6c98f8c | 2019-01-22 15:18:03 -0800 | [diff] [blame] | 365 | countValueRequired, arrayRequired, stype_vuid, param_vuid, count_required_vuid); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | return skip_call; |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Validate a Vulkan handle. |
| 373 | * |
| 374 | * Verify that the specified handle is not VK_NULL_HANDLE. |
| 375 | * |
| 376 | * @param api_name Name of API call being validated. |
| 377 | * @param parameter_name Name of struct parameter being validated. |
| 378 | * @param value Handle to validate. |
| 379 | * @return Boolean value indicating that the call should be skipped. |
| 380 | */ |
| 381 | template <typename T> |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 382 | bool validate_required_handle(const char *api_name, const ParameterName ¶meter_name, T value) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 383 | bool skip_call = false; |
| 384 | |
| 385 | if (value == VK_NULL_HANDLE) { |
| 386 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 387 | kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE", api_name, |
| 388 | parameter_name.get_name().c_str()); |
| 389 | } |
| 390 | |
| 391 | return skip_call; |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * Validate an array of Vulkan handles. |
| 396 | * |
| 397 | * Verify that required count and array parameters are not NULL. If count |
| 398 | * is not NULL and its value is not optional, verify that it is not 0. |
| 399 | * If the array contains 1 or more handles, verify that no handle is set to |
| 400 | * VK_NULL_HANDLE. |
| 401 | * |
| 402 | * @note This function is only intended to validate arrays of handles when none |
| 403 | * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles |
| 404 | * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead. |
| 405 | * |
| 406 | * @param api_name Name of API call being validated. |
| 407 | * @param count_name Name of count parameter. |
| 408 | * @param array_name Name of array parameter. |
| 409 | * @param count Number of elements in the array. |
| 410 | * @param array Array to validate. |
| 411 | * @param count_required The 'count' parameter may not be 0 when true. |
| 412 | * @param array_required The 'array' parameter may not be NULL when true. |
| 413 | * @return Boolean value indicating that the call should be skipped. |
| 414 | */ |
| 415 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 416 | bool validate_handle_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 417 | uint32_t count, const T *array, bool count_required, bool array_required) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 418 | bool skip_call = false; |
| 419 | |
| 420 | if ((count == 0) || (array == NULL)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 421 | skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required, |
| 422 | kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 423 | } else { |
| 424 | // Verify that no handles in the array are VK_NULL_HANDLE |
| 425 | for (uint32_t i = 0; i < count; ++i) { |
| 426 | if (array[i] == VK_NULL_HANDLE) { |
| 427 | skip_call |= |
| 428 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 429 | kVUID_PVError_RequiredParameter, "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", |
| 430 | api_name, array_name.get_name().c_str(), i); |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | return skip_call; |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * Validate string array count and content. |
| 440 | * |
| 441 | * Verify that required count and array parameters are not 0 or NULL. If the |
| 442 | * count parameter is not optional, verify that it is not 0. If the array |
| 443 | * parameter is NULL, and it is not optional, verify that count is 0. If the |
| 444 | * array parameter is not NULL, verify that none of the strings are NULL. |
| 445 | * |
| 446 | * @param apiName Name of API call being validated. |
| 447 | * @param countName Name of count parameter. |
| 448 | * @param arrayName Name of array parameter. |
| 449 | * @param count Number of strings in the array. |
| 450 | * @param array Array of strings to validate. |
| 451 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 452 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 453 | * @return Boolean value indicating that the call should be skipped. |
| 454 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 455 | bool validate_string_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count, |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 456 | const char *const *array, bool countRequired, bool arrayRequired, const char *count_required_vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 457 | const char *array_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 458 | bool skip_call = false; |
| 459 | |
| 460 | if ((count == 0) || (array == NULL)) { |
| 461 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, |
| 462 | count_required_vuid, array_required_vuid); |
| 463 | } else { |
| 464 | // Verify that strings in the array are not NULL |
| 465 | for (uint32_t i = 0; i < count; ++i) { |
| 466 | if (array[i] == NULL) { |
| 467 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 468 | kVUID_PVError_RequiredParameter, "%s: required parameter %s[%d] specified as NULL", |
| 469 | apiName, arrayName.get_name().c_str(), i); |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | return skip_call; |
| 475 | } |
| 476 | |
| 477 | // Forward declaration for pNext validation |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 478 | bool ValidatePnextStructContents(const char *api_name, const ParameterName ¶meter_name, |
| 479 | const VkBaseOutStructure *header) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 480 | |
| 481 | /** |
| 482 | * Validate a structure's pNext member. |
| 483 | * |
| 484 | * Verify that the specified pNext value points to the head of a list of |
| 485 | * allowed extension structures. If no extension structures are allowed, |
| 486 | * verify that pNext is null. |
| 487 | * |
| 488 | * @param api_name Name of API call being validated. |
| 489 | * @param parameter_name Name of parameter being validated. |
| 490 | * @param allowed_struct_names Names of allowed structs. |
| 491 | * @param next Pointer to validate. |
| 492 | * @param allowed_type_count Total number of allowed structure types. |
| 493 | * @param allowed_types Array of structure types allowed for pNext. |
| 494 | * @param header_version Version of header defining the pNext validation rules. |
| 495 | * @return Boolean value indicating that the call should be skipped. |
| 496 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 497 | bool validate_struct_pnext(const char *api_name, const ParameterName ¶meter_name, const char *allowed_struct_names, |
| 498 | const void *next, size_t allowed_type_count, const VkStructureType *allowed_types, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 499 | uint32_t header_version, const char *vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 500 | bool skip_call = false; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 501 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 502 | // TODO: The valid pNext structure types are not recursive. Each structure has its own list of valid sTypes for pNext. |
| 503 | // Codegen a map of vectors containing the allowable pNext types for each struct and use that here -- also simplifies parms. |
| 504 | if (next != NULL) { |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 505 | std::unordered_set<const void *> cycle_check; |
| 506 | std::unordered_set<VkStructureType, std::hash<int>> unique_stype_check; |
| 507 | |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 508 | const char *disclaimer = |
| 509 | "This warning is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that " |
| 510 | "you " |
| 511 | "are " |
| 512 | "using a struct from a private extension or an extension that was added to a later version of the Vulkan header, " |
| 513 | "in " |
| 514 | "which " |
| 515 | "case your use of %s is perfectly valid but is not guaranteed to work correctly with validation enabled"; |
| 516 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 517 | if (allowed_type_count == 0) { |
| 518 | std::string message = "%s: value of %s must be NULL. "; |
| 519 | message += disclaimer; |
| 520 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 521 | message.c_str(), api_name, parameter_name.get_name().c_str(), header_version, |
| 522 | parameter_name.get_name().c_str()); |
| 523 | } else { |
| 524 | const VkStructureType *start = allowed_types; |
| 525 | const VkStructureType *end = allowed_types + allowed_type_count; |
Locke | fbdd1af | 2019-04-16 15:07:23 -0600 | [diff] [blame] | 526 | const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 527 | |
| 528 | cycle_check.insert(next); |
| 529 | |
| 530 | while (current != NULL) { |
| 531 | if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) || |
| 532 | (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) && |
| 533 | ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) || |
| 534 | (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) { |
| 535 | if (cycle_check.find(current->pNext) != cycle_check.end()) { |
| 536 | std::string message = "%s: %s chain contains a cycle -- pNext pointer " PRIx64 " is repeated."; |
| 537 | skip_call |= |
| 538 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 539 | kVUID_PVError_InvalidStructPNext, message.c_str(), api_name, |
| 540 | parameter_name.get_name().c_str(), reinterpret_cast<uint64_t>(next)); |
| 541 | break; |
| 542 | } else { |
| 543 | cycle_check.insert(current->pNext); |
| 544 | } |
| 545 | |
| 546 | std::string type_name = string_VkStructureType(current->sType); |
| 547 | if (unique_stype_check.find(current->sType) != unique_stype_check.end()) { |
| 548 | std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times."; |
| 549 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, |
| 550 | VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, kVUID_PVError_InvalidStructPNext, |
| 551 | message.c_str(), api_name, parameter_name.get_name().c_str(), type_name.c_str()); |
| 552 | } else { |
| 553 | unique_stype_check.insert(current->sType); |
| 554 | } |
| 555 | |
| 556 | if (std::find(start, end, current->sType) == end) { |
| 557 | if (type_name == UnsupportedStructureTypeString) { |
| 558 | std::string message = |
| 559 | "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures are " |
| 560 | "[%s]. "; |
| 561 | message += disclaimer; |
| 562 | skip_call |= |
| 563 | log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, |
| 564 | 0, vuid, message.c_str(), api_name, parameter_name.get_name().c_str(), current->sType, |
| 565 | allowed_struct_names, header_version, parameter_name.get_name().c_str()); |
| 566 | } else { |
| 567 | std::string message = |
| 568 | "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures are " |
| 569 | "[%s]. "; |
| 570 | message += disclaimer; |
| 571 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, |
| 572 | VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, message.c_str(), api_name, |
| 573 | parameter_name.get_name().c_str(), type_name.c_str(), allowed_struct_names, |
| 574 | header_version, parameter_name.get_name().c_str()); |
| 575 | } |
| 576 | } |
| 577 | skip_call |= ValidatePnextStructContents(api_name, parameter_name, current); |
| 578 | } |
Locke | fbdd1af | 2019-04-16 15:07:23 -0600 | [diff] [blame] | 579 | current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 580 | } |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | return skip_call; |
| 585 | } |
| 586 | |
| 587 | /** |
| 588 | * Validate a VkBool32 value. |
| 589 | * |
| 590 | * Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE. |
| 591 | * |
| 592 | * @param apiName Name of API call being validated. |
| 593 | * @param parameterName Name of parameter being validated. |
| 594 | * @param value Boolean value to validate. |
| 595 | * @return Boolean value indicating that the call should be skipped. |
| 596 | */ |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 597 | bool validate_bool32(const char *apiName, const ParameterName ¶meterName, VkBool32 value) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 598 | bool skip_call = false; |
| 599 | |
| 600 | if ((value != VK_TRUE) && (value != VK_FALSE)) { |
| 601 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 602 | kVUID_PVError_UnrecognizedValue, "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE", apiName, |
| 603 | parameterName.get_name().c_str(), value); |
| 604 | } |
| 605 | |
| 606 | return skip_call; |
| 607 | } |
| 608 | |
| 609 | /** |
| 610 | * Validate a Vulkan enumeration value. |
| 611 | * |
| 612 | * Generate a warning if an enumeration token value does not fall within the core enumeration |
| 613 | * begin and end token values, and was not added to the enumeration by an extension. Extension |
| 614 | * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification, |
| 615 | * with 1,000,000,000 as the base token value. |
| 616 | * |
| 617 | * @note This function does not expect to process enumerations defining bitmask flag bits. |
| 618 | * |
| 619 | * @param apiName Name of API call being validated. |
| 620 | * @param parameterName Name of parameter being validated. |
| 621 | * @param enumName Name of the enumeration being validated. |
| 622 | * @param valid_values The list of valid values for the enumeration. |
| 623 | * @param value Enumeration value to validate. |
| 624 | * @return Boolean value indicating that the call should be skipped. |
| 625 | */ |
| 626 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 627 | bool validate_ranged_enum(const char *apiName, const ParameterName ¶meterName, const char *enumName, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 628 | const std::vector<T> &valid_values, T value, const char *vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 629 | bool skip = false; |
| 630 | |
| 631 | if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) { |
| 632 | skip |= |
| 633 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 634 | "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is " |
| 635 | "not an extension added token.", |
| 636 | apiName, parameterName.get_name().c_str(), value, enumName); |
| 637 | } |
| 638 | |
| 639 | return skip; |
| 640 | } |
| 641 | |
| 642 | /** |
| 643 | * Validate an array of Vulkan enumeration value. |
| 644 | * |
| 645 | * Process all enumeration token values in the specified array and generate a warning if a value |
| 646 | * does not fall within the core enumeration begin and end token values, and was not added to |
| 647 | * the enumeration by an extension. Extension provided enumerations use the equation specified |
| 648 | * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value. |
| 649 | * |
| 650 | * @note This function does not expect to process enumerations defining bitmask flag bits. |
| 651 | * |
| 652 | * @param apiName Name of API call being validated. |
| 653 | * @param countName Name of count parameter. |
| 654 | * @param arrayName Name of array parameter. |
| 655 | * @param enumName Name of the enumeration being validated. |
| 656 | * @param valid_values The list of valid values for the enumeration. |
| 657 | * @param count Number of enumeration values in the array. |
| 658 | * @param array Array of enumeration values to validate. |
| 659 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 660 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 661 | * @return Boolean value indicating that the call should be skipped. |
| 662 | */ |
| 663 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 664 | bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, |
| 665 | const char *enumName, const std::vector<T> &valid_values, uint32_t count, const T *array, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 666 | bool countRequired, bool arrayRequired) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 667 | bool skip_call = false; |
| 668 | |
| 669 | if ((count == 0) || (array == NULL)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 670 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined, |
| 671 | kVUIDUndefined); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 672 | } else { |
| 673 | for (uint32_t i = 0; i < count; ++i) { |
| 674 | if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) { |
| 675 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 676 | kVUID_PVError_UnrecognizedValue, |
| 677 | "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s " |
| 678 | "enumeration tokens and is not an extension added token", |
| 679 | apiName, arrayName.get_name().c_str(), i, array[i], enumName); |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | return skip_call; |
| 685 | } |
| 686 | |
| 687 | /** |
| 688 | * Verify that a reserved VkFlags value is zero. |
| 689 | * |
| 690 | * Verify that the specified value is zero, to check VkFlags values that are reserved for |
| 691 | * future use. |
| 692 | * |
| 693 | * @param api_name Name of API call being validated. |
| 694 | * @param parameter_name Name of parameter being validated. |
| 695 | * @param value Value to validate. |
| 696 | * @return Boolean value indicating that the call should be skipped. |
| 697 | */ |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 698 | bool validate_reserved_flags(const char *api_name, const ParameterName ¶meter_name, VkFlags value, const char *vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 699 | bool skip_call = false; |
| 700 | |
| 701 | if (value != 0) { |
| 702 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 703 | "%s: parameter %s must be 0.", api_name, parameter_name.get_name().c_str()); |
| 704 | } |
| 705 | |
| 706 | return skip_call; |
| 707 | } |
| 708 | |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 709 | enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit }; |
| 710 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 711 | /** |
| 712 | * Validate a Vulkan bitmask value. |
| 713 | * |
| 714 | * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits |
| 715 | * for that type. |
| 716 | * |
| 717 | * @param api_name Name of API call being validated. |
| 718 | * @param parameter_name Name of parameter being validated. |
| 719 | * @param flag_bits_name Name of the VkFlags type being validated. |
| 720 | * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated. |
| 721 | * @param value VkFlags value to validate. |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 722 | * @param flag_type The type of flag, like optional, or single bit. |
| 723 | * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type). |
| 724 | * @param flags_zero_vuid VUID used for non-optional Flags that are zero. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 725 | * @return Boolean value indicating that the call should be skipped. |
| 726 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 727 | bool validate_flags(const char *api_name, const ParameterName ¶meter_name, const char *flag_bits_name, VkFlags all_flags, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 728 | VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 729 | bool skip_call = false; |
| 730 | |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 731 | if ((value & ~all_flags) != 0) { |
| 732 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 733 | "%s: value of %s contains flag bits that are not recognized members of %s", api_name, |
| 734 | parameter_name.get_name().c_str(), flag_bits_name); |
| 735 | } |
| 736 | |
| 737 | const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit; |
| 738 | const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid; |
| 739 | if (required && value == 0) { |
| 740 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, zero_vuid, |
| 741 | "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str()); |
| 742 | } |
| 743 | |
| 744 | const auto HasMaxOneBitSet = [](const VkFlags f) { |
| 745 | // Decrement flips bits from right upto first 1. |
| 746 | // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED |
| 747 | return f == 0 || !(f & (f - 1)); |
| 748 | }; |
| 749 | |
| 750 | const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit; |
| 751 | if (is_bits_type && !HasMaxOneBitSet(value)) { |
| 752 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 753 | "%s: value of %s contains multiple members of %s when only a single value is allowed", api_name, |
| 754 | parameter_name.get_name().c_str(), flag_bits_name); |
| 755 | } |
| 756 | |
| 757 | return skip_call; |
| 758 | } |
| 759 | |
| 760 | /** |
| 761 | * Validate an array of Vulkan bitmask values. |
| 762 | * |
| 763 | * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits |
| 764 | * for that type. |
| 765 | * |
| 766 | * @param api_name Name of API call being validated. |
| 767 | * @param count_name Name of parameter being validated. |
| 768 | * @param array_name Name of parameter being validated. |
| 769 | * @param flag_bits_name Name of the VkFlags type being validated. |
| 770 | * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated. |
| 771 | * @param count Number of VkFlags values in the array. |
| 772 | * @param array Array of VkFlags value to validate. |
| 773 | * @param count_required The 'count' parameter may not be 0 when true. |
| 774 | * @param array_required The 'array' parameter may not be NULL when true. |
| 775 | * @return Boolean value indicating that the call should be skipped. |
| 776 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 777 | bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name, |
| 778 | const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 779 | bool count_required, bool array_required) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 780 | bool skip_call = false; |
| 781 | |
| 782 | if ((count == 0) || (array == NULL)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 783 | skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required, |
| 784 | kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 785 | } else { |
| 786 | // Verify that all VkFlags values in the array |
| 787 | for (uint32_t i = 0; i < count; ++i) { |
| 788 | if (array[i] == 0) { |
| 789 | // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if |
| 790 | // elements in the array are allowed be 0 |
| 791 | if (array_required) { |
| 792 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 793 | kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0", api_name, |
| 794 | array_name.get_name().c_str(), i); |
| 795 | } |
| 796 | } else if ((array[i] & (~all_flags)) != 0) { |
| 797 | skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 798 | kVUID_PVError_UnrecognizedValue, |
| 799 | "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name, |
| 800 | array_name.get_name().c_str(), i, flag_bits_name); |
| 801 | } |
| 802 | } |
| 803 | } |
| 804 | |
| 805 | return skip_call; |
| 806 | } |
| 807 | |
| 808 | template <typename ExtensionState> |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 809 | bool validate_extension_reqs(const ExtensionState &extensions, const char *vuid, const char *extension_type, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 810 | const char *extension_name) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 811 | bool skip = false; |
| 812 | if (!extension_name) { |
| 813 | return skip; // Robust to invalid char * |
| 814 | } |
| 815 | auto info = ExtensionState::get_info(extension_name); |
| 816 | |
| 817 | if (!info.state) { |
| 818 | return skip; // Unknown extensions cannot be checked so report OK |
| 819 | } |
| 820 | |
| 821 | // Check against the required list in the info |
| 822 | std::vector<const char *> missing; |
| 823 | for (const auto &req : info.requires) { |
| 824 | if (!(extensions.*(req.enabled))) { |
| 825 | missing.push_back(req.name); |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | // Report any missing requirements |
| 830 | if (missing.size()) { |
| 831 | std::string missing_joined_list = string_join(", ", missing); |
| 832 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 833 | HandleToUint64(instance), vuid, "Missing extension%s required by the %s extension %s: %s.", |
| 834 | ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 835 | } |
| 836 | return skip; |
| 837 | } |
| 838 | |
| 839 | enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 }; |
| 840 | |
| 841 | template <typename RenderPassCreateInfoGeneric> |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 842 | bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo, |
| 843 | uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags stages, const char *vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 844 | const char *target) const { |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 845 | const VkPipelineStageFlags kCommonStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; |
| 846 | const VkPipelineStageFlags kFramebufferStages = |
| 847 | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | |
| 848 | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; |
| 849 | const VkPipelineStageFlags kPrimitiveShadingPipelineStages = |
| 850 | kCommonStages | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 851 | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | |
| 852 | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 853 | VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT | VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV | kFramebufferStages; |
| 854 | const VkPipelineStageFlags kMeshShadingPipelineStages = |
| 855 | kCommonStages | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV | |
| 856 | VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV | VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV | kFramebufferStages; |
| 857 | const VkPipelineStageFlags kFragmentDensityStages = VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT; |
| 858 | const VkPipelineStageFlags kConditionalRenderingStages = VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT; |
| 859 | const VkPipelineStageFlags kCommandProcessingPipelineStages = kCommonStages | VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX; |
| 860 | |
| 861 | const VkPipelineStageFlags kGraphicsStages = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | kPrimitiveShadingPipelineStages | |
| 862 | kMeshShadingPipelineStages | kFragmentDensityStages | |
| 863 | kConditionalRenderingStages | kCommandProcessingPipelineStages; |
| 864 | |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 865 | bool skip = false; |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 866 | |
| 867 | const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) { |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 868 | if (subpass == VK_SUBPASS_EXTERNAL) |
| 869 | return false; |
| 870 | else |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 871 | return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage; |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 872 | }; |
| 873 | |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 874 | const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0; |
| 875 | if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) { |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 876 | skip |= |
| 877 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, 0, vuid, |
| 878 | "Dependency pDependencies[%" PRIu32 |
| 879 | "] specifies a %sStageMask that contains stages (%s) that are not part " |
| 880 | "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.", |
| 881 | dependency_index, target, string_VkPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass); |
| 882 | } |
| 883 | |
| 884 | return skip; |
| 885 | }; |
| 886 | |
| 887 | template <typename RenderPassCreateInfoGeneric> |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 888 | bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 889 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 890 | RenderPassCreateVersion rp_version) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 891 | bool skip = false; |
| 892 | uint32_t max_color_attachments = device_limits.maxColorAttachments; |
| 893 | bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2); |
| 894 | const char *vuid; |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame^] | 895 | const auto *separate_depth_stencil_layouts_features = |
| 896 | lvl_find_in_chain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR>(physical_device_features2.pNext); |
| 897 | const auto *attachment_description_stencil_layout = |
| 898 | lvl_find_in_chain<VkAttachmentDescriptionStencilLayoutKHR>(pCreateInfo->pNext); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 899 | |
| 900 | for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) { |
| 901 | if (pCreateInfo->pAttachments[i].format == VK_FORMAT_UNDEFINED) { |
| 902 | std::stringstream ss; |
| 903 | ss << (use_rp2 ? "vkCreateRenderPass2KHR" : "vkCreateRenderPass") << ": pCreateInfo->pAttachments[" << i |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 904 | << "].format is VK_FORMAT_UNDEFINED. "; |
| 905 | vuid = |
| 906 | use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-parameter" : "VUID-VkAttachmentDescription-format-parameter"; |
| 907 | skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 908 | "%s", ss.str().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 909 | } |
| 910 | if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_UNDEFINED || |
| 911 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 912 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-finalLayout-03061" |
| 913 | : "VUID-VkAttachmentDescription-finalLayout-00843"; |
| 914 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 915 | "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or " |
| 916 | "VK_IMAGE_LAYOUT_PREINITIALIZED.", |
| 917 | i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 918 | } |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame^] | 919 | if (!separate_depth_stencil_layouts_features || !separate_depth_stencil_layouts_features->separateDepthStencilLayouts) { |
| 920 | if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 921 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 922 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 923 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 924 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-separateDepthStencilLayouts-03298" |
| 925 | : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284"; |
| 926 | skip |= log_msg( |
| 927 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 928 | "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, " |
| 929 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or " |
| 930 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR", |
| 931 | i); |
| 932 | } |
| 933 | if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 934 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 935 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 936 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 937 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-separateDepthStencilLayouts-03299" |
| 938 | : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285"; |
| 939 | skip |= log_msg( |
| 940 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 941 | "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, " |
| 942 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or " |
| 943 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR", |
| 944 | i); |
| 945 | } |
| 946 | } |
| 947 | if (!FormatIsDepthOrStencil(pCreateInfo->pAttachments[i].format)) { |
| 948 | if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 949 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 950 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 951 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 952 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03300" : "VUID-VkAttachmentDescription-format-03286"; |
| 953 | skip |= log_msg( |
| 954 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 955 | "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, " |
| 956 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or " |
| 957 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL", |
| 958 | i); |
| 959 | } |
| 960 | if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 961 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 962 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 963 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 964 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03301" : "VUID-VkAttachmentDescription-format-03287"; |
| 965 | skip |= log_msg( |
| 966 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 967 | "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, " |
| 968 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or " |
| 969 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR", |
| 970 | i); |
| 971 | } |
| 972 | } else if (FormatIsDepthAndStencil(pCreateInfo->pAttachments[i].format)) { |
| 973 | if (use_rp2) { |
| 974 | if (!attachment_description_stencil_layout) { |
| 975 | if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 976 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) { |
| 977 | skip |= |
| 978 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 979 | "VUID-VkAttachmentDescription2KHR-format-03302", |
| 980 | "pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayoutKHR"); |
| 981 | } |
| 982 | if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 983 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) { |
| 984 | skip |= |
| 985 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 986 | "VUID-VkAttachmentDescription2KHR-format-03303", |
| 987 | "pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayoutKHR"); |
| 988 | } |
| 989 | } |
| 990 | } else { |
| 991 | if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 992 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 993 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 994 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 995 | skip |= log_msg( |
| 996 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 997 | "VUID-VkAttachmentDescription-format-03288", |
| 998 | "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, " |
| 999 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or " |
| 1000 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR", |
| 1001 | i); |
| 1002 | } |
| 1003 | if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 1004 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 1005 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 1006 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 1007 | skip |= log_msg( |
| 1008 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1009 | "VUID-VkAttachmentDescription-format-03289", |
| 1010 | "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, " |
| 1011 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or " |
| 1012 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR", |
| 1013 | i); |
| 1014 | } |
| 1015 | } |
| 1016 | } else if (FormatIsDepthOnly(pCreateInfo->pAttachments[i].format)) { |
| 1017 | if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 1018 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 1019 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03304" : "VUID-VkAttachmentDescription-format-03290"; |
| 1020 | skip |= log_msg( |
| 1021 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 1022 | "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or" |
| 1023 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR", |
| 1024 | i); |
| 1025 | } |
| 1026 | if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR || |
| 1027 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) { |
| 1028 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03305" : "VUID-VkAttachmentDescription-format-03291"; |
| 1029 | skip |= log_msg( |
| 1030 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 1031 | "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or " |
| 1032 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR", |
| 1033 | i); |
| 1034 | } |
| 1035 | } else if (FormatIsStencilOnly(pCreateInfo->pAttachments[i].format)) { |
| 1036 | if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 1037 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) { |
| 1038 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03306" : "VUID-VkAttachmentDescription-format-03292"; |
| 1039 | skip |= log_msg( |
| 1040 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 1041 | "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or" |
| 1042 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR", |
| 1043 | i); |
| 1044 | } |
| 1045 | if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 1046 | pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) { |
| 1047 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03307" : "VUID-VkAttachmentDescription-format-03293"; |
| 1048 | skip |= log_msg( |
| 1049 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 1050 | "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or " |
| 1051 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL", |
| 1052 | i); |
| 1053 | } |
| 1054 | } |
| 1055 | if (use_rp2 && attachment_description_stencil_layout) { |
| 1056 | if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || |
| 1057 | attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 1058 | attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 1059 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1060 | VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || |
| 1061 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1062 | VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL || |
| 1063 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1064 | VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL || |
| 1065 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1066 | VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) { |
| 1067 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1068 | "VUID-VkAttachmentDescriptionStencilLayoutKHR-stencilInitialLayout-03308", |
| 1069 | "VkAttachmentDescriptionStencilLayoutKHR.stencilInitialLayout must not be " |
| 1070 | "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, " |
| 1071 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, " |
| 1072 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " |
| 1073 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, " |
| 1074 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or " |
| 1075 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL."); |
| 1076 | } |
| 1077 | if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || |
| 1078 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR || |
| 1079 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR || |
| 1080 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || |
| 1081 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL || |
| 1082 | attachment_description_stencil_layout->stencilFinalLayout == |
| 1083 | VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL || |
| 1084 | attachment_description_stencil_layout->stencilFinalLayout == |
| 1085 | VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) { |
| 1086 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1087 | "VUID-VkAttachmentDescriptionStencilLayoutKHR-stencilFinalLayout-03309", |
| 1088 | "VkAttachmentDescriptionStencilLayoutKHR.stencilFinalLayout must not be " |
| 1089 | "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, " |
| 1090 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, " |
| 1091 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " |
| 1092 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, " |
| 1093 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or " |
| 1094 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL."); |
| 1095 | } |
| 1096 | if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED || |
| 1097 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) { |
| 1098 | skip |= log_msg( |
| 1099 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1100 | "VUID-VkAttachmentDescriptionStencilLayoutKHR-stencilFinalLayout-03310", |
| 1101 | "VkAttachmentDescriptionStencilLayoutKHR.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or " |
| 1102 | "VK_IMAGE_LAYOUT_PREINITIALIZED."); |
| 1103 | } |
| 1104 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1105 | } |
| 1106 | |
| 1107 | for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) { |
| 1108 | if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) { |
| 1109 | vuid = use_rp2 ? "VUID-VkSubpassDescription2KHR-colorAttachmentCount-03063" |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1110 | : "VUID-VkSubpassDescription-colorAttachmentCount-00845"; |
| 1111 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 1112 | "Cannot create a render pass with %d color attachments. Max is %d.", |
| 1113 | pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1114 | } |
| 1115 | } |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 1116 | |
| 1117 | for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) { |
| 1118 | const auto &dependency = pCreateInfo->pDependencies[i]; |
| 1119 | |
| 1120 | // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked |
| 1121 | vuid = |
| 1122 | use_rp2 ? "VUID-VkRenderPassCreateInfo2KHR-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837"; |
| 1123 | skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid, |
| 1124 | "src"); |
| 1125 | |
| 1126 | vuid = |
| 1127 | use_rp2 ? "VUID-VkRenderPassCreateInfo2KHR-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838"; |
| 1128 | skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid, |
| 1129 | "dst"); |
| 1130 | } |
| 1131 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1132 | return skip; |
| 1133 | } |
| 1134 | |
| 1135 | template <typename T> |
| 1136 | void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) { |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1137 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1138 | auto &renderpass_state = renderpasses_states[renderPass]; |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1139 | lock.unlock(); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1140 | |
| 1141 | for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) { |
| 1142 | bool uses_color = false; |
| 1143 | for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i) |
| 1144 | if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true; |
| 1145 | |
| 1146 | bool uses_depthstencil = false; |
| 1147 | if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment) |
| 1148 | if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) |
| 1149 | uses_depthstencil = true; |
| 1150 | |
| 1151 | if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass); |
| 1152 | if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass); |
| 1153 | } |
| 1154 | } |
| 1155 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1156 | bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1157 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1158 | bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1159 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1160 | bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1161 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1162 | bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid, |
| 1163 | const char *validateString) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1164 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1165 | bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1166 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1167 | bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name, |
| 1168 | const char *array_parameter_name, const std::string &unique_error_code, |
| 1169 | const std::string &valid_error_code, bool optional); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1170 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1171 | bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name, |
| 1172 | const std::string &error_code, bool optional); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1173 | |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 1174 | bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkDebugReportObjectTypeEXT object_type, |
| 1175 | uint64_t object_handle, const char *func_name) const; |
| 1176 | bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkDebugReportObjectTypeEXT object_type, uint64_t object_handle, |
| 1177 | const char *func_name) const; |
| 1178 | bool ValidateGeometryNV(const VkGeometryNV &geometry, VkDebugReportObjectTypeEXT object_type, uint64_t object_handle, |
| 1179 | const char *func_name) const; |
| 1180 | bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkDebugReportObjectTypeEXT object_type, |
| 1181 | uint64_t object_handle, const char *func_nam) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1182 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1183 | bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1184 | |
| 1185 | void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 1186 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, VkResult result); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1187 | void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 1188 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, VkResult result); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1189 | void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator); |
| 1190 | void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 1191 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1192 | |
| 1193 | void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 1194 | VkInstance *pInstance, VkResult result); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1195 | |
locke-lunarg | b1909cd | 2019-08-01 23:40:05 -0600 | [diff] [blame] | 1196 | void PostCallRecordQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo, VkResult result); |
| 1197 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1198 | bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1199 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1200 | |
| 1201 | bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1202 | VkInstance *pInstance) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1203 | |
| 1204 | bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1205 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1206 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1207 | bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1208 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1209 | |
| 1210 | bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1211 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1212 | |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 1213 | bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName ¶meter_name, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1214 | VkDebugReportObjectTypeEXT object_type, uint64_t object) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1215 | |
| 1216 | bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 1217 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1218 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1219 | bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 1220 | const VkComputePipelineCreateInfo *pCreateInfos, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1221 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1222 | |
| 1223 | bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1224 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1225 | bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1226 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1227 | VkDescriptorSetLayout *pSetLayout) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1228 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1229 | bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 1230 | const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1231 | const VkCopyDescriptorSet *pDescriptorCopies) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1232 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1233 | bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1234 | const VkDescriptorSet *pDescriptorSets) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1235 | |
| 1236 | bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1237 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1238 | |
| 1239 | bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1240 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1241 | |
| 1242 | bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1243 | const VkCommandBuffer *pCommandBuffers) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1244 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1245 | bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1246 | |
| 1247 | bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1248 | const VkViewport *pViewports) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1249 | |
| 1250 | bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1251 | const VkRect2D *pScissors) const; |
| 1252 | bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1253 | |
| 1254 | bool manual_PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1255 | uint32_t firstVertex, uint32_t firstInstance) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1256 | |
| 1257 | bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1258 | uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1259 | |
| 1260 | bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1261 | uint32_t count, uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1262 | |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 1263 | bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 1264 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1265 | const VkClearRect *pRects) const; |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 1266 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1267 | bool manual_PreCallValidateCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 1268 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1269 | const VkImageCopy *pRegions) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1270 | |
| 1271 | bool manual_PreCallValidateCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 1272 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1273 | const VkImageBlit *pRegions, VkFilter filter) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1274 | |
| 1275 | bool manual_PreCallValidateCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, |
| 1276 | VkImageLayout dstImageLayout, uint32_t regionCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1277 | const VkBufferImageCopy *pRegions) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1278 | |
| 1279 | bool manual_PreCallValidateCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1280 | VkBuffer dstBuffer, uint32_t regionCount, |
| 1281 | const VkBufferImageCopy *pRegions) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1282 | |
| 1283 | bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1284 | VkDeviceSize dataSize, const void *pData) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1285 | |
| 1286 | bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1287 | VkDeviceSize size, uint32_t data) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1288 | |
| 1289 | bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1290 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const; |
| 1291 | bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1292 | |
| 1293 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 1294 | bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1295 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1296 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 1297 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1298 | bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1299 | const VkAllocationCallbacks *pAllocator, |
| 1300 | VkDescriptorPool *pDescriptorPool) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1301 | bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1302 | uint32_t groupCountZ) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1303 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1304 | bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1305 | |
| 1306 | bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, |
| 1307 | uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1308 | uint32_t groupCountZ) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1309 | bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1310 | uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1311 | bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
| 1312 | uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1313 | const VkShadingRatePaletteNV *pShadingRatePalettes) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1314 | |
| 1315 | bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, |
| 1316 | uint32_t customSampleOrderCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1317 | const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1318 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1319 | bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1320 | bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1321 | uint32_t drawCount, uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1322 | |
| 1323 | bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1324 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1325 | uint32_t maxDrawCount, uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1326 | |
| 1327 | bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1328 | uint32_t *pPropertyCount, |
| 1329 | VkExtensionProperties *pProperties) const; |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 1330 | bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1331 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const; |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 1332 | |
| 1333 | bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device, |
| 1334 | const VkAccelerationStructureCreateInfoNV *pCreateInfo, |
| 1335 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1336 | VkAccelerationStructureNV *pAccelerationStructure) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1337 | bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, |
| 1338 | const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData, |
| 1339 | VkDeviceSize instanceOffset, VkBool32 update, |
| 1340 | VkAccelerationStructureNV dst, VkAccelerationStructureNV src, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1341 | VkBuffer scratch, VkDeviceSize scratchOffset) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1342 | bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1343 | size_t dataSize, void *pData) const; |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 1344 | bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 1345 | const VkRayTracingPipelineCreateInfoNV *pCreateInfos, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1346 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const; |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 1347 | bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1348 | uint32_t viewportCount, |
| 1349 | const VkViewportWScalingNV *pViewportWScalings) const; |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 1350 | |
| 1351 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 1352 | bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1353 | VkDeviceGroupPresentModeFlagsKHR *pModes) const; |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 1354 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 1355 | |
| 1356 | bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1357 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const; |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 1358 | |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1359 | bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1360 | uint16_t lineStipplePattern) const; |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 1361 | |
| 1362 | bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1363 | VkIndexType indexType) const; |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 1364 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1365 | bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const; |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 1366 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1367 | bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const; |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 1368 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1369 | #include "parameter_validation.h" |
| 1370 | }; // Class StatelessValidation |