blob: f1b304df1364765555ae2eeca62f6fe7896700f0 [file] [log] [blame]
Nathaniel Cesario645a15b2021-01-08 22:40:21 -07001/* 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 Lobodzinskiaf7c0382018-12-18 11:55:55 -07005 *
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 Lobodzinskiaf7c0382018-12-18 11:55:55 -070024#include "parameter_name.h"
25#include "vk_typemap_helper.h"
Jeremy Gebben5f585ae2021-02-02 09:03:06 -070026#include "sync_utils.h"
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070027
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 Lobodzinskiaf7c0382018-12-18 11:55:55 -070035static const char DECORATE_UNUSED *kVUID_PVError_RequiredParameter = "UNASSIGNED-GeneralParameterError-RequiredParameter";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070036static const char DECORATE_UNUSED *kVUID_PVError_UnrecognizedValue = "UNASSIGNED-GeneralParameterError-UnrecognizedValue";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070037static const char DECORATE_UNUSED *kVUID_PVError_ExtensionNotEnabled = "UNASSIGNED-GeneralParameterError-ExtensionNotEnabled";
Mark Lobodzinski2e40a132020-08-10 14:51:41 -060038static const char DECORATE_UNUSED *kVUID_PVError_ApiVersionViolation = "UNASSIGNED-API-Version-Violation";
Mark Lobodzinskiacf4ab42020-10-30 15:30:10 -060039// 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 Lobodzinskiaf7c0382018-12-18 11:55:55 -070048extern const uint32_t GeneratedVulkanHeaderVersion;
49
sfricke-samsungd854f4c2021-07-03 23:25:05 -070050// 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 Lobodzinskiaf7c0382018-12-18 11:55:55 -070052extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits;
53extern const VkColorComponentFlags AllVkColorComponentFlagBits;
54extern const VkShaderStageFlags AllVkShaderStageFlagBits;
55extern const VkQueryControlFlags AllVkQueryControlFlagBits;
56extern const VkImageUsageFlags AllVkImageUsageFlagBits;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060057extern const VkSampleCountFlags AllVkSampleCountFlagBits;
sourav parmara96ab1a2020-04-25 16:28:23 -070058extern const VkBuildAccelerationStructureFlagsNV AllVkBuildAccelerationStructureFlagBitsNV;
59extern const VkGeometryFlagsKHR AllVkGeometryFlagBitsKHR;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070060
sourav parmara96ab1a2020-04-25 16:28:23 -070061extern const std::vector<VkGeometryTypeKHR> AllVkGeometryTypeKHREnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070062extern const std::vector<VkCompareOp> AllVkCompareOpEnums;
63extern const std::vector<VkStencilOp> AllVkStencilOpEnums;
64extern const std::vector<VkBlendFactor> AllVkBlendFactorEnums;
65extern const std::vector<VkBlendOp> AllVkBlendOpEnums;
66extern const std::vector<VkLogicOp> AllVkLogicOpEnums;
67extern const std::vector<VkBorderColor> AllVkBorderColorEnums;
68extern const std::vector<VkImageLayout> AllVkImageLayoutEnums;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060069extern const std::vector<VkFormat> AllVkFormatEnums;
70extern const std::vector<VkVertexInputRate> AllVkVertexInputRateEnums;
71extern const std::vector<VkPrimitiveTopology> AllVkPrimitiveTopologyEnums;
sourav parmara96ab1a2020-04-25 16:28:23 -070072extern const std::vector<VkIndexType> AllVkIndexTypeEnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070073
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -060074extern std::vector<std::pair<uint32_t, uint32_t>> custom_stype_info;
75
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070076// String returned by string_VkStructureType for an unrecognized type.
77const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType";
78
79// String returned by string_VkResult for an unrecognized type.
80const std::string UnsupportedResultString = "Unhandled VkResult";
81
82// The base value used when computing the offset for an enumeration token value that is added by an extension.
83// When validating enumeration tokens, any value >= to this value is considered to be provided by an extension.
84// See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification
85const uint32_t ExtEnumBaseValue = 1000000000;
86
87// The value of all VK_xxx_MAX_ENUM tokens
88const uint32_t MaxEnumValue = 0x7FFFFFFF;
89
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070090class StatelessValidation : public ValidationObject {
Petr Kraus4ed81e32019-09-02 23:41:19 +020091 public:
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070092 VkPhysicalDeviceLimits device_limits = {};
Petr Kraus715bcc72019-08-15 17:17:33 +020093 safe_VkPhysicalDeviceFeatures2 physical_device_features2;
Tony-LunarG6c3c5452019-12-13 10:37:38 -070094 void *device_createinfo_pnext;
Petr Kraus715bcc72019-08-15 17:17:33 +020095 const VkPhysicalDeviceFeatures &physical_device_features = physical_device_features2.features;
Jeremy Gebbencbf22862021-03-03 12:01:22 -070096 layer_data::unordered_map<VkPhysicalDevice, VkPhysicalDeviceProperties *> physical_device_properties_map;
97 layer_data::unordered_map<VkPhysicalDevice, layer_data::unordered_set<std::string>> device_extensions_enumerated{};
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070098
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -070099 // Override chassis read/write locks for this validation object
100 // This override takes a deferred lock. i.e. it is not acquired.
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -0700101 read_lock_guard_t read_lock() override;
102 write_lock_guard_t write_lock() override;
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700103
sfricke-samsunga6c67fb2020-12-15 20:51:42 -0800104 // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2::pNext chain
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700105 struct DeviceExtensionProperties {
106 VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props;
107 VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props;
Jeff Bolz443c2ca2020-03-19 12:11:51 -0500108 VkPhysicalDeviceRayTracingPropertiesNV ray_tracing_propsNV;
sourav parmarcd5fb182020-07-17 12:58:44 -0700109 VkPhysicalDeviceRayTracingPipelinePropertiesKHR ray_tracing_propsKHR;
110 VkPhysicalDeviceAccelerationStructurePropertiesKHR acc_structure_props;
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -0700111 VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback_props;
Piers Daniellcb6d8032021-04-19 18:51:26 -0600112 VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_attribute_divisor_props;
ziga-lunarga283d022021-08-04 18:35:23 +0200113 VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT blend_operation_advanced_props;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700114 };
115 DeviceExtensionProperties phys_dev_ext_props = {};
116
117 struct SubpassesUsageStates {
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700118 layer_data::unordered_set<uint32_t> subpasses_using_color_attachment;
119 layer_data::unordered_set<uint32_t> subpasses_using_depthstencil_attachment;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700120 };
121
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700122 // Though this validation object is predominantly statless, the Framebuffer checks are greatly simplified by creating and
123 // updating a map of the renderpass usage states, and these accesses need thread protection. Use a mutex separate from the
124 // parent object's to maintain that functionality.
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500125 mutable std::mutex renderpass_map_mutex;
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700126 layer_data::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700127
128 // Constructor for stateles validation tracking
Jeff Bolz165818a2020-05-08 11:19:03 -0500129 StatelessValidation() : device_createinfo_pnext(nullptr) { container_type = LayerObjectTypeParameterValidation; }
130 ~StatelessValidation() {
131 if (device_createinfo_pnext) {
132 FreePnextChain(device_createinfo_pnext);
133 }
134 }
135
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700136 /**
137 * Validate a minimum value.
138 *
139 * Verify that the specified value is greater than the specified lower bound.
140 *
141 * @param api_name Name of API call being validated.
142 * @param parameter_name Name of parameter being validated.
143 * @param value Value to validate.
144 * @param lower_bound Lower bound value to use for validation.
145 * @return Boolean value indicating that the call should be skipped.
146 */
147 template <typename T>
148 bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700149 const char *api_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700150 bool skip_call = false;
151
152 if (value <= lower_bound) {
153 std::ostringstream ss;
Mark Lobodzinski525c1292020-10-30 16:00:00 -0600154 ss << api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is not greater than "
155 << lower_bound;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700156 skip_call |= LogError(device, vuid, "%s", ss.str().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700157 }
158
159 return skip_call;
160 }
161
162 template <typename T>
163 bool ValidateGreaterThanZero(const T value, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700164 const char *api_name) const {
165 return ValidateGreaterThan(value, T{0}, parameter_name, vuid, api_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700166 }
167 /**
168 * Validate a required pointer.
169 *
170 * Verify that a required pointer is not NULL.
171 *
172 * @param apiName Name of API call being validated.
173 * @param parameterName Name of parameter being validated.
174 * @param value Pointer to validate.
175 * @return Boolean value indicating that the call should be skipped.
176 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700177 bool validate_required_pointer(const char *apiName, const ParameterName &parameterName, const void *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500178 const std::string &vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700179 bool skip_call = false;
180
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700181 if (value == nullptr) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700182 skip_call |=
183 LogError(device, vuid, "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700184 }
185
186 return skip_call;
187 }
188
189 /**
190 * Validate array count and pointer to array.
191 *
192 * Verify that required count and array parameters are not 0 or NULL. If the
193 * count parameter is not optional, verify that it is not 0. If the array
194 * parameter is NULL, and it is not optional, verify that count is 0.
195 *
196 * @param apiName Name of API call being validated.
197 * @param countName Name of count parameter.
198 * @param arrayName Name of array parameter.
199 * @param count Number of elements in the array.
200 * @param array Array to validate.
201 * @param countRequired The 'count' parameter may not be 0 when true.
202 * @param arrayRequired The 'array' parameter may not be NULL when true.
203 * @return Boolean value indicating that the call should be skipped.
204 */
205 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700206 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, T1 count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600207 const T2 *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500208 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700209 bool skip_call = false;
210
211 // Count parameters not tagged as optional cannot be 0
212 if (countRequired && (count == 0)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700213 skip_call |= LogError(device, count_required_vuid, "%s: parameter %s must be greater than 0.", apiName,
214 countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700215 }
216
217 // Array parameters not tagged as optional cannot be NULL, unless the count is 0
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700218 if (arrayRequired && (count != 0) && (*array == nullptr)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700219 skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s specified as NULL.", apiName,
220 arrayName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700221 }
222
223 return skip_call;
224 }
225
226 /**
227 * Validate pointer to array count and pointer to array.
228 *
229 * Verify that required count and array parameters are not NULL. If count
230 * is not NULL and its value is not optional, verify that it is not 0. If the
231 * array parameter is NULL, and it is not optional, verify that count is 0.
232 * The array parameter will typically be optional for this case (where count is
233 * a pointer), allowing the caller to retrieve the available count.
234 *
235 * @param apiName Name of API call being validated.
236 * @param countName Name of count parameter.
237 * @param arrayName Name of array parameter.
238 * @param count Pointer to the number of elements in the array.
239 * @param array Array to validate.
240 * @param countPtrRequired The 'count' parameter may not be NULL when true.
241 * @param countValueRequired The '*count' value may not be 0 when true.
242 * @param arrayRequired The 'array' parameter may not be NULL when true.
sfricke-samsung817d27c2020-12-01 22:22:56 -0800243 * @param count_required_vuid The VUID for the '*count' parameter.
244 * @param array_required_vuid The VUID for the 'array' parameter.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700245 * @return Boolean value indicating that the call should be skipped.
246 */
247 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700248 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T1 *count,
249 const T2 *array, bool countPtrRequired, bool countValueRequired, bool arrayRequired,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500250 const char *count_required_vuid, const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700251 bool skip_call = false;
252
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700253 if (count == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700254 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700255 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
256 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700257 }
258 } else {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700259 skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array, countValueRequired,
260 arrayRequired, count_required_vuid, array_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700261 }
262
263 return skip_call;
264 }
265
266 /**
267 * Validate a pointer to a Vulkan structure.
268 *
269 * Verify that a required pointer to a structure is not NULL. If the pointer is
270 * not NULL, verify that each structure's sType field is set to the correct
271 * VkStructureType value.
272 *
273 * @param apiName Name of API call being validated.
274 * @param parameterName Name of struct parameter being validated.
275 * @param sTypeName Name of expected VkStructureType value.
276 * @param value Pointer to the struct to validate.
277 * @param sType VkStructureType for structure validation.
278 * @param required The parameter may not be NULL when true.
279 * @return Boolean value indicating that the call should be skipped.
280 */
281 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700282 bool validate_struct_type(const char *apiName, const ParameterName &parameterName, const char *sTypeName, const T *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500283 VkStructureType sType, bool required, const char *struct_vuid, const char *stype_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700284 bool skip_call = false;
285
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700286 if (value == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700287 if (required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700288 skip_call |= LogError(device, struct_vuid, "%s: required parameter %s specified as NULL", apiName,
289 parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700290 }
291 } else if (value->sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700292 skip_call |= LogError(device, stype_vuid, "%s: parameter %s->sType must be %s.", apiName,
293 parameterName.get_name().c_str(), sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700294 }
295
296 return skip_call;
297 }
298
299 /**
300 * Validate an array of Vulkan structures
301 *
302 * Verify that required count and array parameters are not 0 or NULL. If
303 * the array contains 1 or more structures, verify that each structure's
304 * sType field is set to the correct VkStructureType value.
305 *
306 * @param apiName Name of API call being validated.
307 * @param countName Name of count parameter.
308 * @param arrayName Name of array parameter.
309 * @param sTypeName Name of expected VkStructureType value.
310 * @param count Number of elements in the array.
311 * @param array Array to validate.
312 * @param sType VkStructureType for structure validation.
313 * @param countRequired The 'count' parameter may not be 0 when true.
314 * @param arrayRequired The 'array' parameter may not be NULL when true.
315 * @return Boolean value indicating that the call should be skipped.
316 */
317 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700318 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
319 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800320 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500321 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700322 bool skip_call = false;
323
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700324 if ((count == 0) || (array == nullptr)) {
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800325 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
326 count_required_vuid, param_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700327 } else {
328 // Verify that all structs in the array have the correct type
329 for (uint32_t i = 0; i < count; ++i) {
330 if (array[i].sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700331 skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d].sType must be %s", apiName,
332 arrayName.get_name().c_str(), i, sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700333 }
334 }
335 }
336
337 return skip_call;
338 }
sourav parmarcd5fb182020-07-17 12:58:44 -0700339
340 /**
341 * Validate an pointer type array of Vulkan structures
342 *
343 * Verify that required count and array parameters are not 0 or NULL. If
344 * the array contains 1 or more structures, verify that each structure's
345 * sType field is set to the correct VkStructureType value.
346 *
347 * @param apiName Name of API call being validated.
348 * @param countName Name of count parameter.
349 * @param arrayName Name of array parameter.
350 * @param sTypeName Name of expected VkStructureType value.
351 * @param count Number of elements in the array.
352 * @param array Array to validate.
353 * @param sType VkStructureType for structure validation.
354 * @param countRequired The 'count' parameter may not be 0 when true.
355 * @param arrayRequired The 'array' parameter may not be NULL when true.
356 * @return Boolean value indicating that the call should be skipped.
357 */
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700358 template <typename T>
359 bool validate_struct_pointer_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
sourav parmarcd5fb182020-07-17 12:58:44 -0700360 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
361 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
362 const char *count_required_vuid) const {
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700363 bool skip_call = false;
364
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700365 if ((count == 0) || (array == nullptr)) {
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700366 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
367 count_required_vuid, param_vuid);
368 } else {
369 // Verify that all structs in the array have the correct type
370 for (uint32_t i = 0; i < count; ++i) {
371 if (array[i]->sType != sType) {
372 skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d]->sType must be %s", apiName,
373 arrayName.get_name().c_str(), i, sTypeName);
374 }
375 }
376 }
377
378 return skip_call;
379 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700380
381 /**
382 * Validate an array of Vulkan structures.
383 *
384 * Verify that required count and array parameters are not NULL. If count
385 * is not NULL and its value is not optional, verify that it is not 0.
386 * If the array contains 1 or more structures, verify that each structure's
387 * sType field is set to the correct VkStructureType value.
388 *
389 * @param apiName Name of API call being validated.
390 * @param countName Name of count parameter.
391 * @param arrayName Name of array parameter.
392 * @param sTypeName Name of expected VkStructureType value.
393 * @param count Pointer to the number of elements in the array.
394 * @param array Array to validate.
395 * @param sType VkStructureType for structure validation.
396 * @param countPtrRequired The 'count' parameter may not be NULL when true.
397 * @param countValueRequired The '*count' value may not be 0 when true.
398 * @param arrayRequired The 'array' parameter may not be NULL when true.
399 * @return Boolean value indicating that the call should be skipped.
400 */
401 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700402 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
403 const char *sTypeName, uint32_t *count, const T *array, VkStructureType sType,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600404 bool countPtrRequired, bool countValueRequired, bool arrayRequired, const char *stype_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500405 const char *param_vuid, const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700406 bool skip_call = false;
407
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700408 if (count == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700409 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700410 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
411 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700412 }
413 } else {
414 skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType,
Mark Lobodzinski75a38812019-12-10 15:22:52 -0700415 countValueRequired && (array != nullptr), arrayRequired, stype_vuid, param_vuid,
416 count_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700417 }
418
419 return skip_call;
420 }
421
422 /**
423 * Validate a Vulkan handle.
424 *
425 * Verify that the specified handle is not VK_NULL_HANDLE.
426 *
427 * @param api_name Name of API call being validated.
428 * @param parameter_name Name of struct parameter being validated.
429 * @param value Handle to validate.
430 * @return Boolean value indicating that the call should be skipped.
431 */
432 template <typename T>
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500433 bool validate_required_handle(const char *api_name, const ParameterName &parameter_name, T value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700434 bool skip_call = false;
435
436 if (value == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700437 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE",
438 api_name, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700439 }
440
441 return skip_call;
442 }
443
444 /**
445 * Validate an array of Vulkan handles.
446 *
447 * Verify that required count and array parameters are not NULL. If count
448 * is not NULL and its value is not optional, verify that it is not 0.
449 * If the array contains 1 or more handles, verify that no handle is set to
450 * VK_NULL_HANDLE.
451 *
452 * @note This function is only intended to validate arrays of handles when none
453 * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles
454 * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead.
455 *
456 * @param api_name Name of API call being validated.
457 * @param count_name Name of count parameter.
458 * @param array_name Name of array parameter.
459 * @param count Number of elements in the array.
460 * @param array Array to validate.
461 * @param count_required The 'count' parameter may not be 0 when true.
462 * @param array_required The 'array' parameter may not be NULL when true.
sfricke-samsung817d27c2020-12-01 22:22:56 -0800463 * @param count_required_vuid The VUID for the '*count' parameter.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700464 * @return Boolean value indicating that the call should be skipped.
465 */
466 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700467 bool validate_handle_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
sfricke-samsung817d27c2020-12-01 22:22:56 -0800468 uint32_t count, const T *array, bool count_required, bool array_required,
469 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700470 bool skip_call = false;
471
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700472 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700473 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
sfricke-samsung817d27c2020-12-01 22:22:56 -0800474 count_required_vuid, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700475 } else {
476 // Verify that no handles in the array are VK_NULL_HANDLE
477 for (uint32_t i = 0; i < count; ++i) {
478 if (array[i] == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700479 skip_call |= LogError(device, kVUID_PVError_RequiredParameter,
480 "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name,
481 array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700482 }
483 }
484 }
485
486 return skip_call;
487 }
488
489 /**
490 * Validate string array count and content.
491 *
492 * Verify that required count and array parameters are not 0 or NULL. If the
493 * count parameter is not optional, verify that it is not 0. If the array
494 * parameter is NULL, and it is not optional, verify that count is 0. If the
495 * array parameter is not NULL, verify that none of the strings are NULL.
496 *
497 * @param apiName Name of API call being validated.
498 * @param countName Name of count parameter.
499 * @param arrayName Name of array parameter.
500 * @param count Number of strings in the array.
501 * @param array Array of strings to validate.
502 * @param countRequired The 'count' parameter may not be 0 when true.
503 * @param arrayRequired The 'array' parameter may not be NULL when true.
504 * @return Boolean value indicating that the call should be skipped.
505 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700506 bool validate_string_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600507 const char *const *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500508 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700509 bool skip_call = false;
510
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700511 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700512 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
513 count_required_vuid, array_required_vuid);
514 } else {
515 // Verify that strings in the array are not NULL
516 for (uint32_t i = 0; i < count; ++i) {
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700517 if (array[i] == nullptr) {
Mark Lobodzinski525c1292020-10-30 16:00:00 -0600518 skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s[%d] specified as NULL", apiName,
519 arrayName.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700520 }
521 }
522 }
523
524 return skip_call;
525 }
526
Mark Lobodzinski2e40a132020-08-10 14:51:41 -0600527 // Forward declarations
528 bool CheckPromotedApiAgainstVulkanVersion(VkInstance instance, const char *api_name, const uint32_t promoted_version) const;
529 bool CheckPromotedApiAgainstVulkanVersion(VkPhysicalDevice pdev, const char *api_name, const uint32_t promoted_version) const;
Mark Lobodzinskibece6c12020-08-27 15:34:02 -0600530 bool SupportedByPdev(const VkPhysicalDevice physical_device, const std::string ext_name) const;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -0600531
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600532 bool ValidatePnextStructContents(const char *api_name, const ParameterName &parameter_name, const VkBaseOutStructure *header,
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600533 const char *pnext_vuid, bool is_physdev_api = false, bool is_const_param = true) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700534
535 /**
536 * Validate a structure's pNext member.
537 *
538 * Verify that the specified pNext value points to the head of a list of
539 * allowed extension structures. If no extension structures are allowed,
540 * verify that pNext is null.
541 *
542 * @param api_name Name of API call being validated.
543 * @param parameter_name Name of parameter being validated.
544 * @param allowed_struct_names Names of allowed structs.
545 * @param next Pointer to validate.
546 * @param allowed_type_count Total number of allowed structure types.
547 * @param allowed_types Array of structure types allowed for pNext.
548 * @param header_version Version of header defining the pNext validation rules.
549 * @return Boolean value indicating that the call should be skipped.
550 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700551 bool validate_struct_pnext(const char *api_name, const ParameterName &parameter_name, const char *allowed_struct_names,
552 const void *next, size_t allowed_type_count, const VkStructureType *allowed_types,
Nathaniel Cesarioe0c387b2021-09-02 13:51:34 -0600553 uint32_t header_version, const char *pnext_vuid, const char *stype_vuid,
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600554 const bool is_physdev_api = false, const bool is_const_param = true) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700555 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700556
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700557 if (next != nullptr) {
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700558 layer_data::unordered_set<const void *> cycle_check;
559 layer_data::unordered_set<VkStructureType, layer_data::hash<int>> unique_stype_check;
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600560
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600561 const char *disclaimer =
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600562 "This error is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that "
563 "you are using a struct from a private extension or an extension that was added to a later version of the Vulkan "
564 "header, in which case the use of %s is undefined and may not work correctly with validation enabled";
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600565
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600566 if ((allowed_type_count == 0) && (custom_stype_info.size() == 0)) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700567 std::string message = "%s: value of %s must be NULL. ";
568 message += disclaimer;
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600569 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
570 header_version, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700571 } else {
572 const VkStructureType *start = allowed_types;
573 const VkStructureType *end = allowed_types + allowed_type_count;
Lockefbdd1af2019-04-16 15:07:23 -0600574 const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700575
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700576 while (current != nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700577 if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) ||
578 (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) &&
579 ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) ||
580 (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700581 std::string type_name = string_VkStructureType(current->sType);
Nathaniel Cesario78c1cdd2021-04-01 23:13:33 -0600582 if (unique_stype_check.find(current->sType) != unique_stype_check.end() &&
583 !IsDuplicatePnext(current->sType)) {
sfricke-samsung32a27362020-02-28 09:06:42 -0800584 // stype_vuid will only be null if there are no listed pNext and will hit disclaimer check
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700585 std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times.";
sfricke-samsung32a27362020-02-28 09:06:42 -0800586 skip_call |= LogError(device, stype_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
587 type_name.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700588 } else {
589 unique_stype_check.insert(current->sType);
590 }
591
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600592 // Search custom stype list -- if sType found, skip this entirely
593 bool custom = false;
John Zulauf79f06582021-02-27 18:38:39 -0700594 for (const auto &item : custom_stype_info) {
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600595 if (item.first == current->sType) {
596 custom = true;
597 break;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700598 }
599 }
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600600 if (!custom) {
601 if (std::find(start, end, current->sType) == end) {
602 if (type_name.compare(UnsupportedStructureTypeString) == 0) {
603 std::string message =
604 "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures "
605 "are [%s]. ";
606 message += disclaimer;
607 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
608 parameter_name.get_name().c_str(), current->sType, allowed_struct_names,
609 header_version, parameter_name.get_name().c_str());
610 } else {
611 std::string message =
612 "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures "
613 "are [%s]. ";
614 message += disclaimer;
615 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
616 parameter_name.get_name().c_str(), type_name.c_str(),
617 allowed_struct_names, header_version, parameter_name.get_name().c_str());
618 }
619 }
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600620 skip_call |= ValidatePnextStructContents(api_name, parameter_name, current, pnext_vuid, is_physdev_api,
621 is_const_param);
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600622 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700623 }
Lockefbdd1af2019-04-16 15:07:23 -0600624 current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700625 }
626 }
627 }
628
629 return skip_call;
630 }
631
632 /**
633 * Validate a VkBool32 value.
634 *
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600635 * Generate an error if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700636 *
637 * @param apiName Name of API call being validated.
638 * @param parameterName Name of parameter being validated.
639 * @param value Boolean value to validate.
640 * @return Boolean value indicating that the call should be skipped.
641 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500642 bool validate_bool32(const char *apiName, const ParameterName &parameterName, VkBool32 value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700643 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700644 if ((value != VK_TRUE) && (value != VK_FALSE)) {
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600645 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
646 "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
647 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
648 apiName, parameterName.get_name().c_str(), value);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700649 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700650 return skip_call;
651 }
652
653 /**
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700654 * Validate an array of VkBool32 values.
655 *
656 * Generate an error if any VkBool32 value in an array is neither VK_TRUE nor VK_FALSE.
657 *
658 * @param apiName Name of API call being validated.
659 * @param countName Name of count parameter.
660 * @param arrayName Name of array parameter.
661 * @param count Number of values in the array.
662 * @param array Array of VkBool32 values to validate.
663 * @param countRequired The 'count' parameter may not be 0 when true.
664 * @param arrayRequired The 'array' parameter may not be NULL when true.
665 * @return Boolean value indicating that the call should be skipped.
666 */
667 bool validate_bool32_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
668 const VkBool32 *array, bool countRequired, bool arrayRequired) const {
669 bool skip_call = false;
670
671 if ((count == 0) || (array == nullptr)) {
672 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
673 kVUIDUndefined);
674 } else {
675 for (uint32_t i = 0; i < count; ++i) {
676 if ((array[i] != VK_TRUE) && (array[i] != VK_FALSE)) {
677 skip_call |=
678 LogError(device, kVUID_PVError_UnrecognizedValue,
679 "%s: value of %s[%d] (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
680 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
681 apiName, arrayName.get_name().c_str(), i, array[i]);
682 }
683 }
684 }
685
686 return skip_call;
687 }
688
689 /**
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700690 * Validate a Vulkan enumeration value.
691 *
692 * Generate a warning if an enumeration token value does not fall within the core enumeration
693 * begin and end token values, and was not added to the enumeration by an extension. Extension
694 * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
695 * with 1,000,000,000 as the base token value.
696 *
697 * @note This function does not expect to process enumerations defining bitmask flag bits.
698 *
699 * @param apiName Name of API call being validated.
700 * @param parameterName Name of parameter being validated.
701 * @param enumName Name of the enumeration being validated.
702 * @param valid_values The list of valid values for the enumeration.
703 * @param value Enumeration value to validate.
704 * @return Boolean value indicating that the call should be skipped.
705 */
706 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700707 bool validate_ranged_enum(const char *apiName, const ParameterName &parameterName, const char *enumName,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500708 const std::vector<T> &valid_values, T value, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700709 bool skip = false;
710
711 if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) {
712 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700713 LogError(device, vuid,
714 "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is "
715 "not an extension added token.",
716 apiName, parameterName.get_name().c_str(), value, enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700717 }
718
719 return skip;
720 }
721
722 /**
723 * Validate an array of Vulkan enumeration value.
724 *
725 * Process all enumeration token values in the specified array and generate a warning if a value
726 * does not fall within the core enumeration begin and end token values, and was not added to
727 * the enumeration by an extension. Extension provided enumerations use the equation specified
728 * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
729 *
730 * @note This function does not expect to process enumerations defining bitmask flag bits.
731 *
732 * @param apiName Name of API call being validated.
733 * @param countName Name of count parameter.
734 * @param arrayName Name of array parameter.
735 * @param enumName Name of the enumeration being validated.
736 * @param valid_values The list of valid values for the enumeration.
737 * @param count Number of enumeration values in the array.
738 * @param array Array of enumeration values to validate.
739 * @param countRequired The 'count' parameter may not be 0 when true.
740 * @param arrayRequired The 'array' parameter may not be NULL when true.
741 * @return Boolean value indicating that the call should be skipped.
742 */
743 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700744 bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
745 const char *enumName, const std::vector<T> &valid_values, uint32_t count, const T *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500746 bool countRequired, bool arrayRequired) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700747 bool skip_call = false;
748
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700749 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700750 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
751 kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700752 } else {
753 for (uint32_t i = 0; i < count; ++i) {
754 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700755 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
756 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
757 "enumeration tokens and is not an extension added token",
758 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700759 }
760 }
761 }
762
763 return skip_call;
764 }
765
766 /**
767 * Verify that a reserved VkFlags value is zero.
768 *
769 * Verify that the specified value is zero, to check VkFlags values that are reserved for
770 * future use.
771 *
772 * @param api_name Name of API call being validated.
773 * @param parameter_name Name of parameter being validated.
774 * @param value Value to validate.
775 * @return Boolean value indicating that the call should be skipped.
776 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500777 bool validate_reserved_flags(const char *api_name, const ParameterName &parameter_name, VkFlags value, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700778 bool skip_call = false;
779
780 if (value != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700781 skip_call |= LogError(device, vuid, "%s: parameter %s must be 0.", api_name, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700782 }
783
784 return skip_call;
785 }
786
Petr Kraus52758be2019-08-12 00:53:58 +0200787 enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit };
788
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700789 // helper to implement validation of both 32 bit and 64 bit flags.
790 template <typename FlagTypedef>
791 bool validate_flags_impl(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name,
792 FlagTypedef all_flags, FlagTypedef value, const FlagType flag_type, const char *vuid,
793 const char *flags_zero_vuid = nullptr) const {
794 bool skip_call = false;
795
796 if ((value & ~all_flags) != 0) {
797 skip_call |= LogError(device, vuid, "%s: value of %s contains flag bits that are not recognized members of %s",
798 api_name, parameter_name.get_name().c_str(), flag_bits_name);
799 }
800
801 const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit;
802 const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid;
803 if (required && value == 0) {
804 skip_call |= LogError(device, zero_vuid, "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str());
805 }
806
807 const auto HasMaxOneBitSet = [](const FlagTypedef f) {
808 // Decrement flips bits from right upto first 1.
809 // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED
810 return f == 0 || !(f & (f - 1));
811 };
812
813 const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit;
814 if (is_bits_type && !HasMaxOneBitSet(value)) {
815 skip_call |=
816 LogError(device, vuid, "%s: value of %s contains multiple members of %s when only a single value is allowed",
817 api_name, parameter_name.get_name().c_str(), flag_bits_name);
818 }
819
820 return skip_call;
821 }
822
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700823 /**
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700824 * Validate a 32 bit Vulkan bitmask value.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700825 *
826 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
827 * for that type.
828 *
829 * @param api_name Name of API call being validated.
830 * @param parameter_name Name of parameter being validated.
831 * @param flag_bits_name Name of the VkFlags type being validated.
832 * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated.
833 * @param value VkFlags value to validate.
Petr Kraus52758be2019-08-12 00:53:58 +0200834 * @param flag_type The type of flag, like optional, or single bit.
835 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
836 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700837 * @return Boolean value indicating that the call should be skipped.
838 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700839 bool validate_flags(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name, VkFlags all_flags,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500840 VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700841 return validate_flags_impl<VkFlags>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
842 flags_zero_vuid);
843 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700844
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700845 /**
846 * Validate a 64 bit Vulkan bitmask value.
847 *
848 * Generate a warning if a value with a VkFlags64 derived type does not contain valid flag bits
849 * for that type.
850 *
851 * @param api_name Name of API call being validated.
852 * @param parameter_name Name of parameter being validated.
853 * @param flag_bits_name Name of the VkFlags64 type being validated.
854 * @param all_flags A bit mask combining all valid flag bits for the VkFlags64 type being validated.
855 * @param value VkFlags64 value to validate.
856 * @param flag_type The type of flag, like optional, or single bit.
857 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
858 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
859 * @return Boolean value indicating that the call should be skipped.
860 */
861 bool validate_flags(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name, VkFlags64 all_flags,
862 VkFlags64 value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
863 return validate_flags_impl<VkFlags64>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
864 flags_zero_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700865 }
866
867 /**
868 * Validate an array of Vulkan bitmask values.
869 *
870 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
871 * for that type.
872 *
873 * @param api_name Name of API call being validated.
874 * @param count_name Name of parameter being validated.
875 * @param array_name Name of parameter being validated.
876 * @param flag_bits_name Name of the VkFlags type being validated.
877 * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated.
878 * @param count Number of VkFlags values in the array.
879 * @param array Array of VkFlags value to validate.
880 * @param count_required The 'count' parameter may not be 0 when true.
881 * @param array_required The 'array' parameter may not be NULL when true.
882 * @return Boolean value indicating that the call should be skipped.
883 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700884 bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
885 const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500886 bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700887 bool skip_call = false;
888
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700889 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700890 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
891 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700892 } else {
893 // Verify that all VkFlags values in the array
894 for (uint32_t i = 0; i < count; ++i) {
895 if (array[i] == 0) {
896 // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if
897 // elements in the array are allowed be 0
898 if (array_required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700899 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0",
900 api_name, array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700901 }
902 } else if ((array[i] & (~all_flags)) != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700903 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
904 "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name,
905 array_name.get_name().c_str(), i, flag_bits_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700906 }
907 }
908 }
909
910 return skip_call;
911 }
912
913 template <typename ExtensionState>
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600914 bool validate_extension_reqs(const ExtensionState &extensions, const char *vuid, const char *extension_type,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500915 const char *extension_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700916 bool skip = false;
917 if (!extension_name) {
918 return skip; // Robust to invalid char *
919 }
920 auto info = ExtensionState::get_info(extension_name);
921
922 if (!info.state) {
923 return skip; // Unknown extensions cannot be checked so report OK
924 }
925
926 // Check against the required list in the info
927 std::vector<const char *> missing;
Petr Krausbce952d2020-04-02 18:40:40 +0200928 for (const auto &req : info.requirements) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700929 if (!(extensions.*(req.enabled))) {
930 missing.push_back(req.name);
931 }
932 }
933
934 // Report any missing requirements
935 if (missing.size()) {
936 std::string missing_joined_list = string_join(", ", missing);
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700937 skip |= LogError(instance, vuid, "Missing extension%s required by the %s extension %s: %s.",
938 ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700939 }
940 return skip;
941 }
942
943 enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
944
945 template <typename RenderPassCreateInfoGeneric>
Petr Kraus3e52eba2019-07-10 01:24:10 +0200946 bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo,
Jeremy Gebben40a22942020-12-22 14:22:06 -0700947 uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags2KHR stages,
948 const char *vuid, const char *target, const char *func_name) const {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200949 bool skip = false;
Jeremy Gebben5f585ae2021-02-02 09:03:06 -0700950 // make sure we consider all of the expanded and un-expanded graphics bits to be valid
Jeremy Gebben40a22942020-12-22 14:22:06 -0700951 const auto kExcludeStages = VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR | VK_PIPELINE_STAGE_2_COPY_BIT_KHR |
952 VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR | VK_PIPELINE_STAGE_2_BLIT_BIT_KHR |
953 VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR;
954 const auto kMetaGraphicsStages = VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR | VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR |
955 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR;
956 const auto kGraphicsStages =
957 (sync_utils::ExpandPipelineStages(VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_QUEUE_GRAPHICS_BIT) | kMetaGraphicsStages) &
958 ~kExcludeStages;
Petr Krausdfd26442019-08-13 03:25:19 +0200959
960 const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) {
Jeremy Gebben12933ef2021-05-12 17:16:27 -0600961 if (subpass == VK_SUBPASS_EXTERNAL || subpass >= pCreateInfo->subpassCount)
Petr Kraus3e52eba2019-07-10 01:24:10 +0200962 return false;
963 else
Petr Krausdfd26442019-08-13 03:25:19 +0200964 return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage;
Petr Kraus3e52eba2019-07-10 01:24:10 +0200965 };
966
Petr Krausdfd26442019-08-13 03:25:19 +0200967 const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0;
968 if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) {
sfricke-samsung46fc6632020-09-12 14:28:58 -0700969 skip |= LogError(VkRenderPass(0), vuid,
970 "%s: Dependency pDependencies[%" PRIu32
971 "] specifies a %sStageMask that contains stages (%s) that are not part "
972 "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.",
Jeremy Gebben40a22942020-12-22 14:22:06 -0700973 func_name, dependency_index, target,
974 sync_utils::StringPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass);
Petr Kraus3e52eba2019-07-10 01:24:10 +0200975 }
976
977 return skip;
978 };
979
980 template <typename RenderPassCreateInfoGeneric>
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700981 bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700982 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500983 RenderPassCreateVersion rp_version) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700984 bool skip = false;
985 uint32_t max_color_attachments = device_limits.maxColorAttachments;
986 bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2);
sfricke-samsung46fc6632020-09-12 14:28:58 -0700987 const char *func_name = (use_rp2) ? "vkCreateRenderPass2" : "vkCreateRenderPass";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700988 const char *vuid;
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700989 VkBool32 separate_depth_stencil_layouts = false;
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700990 const auto *vulkan_12_features = LvlFindInChain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700991 if (vulkan_12_features) {
992 separate_depth_stencil_layouts = vulkan_12_features->separateDepthStencilLayouts;
993 } else {
994 const auto *separate_depth_stencil_layouts_features =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700995 LvlFindInChain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700996 if (separate_depth_stencil_layouts_features)
997 separate_depth_stencil_layouts = separate_depth_stencil_layouts_features->separateDepthStencilLayouts;
998 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700999
1000 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
Piers Daniell4fde9b72019-11-27 16:19:46 -07001001 const auto *attachment_description_stencil_layout =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -07001002 (use_rp2) ? LvlFindInChain<VkAttachmentDescriptionStencilLayout>(
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001003 reinterpret_cast<VkAttachmentDescription2 const *>(&pCreateInfo->pAttachments[i])->pNext)
Piers Daniell4fde9b72019-11-27 16:19:46 -07001004 : 0;
1005
sfricke-samsungcac6a262020-04-28 07:50:49 -07001006 const VkFormat attachment_format = pCreateInfo->pAttachments[i].format;
1007 const VkImageLayout initial_layout = pCreateInfo->pAttachments[i].initialLayout;
1008 const VkImageLayout final_layout = pCreateInfo->pAttachments[i].finalLayout;
1009 if (attachment_format == VK_FORMAT_UNDEFINED) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001010 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-parameter" : "VUID-VkAttachmentDescription-format-parameter";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001011 skip |= LogWarning(device, vuid, "%s: pCreateInfo->pAttachments[%u].format is VK_FORMAT_UNDEFINED.", func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001012 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001013 if (final_layout == VK_IMAGE_LAYOUT_UNDEFINED || final_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001014 vuid =
1015 use_rp2 ? "VUID-VkAttachmentDescription2-finalLayout-03061" : "VUID-VkAttachmentDescription-finalLayout-00843";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001016 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001017 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001018 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001019 func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001020 }
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001021 if (!separate_depth_stencil_layouts) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001022 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1023 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1024 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1025 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001026 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03298"
Piers Daniell9af77cd2019-10-16 13:54:12 -06001027 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001028 skip |= LogError(
1029 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001030 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1031 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1032 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001033 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001034 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001035 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1036 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1037 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1038 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001039 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03299"
Piers Daniell9af77cd2019-10-16 13:54:12 -06001040 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001041 skip |= LogError(
1042 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001043 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1044 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1045 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001046 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001047 }
1048 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001049 if (!FormatIsDepthOrStencil(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001050 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1051 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1052 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1053 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001054 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03300" : "VUID-VkAttachmentDescription-format-03286";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001055 skip |= LogError(
1056 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001057 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1058 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
Piers Daniell9af77cd2019-10-16 13:54:12 -06001059 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001060 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001061 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001062 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1063 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1064 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1065 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001066 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03301" : "VUID-VkAttachmentDescription-format-03287";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001067 skip |= LogError(
1068 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001069 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1070 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1071 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001072 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001073 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001074 } else if (FormatIsDepthAndStencil(attachment_format)) {
Piers Daniell9af77cd2019-10-16 13:54:12 -06001075 if (use_rp2) {
1076 if (!attachment_description_stencil_layout) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001077 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1078 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
1079 skip |=
1080 LogError(device, "VUID-VkAttachmentDescription2-format-03302",
1081 "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout",
1082 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001083 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001084 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1085 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
1086 skip |=
1087 LogError(device, "VUID-VkAttachmentDescription2-format-03303",
1088 "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout",
1089 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001090 }
1091 }
1092 } else {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001093 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1094 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1095 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1096 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1097 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03288",
1098 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1099 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1100 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1101 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1102 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001103 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001104 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1105 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1106 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1107 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1108 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03289",
1109 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1110 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1111 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1112 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1113 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001114 }
1115 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001116 } else if (FormatIsDepthOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001117 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1118 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001119 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03304" : "VUID-VkAttachmentDescription-format-03290";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001120 skip |= LogError(device, vuid,
1121 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001122 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or"
1123 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001124 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001125 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001126 if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1127 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001128 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03305" : "VUID-VkAttachmentDescription-format-03291";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001129 skip |= LogError(device, vuid,
1130 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001131 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1132 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001133 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001134 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001135 } else if (FormatIsStencilOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001136 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1137 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001138 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03306" : "VUID-VkAttachmentDescription-format-03292";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001139 skip |= LogError(device, vuid,
1140 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001141 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or"
1142 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001143 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001144 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001145 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1146 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001147 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03307" : "VUID-VkAttachmentDescription-format-03293";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001148 skip |= LogError(device, vuid,
1149 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001150 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001151 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL",
1152 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001153 }
1154 }
1155 if (use_rp2 && attachment_description_stencil_layout) {
1156 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001157 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1158 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001159 attachment_description_stencil_layout->stencilInitialLayout ==
1160 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1161 attachment_description_stencil_layout->stencilInitialLayout ==
1162 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1163 attachment_description_stencil_layout->stencilInitialLayout ==
1164 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1165 attachment_description_stencil_layout->stencilInitialLayout ==
1166 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001167 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001168 "%s: VkAttachmentDescriptionStencilLayout.stencilInitialLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001169 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001170 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001171 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1172 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1173 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001174 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1175 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001176 }
1177 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001178 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1179 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001180 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1181 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1182 attachment_description_stencil_layout->stencilFinalLayout ==
1183 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1184 attachment_description_stencil_layout->stencilFinalLayout ==
1185 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001186 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001187 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001188 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001189 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001190 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1191 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1192 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001193 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1194 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001195 }
1196 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
1197 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001198 skip |= LogError(
1199 device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001200 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001201 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
1202 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001203 }
1204 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001205
1206 if (FormatIsDepthOrStencil(attachment_format)) {
1207 if (initial_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1208 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03295" : "VUID-VkAttachmentDescription-format-03281";
1209 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001210 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001211 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001212 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001213 }
1214 if (final_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1215 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03297" : "VUID-VkAttachmentDescription-format-03283";
1216 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001217 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001218 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001219 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001220 }
1221 }
1222 if (FormatIsColor(attachment_format)) {
1223 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1224 initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1225 initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1226 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1227 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03294" : "VUID-VkAttachmentDescription-format-03280";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001228 skip |= LogError(device, vuid,
1229 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1230 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1231 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1232 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1233 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1234 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001235 }
1236 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1237 final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1238 final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1239 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1240 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03296" : "VUID-VkAttachmentDescription-format-03282";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001241 skip |= LogError(device, vuid,
1242 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1243 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1244 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1245 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1246 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1247 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001248 }
1249 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001250 }
1251
1252 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
1253 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001254 vuid = use_rp2 ? "VUID-VkSubpassDescription2-colorAttachmentCount-03063"
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001255 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001256 skip |=
1257 LogError(device, vuid,
1258 "%s: Cannot create a render pass with %d color attachments in pCreateInfo->pSubpasses[%u]. Max is %d.",
1259 func_name, pCreateInfo->pSubpasses[i].colorAttachmentCount, i, max_color_attachments);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001260 }
1261 }
Petr Kraus3e52eba2019-07-10 01:24:10 +02001262
1263 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) {
1264 const auto &dependency = pCreateInfo->pDependencies[i];
1265
sfricke-samsung55f01952020-03-24 08:16:41 -07001266 // Need to check first so layer doesn't segfault from out of bound array access
1267 // src subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001268 if ((dependency.srcSubpass != VK_SUBPASS_EXTERNAL) && (dependency.srcSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001269 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-srcSubpass-02526" : "VUID-VkRenderPassCreateInfo-srcSubpass-02517";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001270 skip |= LogError(device, vuid,
1271 "%s: pCreateInfo->pDependencies[%u].srcSubpass index (%u) has to be less than subpassCount (%u)",
1272 func_name, i, dependency.srcSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001273 }
1274
sfricke-samsung55f01952020-03-24 08:16:41 -07001275 // dst subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001276 if ((dependency.dstSubpass != VK_SUBPASS_EXTERNAL) && (dependency.dstSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001277 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-dstSubpass-02527" : "VUID-VkRenderPassCreateInfo-dstSubpass-02518";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001278 skip |= LogError(device, vuid,
1279 "%s: pCreateInfo->pDependencies[%u].dstSubpass index (%u) has to be less than subpassCount (%u)",
1280 func_name, i, dependency.dstSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001281 }
1282
Petr Kraus3e52eba2019-07-10 01:24:10 +02001283 // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked
Mike Schuchardt65847d92019-12-20 13:50:47 -08001284 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001285 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001286 "src", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001287
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001288 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001289 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001290 "dst", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001291 }
1292
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001293 return skip;
1294 }
1295
1296 template <typename T>
1297 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001298 std::unique_lock<std::mutex> lock(renderpass_map_mutex);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001299 auto &renderpass_state = renderpasses_states[renderPass];
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001300 lock.unlock();
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001301
1302 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
1303 bool uses_color = false;
1304 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
1305 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
1306
1307 bool uses_depthstencil = false;
1308 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
1309 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
1310 uses_depthstencil = true;
1311
1312 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
1313 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
1314 }
1315 }
1316
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001317 // Pre/PostCallRecord declarations
1318 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1319 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1320 VkResult result) override;
Mike Schuchardt2df08912020-12-15 16:28:09 -08001321 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001322 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1323 VkResult result) override;
1324 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1325 const VkAllocationCallbacks *pAllocator) override;
Tony-LunarG3c287f62020-12-17 12:39:49 -07001326 void PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo,
1327 VkCommandBuffer *pCommandBuffers, VkResult result) override;
1328 void PostCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
1329 const VkCommandBuffer *pCommandBuffers) override;
1330 void PostCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1331 const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001332 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
1333 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) override;
1334 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
1335 VkInstance *pInstance, VkResult result) override;
1336
Nathaniel Cesario645a15b2021-01-08 22:40:21 -07001337 void CommonPostCallRecordEnumeratePhysicalDevice(const VkPhysicalDevice *phys_devices, const int count);
1338 void PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
1339 VkPhysicalDevice *pPhysicalDevices, VkResult result) override;
1340
1341 void PostCallRecordEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
1342 VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties,
1343 VkResult result) override;
1344
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001345 bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001346
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001347 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001348
Tony-LunarG866843d2020-05-13 11:22:42 -06001349 bool validate_validation_features(const VkInstanceCreateInfo *pCreateInfo,
1350 const VkValidationFeaturesEXT *validation_features) const;
1351
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001352 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001353
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001354 bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid,
1355 const char *validateString) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001356
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001357 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001358
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001359 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name,
1360 const char *array_parameter_name, const std::string &unique_error_code,
1361 const std::string &valid_error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001362
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001363 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name,
1364 const std::string &error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001365
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001366 bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkAccelerationStructureNV object_handle,
1367 const char *func_name) const;
1368 bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkAccelerationStructureNV object_handle,
Jason Macnak192fa0e2019-07-26 15:07:16 -07001369 const char *func_name) const;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001370 bool ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, const char *func_name) const;
1371 bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkAccelerationStructureNV object_handle,
Mark Lobodzinski17dc4602020-05-29 07:48:40 -06001372 const char *func_nam, bool is_cmd) const;
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001373 bool ValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1374 const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion,
1375 const char *apiName) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001376 bool ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1377 bool khr) const;
1378 bool ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1379 bool khr) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001380
sfricke-samsunga1d00272021-03-10 21:37:41 -08001381 bool ValidateSwapchainCreateInfo(const char *func_name, VkSwapchainCreateInfoKHR const *pCreateInfo) const;
1382
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001383 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001384
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001385 void PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -06001386
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001387 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001388 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001389
1390 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001391 VkInstance *pInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001392
1393 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001394 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001395
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001396 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001397 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001398
1399 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001400 const VkAllocationCallbacks *pAllocator, VkImage *pImage) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001401
Jeff Bolz99e3f632020-03-24 22:59:22 -05001402 bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1403 const VkAllocationCallbacks *pAllocator, VkImageView *pView) const;
1404
Jeff Bolz6d3beaa2019-02-09 21:00:05 -06001405 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName &parameter_name,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001406 VkCommandBuffer object) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001407
sfricke-samsung51303fb2021-05-09 19:09:13 -07001408 bool manual_PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo,
1409 const VkAllocationCallbacks *pAllocator,
1410 VkPipelineLayout *pPipelineLayout) const;
ziga-lunargc6341372021-07-28 12:57:42 +02001411
1412 bool ValidatePipelineShaderStageCreateInfo(const char *func_name, const char *msg,
1413 const VkPipelineShaderStageCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001414 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1415 const VkGraphicsPipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001416 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001417 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1418 const VkComputePipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001419 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001420
1421 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001422 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001423 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001424 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001425 VkDescriptorSetLayout *pSetLayout) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001426
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001427 bool validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount,
1428 const VkWriteDescriptorSet *pDescriptorWrites, const bool validateDstSet = true) const;
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001429 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1430 const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001431 const VkCopyDescriptorSet *pDescriptorCopies) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001432
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001433 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001434 const VkDescriptorSet *pDescriptorSets) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001435
1436 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001437 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001438
sfricke-samsung681ab7b2020-10-29 01:53:35 -07001439 bool manual_PreCallValidateCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
1440 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
1441
Mike Schuchardt2df08912020-12-15 16:28:09 -08001442 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001443 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001444
1445 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001446 const VkCommandBuffer *pCommandBuffers) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001447
Jeff Bolz5c801d12019-10-09 10:38:45 -05001448 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001449
1450 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001451 const VkViewport *pViewports) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001452
1453 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001454 const VkRect2D *pScissors) const;
1455 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001456
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001457 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1458 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001459
1460 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001461 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001462
sfricke-samsungf692b972020-05-02 08:00:45 -07001463 bool manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1464 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1465 uint32_t stride) const;
1466
1467 bool manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1468 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1469 uint32_t stride) const;
1470
1471 bool manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1472 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1473 uint32_t maxDrawCount, uint32_t stride) const;
1474
1475 bool manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1476 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1477 uint32_t maxDrawCount, uint32_t stride) const;
1478
Tony-LunarG4490de42021-06-21 15:49:19 -06001479 bool manual_PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1480 const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount,
1481 uint32_t firstInstance, uint32_t stride) const;
1482
1483 bool manual_PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1484 const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount,
1485 uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset) const;
1486
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001487 bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1488 const VkClearAttachment *pAttachments, uint32_t rectCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001489 const VkClearRect *pRects) const;
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001490
Andrew Fobel3abeb992020-01-20 16:33:22 -05001491 bool ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1492 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1493 VkImageFormatProperties2 *pImageFormatProperties,
1494 const char *apiName) const;
1495 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1496 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1497 VkImageFormatProperties2 *pImageFormatProperties) const;
1498 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1499 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1500 VkImageFormatProperties2 *pImageFormatProperties) const;
Lionel Landwerlin5fe52752020-07-22 08:18:14 +03001501 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
1502 VkImageType type, VkImageTiling tiling,
1503 VkImageUsageFlags usage, VkImageCreateFlags flags,
1504 VkImageFormatProperties *pImageFormatProperties) const;
Andrew Fobel3abeb992020-01-20 16:33:22 -05001505
ziga-lunarg73b5ef22021-07-29 20:25:06 +02001506 bool manual_PreCallValidateGetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
1507 const VkPhysicalDeviceVideoFormatInfoKHR *pVideoFormatInfo,
1508 uint32_t *pVideoFormatPropertyCount,
1509 VkVideoFormatPropertiesKHR *pVideoFormatProperties) const;
1510
sfricke-samsung3999ef62020-02-09 17:05:59 -08001511 bool manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
1512 uint32_t regionCount, const VkBufferCopy *pRegions) const;
1513
Jeff Leger178b1e52020-10-05 12:22:23 -04001514 bool manual_PreCallValidateCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2KHR *pCopyBufferInfo) const;
1515
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001516 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001517 VkDeviceSize dataSize, const void *pData) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001518
1519 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001520 VkDeviceSize size, uint32_t data) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001521
1522 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001523 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const;
sfricke-samsunga1d00272021-03-10 21:37:41 -08001524 bool manual_PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
1525 const VkSwapchainCreateInfoKHR *pCreateInfos,
1526 const VkAllocationCallbacks *pAllocator,
1527 VkSwapchainKHR *pSwapchains) const;
Jeff Bolz5c801d12019-10-09 10:38:45 -05001528 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const;
sfricke-samsung5c1b7392020-12-13 22:17:15 -08001529 bool manual_PreCallValidateCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
1530 const VkDisplayModeCreateInfoKHR *pCreateInfo,
1531 const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001532
1533#ifdef VK_USE_PLATFORM_WIN32_KHR
1534 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001535 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001536#endif // VK_USE_PLATFORM_WIN32_KHR
1537
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001538 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001539 const VkAllocationCallbacks *pAllocator,
1540 VkDescriptorPool *pDescriptorPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001541 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001542 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001543
Jeff Bolz5c801d12019-10-09 10:38:45 -05001544 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001545
1546 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1547 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001548 uint32_t groupCountZ) const;
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001549 bool manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1550 VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount,
1551 const VkWriteDescriptorSet *pDescriptorWrites) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001552 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001553 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001554 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1555 uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001556 const VkShadingRatePaletteNV *pShadingRatePalettes) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001557
1558 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1559 uint32_t customSampleOrderCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001560 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001561
Jeff Bolz5c801d12019-10-09 10:38:45 -05001562 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001563 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001564 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001565
1566 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1567 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001568 uint32_t maxDrawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001569
1570 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001571 uint32_t *pPropertyCount,
1572 VkExtensionProperties *pProperties) const;
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001573 bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001574 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const;
Ricardo Garciaa4935972019-02-21 17:43:18 +01001575
1576 bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device,
1577 const VkAccelerationStructureCreateInfoNV *pCreateInfo,
1578 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001579 VkAccelerationStructureNV *pAccelerationStructure) const;
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001580 bool manual_PreCallValidateCreateAccelerationStructureKHR(VkDevice device,
1581 const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
1582 const VkAllocationCallbacks *pAllocator,
1583 VkAccelerationStructureKHR *pAccelerationStructure) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001584 bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer,
1585 const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData,
1586 VkDeviceSize instanceOffset, VkBool32 update,
1587 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001588 VkBuffer scratch, VkDeviceSize scratchOffset) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001589 bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001590 size_t dataSize, void *pData) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001591
1592 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer,
1593 uint32_t accelerationStructureCount,
1594 const VkAccelerationStructureNV *pAccelerationStructures,
1595 VkQueryType queryType, VkQueryPool queryPool,
1596 uint32_t firstQuery) const;
Peter Chen85366392019-05-14 15:20:11 -04001597 bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1598 const VkRayTracingPipelineCreateInfoNV *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001599 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001600 bool manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1601 VkPipelineCache pipelineCache, uint32_t createInfoCount,
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001602 const VkRayTracingPipelineCreateInfoKHR *pCreateInfos,
1603 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Chris Mayer9ded5eb2019-09-19 16:33:26 +02001604 bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001605 uint32_t viewportCount,
1606 const VkViewportWScalingNV *pViewportWScalings) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001607
1608#ifdef VK_USE_PLATFORM_WIN32_KHR
1609 bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
Jamie Madillaa076da2020-12-22 15:34:34 -05001610 VkDeviceGroupPresentModeFlagsKHR *pModes) const override;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001611#endif // VK_USE_PLATFORM_WIN32_KHR
Tobias Hectorebb855f2019-07-23 12:17:33 +01001612
1613 bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001614 const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const;
Tobias Hectorebb855f2019-07-23 12:17:33 +01001615
Jeff Bolz8125a8b2019-08-16 16:29:45 -05001616 bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001617 uint16_t lineStipplePattern) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001618
1619 bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001620 VkIndexType indexType) const;
sfricke-samsung4ada8d42020-02-09 17:43:11 -08001621 bool manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1622 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001623
Jeff Bolz5c801d12019-10-09 10:38:45 -05001624 bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001625
Jeff Bolz5c801d12019-10-09 10:38:45 -05001626 bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001627
Petr Kraus3d720392019-11-13 02:52:39 +01001628 bool manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout,
1629 VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) const;
1630
1631 bool manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
1632 uint32_t *pImageIndex) const;
1633
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001634 bool manual_PreCallValidateCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1635 uint32_t bindingCount, const VkBuffer *pBuffers,
1636 const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) const;
1637
1638 bool manual_PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1639 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1640 const VkDeviceSize *pCounterBufferOffsets) const;
1641
1642 bool manual_PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1643 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1644 const VkDeviceSize *pCounterBufferOffsets) const;
1645
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -07001646 bool manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount,
1647 uint32_t firstInstance, VkBuffer counterBuffer,
1648 VkDeviceSize counterBufferOffset, uint32_t counterOffset,
1649 uint32_t vertexStride) const;
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001650
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001651 bool manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1652 const VkAllocationCallbacks *pAllocator,
1653 VkSamplerYcbcrConversion *pYcbcrConversion) const;
1654 bool manual_PreCallValidateCreateSamplerYcbcrConversionKHR(VkDevice device,
1655 const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1656 const VkAllocationCallbacks *pAllocator,
1657 VkSamplerYcbcrConversion *pYcbcrConversion) const;
sfricke-samsung1708a8c2020-02-10 00:35:06 -08001658 bool manual_PreCallValidateImportSemaphoreFdKHR(VkDevice device,
1659 const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001660
sourav parmarcd5fb182020-07-17 12:58:44 -07001661 bool manual_PreCallValidateCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001662 const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1663
1664 bool manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR(
1665 VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1666
sourav parmarcd5fb182020-07-17 12:58:44 -07001667 bool manual_PreCallValidateCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1668 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001669
1670 bool manual_PreCallValidateCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
1671 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
1672 bool ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, const char *api_name) const;
1673 bool ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo,
Mark Lobodzinskiaad69e42020-05-12 08:44:21 -06001674 const char *api_name, bool is_cmd = false) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001675
sourav parmarcd5fb182020-07-17 12:58:44 -07001676 bool manual_PreCallValidateCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001677 const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
1678 bool manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR(
1679 VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001680
sourav parmar83c31b12020-05-06 12:30:54 -07001681 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesKHR(
1682 VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount,
1683 const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool,
1684 uint32_t firstQuery) const;
1685 bool manual_PreCallValidateWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount,
1686 const VkAccelerationStructureKHR *pAccelerationStructures,
1687 VkQueryType queryType, size_t dataSize, void *pData,
1688 size_t stride) const;
1689 bool manual_PreCallValidateGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline,
1690 uint32_t firstGroup, uint32_t groupCount,
1691 size_t dataSize, void *pData) const;
1692
1693 bool manual_PreCallValidateCmdTraceRaysKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001694 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1695 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1696 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1697 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width,
sourav parmar83c31b12020-05-06 12:30:54 -07001698 uint32_t height, uint32_t depth) const;
1699
1700 bool manual_PreCallValidateCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001701 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1702 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1703 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1704 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable,
1705 VkDeviceAddress indirectDeviceAddress) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001706
1707 bool manual_PreCallValidateCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer,
1708 VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer,
1709 VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride,
1710 VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset,
1711 VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer,
1712 VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride,
1713 uint32_t width, uint32_t height, uint32_t depth) const;
1714
sourav parmarcd5fb182020-07-17 12:58:44 -07001715 bool manual_PreCallValidateCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount,
1716 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1717 const VkDeviceAddress *pIndirectDeviceAddresses,
1718 const uint32_t *pIndirectStrides,
1719 const uint32_t *const *ppMaxPrimitiveCounts) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001720
1721 bool manual_PreCallValidateGetDeviceAccelerationStructureCompatibilityKHR(
sourav parmarcd5fb182020-07-17 12:58:44 -07001722 VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo,
1723 VkAccelerationStructureCompatibilityKHR *pCompatibility) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001724
1725 bool manual_PreCallValidateCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount,
1726 const VkViewport *pViewports) const;
1727 bool manual_PreCallValidateCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount,
1728 const VkRect2D *pScissors) const;
1729 bool manual_PreCallValidateCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1730 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets,
1731 const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const;
1732
sourav parmarcd5fb182020-07-17 12:58:44 -07001733 bool ValidateAccelerationStructureBuildGeometryInfoKHR(const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1734 uint32_t infoCount, const char *api_name) const;
1735 bool manual_PreCallValidateCmdBuildAccelerationStructuresKHR(
1736 VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1737 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1738
1739 bool manual_PreCallValidateBuildAccelerationStructuresKHR(
1740 VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount,
1741 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1742 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1743
1744 bool manual_PreCallValidateGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType,
1745 const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo,
1746 const uint32_t *pMaxPrimitiveCounts,
1747 VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) const;
1748
sfricke-samsungecafb192021-01-17 08:21:14 -08001749 bool manual_PreCallValidateCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfoEXT *pCreateInfo,
1750 const VkAllocationCallbacks *pAllocator,
1751 VkPrivateDataSlotEXT *pPrivateDataSlot) const;
Piers Daniellcb6d8032021-04-19 18:51:26 -06001752
1753 bool manual_PreCallValidateCmdSetVertexInputEXT(
1754 VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount,
1755 const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount,
1756 const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) const;
sfricke-samsung51303fb2021-05-09 19:09:13 -07001757
1758 bool manual_PreCallValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
1759 VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size,
1760 const void *pValues) const;
ziga-lunargb1dd8a22021-07-15 17:47:19 +02001761
1762 bool manual_PreCallValidateMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount,
1763 const VkPipelineCache *pSrcCaches) const;
1764
Nathaniel Cesario298d3cb2021-08-03 13:49:02 -06001765 bool manual_PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
1766 const VkClearColorValue *pColor, uint32_t rangeCount,
1767 const VkImageSubresourceRange *pRanges) const;
1768
1769 bool ValidateCmdBeginRenderPass(const char *const func_name, const VkRenderPassBeginInfo *const rp_begin) const;
1770 bool manual_PreCallValidateCmdBeginRenderPass(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1771 VkSubpassContents) const;
1772 bool manual_PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1773 const VkSubpassBeginInfo *) const;
1774 bool manual_PreCallValidateCmdBeginRenderPass2(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1775 const VkSubpassBeginInfo *) const;
1776
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001777 bool manual_PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle,
1778 uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) const;
ziga-lunarg3c37dfb2021-08-24 12:51:07 +02001779 bool manual_PreCallValidateGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount,
ziga-lunargcf340c42021-08-19 00:13:38 +02001780 size_t dataSize, void *pData, VkDeviceSize stride,
1781 VkQueryResultFlags flags) const;
1782 bool manual_PreCallValidateCmdBeginConditionalRenderingEXT(
1783 VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin) const;
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001784
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001785#include "parameter_validation.h"
1786}; // Class StatelessValidation