Nathaniel Cesario | 645a15b | 2021-01-08 22:40:21 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2021 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2021 Valve Corporation |
| 3 | * Copyright (c) 2015-2021 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2021 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" |
Jeremy Gebben | 5f585ae | 2021-02-02 09:03:06 -0700 | [diff] [blame] | 26 | #include "sync_utils.h" |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 27 | |
| 28 | // Suppress unused warning on Linux |
| 29 | #if defined(__GNUC__) |
| 30 | #define DECORATE_UNUSED __attribute__((unused)) |
| 31 | #else |
| 32 | #define DECORATE_UNUSED |
| 33 | #endif |
| 34 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 35 | static const char DECORATE_UNUSED *kVUID_PVError_RequiredParameter = "UNASSIGNED-GeneralParameterError-RequiredParameter"; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 36 | static const char DECORATE_UNUSED *kVUID_PVError_UnrecognizedValue = "UNASSIGNED-GeneralParameterError-UnrecognizedValue"; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 37 | static const char DECORATE_UNUSED *kVUID_PVError_ExtensionNotEnabled = "UNASSIGNED-GeneralParameterError-ExtensionNotEnabled"; |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 38 | static const char DECORATE_UNUSED *kVUID_PVError_ApiVersionViolation = "UNASSIGNED-API-Version-Violation"; |
Mark Lobodzinski | acf4ab4 | 2020-10-30 15:30:10 -0600 | [diff] [blame] | 39 | // static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructPNext = "UNASSIGNED-GeneralParameterError-InvalidStructPNext"; |
| 40 | // static const char DECORATE_UNUSED *kVUID_PVError_NONE = "UNASSIGNED-GeneralParameterError-Info"; |
| 41 | // static const char DECORATE_UNUSED *kVUID_PVError_InvalidUsage = "UNASSIGNED-GeneralParameterError-InvalidUsage"; |
| 42 | // static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructSType = "UNASSIGNED-GeneralParameterError-InvalidStructSType"; |
| 43 | // static const char DECORATE_UNUSED *kVUID_PVError_ReservedParameter = "UNASSIGNED-GeneralParameterError-ReservedParameter"; |
| 44 | // static const char DECORATE_UNUSED *kVUID_PVError_DeviceLimit = "UNASSIGNED-GeneralParameterError-DeviceLimit"; |
| 45 | // static const char DECORATE_UNUSED *kVUID_PVError_FailureCode = "UNASSIGNED-GeneralParameterError-FailureCode"; |
| 46 | // static const char DECORATE_UNUSED *kVUID_PVError_DeviceFeature = "UNASSIGNED-GeneralParameterError-DeviceFeature"; |
| 47 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 48 | extern const uint32_t GeneratedVulkanHeaderVersion; |
| 49 | |
sfricke-samsung | d854f4c | 2021-07-03 23:25:05 -0700 | [diff] [blame] | 50 | // Some flags and enums are never used in and won't be generated by default |
| 51 | // Add to 'noautovalidity_type_exceptions' in parameter_validation_generator.py if needed |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 52 | extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits; |
| 53 | extern const VkColorComponentFlags AllVkColorComponentFlagBits; |
| 54 | extern const VkShaderStageFlags AllVkShaderStageFlagBits; |
| 55 | extern const VkQueryControlFlags AllVkQueryControlFlagBits; |
| 56 | extern const VkImageUsageFlags AllVkImageUsageFlagBits; |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 57 | extern const VkSampleCountFlags AllVkSampleCountFlagBits; |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 58 | extern const VkBuildAccelerationStructureFlagsNV AllVkBuildAccelerationStructureFlagBitsNV; |
| 59 | extern const VkGeometryFlagsKHR AllVkGeometryFlagBitsKHR; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 60 | |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 61 | extern const std::vector<VkGeometryTypeKHR> AllVkGeometryTypeKHREnums; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 62 | extern const std::vector<VkCompareOp> AllVkCompareOpEnums; |
| 63 | extern const std::vector<VkStencilOp> AllVkStencilOpEnums; |
| 64 | extern const std::vector<VkBlendFactor> AllVkBlendFactorEnums; |
| 65 | extern const std::vector<VkBlendOp> AllVkBlendOpEnums; |
| 66 | extern const std::vector<VkLogicOp> AllVkLogicOpEnums; |
| 67 | extern const std::vector<VkBorderColor> AllVkBorderColorEnums; |
| 68 | extern const std::vector<VkImageLayout> AllVkImageLayoutEnums; |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 69 | extern const std::vector<VkFormat> AllVkFormatEnums; |
| 70 | extern const std::vector<VkVertexInputRate> AllVkVertexInputRateEnums; |
| 71 | extern const std::vector<VkPrimitiveTopology> AllVkPrimitiveTopologyEnums; |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 72 | extern const std::vector<VkIndexType> AllVkIndexTypeEnums; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 73 | |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 74 | extern std::vector<std::pair<uint32_t, uint32_t>> custom_stype_info; |
| 75 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 76 | // String returned by string_VkStructureType for an unrecognized type. |
| 77 | const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType"; |
| 78 | |
| 79 | // String returned by string_VkResult for an unrecognized type. |
| 80 | const std::string UnsupportedResultString = "Unhandled VkResult"; |
| 81 | |
| 82 | // The base value used when computing the offset for an enumeration token value that is added by an extension. |
| 83 | // When validating enumeration tokens, any value >= to this value is considered to be provided by an extension. |
| 84 | // See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification |
| 85 | const uint32_t ExtEnumBaseValue = 1000000000; |
| 86 | |
| 87 | // The value of all VK_xxx_MAX_ENUM tokens |
| 88 | const uint32_t MaxEnumValue = 0x7FFFFFFF; |
| 89 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 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; |
Tony-LunarG | 6c3c545 | 2019-12-13 10:37:38 -0700 | [diff] [blame] | 94 | void *device_createinfo_pnext; |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 95 | const VkPhysicalDeviceFeatures &physical_device_features = physical_device_features2.features; |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 96 | layer_data::unordered_map<VkPhysicalDevice, VkPhysicalDeviceProperties *> physical_device_properties_map; |
| 97 | layer_data::unordered_map<VkPhysicalDevice, layer_data::unordered_set<std::string>> device_extensions_enumerated{}; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 98 | |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 99 | // Override chassis read/write locks for this validation object |
| 100 | // This override takes a deferred lock. i.e. it is not acquired. |
Mark Lobodzinski | 21b91fe | 2020-12-03 15:44:24 -0700 | [diff] [blame] | 101 | read_lock_guard_t read_lock() override; |
| 102 | write_lock_guard_t write_lock() override; |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 103 | |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 104 | // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2::pNext chain |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 105 | struct DeviceExtensionProperties { |
| 106 | VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props; |
| 107 | VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props; |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 108 | VkPhysicalDeviceRayTracingPropertiesNV ray_tracing_propsNV; |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 109 | VkPhysicalDeviceRayTracingPipelinePropertiesKHR ray_tracing_propsKHR; |
| 110 | VkPhysicalDeviceAccelerationStructurePropertiesKHR acc_structure_props; |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 111 | VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback_props; |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 112 | VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_attribute_divisor_props; |
ziga-lunarg | a283d02 | 2021-08-04 18:35:23 +0200 | [diff] [blame] | 113 | VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT blend_operation_advanced_props; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 114 | }; |
| 115 | DeviceExtensionProperties phys_dev_ext_props = {}; |
| 116 | |
| 117 | struct SubpassesUsageStates { |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 118 | layer_data::unordered_set<uint32_t> subpasses_using_color_attachment; |
| 119 | layer_data::unordered_set<uint32_t> subpasses_using_depthstencil_attachment; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 120 | }; |
| 121 | |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 122 | // Though this validation object is predominantly statless, the Framebuffer checks are greatly simplified by creating and |
| 123 | // updating a map of the renderpass usage states, and these accesses need thread protection. Use a mutex separate from the |
| 124 | // parent object's to maintain that functionality. |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 125 | mutable std::mutex renderpass_map_mutex; |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 126 | layer_data::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 127 | |
| 128 | // Constructor for stateles validation tracking |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 129 | StatelessValidation() : device_createinfo_pnext(nullptr) { container_type = LayerObjectTypeParameterValidation; } |
| 130 | ~StatelessValidation() { |
| 131 | if (device_createinfo_pnext) { |
| 132 | FreePnextChain(device_createinfo_pnext); |
| 133 | } |
| 134 | } |
| 135 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 136 | /** |
| 137 | * Validate a minimum value. |
| 138 | * |
| 139 | * Verify that the specified value is greater than the specified lower bound. |
| 140 | * |
| 141 | * @param api_name Name of API call being validated. |
| 142 | * @param parameter_name Name of parameter being validated. |
| 143 | * @param value Value to validate. |
| 144 | * @param lower_bound Lower bound value to use for validation. |
| 145 | * @return Boolean value indicating that the call should be skipped. |
| 146 | */ |
| 147 | template <typename T> |
| 148 | bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName ¶meter_name, const std::string &vuid, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 149 | const char *api_name) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 150 | bool skip_call = false; |
| 151 | |
| 152 | if (value <= lower_bound) { |
| 153 | std::ostringstream ss; |
Mark Lobodzinski | 525c129 | 2020-10-30 16:00:00 -0600 | [diff] [blame] | 154 | ss << api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is not greater than " |
| 155 | << lower_bound; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 156 | skip_call |= LogError(device, vuid, "%s", ss.str().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | return skip_call; |
| 160 | } |
| 161 | |
| 162 | template <typename T> |
| 163 | bool ValidateGreaterThanZero(const T value, const ParameterName ¶meter_name, const std::string &vuid, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 164 | const char *api_name) const { |
| 165 | return ValidateGreaterThan(value, T{0}, parameter_name, vuid, api_name); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 166 | } |
| 167 | /** |
| 168 | * Validate a required pointer. |
| 169 | * |
| 170 | * Verify that a required pointer is not NULL. |
| 171 | * |
| 172 | * @param apiName Name of API call being validated. |
| 173 | * @param parameterName Name of parameter being validated. |
| 174 | * @param value Pointer to validate. |
| 175 | * @return Boolean value indicating that the call should be skipped. |
| 176 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 177 | 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] | 178 | const std::string &vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 179 | bool skip_call = false; |
| 180 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 181 | if (value == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 182 | skip_call |= |
| 183 | LogError(device, vuid, "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | return skip_call; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Validate array count and pointer to array. |
| 191 | * |
| 192 | * Verify that required count and array parameters are not 0 or NULL. If the |
| 193 | * count parameter is not optional, verify that it is not 0. If the array |
| 194 | * parameter is NULL, and it is not optional, verify that count is 0. |
| 195 | * |
| 196 | * @param apiName Name of API call being validated. |
| 197 | * @param countName Name of count parameter. |
| 198 | * @param arrayName Name of array parameter. |
| 199 | * @param count Number of elements in the array. |
| 200 | * @param array Array to validate. |
| 201 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 202 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 203 | * @return Boolean value indicating that the call should be skipped. |
| 204 | */ |
| 205 | template <typename T1, typename T2> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 206 | 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] | 207 | const T2 *array, bool countRequired, bool arrayRequired, const char *count_required_vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 208 | const char *array_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 209 | bool skip_call = false; |
| 210 | |
| 211 | // Count parameters not tagged as optional cannot be 0 |
| 212 | if (countRequired && (count == 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 213 | skip_call |= LogError(device, count_required_vuid, "%s: parameter %s must be greater than 0.", apiName, |
| 214 | countName.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | // Array parameters not tagged as optional cannot be NULL, unless the count is 0 |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 218 | if (arrayRequired && (count != 0) && (*array == nullptr)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 219 | skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s specified as NULL.", apiName, |
| 220 | arrayName.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | return skip_call; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Validate pointer to array count and pointer to array. |
| 228 | * |
| 229 | * Verify that required count and array parameters are not NULL. If count |
| 230 | * is not NULL and its value is not optional, verify that it is not 0. If the |
| 231 | * array parameter is NULL, and it is not optional, verify that count is 0. |
| 232 | * The array parameter will typically be optional for this case (where count is |
| 233 | * a pointer), allowing the caller to retrieve the available count. |
| 234 | * |
| 235 | * @param apiName Name of API call being validated. |
| 236 | * @param countName Name of count parameter. |
| 237 | * @param arrayName Name of array parameter. |
| 238 | * @param count Pointer to the number of elements in the array. |
| 239 | * @param array Array to validate. |
| 240 | * @param countPtrRequired The 'count' parameter may not be NULL when true. |
| 241 | * @param countValueRequired The '*count' value may not be 0 when true. |
| 242 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
sfricke-samsung | 817d27c | 2020-12-01 22:22:56 -0800 | [diff] [blame] | 243 | * @param count_required_vuid The VUID for the '*count' parameter. |
| 244 | * @param array_required_vuid The VUID for the 'array' parameter. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 245 | * @return Boolean value indicating that the call should be skipped. |
| 246 | */ |
| 247 | template <typename T1, typename T2> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 248 | bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T1 *count, |
| 249 | const T2 *array, bool countPtrRequired, bool countValueRequired, bool arrayRequired, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 250 | const char *count_required_vuid, const char *array_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 251 | bool skip_call = false; |
| 252 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 253 | if (count == nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 254 | if (countPtrRequired) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 255 | skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", |
| 256 | apiName, countName.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 257 | } |
| 258 | } else { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 259 | skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array, countValueRequired, |
| 260 | arrayRequired, count_required_vuid, array_required_vuid); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | return skip_call; |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * Validate a pointer to a Vulkan structure. |
| 268 | * |
| 269 | * Verify that a required pointer to a structure is not NULL. If the pointer is |
| 270 | * not NULL, verify that each structure's sType field is set to the correct |
| 271 | * VkStructureType value. |
| 272 | * |
| 273 | * @param apiName Name of API call being validated. |
| 274 | * @param parameterName Name of struct parameter being validated. |
| 275 | * @param sTypeName Name of expected VkStructureType value. |
| 276 | * @param value Pointer to the struct to validate. |
| 277 | * @param sType VkStructureType for structure validation. |
| 278 | * @param required The parameter may not be NULL when true. |
| 279 | * @return Boolean value indicating that the call should be skipped. |
| 280 | */ |
| 281 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 282 | 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] | 283 | 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] | 284 | bool skip_call = false; |
| 285 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 286 | if (value == nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 287 | if (required) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 288 | skip_call |= LogError(device, struct_vuid, "%s: required parameter %s specified as NULL", apiName, |
| 289 | parameterName.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 290 | } |
| 291 | } else if (value->sType != sType) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 292 | skip_call |= LogError(device, stype_vuid, "%s: parameter %s->sType must be %s.", apiName, |
| 293 | parameterName.get_name().c_str(), sTypeName); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | return skip_call; |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * Validate an array of Vulkan structures |
| 301 | * |
| 302 | * Verify that required count and array parameters are not 0 or NULL. If |
| 303 | * the array contains 1 or more structures, verify that each structure's |
| 304 | * sType field is set to the correct VkStructureType value. |
| 305 | * |
| 306 | * @param apiName Name of API call being validated. |
| 307 | * @param countName Name of count parameter. |
| 308 | * @param arrayName Name of array parameter. |
| 309 | * @param sTypeName Name of expected VkStructureType value. |
| 310 | * @param count Number of elements in the array. |
| 311 | * @param array Array to validate. |
| 312 | * @param sType VkStructureType for structure validation. |
| 313 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 314 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 315 | * @return Boolean value indicating that the call should be skipped. |
| 316 | */ |
| 317 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 318 | bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, |
| 319 | const char *sTypeName, uint32_t count, const T *array, VkStructureType sType, |
Jasper St. Pierre | 6c98f8c | 2019-01-22 15:18:03 -0800 | [diff] [blame] | 320 | bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 321 | const char *count_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 322 | bool skip_call = false; |
| 323 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 324 | if ((count == 0) || (array == nullptr)) { |
Jasper St. Pierre | 6c98f8c | 2019-01-22 15:18:03 -0800 | [diff] [blame] | 325 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, |
| 326 | count_required_vuid, param_vuid); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 327 | } else { |
| 328 | // Verify that all structs in the array have the correct type |
| 329 | for (uint32_t i = 0; i < count; ++i) { |
| 330 | if (array[i].sType != sType) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 331 | skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d].sType must be %s", apiName, |
| 332 | arrayName.get_name().c_str(), i, sTypeName); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 333 | } |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | return skip_call; |
| 338 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 339 | |
| 340 | /** |
| 341 | * Validate an pointer type array of Vulkan structures |
| 342 | * |
| 343 | * Verify that required count and array parameters are not 0 or NULL. If |
| 344 | * the array contains 1 or more structures, verify that each structure's |
| 345 | * sType field is set to the correct VkStructureType value. |
| 346 | * |
| 347 | * @param apiName Name of API call being validated. |
| 348 | * @param countName Name of count parameter. |
| 349 | * @param arrayName Name of array parameter. |
| 350 | * @param sTypeName Name of expected VkStructureType value. |
| 351 | * @param count Number of elements in the array. |
| 352 | * @param array Array to validate. |
| 353 | * @param sType VkStructureType for structure validation. |
| 354 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 355 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 356 | * @return Boolean value indicating that the call should be skipped. |
| 357 | */ |
Mike Schuchardt | bf67ad2 | 2020-07-06 17:29:55 -0700 | [diff] [blame] | 358 | template <typename T> |
| 359 | bool validate_struct_pointer_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 360 | const char *sTypeName, uint32_t count, const T *array, VkStructureType sType, |
| 361 | bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid, |
| 362 | const char *count_required_vuid) const { |
Mike Schuchardt | bf67ad2 | 2020-07-06 17:29:55 -0700 | [diff] [blame] | 363 | bool skip_call = false; |
| 364 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 365 | if ((count == 0) || (array == nullptr)) { |
Mike Schuchardt | bf67ad2 | 2020-07-06 17:29:55 -0700 | [diff] [blame] | 366 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, |
| 367 | count_required_vuid, param_vuid); |
| 368 | } else { |
| 369 | // Verify that all structs in the array have the correct type |
| 370 | for (uint32_t i = 0; i < count; ++i) { |
| 371 | if (array[i]->sType != sType) { |
| 372 | skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d]->sType must be %s", apiName, |
| 373 | arrayName.get_name().c_str(), i, sTypeName); |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | return skip_call; |
| 379 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 380 | |
| 381 | /** |
| 382 | * Validate an array of Vulkan structures. |
| 383 | * |
| 384 | * Verify that required count and array parameters are not NULL. If count |
| 385 | * is not NULL and its value is not optional, verify that it is not 0. |
| 386 | * If the array contains 1 or more structures, verify that each structure's |
| 387 | * sType field is set to the correct VkStructureType value. |
| 388 | * |
| 389 | * @param apiName Name of API call being validated. |
| 390 | * @param countName Name of count parameter. |
| 391 | * @param arrayName Name of array parameter. |
| 392 | * @param sTypeName Name of expected VkStructureType value. |
| 393 | * @param count Pointer to the number of elements in the array. |
| 394 | * @param array Array to validate. |
| 395 | * @param sType VkStructureType for structure validation. |
| 396 | * @param countPtrRequired The 'count' parameter may not be NULL when true. |
| 397 | * @param countValueRequired The '*count' value may not be 0 when true. |
| 398 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 399 | * @return Boolean value indicating that the call should be skipped. |
| 400 | */ |
| 401 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 402 | bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, |
| 403 | const char *sTypeName, uint32_t *count, const T *array, VkStructureType sType, |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 404 | bool countPtrRequired, bool countValueRequired, bool arrayRequired, const char *stype_vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 405 | const char *param_vuid, const char *count_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 406 | bool skip_call = false; |
| 407 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 408 | if (count == nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 409 | if (countPtrRequired) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 410 | skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", |
| 411 | apiName, countName.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 412 | } |
| 413 | } else { |
| 414 | skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType, |
Mark Lobodzinski | 75a3881 | 2019-12-10 15:22:52 -0700 | [diff] [blame] | 415 | countValueRequired && (array != nullptr), arrayRequired, stype_vuid, param_vuid, |
| 416 | count_required_vuid); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 417 | } |
| 418 | |
| 419 | return skip_call; |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Validate a Vulkan handle. |
| 424 | * |
| 425 | * Verify that the specified handle is not VK_NULL_HANDLE. |
| 426 | * |
| 427 | * @param api_name Name of API call being validated. |
| 428 | * @param parameter_name Name of struct parameter being validated. |
| 429 | * @param value Handle to validate. |
| 430 | * @return Boolean value indicating that the call should be skipped. |
| 431 | */ |
| 432 | template <typename T> |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 433 | 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] | 434 | bool skip_call = false; |
| 435 | |
| 436 | if (value == VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 437 | skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE", |
| 438 | api_name, parameter_name.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | return skip_call; |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * Validate an array of Vulkan handles. |
| 446 | * |
| 447 | * Verify that required count and array parameters are not NULL. If count |
| 448 | * is not NULL and its value is not optional, verify that it is not 0. |
| 449 | * If the array contains 1 or more handles, verify that no handle is set to |
| 450 | * VK_NULL_HANDLE. |
| 451 | * |
| 452 | * @note This function is only intended to validate arrays of handles when none |
| 453 | * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles |
| 454 | * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead. |
| 455 | * |
| 456 | * @param api_name Name of API call being validated. |
| 457 | * @param count_name Name of count parameter. |
| 458 | * @param array_name Name of array parameter. |
| 459 | * @param count Number of elements in the array. |
| 460 | * @param array Array to validate. |
| 461 | * @param count_required The 'count' parameter may not be 0 when true. |
| 462 | * @param array_required The 'array' parameter may not be NULL when true. |
sfricke-samsung | 817d27c | 2020-12-01 22:22:56 -0800 | [diff] [blame] | 463 | * @param count_required_vuid The VUID for the '*count' parameter. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 464 | * @return Boolean value indicating that the call should be skipped. |
| 465 | */ |
| 466 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 467 | bool validate_handle_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name, |
sfricke-samsung | 817d27c | 2020-12-01 22:22:56 -0800 | [diff] [blame] | 468 | uint32_t count, const T *array, bool count_required, bool array_required, |
| 469 | const char *count_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 470 | bool skip_call = false; |
| 471 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 472 | if ((count == 0) || (array == nullptr)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 473 | skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required, |
sfricke-samsung | 817d27c | 2020-12-01 22:22:56 -0800 | [diff] [blame] | 474 | count_required_vuid, kVUIDUndefined); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 475 | } else { |
| 476 | // Verify that no handles in the array are VK_NULL_HANDLE |
| 477 | for (uint32_t i = 0; i < count; ++i) { |
| 478 | if (array[i] == VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 479 | skip_call |= LogError(device, kVUID_PVError_RequiredParameter, |
| 480 | "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name, |
| 481 | array_name.get_name().c_str(), i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 482 | } |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | return skip_call; |
| 487 | } |
| 488 | |
| 489 | /** |
| 490 | * Validate string array count and content. |
| 491 | * |
| 492 | * Verify that required count and array parameters are not 0 or NULL. If the |
| 493 | * count parameter is not optional, verify that it is not 0. If the array |
| 494 | * parameter is NULL, and it is not optional, verify that count is 0. If the |
| 495 | * array parameter is not NULL, verify that none of the strings are NULL. |
| 496 | * |
| 497 | * @param apiName Name of API call being validated. |
| 498 | * @param countName Name of count parameter. |
| 499 | * @param arrayName Name of array parameter. |
| 500 | * @param count Number of strings in the array. |
| 501 | * @param array Array of strings to validate. |
| 502 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 503 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 504 | * @return Boolean value indicating that the call should be skipped. |
| 505 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 506 | 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] | 507 | 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] | 508 | const char *array_required_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 509 | bool skip_call = false; |
| 510 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 511 | if ((count == 0) || (array == nullptr)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 512 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, |
| 513 | count_required_vuid, array_required_vuid); |
| 514 | } else { |
| 515 | // Verify that strings in the array are not NULL |
| 516 | for (uint32_t i = 0; i < count; ++i) { |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 517 | if (array[i] == nullptr) { |
Mark Lobodzinski | 525c129 | 2020-10-30 16:00:00 -0600 | [diff] [blame] | 518 | skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s[%d] specified as NULL", apiName, |
| 519 | arrayName.get_name().c_str(), i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 520 | } |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | return skip_call; |
| 525 | } |
| 526 | |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 527 | // Forward declarations |
| 528 | bool CheckPromotedApiAgainstVulkanVersion(VkInstance instance, const char *api_name, const uint32_t promoted_version) const; |
| 529 | bool CheckPromotedApiAgainstVulkanVersion(VkPhysicalDevice pdev, const char *api_name, const uint32_t promoted_version) const; |
Mark Lobodzinski | bece6c1 | 2020-08-27 15:34:02 -0600 | [diff] [blame] | 530 | bool SupportedByPdev(const VkPhysicalDevice physical_device, const std::string ext_name) const; |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 531 | |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 532 | bool ValidatePnextStructContents(const char *api_name, const ParameterName ¶meter_name, const VkBaseOutStructure *header, |
| 533 | const char *pnext_vuid) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 534 | |
| 535 | /** |
| 536 | * Validate a structure's pNext member. |
| 537 | * |
| 538 | * Verify that the specified pNext value points to the head of a list of |
| 539 | * allowed extension structures. If no extension structures are allowed, |
| 540 | * verify that pNext is null. |
| 541 | * |
| 542 | * @param api_name Name of API call being validated. |
| 543 | * @param parameter_name Name of parameter being validated. |
| 544 | * @param allowed_struct_names Names of allowed structs. |
| 545 | * @param next Pointer to validate. |
| 546 | * @param allowed_type_count Total number of allowed structure types. |
| 547 | * @param allowed_types Array of structure types allowed for pNext. |
| 548 | * @param header_version Version of header defining the pNext validation rules. |
| 549 | * @return Boolean value indicating that the call should be skipped. |
| 550 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 551 | bool validate_struct_pnext(const char *api_name, const ParameterName ¶meter_name, const char *allowed_struct_names, |
| 552 | const void *next, size_t allowed_type_count, const VkStructureType *allowed_types, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 553 | uint32_t header_version, const char *pnext_vuid, const char *stype_vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 554 | bool skip_call = false; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 555 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 556 | if (next != nullptr) { |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 557 | layer_data::unordered_set<const void *> cycle_check; |
| 558 | layer_data::unordered_set<VkStructureType, layer_data::hash<int>> unique_stype_check; |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 559 | |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 560 | const char *disclaimer = |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 561 | "This error is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that " |
| 562 | "you are using a struct from a private extension or an extension that was added to a later version of the Vulkan " |
| 563 | "header, in which case the use of %s is undefined and may not work correctly with validation enabled"; |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 564 | |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 565 | if ((allowed_type_count == 0) && (custom_stype_info.size() == 0)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 566 | std::string message = "%s: value of %s must be NULL. "; |
| 567 | message += disclaimer; |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 568 | skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(), |
| 569 | header_version, parameter_name.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 570 | } else { |
| 571 | const VkStructureType *start = allowed_types; |
| 572 | const VkStructureType *end = allowed_types + allowed_type_count; |
Locke | fbdd1af | 2019-04-16 15:07:23 -0600 | [diff] [blame] | 573 | const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 574 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 575 | while (current != nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 576 | if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) || |
| 577 | (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) && |
| 578 | ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) || |
| 579 | (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 580 | std::string type_name = string_VkStructureType(current->sType); |
Nathaniel Cesario | 78c1cdd | 2021-04-01 23:13:33 -0600 | [diff] [blame] | 581 | if (unique_stype_check.find(current->sType) != unique_stype_check.end() && |
| 582 | !IsDuplicatePnext(current->sType)) { |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 583 | // stype_vuid will only be null if there are no listed pNext and will hit disclaimer check |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 584 | std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times."; |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 585 | skip_call |= LogError(device, stype_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(), |
| 586 | type_name.c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 587 | } else { |
| 588 | unique_stype_check.insert(current->sType); |
| 589 | } |
| 590 | |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 591 | // Search custom stype list -- if sType found, skip this entirely |
| 592 | bool custom = false; |
John Zulauf | 79f0658 | 2021-02-27 18:38:39 -0700 | [diff] [blame] | 593 | for (const auto &item : custom_stype_info) { |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 594 | if (item.first == current->sType) { |
| 595 | custom = true; |
| 596 | break; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 597 | } |
| 598 | } |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 599 | if (!custom) { |
| 600 | if (std::find(start, end, current->sType) == end) { |
| 601 | if (type_name.compare(UnsupportedStructureTypeString) == 0) { |
| 602 | std::string message = |
| 603 | "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures " |
| 604 | "are [%s]. "; |
| 605 | message += disclaimer; |
| 606 | skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name, |
| 607 | parameter_name.get_name().c_str(), current->sType, allowed_struct_names, |
| 608 | header_version, parameter_name.get_name().c_str()); |
| 609 | } else { |
| 610 | std::string message = |
| 611 | "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures " |
| 612 | "are [%s]. "; |
| 613 | message += disclaimer; |
| 614 | skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name, |
| 615 | parameter_name.get_name().c_str(), type_name.c_str(), |
| 616 | allowed_struct_names, header_version, parameter_name.get_name().c_str()); |
| 617 | } |
| 618 | } |
| 619 | skip_call |= ValidatePnextStructContents(api_name, parameter_name, current, pnext_vuid); |
| 620 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 621 | } |
Locke | fbdd1af | 2019-04-16 15:07:23 -0600 | [diff] [blame] | 622 | current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 623 | } |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | return skip_call; |
| 628 | } |
| 629 | |
| 630 | /** |
| 631 | * Validate a VkBool32 value. |
| 632 | * |
Mark Lobodzinski | 9d85750 | 2020-10-19 09:47:11 -0600 | [diff] [blame] | 633 | * Generate an error if a VkBool32 value is neither VK_TRUE nor VK_FALSE. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 634 | * |
| 635 | * @param apiName Name of API call being validated. |
| 636 | * @param parameterName Name of parameter being validated. |
| 637 | * @param value Boolean value to validate. |
| 638 | * @return Boolean value indicating that the call should be skipped. |
| 639 | */ |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 640 | bool validate_bool32(const char *apiName, const ParameterName ¶meterName, VkBool32 value) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 641 | bool skip_call = false; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 642 | if ((value != VK_TRUE) && (value != VK_FALSE)) { |
Mark Lobodzinski | 9d85750 | 2020-10-19 09:47:11 -0600 | [diff] [blame] | 643 | skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue, |
| 644 | "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other " |
| 645 | "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.", |
| 646 | apiName, parameterName.get_name().c_str(), value); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 647 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 648 | return skip_call; |
| 649 | } |
| 650 | |
| 651 | /** |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 652 | * Validate an array of VkBool32 values. |
| 653 | * |
| 654 | * Generate an error if any VkBool32 value in an array is neither VK_TRUE nor VK_FALSE. |
| 655 | * |
| 656 | * @param apiName Name of API call being validated. |
| 657 | * @param countName Name of count parameter. |
| 658 | * @param arrayName Name of array parameter. |
| 659 | * @param count Number of values in the array. |
| 660 | * @param array Array of VkBool32 values to validate. |
| 661 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 662 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 663 | * @return Boolean value indicating that the call should be skipped. |
| 664 | */ |
| 665 | bool validate_bool32_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count, |
| 666 | const VkBool32 *array, bool countRequired, bool arrayRequired) const { |
| 667 | bool skip_call = false; |
| 668 | |
| 669 | if ((count == 0) || (array == nullptr)) { |
| 670 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined, |
| 671 | kVUIDUndefined); |
| 672 | } else { |
| 673 | for (uint32_t i = 0; i < count; ++i) { |
| 674 | if ((array[i] != VK_TRUE) && (array[i] != VK_FALSE)) { |
| 675 | skip_call |= |
| 676 | LogError(device, kVUID_PVError_UnrecognizedValue, |
| 677 | "%s: value of %s[%d] (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other " |
| 678 | "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.", |
| 679 | apiName, arrayName.get_name().c_str(), i, array[i]); |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | return skip_call; |
| 685 | } |
| 686 | |
| 687 | /** |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 688 | * Validate a Vulkan enumeration value. |
| 689 | * |
| 690 | * Generate a warning if an enumeration token value does not fall within the core enumeration |
| 691 | * begin and end token values, and was not added to the enumeration by an extension. Extension |
| 692 | * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification, |
| 693 | * with 1,000,000,000 as the base token value. |
| 694 | * |
| 695 | * @note This function does not expect to process enumerations defining bitmask flag bits. |
| 696 | * |
| 697 | * @param apiName Name of API call being validated. |
| 698 | * @param parameterName Name of parameter being validated. |
| 699 | * @param enumName Name of the enumeration being validated. |
| 700 | * @param valid_values The list of valid values for the enumeration. |
| 701 | * @param value Enumeration value to validate. |
| 702 | * @return Boolean value indicating that the call should be skipped. |
| 703 | */ |
| 704 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 705 | 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] | 706 | const std::vector<T> &valid_values, T value, const char *vuid) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 707 | bool skip = false; |
| 708 | |
| 709 | if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) { |
| 710 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 711 | LogError(device, vuid, |
| 712 | "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is " |
| 713 | "not an extension added token.", |
| 714 | apiName, parameterName.get_name().c_str(), value, enumName); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 715 | } |
| 716 | |
| 717 | return skip; |
| 718 | } |
| 719 | |
| 720 | /** |
| 721 | * Validate an array of Vulkan enumeration value. |
| 722 | * |
| 723 | * Process all enumeration token values in the specified array and generate a warning if a value |
| 724 | * does not fall within the core enumeration begin and end token values, and was not added to |
| 725 | * the enumeration by an extension. Extension provided enumerations use the equation specified |
| 726 | * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value. |
| 727 | * |
| 728 | * @note This function does not expect to process enumerations defining bitmask flag bits. |
| 729 | * |
| 730 | * @param apiName Name of API call being validated. |
| 731 | * @param countName Name of count parameter. |
| 732 | * @param arrayName Name of array parameter. |
| 733 | * @param enumName Name of the enumeration being validated. |
| 734 | * @param valid_values The list of valid values for the enumeration. |
| 735 | * @param count Number of enumeration values in the array. |
| 736 | * @param array Array of enumeration values to validate. |
| 737 | * @param countRequired The 'count' parameter may not be 0 when true. |
| 738 | * @param arrayRequired The 'array' parameter may not be NULL when true. |
| 739 | * @return Boolean value indicating that the call should be skipped. |
| 740 | */ |
| 741 | template <typename T> |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 742 | bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, |
| 743 | 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] | 744 | bool countRequired, bool arrayRequired) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 745 | bool skip_call = false; |
| 746 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 747 | if ((count == 0) || (array == nullptr)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 748 | skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined, |
| 749 | kVUIDUndefined); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 750 | } else { |
| 751 | for (uint32_t i = 0; i < count; ++i) { |
| 752 | if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 753 | skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue, |
| 754 | "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s " |
| 755 | "enumeration tokens and is not an extension added token", |
| 756 | apiName, arrayName.get_name().c_str(), i, array[i], enumName); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | return skip_call; |
| 762 | } |
| 763 | |
| 764 | /** |
| 765 | * Verify that a reserved VkFlags value is zero. |
| 766 | * |
| 767 | * Verify that the specified value is zero, to check VkFlags values that are reserved for |
| 768 | * future use. |
| 769 | * |
| 770 | * @param api_name Name of API call being validated. |
| 771 | * @param parameter_name Name of parameter being validated. |
| 772 | * @param value Value to validate. |
| 773 | * @return Boolean value indicating that the call should be skipped. |
| 774 | */ |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 775 | 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] | 776 | bool skip_call = false; |
| 777 | |
| 778 | if (value != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 779 | skip_call |= LogError(device, vuid, "%s: parameter %s must be 0.", api_name, parameter_name.get_name().c_str()); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | return skip_call; |
| 783 | } |
| 784 | |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 785 | enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit }; |
| 786 | |
Jeremy Gebben | 97e718e | 2021-02-15 07:39:51 -0700 | [diff] [blame] | 787 | // helper to implement validation of both 32 bit and 64 bit flags. |
| 788 | template <typename FlagTypedef> |
| 789 | bool validate_flags_impl(const char *api_name, const ParameterName ¶meter_name, const char *flag_bits_name, |
| 790 | FlagTypedef all_flags, FlagTypedef value, const FlagType flag_type, const char *vuid, |
| 791 | const char *flags_zero_vuid = nullptr) const { |
| 792 | bool skip_call = false; |
| 793 | |
| 794 | if ((value & ~all_flags) != 0) { |
| 795 | skip_call |= LogError(device, vuid, "%s: value of %s contains flag bits that are not recognized members of %s", |
| 796 | api_name, parameter_name.get_name().c_str(), flag_bits_name); |
| 797 | } |
| 798 | |
| 799 | const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit; |
| 800 | const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid; |
| 801 | if (required && value == 0) { |
| 802 | skip_call |= LogError(device, zero_vuid, "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str()); |
| 803 | } |
| 804 | |
| 805 | const auto HasMaxOneBitSet = [](const FlagTypedef f) { |
| 806 | // Decrement flips bits from right upto first 1. |
| 807 | // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED |
| 808 | return f == 0 || !(f & (f - 1)); |
| 809 | }; |
| 810 | |
| 811 | const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit; |
| 812 | if (is_bits_type && !HasMaxOneBitSet(value)) { |
| 813 | skip_call |= |
| 814 | LogError(device, vuid, "%s: value of %s contains multiple members of %s when only a single value is allowed", |
| 815 | api_name, parameter_name.get_name().c_str(), flag_bits_name); |
| 816 | } |
| 817 | |
| 818 | return skip_call; |
| 819 | } |
| 820 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 821 | /** |
Jeremy Gebben | 97e718e | 2021-02-15 07:39:51 -0700 | [diff] [blame] | 822 | * Validate a 32 bit Vulkan bitmask value. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 823 | * |
| 824 | * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits |
| 825 | * for that type. |
| 826 | * |
| 827 | * @param api_name Name of API call being validated. |
| 828 | * @param parameter_name Name of parameter being validated. |
| 829 | * @param flag_bits_name Name of the VkFlags type being validated. |
| 830 | * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated. |
| 831 | * @param value VkFlags value to validate. |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 832 | * @param flag_type The type of flag, like optional, or single bit. |
| 833 | * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type). |
| 834 | * @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] | 835 | * @return Boolean value indicating that the call should be skipped. |
| 836 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 837 | 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] | 838 | VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const { |
Jeremy Gebben | 97e718e | 2021-02-15 07:39:51 -0700 | [diff] [blame] | 839 | return validate_flags_impl<VkFlags>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid, |
| 840 | flags_zero_vuid); |
| 841 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 842 | |
Jeremy Gebben | 97e718e | 2021-02-15 07:39:51 -0700 | [diff] [blame] | 843 | /** |
| 844 | * Validate a 64 bit Vulkan bitmask value. |
| 845 | * |
| 846 | * Generate a warning if a value with a VkFlags64 derived type does not contain valid flag bits |
| 847 | * for that type. |
| 848 | * |
| 849 | * @param api_name Name of API call being validated. |
| 850 | * @param parameter_name Name of parameter being validated. |
| 851 | * @param flag_bits_name Name of the VkFlags64 type being validated. |
| 852 | * @param all_flags A bit mask combining all valid flag bits for the VkFlags64 type being validated. |
| 853 | * @param value VkFlags64 value to validate. |
| 854 | * @param flag_type The type of flag, like optional, or single bit. |
| 855 | * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type). |
| 856 | * @param flags_zero_vuid VUID used for non-optional Flags that are zero. |
| 857 | * @return Boolean value indicating that the call should be skipped. |
| 858 | */ |
| 859 | bool validate_flags(const char *api_name, const ParameterName ¶meter_name, const char *flag_bits_name, VkFlags64 all_flags, |
| 860 | VkFlags64 value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const { |
| 861 | return validate_flags_impl<VkFlags64>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid, |
| 862 | flags_zero_vuid); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 863 | } |
| 864 | |
| 865 | /** |
| 866 | * Validate an array of Vulkan bitmask values. |
| 867 | * |
| 868 | * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits |
| 869 | * for that type. |
| 870 | * |
| 871 | * @param api_name Name of API call being validated. |
| 872 | * @param count_name Name of parameter being validated. |
| 873 | * @param array_name Name of parameter being validated. |
| 874 | * @param flag_bits_name Name of the VkFlags type being validated. |
| 875 | * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated. |
| 876 | * @param count Number of VkFlags values in the array. |
| 877 | * @param array Array of VkFlags value to validate. |
| 878 | * @param count_required The 'count' parameter may not be 0 when true. |
| 879 | * @param array_required The 'array' parameter may not be NULL when true. |
| 880 | * @return Boolean value indicating that the call should be skipped. |
| 881 | */ |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 882 | bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name, |
| 883 | 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] | 884 | bool count_required, bool array_required) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 885 | bool skip_call = false; |
| 886 | |
Mike Schuchardt | f39a8dc | 2021-04-19 08:55:48 -0700 | [diff] [blame] | 887 | if ((count == 0) || (array == nullptr)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 888 | skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required, |
| 889 | kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 890 | } else { |
| 891 | // Verify that all VkFlags values in the array |
| 892 | for (uint32_t i = 0; i < count; ++i) { |
| 893 | if (array[i] == 0) { |
| 894 | // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if |
| 895 | // elements in the array are allowed be 0 |
| 896 | if (array_required) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 897 | skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0", |
| 898 | api_name, array_name.get_name().c_str(), i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 899 | } |
| 900 | } else if ((array[i] & (~all_flags)) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 901 | skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue, |
| 902 | "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name, |
| 903 | array_name.get_name().c_str(), i, flag_bits_name); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 904 | } |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | return skip_call; |
| 909 | } |
| 910 | |
| 911 | template <typename ExtensionState> |
Jeff Bolz | fdd0d85 | 2019-02-03 21:55:12 -0600 | [diff] [blame] | 912 | 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] | 913 | const char *extension_name) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 914 | bool skip = false; |
| 915 | if (!extension_name) { |
| 916 | return skip; // Robust to invalid char * |
| 917 | } |
| 918 | auto info = ExtensionState::get_info(extension_name); |
| 919 | |
| 920 | if (!info.state) { |
| 921 | return skip; // Unknown extensions cannot be checked so report OK |
| 922 | } |
| 923 | |
| 924 | // Check against the required list in the info |
| 925 | std::vector<const char *> missing; |
Petr Kraus | bce952d | 2020-04-02 18:40:40 +0200 | [diff] [blame] | 926 | for (const auto &req : info.requirements) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 927 | if (!(extensions.*(req.enabled))) { |
| 928 | missing.push_back(req.name); |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | // Report any missing requirements |
| 933 | if (missing.size()) { |
| 934 | std::string missing_joined_list = string_join(", ", missing); |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 935 | skip |= LogError(instance, vuid, "Missing extension%s required by the %s extension %s: %s.", |
| 936 | ((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] | 937 | } |
| 938 | return skip; |
| 939 | } |
| 940 | |
| 941 | enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 }; |
| 942 | |
| 943 | template <typename RenderPassCreateInfoGeneric> |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 944 | bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo, |
Jeremy Gebben | 40a2294 | 2020-12-22 14:22:06 -0700 | [diff] [blame] | 945 | uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags2KHR stages, |
| 946 | const char *vuid, const char *target, const char *func_name) const { |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 947 | bool skip = false; |
Jeremy Gebben | 5f585ae | 2021-02-02 09:03:06 -0700 | [diff] [blame] | 948 | // make sure we consider all of the expanded and un-expanded graphics bits to be valid |
Jeremy Gebben | 40a2294 | 2020-12-22 14:22:06 -0700 | [diff] [blame] | 949 | const auto kExcludeStages = VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR | VK_PIPELINE_STAGE_2_COPY_BIT_KHR | |
| 950 | VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR | VK_PIPELINE_STAGE_2_BLIT_BIT_KHR | |
| 951 | VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR; |
| 952 | const auto kMetaGraphicsStages = VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR | VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR | |
| 953 | VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR; |
| 954 | const auto kGraphicsStages = |
| 955 | (sync_utils::ExpandPipelineStages(VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_QUEUE_GRAPHICS_BIT) | kMetaGraphicsStages) & |
| 956 | ~kExcludeStages; |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 957 | |
| 958 | const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) { |
Jeremy Gebben | 12933ef | 2021-05-12 17:16:27 -0600 | [diff] [blame] | 959 | if (subpass == VK_SUBPASS_EXTERNAL || subpass >= pCreateInfo->subpassCount) |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 960 | return false; |
| 961 | else |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 962 | return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage; |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 963 | }; |
| 964 | |
Petr Kraus | dfd2644 | 2019-08-13 03:25:19 +0200 | [diff] [blame] | 965 | const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0; |
| 966 | if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) { |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 967 | skip |= LogError(VkRenderPass(0), vuid, |
| 968 | "%s: Dependency pDependencies[%" PRIu32 |
| 969 | "] specifies a %sStageMask that contains stages (%s) that are not part " |
| 970 | "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.", |
Jeremy Gebben | 40a2294 | 2020-12-22 14:22:06 -0700 | [diff] [blame] | 971 | func_name, dependency_index, target, |
| 972 | sync_utils::StringPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass); |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | return skip; |
| 976 | }; |
| 977 | |
| 978 | template <typename RenderPassCreateInfoGeneric> |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 979 | bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 980 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 981 | RenderPassCreateVersion rp_version) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 982 | bool skip = false; |
| 983 | uint32_t max_color_attachments = device_limits.maxColorAttachments; |
| 984 | bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2); |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 985 | const char *func_name = (use_rp2) ? "vkCreateRenderPass2" : "vkCreateRenderPass"; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 986 | const char *vuid; |
Tony-LunarG | b036c2f | 2019-12-05 14:38:25 -0700 | [diff] [blame] | 987 | VkBool32 separate_depth_stencil_layouts = false; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 988 | const auto *vulkan_12_features = LvlFindInChain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext); |
Tony-LunarG | b036c2f | 2019-12-05 14:38:25 -0700 | [diff] [blame] | 989 | if (vulkan_12_features) { |
| 990 | separate_depth_stencil_layouts = vulkan_12_features->separateDepthStencilLayouts; |
| 991 | } else { |
| 992 | const auto *separate_depth_stencil_layouts_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 993 | LvlFindInChain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures>(device_createinfo_pnext); |
Tony-LunarG | b036c2f | 2019-12-05 14:38:25 -0700 | [diff] [blame] | 994 | if (separate_depth_stencil_layouts_features) |
| 995 | separate_depth_stencil_layouts = separate_depth_stencil_layouts_features->separateDepthStencilLayouts; |
| 996 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 997 | |
| 998 | for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) { |
Piers Daniell | 4fde9b7 | 2019-11-27 16:19:46 -0700 | [diff] [blame] | 999 | const auto *attachment_description_stencil_layout = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 1000 | (use_rp2) ? LvlFindInChain<VkAttachmentDescriptionStencilLayout>( |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1001 | reinterpret_cast<VkAttachmentDescription2 const *>(&pCreateInfo->pAttachments[i])->pNext) |
Piers Daniell | 4fde9b7 | 2019-11-27 16:19:46 -0700 | [diff] [blame] | 1002 | : 0; |
| 1003 | |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1004 | const VkFormat attachment_format = pCreateInfo->pAttachments[i].format; |
| 1005 | const VkImageLayout initial_layout = pCreateInfo->pAttachments[i].initialLayout; |
| 1006 | const VkImageLayout final_layout = pCreateInfo->pAttachments[i].finalLayout; |
| 1007 | if (attachment_format == VK_FORMAT_UNDEFINED) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1008 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-parameter" : "VUID-VkAttachmentDescription-format-parameter"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1009 | skip |= LogWarning(device, vuid, "%s: pCreateInfo->pAttachments[%u].format is VK_FORMAT_UNDEFINED.", func_name, i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1010 | } |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1011 | if (final_layout == VK_IMAGE_LAYOUT_UNDEFINED || final_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1012 | vuid = |
| 1013 | use_rp2 ? "VUID-VkAttachmentDescription2-finalLayout-03061" : "VUID-VkAttachmentDescription-finalLayout-00843"; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1014 | skip |= LogError(device, vuid, |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1015 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1016 | "VK_IMAGE_LAYOUT_PREINITIALIZED.", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1017 | func_name, i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1018 | } |
Tony-LunarG | b036c2f | 2019-12-05 14:38:25 -0700 | [diff] [blame] | 1019 | if (!separate_depth_stencil_layouts) { |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1020 | if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1021 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
| 1022 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1023 | pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1024 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03298" |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1025 | : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284"; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1026 | skip |= LogError( |
| 1027 | device, vuid, |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1028 | "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, " |
| 1029 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or " |
| 1030 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1031 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1032 | } |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1033 | if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1034 | final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
| 1035 | final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1036 | final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1037 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03299" |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1038 | : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285"; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1039 | skip |= LogError( |
| 1040 | device, vuid, |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1041 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, " |
| 1042 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or " |
| 1043 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1044 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1045 | } |
| 1046 | } |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1047 | if (!FormatIsDepthOrStencil(attachment_format)) { |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1048 | if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1049 | initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
| 1050 | initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1051 | initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1052 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03300" : "VUID-VkAttachmentDescription-format-03286"; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1053 | skip |= LogError( |
| 1054 | device, vuid, |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1055 | "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, " |
| 1056 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or " |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1057 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1058 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1059 | } |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1060 | if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1061 | final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
| 1062 | final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1063 | final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1064 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03301" : "VUID-VkAttachmentDescription-format-03287"; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1065 | skip |= LogError( |
| 1066 | device, vuid, |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1067 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, " |
| 1068 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or " |
| 1069 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1070 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1071 | } |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1072 | } else if (FormatIsDepthAndStencil(attachment_format)) { |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1073 | if (use_rp2) { |
| 1074 | if (!attachment_description_stencil_layout) { |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1075 | if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1076 | initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) { |
| 1077 | skip |= |
| 1078 | LogError(device, "VUID-VkAttachmentDescription2-format-03302", |
| 1079 | "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout", |
| 1080 | func_name); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1081 | } |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1082 | if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1083 | final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) { |
| 1084 | skip |= |
| 1085 | LogError(device, "VUID-VkAttachmentDescription2-format-03303", |
| 1086 | "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout", |
| 1087 | func_name); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1088 | } |
| 1089 | } |
| 1090 | } else { |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1091 | if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1092 | initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
| 1093 | initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1094 | initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
| 1095 | skip |= LogError(device, "VUID-VkAttachmentDescription-format-03288", |
| 1096 | "%s: pCreateInfo->pAttachments[%d].initialLayout must not be " |
| 1097 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, " |
| 1098 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or " |
| 1099 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL", |
| 1100 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1101 | } |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1102 | if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1103 | final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
| 1104 | final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1105 | final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
| 1106 | skip |= LogError(device, "VUID-VkAttachmentDescription-format-03289", |
| 1107 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be " |
| 1108 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, " |
| 1109 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or " |
| 1110 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL", |
| 1111 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1112 | } |
| 1113 | } |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1114 | } else if (FormatIsDepthOnly(attachment_format)) { |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1115 | if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1116 | initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1117 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03304" : "VUID-VkAttachmentDescription-format-03290"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1118 | skip |= LogError(device, vuid, |
| 1119 | "%s: pCreateInfo->pAttachments[%d].initialLayout must not be " |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1120 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or" |
| 1121 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1122 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1123 | } |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1124 | if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL || |
| 1125 | final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1126 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03305" : "VUID-VkAttachmentDescription-format-03291"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1127 | skip |= LogError(device, vuid, |
| 1128 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be " |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1129 | "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or " |
| 1130 | "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1131 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1132 | } |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1133 | } else if (FormatIsStencilOnly(attachment_format)) { |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1134 | if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1135 | initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1136 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03306" : "VUID-VkAttachmentDescription-format-03292"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1137 | skip |= LogError(device, vuid, |
| 1138 | "%s: pCreateInfo->pAttachments[%d].initialLayout must not be " |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1139 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or" |
| 1140 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1141 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1142 | } |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1143 | if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1144 | final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1145 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03307" : "VUID-VkAttachmentDescription-format-03293"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1146 | skip |= LogError(device, vuid, |
| 1147 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be " |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1148 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or " |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1149 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL", |
| 1150 | func_name, i); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1151 | } |
| 1152 | } |
| 1153 | if (use_rp2 && attachment_description_stencil_layout) { |
| 1154 | if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1155 | attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1156 | attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1157 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1158 | VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || |
| 1159 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1160 | VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL || |
| 1161 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1162 | VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL || |
| 1163 | attachment_description_stencil_layout->stencilInitialLayout == |
| 1164 | VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1165 | skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308", |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1166 | "%s: VkAttachmentDescriptionStencilLayout.stencilInitialLayout must not be " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1167 | "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, " |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1168 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1169 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " |
| 1170 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, " |
| 1171 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or " |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1172 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.", |
| 1173 | func_name); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1174 | } |
| 1175 | if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1176 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL || |
| 1177 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL || |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1178 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || |
| 1179 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL || |
| 1180 | attachment_description_stencil_layout->stencilFinalLayout == |
| 1181 | VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL || |
| 1182 | attachment_description_stencil_layout->stencilFinalLayout == |
| 1183 | VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1184 | skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309", |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1185 | "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1186 | "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, " |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1187 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1188 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " |
| 1189 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, " |
| 1190 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or " |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1191 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.", |
| 1192 | func_name); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1193 | } |
| 1194 | if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED || |
| 1195 | attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1196 | skip |= LogError( |
| 1197 | device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310", |
sfricke-samsung | a6c67fb | 2020-12-15 20:51:42 -0800 | [diff] [blame] | 1198 | "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or " |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1199 | "VK_IMAGE_LAYOUT_PREINITIALIZED.", |
| 1200 | func_name); |
Piers Daniell | 9af77cd | 2019-10-16 13:54:12 -0600 | [diff] [blame] | 1201 | } |
| 1202 | } |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1203 | |
| 1204 | if (FormatIsDepthOrStencil(attachment_format)) { |
| 1205 | if (initial_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) { |
| 1206 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03295" : "VUID-VkAttachmentDescription-format-03281"; |
| 1207 | skip |= LogError(device, vuid, |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1208 | "%s: pCreateInfo->pAttachments[%d].initialLayout must not be " |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1209 | "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1210 | func_name, i); |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1211 | } |
| 1212 | if (final_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) { |
| 1213 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03297" : "VUID-VkAttachmentDescription-format-03283"; |
| 1214 | skip |= LogError(device, vuid, |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1215 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be " |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1216 | "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format", |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1217 | func_name, i); |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1218 | } |
| 1219 | } |
| 1220 | if (FormatIsColor(attachment_format)) { |
| 1221 | if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || |
| 1222 | initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL || |
| 1223 | initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL || |
| 1224 | initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) { |
| 1225 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03294" : "VUID-VkAttachmentDescription-format-03280"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1226 | skip |= LogError(device, vuid, |
| 1227 | "%s: pCreateInfo->pAttachments[%d].initialLayout must not be " |
| 1228 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " |
| 1229 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, " |
| 1230 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or " |
| 1231 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format", |
| 1232 | func_name, i); |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1233 | } |
| 1234 | if (final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || |
| 1235 | final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL || |
| 1236 | final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL || |
| 1237 | final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) { |
| 1238 | vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03296" : "VUID-VkAttachmentDescription-format-03282"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1239 | skip |= LogError(device, vuid, |
| 1240 | "%s: pCreateInfo->pAttachments[%d].finalLayout must not be " |
| 1241 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, " |
| 1242 | "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, " |
| 1243 | "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or " |
| 1244 | "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format", |
| 1245 | func_name, i); |
sfricke-samsung | cac6a26 | 2020-04-28 07:50:49 -0700 | [diff] [blame] | 1246 | } |
| 1247 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1248 | } |
| 1249 | |
| 1250 | for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) { |
| 1251 | if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1252 | vuid = use_rp2 ? "VUID-VkSubpassDescription2-colorAttachmentCount-03063" |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1253 | : "VUID-VkSubpassDescription-colorAttachmentCount-00845"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1254 | skip |= |
| 1255 | LogError(device, vuid, |
| 1256 | "%s: Cannot create a render pass with %d color attachments in pCreateInfo->pSubpasses[%u]. Max is %d.", |
| 1257 | func_name, pCreateInfo->pSubpasses[i].colorAttachmentCount, i, max_color_attachments); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1258 | } |
| 1259 | } |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 1260 | |
| 1261 | for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) { |
| 1262 | const auto &dependency = pCreateInfo->pDependencies[i]; |
| 1263 | |
sfricke-samsung | 55f0195 | 2020-03-24 08:16:41 -0700 | [diff] [blame] | 1264 | // Need to check first so layer doesn't segfault from out of bound array access |
| 1265 | // src subpass bound check |
Mark Lobodzinski | f5a10b6 | 2020-03-09 13:16:13 -0600 | [diff] [blame] | 1266 | if ((dependency.srcSubpass != VK_SUBPASS_EXTERNAL) && (dependency.srcSubpass >= pCreateInfo->subpassCount)) { |
sfricke-samsung | 55f0195 | 2020-03-24 08:16:41 -0700 | [diff] [blame] | 1267 | vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-srcSubpass-02526" : "VUID-VkRenderPassCreateInfo-srcSubpass-02517"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1268 | skip |= LogError(device, vuid, |
| 1269 | "%s: pCreateInfo->pDependencies[%u].srcSubpass index (%u) has to be less than subpassCount (%u)", |
| 1270 | func_name, i, dependency.srcSubpass, pCreateInfo->subpassCount); |
Mark Lobodzinski | f5a10b6 | 2020-03-09 13:16:13 -0600 | [diff] [blame] | 1271 | } |
| 1272 | |
sfricke-samsung | 55f0195 | 2020-03-24 08:16:41 -0700 | [diff] [blame] | 1273 | // dst subpass bound check |
Mark Lobodzinski | f5a10b6 | 2020-03-09 13:16:13 -0600 | [diff] [blame] | 1274 | if ((dependency.dstSubpass != VK_SUBPASS_EXTERNAL) && (dependency.dstSubpass >= pCreateInfo->subpassCount)) { |
sfricke-samsung | 55f0195 | 2020-03-24 08:16:41 -0700 | [diff] [blame] | 1275 | vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-dstSubpass-02527" : "VUID-VkRenderPassCreateInfo-dstSubpass-02518"; |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1276 | skip |= LogError(device, vuid, |
| 1277 | "%s: pCreateInfo->pDependencies[%u].dstSubpass index (%u) has to be less than subpassCount (%u)", |
| 1278 | func_name, i, dependency.dstSubpass, pCreateInfo->subpassCount); |
Mark Lobodzinski | f5a10b6 | 2020-03-09 13:16:13 -0600 | [diff] [blame] | 1279 | } |
| 1280 | |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 1281 | // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 1282 | vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837"; |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 1283 | skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid, |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1284 | "src", func_name); |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 1285 | |
Tony-LunarG | b036c2f | 2019-12-05 14:38:25 -0700 | [diff] [blame] | 1286 | vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838"; |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 1287 | skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid, |
sfricke-samsung | 46fc663 | 2020-09-12 14:28:58 -0700 | [diff] [blame] | 1288 | "dst", func_name); |
Petr Kraus | 3e52eba | 2019-07-10 01:24:10 +0200 | [diff] [blame] | 1289 | } |
| 1290 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1291 | return skip; |
| 1292 | } |
| 1293 | |
| 1294 | template <typename T> |
| 1295 | void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) { |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1296 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1297 | auto &renderpass_state = renderpasses_states[renderPass]; |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1298 | lock.unlock(); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1299 | |
| 1300 | for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) { |
| 1301 | bool uses_color = false; |
| 1302 | for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i) |
| 1303 | if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true; |
| 1304 | |
| 1305 | bool uses_depthstencil = false; |
| 1306 | if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment) |
| 1307 | if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) |
| 1308 | uses_depthstencil = true; |
| 1309 | |
| 1310 | if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass); |
| 1311 | if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass); |
| 1312 | } |
| 1313 | } |
| 1314 | |
Mark Lobodzinski | 21b91fe | 2020-12-03 15:44:24 -0700 | [diff] [blame] | 1315 | // Pre/PostCallRecord declarations |
| 1316 | void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
| 1317 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 1318 | VkResult result) override; |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 1319 | void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, |
Mark Lobodzinski | 21b91fe | 2020-12-03 15:44:24 -0700 | [diff] [blame] | 1320 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 1321 | VkResult result) override; |
| 1322 | void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, |
| 1323 | const VkAllocationCallbacks *pAllocator) override; |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 1324 | void PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
| 1325 | VkCommandBuffer *pCommandBuffers, VkResult result) override; |
| 1326 | void PostCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
| 1327 | const VkCommandBuffer *pCommandBuffers) override; |
| 1328 | void PostCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool, |
| 1329 | const VkAllocationCallbacks *pAllocator) override; |
Mark Lobodzinski | 21b91fe | 2020-12-03 15:44:24 -0700 | [diff] [blame] | 1330 | void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
| 1331 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) override; |
| 1332 | void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 1333 | VkInstance *pInstance, VkResult result) override; |
| 1334 | |
Nathaniel Cesario | 645a15b | 2021-01-08 22:40:21 -0700 | [diff] [blame] | 1335 | void CommonPostCallRecordEnumeratePhysicalDevice(const VkPhysicalDevice *phys_devices, const int count); |
| 1336 | void PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
| 1337 | VkPhysicalDevice *pPhysicalDevices, VkResult result) override; |
| 1338 | |
| 1339 | void PostCallRecordEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, |
| 1340 | VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties, |
| 1341 | VkResult result) override; |
| 1342 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1343 | 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] | 1344 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1345 | bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1346 | |
Tony-LunarG | 866843d | 2020-05-13 11:22:42 -0600 | [diff] [blame] | 1347 | bool validate_validation_features(const VkInstanceCreateInfo *pCreateInfo, |
| 1348 | const VkValidationFeaturesEXT *validation_features) const; |
| 1349 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1350 | 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] | 1351 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1352 | bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid, |
| 1353 | const char *validateString) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1354 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1355 | bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1356 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1357 | bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name, |
| 1358 | const char *array_parameter_name, const std::string &unique_error_code, |
| 1359 | const std::string &valid_error_code, bool optional); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1360 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1361 | bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name, |
| 1362 | const std::string &error_code, bool optional); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1363 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1364 | bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkAccelerationStructureNV object_handle, |
| 1365 | const char *func_name) const; |
| 1366 | bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkAccelerationStructureNV object_handle, |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 1367 | const char *func_name) const; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1368 | bool ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, const char *func_name) const; |
| 1369 | bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkAccelerationStructureNV object_handle, |
Mark Lobodzinski | 17dc460 | 2020-05-29 07:48:40 -0600 | [diff] [blame] | 1370 | const char *func_nam, bool is_cmd) const; |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 1371 | bool ValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, |
| 1372 | const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion, |
| 1373 | const char *apiName) const; |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 1374 | bool ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset, |
| 1375 | bool khr) const; |
| 1376 | bool ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset, |
| 1377 | bool khr) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1378 | |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 1379 | bool ValidateSwapchainCreateInfo(const char *func_name, VkSwapchainCreateInfoKHR const *pCreateInfo) const; |
| 1380 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1381 | 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] | 1382 | |
Mark Lobodzinski | 21b91fe | 2020-12-03 15:44:24 -0700 | [diff] [blame] | 1383 | void PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) override; |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 1384 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1385 | bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1386 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1387 | |
| 1388 | bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1389 | VkInstance *pInstance) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1390 | |
| 1391 | bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1392 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1393 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1394 | bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1395 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1396 | |
| 1397 | bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1398 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1399 | |
Jeff Bolz | 99e3f63 | 2020-03-24 22:59:22 -0500 | [diff] [blame] | 1400 | bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 1401 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) const; |
| 1402 | |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 1403 | bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName ¶meter_name, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1404 | VkCommandBuffer object) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1405 | |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1406 | bool manual_PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, |
| 1407 | const VkAllocationCallbacks *pAllocator, |
| 1408 | VkPipelineLayout *pPipelineLayout) const; |
ziga-lunarg | c634137 | 2021-07-28 12:57:42 +0200 | [diff] [blame] | 1409 | |
| 1410 | bool ValidatePipelineShaderStageCreateInfo(const char *func_name, const char *msg, |
| 1411 | const VkPipelineShaderStageCreateInfo *pCreateInfo) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1412 | bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 1413 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1414 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1415 | bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 1416 | const VkComputePipelineCreateInfo *pCreateInfos, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1417 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1418 | |
| 1419 | bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1420 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1421 | bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1422 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1423 | VkDescriptorSetLayout *pSetLayout) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1424 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 1425 | bool validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount, |
| 1426 | const VkWriteDescriptorSet *pDescriptorWrites, const bool validateDstSet = true) const; |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1427 | bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 1428 | const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1429 | const VkCopyDescriptorSet *pDescriptorCopies) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1430 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1431 | bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1432 | const VkDescriptorSet *pDescriptorSets) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1433 | |
| 1434 | bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1435 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1436 | |
sfricke-samsung | 681ab7b | 2020-10-29 01:53:35 -0700 | [diff] [blame] | 1437 | bool manual_PreCallValidateCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, |
| 1438 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const; |
| 1439 | |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 1440 | bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1441 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1442 | |
| 1443 | bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1444 | const VkCommandBuffer *pCommandBuffers) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1445 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1446 | bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1447 | |
| 1448 | bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1449 | const VkViewport *pViewports) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1450 | |
| 1451 | bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1452 | const VkRect2D *pScissors) const; |
| 1453 | bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1454 | |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 1455 | bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1456 | uint32_t drawCount, uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1457 | |
| 1458 | bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 1459 | uint32_t drawCount, uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1460 | |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 1461 | bool manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1462 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 1463 | uint32_t stride) const; |
| 1464 | |
| 1465 | bool manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1466 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 1467 | uint32_t stride) const; |
| 1468 | |
| 1469 | bool manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1470 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
| 1471 | uint32_t maxDrawCount, uint32_t stride) const; |
| 1472 | |
| 1473 | bool manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1474 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
| 1475 | uint32_t maxDrawCount, uint32_t stride) const; |
| 1476 | |
Tony-LunarG | 4490de4 | 2021-06-21 15:49:19 -0600 | [diff] [blame] | 1477 | bool manual_PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, |
| 1478 | const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount, |
| 1479 | uint32_t firstInstance, uint32_t stride) const; |
| 1480 | |
| 1481 | bool manual_PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, |
| 1482 | const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount, |
| 1483 | uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset) const; |
| 1484 | |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 1485 | bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 1486 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1487 | const VkClearRect *pRects) const; |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 1488 | |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 1489 | bool ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, |
| 1490 | const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 1491 | VkImageFormatProperties2 *pImageFormatProperties, |
| 1492 | const char *apiName) const; |
| 1493 | bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, |
| 1494 | const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 1495 | VkImageFormatProperties2 *pImageFormatProperties) const; |
| 1496 | bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, |
| 1497 | const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 1498 | VkImageFormatProperties2 *pImageFormatProperties) const; |
Lionel Landwerlin | 5fe5275 | 2020-07-22 08:18:14 +0300 | [diff] [blame] | 1499 | bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 1500 | VkImageType type, VkImageTiling tiling, |
| 1501 | VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 1502 | VkImageFormatProperties *pImageFormatProperties) const; |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 1503 | |
ziga-lunarg | 73b5ef2 | 2021-07-29 20:25:06 +0200 | [diff] [blame] | 1504 | bool manual_PreCallValidateGetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice, |
| 1505 | const VkPhysicalDeviceVideoFormatInfoKHR *pVideoFormatInfo, |
| 1506 | uint32_t *pVideoFormatPropertyCount, |
| 1507 | VkVideoFormatPropertiesKHR *pVideoFormatProperties) const; |
| 1508 | |
sfricke-samsung | 3999ef6 | 2020-02-09 17:05:59 -0800 | [diff] [blame] | 1509 | bool manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 1510 | uint32_t regionCount, const VkBufferCopy *pRegions) const; |
| 1511 | |
Jeff Leger | 178b1e5 | 2020-10-05 12:22:23 -0400 | [diff] [blame] | 1512 | bool manual_PreCallValidateCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2KHR *pCopyBufferInfo) const; |
| 1513 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1514 | bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1515 | VkDeviceSize dataSize, const void *pData) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1516 | |
| 1517 | bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1518 | VkDeviceSize size, uint32_t data) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1519 | |
| 1520 | bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1521 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const; |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 1522 | bool manual_PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 1523 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 1524 | const VkAllocationCallbacks *pAllocator, |
| 1525 | VkSwapchainKHR *pSwapchains) const; |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1526 | bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const; |
sfricke-samsung | 5c1b739 | 2020-12-13 22:17:15 -0800 | [diff] [blame] | 1527 | bool manual_PreCallValidateCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 1528 | const VkDisplayModeCreateInfoKHR *pCreateInfo, |
| 1529 | const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1530 | |
| 1531 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 1532 | bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1533 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1534 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 1535 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1536 | bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1537 | const VkAllocationCallbacks *pAllocator, |
| 1538 | VkDescriptorPool *pDescriptorPool) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1539 | bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1540 | uint32_t groupCountZ) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1541 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1542 | bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1543 | |
| 1544 | bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, |
| 1545 | uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1546 | uint32_t groupCountZ) const; |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 1547 | bool manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 1548 | VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, |
| 1549 | const VkWriteDescriptorSet *pDescriptorWrites) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1550 | bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1551 | uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1552 | bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
| 1553 | uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1554 | const VkShadingRatePaletteNV *pShadingRatePalettes) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1555 | |
| 1556 | bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, |
| 1557 | uint32_t customSampleOrderCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1558 | const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1559 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1560 | bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1561 | bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1562 | uint32_t drawCount, uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1563 | |
| 1564 | bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1565 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1566 | uint32_t maxDrawCount, uint32_t stride) const; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1567 | |
| 1568 | bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1569 | uint32_t *pPropertyCount, |
| 1570 | VkExtensionProperties *pProperties) const; |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 1571 | bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1572 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const; |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 1573 | |
| 1574 | bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device, |
| 1575 | const VkAccelerationStructureCreateInfoNV *pCreateInfo, |
| 1576 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1577 | VkAccelerationStructureNV *pAccelerationStructure) const; |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 1578 | bool manual_PreCallValidateCreateAccelerationStructureKHR(VkDevice device, |
| 1579 | const VkAccelerationStructureCreateInfoKHR *pCreateInfo, |
| 1580 | const VkAllocationCallbacks *pAllocator, |
| 1581 | VkAccelerationStructureKHR *pAccelerationStructure) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1582 | bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, |
| 1583 | const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData, |
| 1584 | VkDeviceSize instanceOffset, VkBool32 update, |
| 1585 | VkAccelerationStructureNV dst, VkAccelerationStructureNV src, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1586 | VkBuffer scratch, VkDeviceSize scratchOffset) const; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 1587 | bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1588 | size_t dataSize, void *pData) const; |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1589 | |
| 1590 | bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, |
| 1591 | uint32_t accelerationStructureCount, |
| 1592 | const VkAccelerationStructureNV *pAccelerationStructures, |
| 1593 | VkQueryType queryType, VkQueryPool queryPool, |
| 1594 | uint32_t firstQuery) const; |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 1595 | bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 1596 | const VkRayTracingPipelineCreateInfoNV *pCreateInfos, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1597 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const; |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1598 | bool manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, |
| 1599 | VkPipelineCache pipelineCache, uint32_t createInfoCount, |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 1600 | const VkRayTracingPipelineCreateInfoKHR *pCreateInfos, |
| 1601 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const; |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 1602 | bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1603 | uint32_t viewportCount, |
| 1604 | const VkViewportWScalingNV *pViewportWScalings) const; |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 1605 | |
| 1606 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 1607 | bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
Jamie Madill | aa076da | 2020-12-22 15:34:34 -0500 | [diff] [blame] | 1608 | VkDeviceGroupPresentModeFlagsKHR *pModes) const override; |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 1609 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 1610 | |
| 1611 | bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1612 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const; |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 1613 | |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1614 | bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1615 | uint16_t lineStipplePattern) const; |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 1616 | |
| 1617 | bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1618 | VkIndexType indexType) const; |
sfricke-samsung | 4ada8d4 | 2020-02-09 17:43:11 -0800 | [diff] [blame] | 1619 | bool manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 1620 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) const; |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 1621 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1622 | bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const; |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 1623 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1624 | bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const; |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 1625 | |
Petr Kraus | 3d72039 | 2019-11-13 02:52:39 +0100 | [diff] [blame] | 1626 | bool manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
| 1627 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) const; |
| 1628 | |
| 1629 | bool manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, |
| 1630 | uint32_t *pImageIndex) const; |
| 1631 | |
Jeremy Hayes | 9bda85a | 2020-05-21 16:36:17 -0600 | [diff] [blame] | 1632 | bool manual_PreCallValidateCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, |
| 1633 | uint32_t bindingCount, const VkBuffer *pBuffers, |
| 1634 | const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) const; |
| 1635 | |
| 1636 | bool manual_PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, |
| 1637 | uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, |
| 1638 | const VkDeviceSize *pCounterBufferOffsets) const; |
| 1639 | |
| 1640 | bool manual_PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, |
| 1641 | uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, |
| 1642 | const VkDeviceSize *pCounterBufferOffsets) const; |
| 1643 | |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 1644 | bool manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, |
| 1645 | uint32_t firstInstance, VkBuffer counterBuffer, |
| 1646 | VkDeviceSize counterBufferOffset, uint32_t counterOffset, |
| 1647 | uint32_t vertexStride) const; |
Jeremy Hayes | 9bda85a | 2020-05-21 16:36:17 -0600 | [diff] [blame] | 1648 | |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 1649 | bool manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, |
| 1650 | const VkAllocationCallbacks *pAllocator, |
| 1651 | VkSamplerYcbcrConversion *pYcbcrConversion) const; |
| 1652 | bool manual_PreCallValidateCreateSamplerYcbcrConversionKHR(VkDevice device, |
| 1653 | const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, |
| 1654 | const VkAllocationCallbacks *pAllocator, |
| 1655 | VkSamplerYcbcrConversion *pYcbcrConversion) const; |
sfricke-samsung | 1708a8c | 2020-02-10 00:35:06 -0800 | [diff] [blame] | 1656 | bool manual_PreCallValidateImportSemaphoreFdKHR(VkDevice device, |
| 1657 | const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const; |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 1658 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1659 | bool manual_PreCallValidateCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 1660 | const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const; |
| 1661 | |
| 1662 | bool manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR( |
| 1663 | VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const; |
| 1664 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1665 | bool manual_PreCallValidateCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, |
| 1666 | const VkCopyAccelerationStructureInfoKHR *pInfo) const; |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 1667 | |
| 1668 | bool manual_PreCallValidateCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer, |
| 1669 | const VkCopyAccelerationStructureInfoKHR *pInfo) const; |
| 1670 | bool ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, const char *api_name) const; |
| 1671 | bool ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo, |
Mark Lobodzinski | aad69e4 | 2020-05-12 08:44:21 -0600 | [diff] [blame] | 1672 | const char *api_name, bool is_cmd = false) const; |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 1673 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1674 | bool manual_PreCallValidateCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation, |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 1675 | const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const; |
| 1676 | bool manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR( |
| 1677 | VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const; |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 1678 | |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 1679 | bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesKHR( |
| 1680 | VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, |
| 1681 | const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, |
| 1682 | uint32_t firstQuery) const; |
| 1683 | bool manual_PreCallValidateWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount, |
| 1684 | const VkAccelerationStructureKHR *pAccelerationStructures, |
| 1685 | VkQueryType queryType, size_t dataSize, void *pData, |
| 1686 | size_t stride) const; |
| 1687 | bool manual_PreCallValidateGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline, |
| 1688 | uint32_t firstGroup, uint32_t groupCount, |
| 1689 | size_t dataSize, void *pData) const; |
| 1690 | |
| 1691 | bool manual_PreCallValidateCmdTraceRaysKHR(VkCommandBuffer commandBuffer, |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1692 | const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, |
| 1693 | const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, |
| 1694 | const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, |
| 1695 | const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width, |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 1696 | uint32_t height, uint32_t depth) const; |
| 1697 | |
| 1698 | bool manual_PreCallValidateCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer, |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1699 | const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, |
| 1700 | const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, |
| 1701 | const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, |
| 1702 | const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, |
| 1703 | VkDeviceAddress indirectDeviceAddress) const; |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 1704 | |
| 1705 | bool manual_PreCallValidateCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, |
| 1706 | VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, |
| 1707 | VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, |
| 1708 | VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, |
| 1709 | VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer, |
| 1710 | VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, |
| 1711 | uint32_t width, uint32_t height, uint32_t depth) const; |
| 1712 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1713 | bool manual_PreCallValidateCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount, |
| 1714 | const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, |
| 1715 | const VkDeviceAddress *pIndirectDeviceAddresses, |
| 1716 | const uint32_t *pIndirectStrides, |
| 1717 | const uint32_t *const *ppMaxPrimitiveCounts) const; |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 1718 | |
| 1719 | bool manual_PreCallValidateGetDeviceAccelerationStructureCompatibilityKHR( |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1720 | VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo, |
| 1721 | VkAccelerationStructureCompatibilityKHR *pCompatibility) const; |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1722 | |
| 1723 | bool manual_PreCallValidateCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount, |
| 1724 | const VkViewport *pViewports) const; |
| 1725 | bool manual_PreCallValidateCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount, |
| 1726 | const VkRect2D *pScissors) const; |
| 1727 | bool manual_PreCallValidateCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 1728 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, |
| 1729 | const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const; |
| 1730 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 1731 | bool ValidateAccelerationStructureBuildGeometryInfoKHR(const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, |
| 1732 | uint32_t infoCount, const char *api_name) const; |
| 1733 | bool manual_PreCallValidateCmdBuildAccelerationStructuresKHR( |
| 1734 | VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, |
| 1735 | const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const; |
| 1736 | |
| 1737 | bool manual_PreCallValidateBuildAccelerationStructuresKHR( |
| 1738 | VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, |
| 1739 | const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, |
| 1740 | const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const; |
| 1741 | |
| 1742 | bool manual_PreCallValidateGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, |
| 1743 | const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo, |
| 1744 | const uint32_t *pMaxPrimitiveCounts, |
| 1745 | VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) const; |
| 1746 | |
sfricke-samsung | ecafb19 | 2021-01-17 08:21:14 -0800 | [diff] [blame] | 1747 | bool manual_PreCallValidateCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfoEXT *pCreateInfo, |
| 1748 | const VkAllocationCallbacks *pAllocator, |
| 1749 | VkPrivateDataSlotEXT *pPrivateDataSlot) const; |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 1750 | |
| 1751 | bool manual_PreCallValidateCmdSetVertexInputEXT( |
| 1752 | VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount, |
| 1753 | const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount, |
| 1754 | const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) const; |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1755 | |
| 1756 | bool manual_PreCallValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, |
| 1757 | VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, |
| 1758 | const void *pValues) const; |
ziga-lunarg | b1dd8a2 | 2021-07-15 17:47:19 +0200 | [diff] [blame] | 1759 | |
| 1760 | bool manual_PreCallValidateMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, |
| 1761 | const VkPipelineCache *pSrcCaches) const; |
| 1762 | |
Nathaniel Cesario | 298d3cb | 2021-08-03 13:49:02 -0600 | [diff] [blame] | 1763 | bool manual_PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 1764 | const VkClearColorValue *pColor, uint32_t rangeCount, |
| 1765 | const VkImageSubresourceRange *pRanges) const; |
| 1766 | |
| 1767 | bool ValidateCmdBeginRenderPass(const char *const func_name, const VkRenderPassBeginInfo *const rp_begin) const; |
| 1768 | bool manual_PreCallValidateCmdBeginRenderPass(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 1769 | VkSubpassContents) const; |
| 1770 | bool manual_PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 1771 | const VkSubpassBeginInfo *) const; |
| 1772 | bool manual_PreCallValidateCmdBeginRenderPass2(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 1773 | const VkSubpassBeginInfo *) const; |
| 1774 | |
ziga-lunarg | c7bb56a | 2021-08-10 09:28:52 +0200 | [diff] [blame^] | 1775 | bool manual_PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, |
| 1776 | uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) const; |
| 1777 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1778 | #include "parameter_validation.h" |
| 1779 | }; // Class StatelessValidation |