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