blob: 7898db2bc4114447730e05b833315576405289bf [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,
533 const char *pnext_vuid) 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,
sfricke-samsung32a27362020-02-28 09:06:42 -0800553 uint32_t header_version, const char *pnext_vuid, const char *stype_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700554 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700555
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700556 if (next != nullptr) {
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700557 layer_data::unordered_set<const void *> cycle_check;
558 layer_data::unordered_set<VkStructureType, layer_data::hash<int>> unique_stype_check;
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600559
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600560 const char *disclaimer =
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600561 "This error is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that "
562 "you are using a struct from a private extension or an extension that was added to a later version of the Vulkan "
563 "header, in which case the use of %s is undefined and may not work correctly with validation enabled";
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600564
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600565 if ((allowed_type_count == 0) && (custom_stype_info.size() == 0)) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700566 std::string message = "%s: value of %s must be NULL. ";
567 message += disclaimer;
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600568 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
569 header_version, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700570 } else {
571 const VkStructureType *start = allowed_types;
572 const VkStructureType *end = allowed_types + allowed_type_count;
Lockefbdd1af2019-04-16 15:07:23 -0600573 const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700574
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700575 while (current != nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700576 if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) ||
577 (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) &&
578 ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) ||
579 (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700580 std::string type_name = string_VkStructureType(current->sType);
Nathaniel Cesario78c1cdd2021-04-01 23:13:33 -0600581 if (unique_stype_check.find(current->sType) != unique_stype_check.end() &&
582 !IsDuplicatePnext(current->sType)) {
sfricke-samsung32a27362020-02-28 09:06:42 -0800583 // stype_vuid will only be null if there are no listed pNext and will hit disclaimer check
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700584 std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times.";
sfricke-samsung32a27362020-02-28 09:06:42 -0800585 skip_call |= LogError(device, stype_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
586 type_name.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700587 } else {
588 unique_stype_check.insert(current->sType);
589 }
590
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600591 // Search custom stype list -- if sType found, skip this entirely
592 bool custom = false;
John Zulauf79f06582021-02-27 18:38:39 -0700593 for (const auto &item : custom_stype_info) {
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600594 if (item.first == current->sType) {
595 custom = true;
596 break;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700597 }
598 }
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600599 if (!custom) {
600 if (std::find(start, end, current->sType) == end) {
601 if (type_name.compare(UnsupportedStructureTypeString) == 0) {
602 std::string message =
603 "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures "
604 "are [%s]. ";
605 message += disclaimer;
606 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
607 parameter_name.get_name().c_str(), current->sType, allowed_struct_names,
608 header_version, parameter_name.get_name().c_str());
609 } else {
610 std::string message =
611 "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures "
612 "are [%s]. ";
613 message += disclaimer;
614 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
615 parameter_name.get_name().c_str(), type_name.c_str(),
616 allowed_struct_names, header_version, parameter_name.get_name().c_str());
617 }
618 }
619 skip_call |= ValidatePnextStructContents(api_name, parameter_name, current, pnext_vuid);
620 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700621 }
Lockefbdd1af2019-04-16 15:07:23 -0600622 current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700623 }
624 }
625 }
626
627 return skip_call;
628 }
629
630 /**
631 * Validate a VkBool32 value.
632 *
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600633 * Generate an error if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700634 *
635 * @param apiName Name of API call being validated.
636 * @param parameterName Name of parameter being validated.
637 * @param value Boolean value to validate.
638 * @return Boolean value indicating that the call should be skipped.
639 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500640 bool validate_bool32(const char *apiName, const ParameterName &parameterName, VkBool32 value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700641 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700642 if ((value != VK_TRUE) && (value != VK_FALSE)) {
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600643 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
644 "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
645 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
646 apiName, parameterName.get_name().c_str(), value);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700647 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700648 return skip_call;
649 }
650
651 /**
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700652 * Validate an array of VkBool32 values.
653 *
654 * Generate an error if any VkBool32 value in an array is neither VK_TRUE nor VK_FALSE.
655 *
656 * @param apiName Name of API call being validated.
657 * @param countName Name of count parameter.
658 * @param arrayName Name of array parameter.
659 * @param count Number of values in the array.
660 * @param array Array of VkBool32 values to validate.
661 * @param countRequired The 'count' parameter may not be 0 when true.
662 * @param arrayRequired The 'array' parameter may not be NULL when true.
663 * @return Boolean value indicating that the call should be skipped.
664 */
665 bool validate_bool32_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
666 const VkBool32 *array, bool countRequired, bool arrayRequired) const {
667 bool skip_call = false;
668
669 if ((count == 0) || (array == nullptr)) {
670 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
671 kVUIDUndefined);
672 } else {
673 for (uint32_t i = 0; i < count; ++i) {
674 if ((array[i] != VK_TRUE) && (array[i] != VK_FALSE)) {
675 skip_call |=
676 LogError(device, kVUID_PVError_UnrecognizedValue,
677 "%s: value of %s[%d] (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
678 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
679 apiName, arrayName.get_name().c_str(), i, array[i]);
680 }
681 }
682 }
683
684 return skip_call;
685 }
686
687 /**
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700688 * Validate a Vulkan enumeration value.
689 *
690 * Generate a warning if an enumeration token value does not fall within the core enumeration
691 * begin and end token values, and was not added to the enumeration by an extension. Extension
692 * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
693 * with 1,000,000,000 as the base token value.
694 *
695 * @note This function does not expect to process enumerations defining bitmask flag bits.
696 *
697 * @param apiName Name of API call being validated.
698 * @param parameterName Name of parameter being validated.
699 * @param enumName Name of the enumeration being validated.
700 * @param valid_values The list of valid values for the enumeration.
701 * @param value Enumeration value to validate.
702 * @return Boolean value indicating that the call should be skipped.
703 */
704 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700705 bool validate_ranged_enum(const char *apiName, const ParameterName &parameterName, const char *enumName,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500706 const std::vector<T> &valid_values, T value, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700707 bool skip = false;
708
709 if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) {
710 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700711 LogError(device, vuid,
712 "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is "
713 "not an extension added token.",
714 apiName, parameterName.get_name().c_str(), value, enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700715 }
716
717 return skip;
718 }
719
720 /**
721 * Validate an array of Vulkan enumeration value.
722 *
723 * Process all enumeration token values in the specified array and generate a warning if a value
724 * does not fall within the core enumeration begin and end token values, and was not added to
725 * the enumeration by an extension. Extension provided enumerations use the equation specified
726 * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
727 *
728 * @note This function does not expect to process enumerations defining bitmask flag bits.
729 *
730 * @param apiName Name of API call being validated.
731 * @param countName Name of count parameter.
732 * @param arrayName Name of array parameter.
733 * @param enumName Name of the enumeration being validated.
734 * @param valid_values The list of valid values for the enumeration.
735 * @param count Number of enumeration values in the array.
736 * @param array Array of enumeration values to validate.
737 * @param countRequired The 'count' parameter may not be 0 when true.
738 * @param arrayRequired The 'array' parameter may not be NULL when true.
739 * @return Boolean value indicating that the call should be skipped.
740 */
741 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700742 bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
743 const char *enumName, const std::vector<T> &valid_values, uint32_t count, const T *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500744 bool countRequired, bool arrayRequired) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700745 bool skip_call = false;
746
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700747 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700748 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
749 kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700750 } else {
751 for (uint32_t i = 0; i < count; ++i) {
752 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700753 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
754 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
755 "enumeration tokens and is not an extension added token",
756 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700757 }
758 }
759 }
760
761 return skip_call;
762 }
763
764 /**
765 * Verify that a reserved VkFlags value is zero.
766 *
767 * Verify that the specified value is zero, to check VkFlags values that are reserved for
768 * future use.
769 *
770 * @param api_name Name of API call being validated.
771 * @param parameter_name Name of parameter being validated.
772 * @param value Value to validate.
773 * @return Boolean value indicating that the call should be skipped.
774 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500775 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 -0700776 bool skip_call = false;
777
778 if (value != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700779 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 -0700780 }
781
782 return skip_call;
783 }
784
Petr Kraus52758be2019-08-12 00:53:58 +0200785 enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit };
786
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700787 // helper to implement validation of both 32 bit and 64 bit flags.
788 template <typename FlagTypedef>
789 bool validate_flags_impl(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name,
790 FlagTypedef all_flags, FlagTypedef value, const FlagType flag_type, const char *vuid,
791 const char *flags_zero_vuid = nullptr) const {
792 bool skip_call = false;
793
794 if ((value & ~all_flags) != 0) {
795 skip_call |= LogError(device, vuid, "%s: value of %s contains flag bits that are not recognized members of %s",
796 api_name, parameter_name.get_name().c_str(), flag_bits_name);
797 }
798
799 const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit;
800 const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid;
801 if (required && value == 0) {
802 skip_call |= LogError(device, zero_vuid, "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str());
803 }
804
805 const auto HasMaxOneBitSet = [](const FlagTypedef f) {
806 // Decrement flips bits from right upto first 1.
807 // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED
808 return f == 0 || !(f & (f - 1));
809 };
810
811 const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit;
812 if (is_bits_type && !HasMaxOneBitSet(value)) {
813 skip_call |=
814 LogError(device, vuid, "%s: value of %s contains multiple members of %s when only a single value is allowed",
815 api_name, parameter_name.get_name().c_str(), flag_bits_name);
816 }
817
818 return skip_call;
819 }
820
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700821 /**
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700822 * Validate a 32 bit Vulkan bitmask value.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700823 *
824 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
825 * for that type.
826 *
827 * @param api_name Name of API call being validated.
828 * @param parameter_name Name of parameter being validated.
829 * @param flag_bits_name Name of the VkFlags type being validated.
830 * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated.
831 * @param value VkFlags value to validate.
Petr Kraus52758be2019-08-12 00:53:58 +0200832 * @param flag_type The type of flag, like optional, or single bit.
833 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
834 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700835 * @return Boolean value indicating that the call should be skipped.
836 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700837 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 -0500838 VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700839 return validate_flags_impl<VkFlags>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
840 flags_zero_vuid);
841 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700842
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700843 /**
844 * Validate a 64 bit Vulkan bitmask value.
845 *
846 * Generate a warning if a value with a VkFlags64 derived type does not contain valid flag bits
847 * for that type.
848 *
849 * @param api_name Name of API call being validated.
850 * @param parameter_name Name of parameter being validated.
851 * @param flag_bits_name Name of the VkFlags64 type being validated.
852 * @param all_flags A bit mask combining all valid flag bits for the VkFlags64 type being validated.
853 * @param value VkFlags64 value to validate.
854 * @param flag_type The type of flag, like optional, or single bit.
855 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
856 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
857 * @return Boolean value indicating that the call should be skipped.
858 */
859 bool validate_flags(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name, VkFlags64 all_flags,
860 VkFlags64 value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
861 return validate_flags_impl<VkFlags64>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
862 flags_zero_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700863 }
864
865 /**
866 * Validate an array of Vulkan bitmask values.
867 *
868 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
869 * for that type.
870 *
871 * @param api_name Name of API call being validated.
872 * @param count_name Name of parameter being validated.
873 * @param array_name Name of parameter being validated.
874 * @param flag_bits_name Name of the VkFlags type being validated.
875 * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated.
876 * @param count Number of VkFlags values in the array.
877 * @param array Array of VkFlags value to validate.
878 * @param count_required The 'count' parameter may not be 0 when true.
879 * @param array_required The 'array' parameter may not be NULL when true.
880 * @return Boolean value indicating that the call should be skipped.
881 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700882 bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
883 const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500884 bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700885 bool skip_call = false;
886
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700887 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700888 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
889 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700890 } else {
891 // Verify that all VkFlags values in the array
892 for (uint32_t i = 0; i < count; ++i) {
893 if (array[i] == 0) {
894 // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if
895 // elements in the array are allowed be 0
896 if (array_required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700897 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0",
898 api_name, array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700899 }
900 } else if ((array[i] & (~all_flags)) != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700901 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
902 "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name,
903 array_name.get_name().c_str(), i, flag_bits_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700904 }
905 }
906 }
907
908 return skip_call;
909 }
910
911 template <typename ExtensionState>
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600912 bool validate_extension_reqs(const ExtensionState &extensions, const char *vuid, const char *extension_type,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500913 const char *extension_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700914 bool skip = false;
915 if (!extension_name) {
916 return skip; // Robust to invalid char *
917 }
918 auto info = ExtensionState::get_info(extension_name);
919
920 if (!info.state) {
921 return skip; // Unknown extensions cannot be checked so report OK
922 }
923
924 // Check against the required list in the info
925 std::vector<const char *> missing;
Petr Krausbce952d2020-04-02 18:40:40 +0200926 for (const auto &req : info.requirements) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700927 if (!(extensions.*(req.enabled))) {
928 missing.push_back(req.name);
929 }
930 }
931
932 // Report any missing requirements
933 if (missing.size()) {
934 std::string missing_joined_list = string_join(", ", missing);
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700935 skip |= LogError(instance, vuid, "Missing extension%s required by the %s extension %s: %s.",
936 ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700937 }
938 return skip;
939 }
940
941 enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
942
943 template <typename RenderPassCreateInfoGeneric>
Petr Kraus3e52eba2019-07-10 01:24:10 +0200944 bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo,
Jeremy Gebben40a22942020-12-22 14:22:06 -0700945 uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags2KHR stages,
946 const char *vuid, const char *target, const char *func_name) const {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200947 bool skip = false;
Jeremy Gebben5f585ae2021-02-02 09:03:06 -0700948 // make sure we consider all of the expanded and un-expanded graphics bits to be valid
Jeremy Gebben40a22942020-12-22 14:22:06 -0700949 const auto kExcludeStages = VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR | VK_PIPELINE_STAGE_2_COPY_BIT_KHR |
950 VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR | VK_PIPELINE_STAGE_2_BLIT_BIT_KHR |
951 VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR;
952 const auto kMetaGraphicsStages = VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR | VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR |
953 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR;
954 const auto kGraphicsStages =
955 (sync_utils::ExpandPipelineStages(VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_QUEUE_GRAPHICS_BIT) | kMetaGraphicsStages) &
956 ~kExcludeStages;
Petr Krausdfd26442019-08-13 03:25:19 +0200957
958 const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) {
Jeremy Gebben12933ef2021-05-12 17:16:27 -0600959 if (subpass == VK_SUBPASS_EXTERNAL || subpass >= pCreateInfo->subpassCount)
Petr Kraus3e52eba2019-07-10 01:24:10 +0200960 return false;
961 else
Petr Krausdfd26442019-08-13 03:25:19 +0200962 return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage;
Petr Kraus3e52eba2019-07-10 01:24:10 +0200963 };
964
Petr Krausdfd26442019-08-13 03:25:19 +0200965 const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0;
966 if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) {
sfricke-samsung46fc6632020-09-12 14:28:58 -0700967 skip |= LogError(VkRenderPass(0), vuid,
968 "%s: Dependency pDependencies[%" PRIu32
969 "] specifies a %sStageMask that contains stages (%s) that are not part "
970 "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.",
Jeremy Gebben40a22942020-12-22 14:22:06 -0700971 func_name, dependency_index, target,
972 sync_utils::StringPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass);
Petr Kraus3e52eba2019-07-10 01:24:10 +0200973 }
974
975 return skip;
976 };
977
978 template <typename RenderPassCreateInfoGeneric>
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700979 bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700980 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500981 RenderPassCreateVersion rp_version) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700982 bool skip = false;
983 uint32_t max_color_attachments = device_limits.maxColorAttachments;
984 bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2);
sfricke-samsung46fc6632020-09-12 14:28:58 -0700985 const char *func_name = (use_rp2) ? "vkCreateRenderPass2" : "vkCreateRenderPass";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700986 const char *vuid;
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700987 VkBool32 separate_depth_stencil_layouts = false;
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700988 const auto *vulkan_12_features = LvlFindInChain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700989 if (vulkan_12_features) {
990 separate_depth_stencil_layouts = vulkan_12_features->separateDepthStencilLayouts;
991 } else {
992 const auto *separate_depth_stencil_layouts_features =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700993 LvlFindInChain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700994 if (separate_depth_stencil_layouts_features)
995 separate_depth_stencil_layouts = separate_depth_stencil_layouts_features->separateDepthStencilLayouts;
996 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700997
998 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
Piers Daniell4fde9b72019-11-27 16:19:46 -0700999 const auto *attachment_description_stencil_layout =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -07001000 (use_rp2) ? LvlFindInChain<VkAttachmentDescriptionStencilLayout>(
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001001 reinterpret_cast<VkAttachmentDescription2 const *>(&pCreateInfo->pAttachments[i])->pNext)
Piers Daniell4fde9b72019-11-27 16:19:46 -07001002 : 0;
1003
sfricke-samsungcac6a262020-04-28 07:50:49 -07001004 const VkFormat attachment_format = pCreateInfo->pAttachments[i].format;
1005 const VkImageLayout initial_layout = pCreateInfo->pAttachments[i].initialLayout;
1006 const VkImageLayout final_layout = pCreateInfo->pAttachments[i].finalLayout;
1007 if (attachment_format == VK_FORMAT_UNDEFINED) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001008 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-parameter" : "VUID-VkAttachmentDescription-format-parameter";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001009 skip |= LogWarning(device, vuid, "%s: pCreateInfo->pAttachments[%u].format is VK_FORMAT_UNDEFINED.", func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001010 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001011 if (final_layout == VK_IMAGE_LAYOUT_UNDEFINED || final_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001012 vuid =
1013 use_rp2 ? "VUID-VkAttachmentDescription2-finalLayout-03061" : "VUID-VkAttachmentDescription-finalLayout-00843";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001014 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001015 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001016 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001017 func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001018 }
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001019 if (!separate_depth_stencil_layouts) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001020 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1021 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1022 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1023 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001024 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03298"
Piers Daniell9af77cd2019-10-16 13:54:12 -06001025 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001026 skip |= LogError(
1027 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001028 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1029 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1030 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001031 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001032 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001033 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1034 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1035 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1036 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001037 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03299"
Piers Daniell9af77cd2019-10-16 13:54:12 -06001038 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001039 skip |= LogError(
1040 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001041 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1042 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1043 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001044 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001045 }
1046 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001047 if (!FormatIsDepthOrStencil(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001048 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1049 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1050 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1051 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001052 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03300" : "VUID-VkAttachmentDescription-format-03286";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001053 skip |= LogError(
1054 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001055 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1056 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
Piers Daniell9af77cd2019-10-16 13:54:12 -06001057 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001058 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001059 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001060 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1061 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1062 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1063 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001064 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03301" : "VUID-VkAttachmentDescription-format-03287";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001065 skip |= LogError(
1066 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001067 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1068 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1069 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001070 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001071 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001072 } else if (FormatIsDepthAndStencil(attachment_format)) {
Piers Daniell9af77cd2019-10-16 13:54:12 -06001073 if (use_rp2) {
1074 if (!attachment_description_stencil_layout) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001075 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1076 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
1077 skip |=
1078 LogError(device, "VUID-VkAttachmentDescription2-format-03302",
1079 "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout",
1080 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001081 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001082 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1083 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
1084 skip |=
1085 LogError(device, "VUID-VkAttachmentDescription2-format-03303",
1086 "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout",
1087 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001088 }
1089 }
1090 } else {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001091 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1092 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1093 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1094 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1095 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03288",
1096 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1097 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1098 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1099 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1100 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001101 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001102 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1103 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1104 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1105 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1106 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03289",
1107 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1108 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1109 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1110 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1111 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001112 }
1113 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001114 } else if (FormatIsDepthOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001115 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1116 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001117 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03304" : "VUID-VkAttachmentDescription-format-03290";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001118 skip |= LogError(device, vuid,
1119 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001120 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or"
1121 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001122 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001123 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001124 if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1125 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001126 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03305" : "VUID-VkAttachmentDescription-format-03291";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001127 skip |= LogError(device, vuid,
1128 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001129 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1130 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001131 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001132 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001133 } else if (FormatIsStencilOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001134 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1135 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001136 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03306" : "VUID-VkAttachmentDescription-format-03292";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001137 skip |= LogError(device, vuid,
1138 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001139 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or"
1140 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001141 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001142 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001143 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1144 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001145 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03307" : "VUID-VkAttachmentDescription-format-03293";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001146 skip |= LogError(device, vuid,
1147 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001148 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001149 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL",
1150 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001151 }
1152 }
1153 if (use_rp2 && attachment_description_stencil_layout) {
1154 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001155 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1156 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001157 attachment_description_stencil_layout->stencilInitialLayout ==
1158 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1159 attachment_description_stencil_layout->stencilInitialLayout ==
1160 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1161 attachment_description_stencil_layout->stencilInitialLayout ==
1162 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1163 attachment_description_stencil_layout->stencilInitialLayout ==
1164 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001165 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001166 "%s: VkAttachmentDescriptionStencilLayout.stencilInitialLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001167 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001168 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001169 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1170 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1171 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001172 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1173 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001174 }
1175 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001176 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1177 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001178 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1179 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1180 attachment_description_stencil_layout->stencilFinalLayout ==
1181 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1182 attachment_description_stencil_layout->stencilFinalLayout ==
1183 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001184 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001185 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001186 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001187 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001188 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1189 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1190 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001191 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1192 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001193 }
1194 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
1195 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001196 skip |= LogError(
1197 device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001198 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001199 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
1200 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001201 }
1202 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001203
1204 if (FormatIsDepthOrStencil(attachment_format)) {
1205 if (initial_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1206 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03295" : "VUID-VkAttachmentDescription-format-03281";
1207 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001208 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001209 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001210 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001211 }
1212 if (final_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1213 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03297" : "VUID-VkAttachmentDescription-format-03283";
1214 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001215 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001216 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001217 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001218 }
1219 }
1220 if (FormatIsColor(attachment_format)) {
1221 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1222 initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1223 initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1224 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1225 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03294" : "VUID-VkAttachmentDescription-format-03280";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001226 skip |= LogError(device, vuid,
1227 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1228 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1229 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1230 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1231 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1232 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001233 }
1234 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1235 final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1236 final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1237 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1238 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03296" : "VUID-VkAttachmentDescription-format-03282";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001239 skip |= LogError(device, vuid,
1240 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1241 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1242 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1243 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1244 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1245 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001246 }
1247 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001248 }
1249
1250 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
1251 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001252 vuid = use_rp2 ? "VUID-VkSubpassDescription2-colorAttachmentCount-03063"
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001253 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001254 skip |=
1255 LogError(device, vuid,
1256 "%s: Cannot create a render pass with %d color attachments in pCreateInfo->pSubpasses[%u]. Max is %d.",
1257 func_name, pCreateInfo->pSubpasses[i].colorAttachmentCount, i, max_color_attachments);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001258 }
1259 }
Petr Kraus3e52eba2019-07-10 01:24:10 +02001260
1261 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) {
1262 const auto &dependency = pCreateInfo->pDependencies[i];
1263
sfricke-samsung55f01952020-03-24 08:16:41 -07001264 // Need to check first so layer doesn't segfault from out of bound array access
1265 // src subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001266 if ((dependency.srcSubpass != VK_SUBPASS_EXTERNAL) && (dependency.srcSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001267 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-srcSubpass-02526" : "VUID-VkRenderPassCreateInfo-srcSubpass-02517";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001268 skip |= LogError(device, vuid,
1269 "%s: pCreateInfo->pDependencies[%u].srcSubpass index (%u) has to be less than subpassCount (%u)",
1270 func_name, i, dependency.srcSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001271 }
1272
sfricke-samsung55f01952020-03-24 08:16:41 -07001273 // dst subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001274 if ((dependency.dstSubpass != VK_SUBPASS_EXTERNAL) && (dependency.dstSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001275 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-dstSubpass-02527" : "VUID-VkRenderPassCreateInfo-dstSubpass-02518";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001276 skip |= LogError(device, vuid,
1277 "%s: pCreateInfo->pDependencies[%u].dstSubpass index (%u) has to be less than subpassCount (%u)",
1278 func_name, i, dependency.dstSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001279 }
1280
Petr Kraus3e52eba2019-07-10 01:24:10 +02001281 // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked
Mike Schuchardt65847d92019-12-20 13:50:47 -08001282 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001283 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001284 "src", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001285
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001286 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001287 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001288 "dst", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001289 }
1290
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001291 return skip;
1292 }
1293
1294 template <typename T>
1295 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001296 std::unique_lock<std::mutex> lock(renderpass_map_mutex);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001297 auto &renderpass_state = renderpasses_states[renderPass];
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001298 lock.unlock();
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001299
1300 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
1301 bool uses_color = false;
1302 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
1303 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
1304
1305 bool uses_depthstencil = false;
1306 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
1307 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
1308 uses_depthstencil = true;
1309
1310 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
1311 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
1312 }
1313 }
1314
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001315 // Pre/PostCallRecord declarations
1316 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1317 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1318 VkResult result) override;
Mike Schuchardt2df08912020-12-15 16:28:09 -08001319 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001320 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1321 VkResult result) override;
1322 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1323 const VkAllocationCallbacks *pAllocator) override;
Tony-LunarG3c287f62020-12-17 12:39:49 -07001324 void PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo,
1325 VkCommandBuffer *pCommandBuffers, VkResult result) override;
1326 void PostCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
1327 const VkCommandBuffer *pCommandBuffers) override;
1328 void PostCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1329 const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001330 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
1331 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) override;
1332 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
1333 VkInstance *pInstance, VkResult result) override;
1334
Nathaniel Cesario645a15b2021-01-08 22:40:21 -07001335 void CommonPostCallRecordEnumeratePhysicalDevice(const VkPhysicalDevice *phys_devices, const int count);
1336 void PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
1337 VkPhysicalDevice *pPhysicalDevices, VkResult result) override;
1338
1339 void PostCallRecordEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
1340 VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties,
1341 VkResult result) override;
1342
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001343 bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001344
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001345 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001346
Tony-LunarG866843d2020-05-13 11:22:42 -06001347 bool validate_validation_features(const VkInstanceCreateInfo *pCreateInfo,
1348 const VkValidationFeaturesEXT *validation_features) const;
1349
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001350 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001351
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001352 bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid,
1353 const char *validateString) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001354
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001355 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001356
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001357 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name,
1358 const char *array_parameter_name, const std::string &unique_error_code,
1359 const std::string &valid_error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001360
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001361 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name,
1362 const std::string &error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001363
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001364 bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkAccelerationStructureNV object_handle,
1365 const char *func_name) const;
1366 bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkAccelerationStructureNV object_handle,
Jason Macnak192fa0e2019-07-26 15:07:16 -07001367 const char *func_name) const;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001368 bool ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, const char *func_name) const;
1369 bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkAccelerationStructureNV object_handle,
Mark Lobodzinski17dc4602020-05-29 07:48:40 -06001370 const char *func_nam, bool is_cmd) const;
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001371 bool ValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1372 const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion,
1373 const char *apiName) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001374 bool ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1375 bool khr) const;
1376 bool ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1377 bool khr) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001378
sfricke-samsunga1d00272021-03-10 21:37:41 -08001379 bool ValidateSwapchainCreateInfo(const char *func_name, VkSwapchainCreateInfoKHR const *pCreateInfo) const;
1380
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001381 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001382
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001383 void PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -06001384
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001385 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001386 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001387
1388 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001389 VkInstance *pInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001390
1391 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001392 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001393
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001394 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001395 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001396
1397 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001398 const VkAllocationCallbacks *pAllocator, VkImage *pImage) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001399
Jeff Bolz99e3f632020-03-24 22:59:22 -05001400 bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1401 const VkAllocationCallbacks *pAllocator, VkImageView *pView) const;
1402
Jeff Bolz6d3beaa2019-02-09 21:00:05 -06001403 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName &parameter_name,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001404 VkCommandBuffer object) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001405
sfricke-samsung51303fb2021-05-09 19:09:13 -07001406 bool manual_PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo,
1407 const VkAllocationCallbacks *pAllocator,
1408 VkPipelineLayout *pPipelineLayout) const;
ziga-lunargc6341372021-07-28 12:57:42 +02001409
1410 bool ValidatePipelineShaderStageCreateInfo(const char *func_name, const char *msg,
1411 const VkPipelineShaderStageCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001412 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1413 const VkGraphicsPipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001414 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001415 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1416 const VkComputePipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001417 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001418
1419 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001420 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001421 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001422 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001423 VkDescriptorSetLayout *pSetLayout) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001424
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001425 bool validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount,
1426 const VkWriteDescriptorSet *pDescriptorWrites, const bool validateDstSet = true) const;
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001427 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1428 const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001429 const VkCopyDescriptorSet *pDescriptorCopies) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001430
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001431 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001432 const VkDescriptorSet *pDescriptorSets) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001433
1434 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001435 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001436
sfricke-samsung681ab7b2020-10-29 01:53:35 -07001437 bool manual_PreCallValidateCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
1438 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
1439
Mike Schuchardt2df08912020-12-15 16:28:09 -08001440 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001441 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001442
1443 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001444 const VkCommandBuffer *pCommandBuffers) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001445
Jeff Bolz5c801d12019-10-09 10:38:45 -05001446 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001447
1448 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001449 const VkViewport *pViewports) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001450
1451 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001452 const VkRect2D *pScissors) const;
1453 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001454
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001455 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1456 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001457
1458 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001459 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001460
sfricke-samsungf692b972020-05-02 08:00:45 -07001461 bool manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1462 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1463 uint32_t stride) const;
1464
1465 bool manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1466 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1467 uint32_t stride) const;
1468
1469 bool manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1470 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1471 uint32_t maxDrawCount, uint32_t stride) const;
1472
1473 bool manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1474 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1475 uint32_t maxDrawCount, uint32_t stride) const;
1476
Tony-LunarG4490de42021-06-21 15:49:19 -06001477 bool manual_PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1478 const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount,
1479 uint32_t firstInstance, uint32_t stride) const;
1480
1481 bool manual_PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1482 const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount,
1483 uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset) const;
1484
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001485 bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1486 const VkClearAttachment *pAttachments, uint32_t rectCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001487 const VkClearRect *pRects) const;
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001488
Andrew Fobel3abeb992020-01-20 16:33:22 -05001489 bool ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1490 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1491 VkImageFormatProperties2 *pImageFormatProperties,
1492 const char *apiName) const;
1493 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1494 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1495 VkImageFormatProperties2 *pImageFormatProperties) const;
1496 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1497 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1498 VkImageFormatProperties2 *pImageFormatProperties) const;
Lionel Landwerlin5fe52752020-07-22 08:18:14 +03001499 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
1500 VkImageType type, VkImageTiling tiling,
1501 VkImageUsageFlags usage, VkImageCreateFlags flags,
1502 VkImageFormatProperties *pImageFormatProperties) const;
Andrew Fobel3abeb992020-01-20 16:33:22 -05001503
ziga-lunarg73b5ef22021-07-29 20:25:06 +02001504 bool manual_PreCallValidateGetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
1505 const VkPhysicalDeviceVideoFormatInfoKHR *pVideoFormatInfo,
1506 uint32_t *pVideoFormatPropertyCount,
1507 VkVideoFormatPropertiesKHR *pVideoFormatProperties) const;
1508
sfricke-samsung3999ef62020-02-09 17:05:59 -08001509 bool manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
1510 uint32_t regionCount, const VkBufferCopy *pRegions) const;
1511
Jeff Leger178b1e52020-10-05 12:22:23 -04001512 bool manual_PreCallValidateCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2KHR *pCopyBufferInfo) const;
1513
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001514 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001515 VkDeviceSize dataSize, const void *pData) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001516
1517 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001518 VkDeviceSize size, uint32_t data) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001519
1520 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001521 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const;
sfricke-samsunga1d00272021-03-10 21:37:41 -08001522 bool manual_PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
1523 const VkSwapchainCreateInfoKHR *pCreateInfos,
1524 const VkAllocationCallbacks *pAllocator,
1525 VkSwapchainKHR *pSwapchains) const;
Jeff Bolz5c801d12019-10-09 10:38:45 -05001526 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const;
sfricke-samsung5c1b7392020-12-13 22:17:15 -08001527 bool manual_PreCallValidateCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
1528 const VkDisplayModeCreateInfoKHR *pCreateInfo,
1529 const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001530
1531#ifdef VK_USE_PLATFORM_WIN32_KHR
1532 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001533 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001534#endif // VK_USE_PLATFORM_WIN32_KHR
1535
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001536 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001537 const VkAllocationCallbacks *pAllocator,
1538 VkDescriptorPool *pDescriptorPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001539 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001540 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001541
Jeff Bolz5c801d12019-10-09 10:38:45 -05001542 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001543
1544 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1545 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001546 uint32_t groupCountZ) const;
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001547 bool manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1548 VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount,
1549 const VkWriteDescriptorSet *pDescriptorWrites) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001550 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001551 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001552 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1553 uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001554 const VkShadingRatePaletteNV *pShadingRatePalettes) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001555
1556 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1557 uint32_t customSampleOrderCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001558 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001559
Jeff Bolz5c801d12019-10-09 10:38:45 -05001560 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001561 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001562 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001563
1564 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1565 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001566 uint32_t maxDrawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001567
1568 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001569 uint32_t *pPropertyCount,
1570 VkExtensionProperties *pProperties) const;
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001571 bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001572 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const;
Ricardo Garciaa4935972019-02-21 17:43:18 +01001573
1574 bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device,
1575 const VkAccelerationStructureCreateInfoNV *pCreateInfo,
1576 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001577 VkAccelerationStructureNV *pAccelerationStructure) const;
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001578 bool manual_PreCallValidateCreateAccelerationStructureKHR(VkDevice device,
1579 const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
1580 const VkAllocationCallbacks *pAllocator,
1581 VkAccelerationStructureKHR *pAccelerationStructure) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001582 bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer,
1583 const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData,
1584 VkDeviceSize instanceOffset, VkBool32 update,
1585 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001586 VkBuffer scratch, VkDeviceSize scratchOffset) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001587 bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001588 size_t dataSize, void *pData) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001589
1590 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer,
1591 uint32_t accelerationStructureCount,
1592 const VkAccelerationStructureNV *pAccelerationStructures,
1593 VkQueryType queryType, VkQueryPool queryPool,
1594 uint32_t firstQuery) const;
Peter Chen85366392019-05-14 15:20:11 -04001595 bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1596 const VkRayTracingPipelineCreateInfoNV *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001597 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001598 bool manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1599 VkPipelineCache pipelineCache, uint32_t createInfoCount,
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001600 const VkRayTracingPipelineCreateInfoKHR *pCreateInfos,
1601 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Chris Mayer9ded5eb2019-09-19 16:33:26 +02001602 bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001603 uint32_t viewportCount,
1604 const VkViewportWScalingNV *pViewportWScalings) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001605
1606#ifdef VK_USE_PLATFORM_WIN32_KHR
1607 bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
Jamie Madillaa076da2020-12-22 15:34:34 -05001608 VkDeviceGroupPresentModeFlagsKHR *pModes) const override;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001609#endif // VK_USE_PLATFORM_WIN32_KHR
Tobias Hectorebb855f2019-07-23 12:17:33 +01001610
1611 bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001612 const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const;
Tobias Hectorebb855f2019-07-23 12:17:33 +01001613
Jeff Bolz8125a8b2019-08-16 16:29:45 -05001614 bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001615 uint16_t lineStipplePattern) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001616
1617 bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001618 VkIndexType indexType) const;
sfricke-samsung4ada8d42020-02-09 17:43:11 -08001619 bool manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1620 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001621
Jeff Bolz5c801d12019-10-09 10:38:45 -05001622 bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001623
Jeff Bolz5c801d12019-10-09 10:38:45 -05001624 bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001625
Petr Kraus3d720392019-11-13 02:52:39 +01001626 bool manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout,
1627 VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) const;
1628
1629 bool manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
1630 uint32_t *pImageIndex) const;
1631
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001632 bool manual_PreCallValidateCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1633 uint32_t bindingCount, const VkBuffer *pBuffers,
1634 const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) const;
1635
1636 bool manual_PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1637 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1638 const VkDeviceSize *pCounterBufferOffsets) const;
1639
1640 bool manual_PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1641 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1642 const VkDeviceSize *pCounterBufferOffsets) const;
1643
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -07001644 bool manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount,
1645 uint32_t firstInstance, VkBuffer counterBuffer,
1646 VkDeviceSize counterBufferOffset, uint32_t counterOffset,
1647 uint32_t vertexStride) const;
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001648
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001649 bool manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1650 const VkAllocationCallbacks *pAllocator,
1651 VkSamplerYcbcrConversion *pYcbcrConversion) const;
1652 bool manual_PreCallValidateCreateSamplerYcbcrConversionKHR(VkDevice device,
1653 const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1654 const VkAllocationCallbacks *pAllocator,
1655 VkSamplerYcbcrConversion *pYcbcrConversion) const;
sfricke-samsung1708a8c2020-02-10 00:35:06 -08001656 bool manual_PreCallValidateImportSemaphoreFdKHR(VkDevice device,
1657 const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001658
sourav parmarcd5fb182020-07-17 12:58:44 -07001659 bool manual_PreCallValidateCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001660 const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1661
1662 bool manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR(
1663 VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1664
sourav parmarcd5fb182020-07-17 12:58:44 -07001665 bool manual_PreCallValidateCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1666 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001667
1668 bool manual_PreCallValidateCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
1669 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
1670 bool ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, const char *api_name) const;
1671 bool ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo,
Mark Lobodzinskiaad69e42020-05-12 08:44:21 -06001672 const char *api_name, bool is_cmd = false) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001673
sourav parmarcd5fb182020-07-17 12:58:44 -07001674 bool manual_PreCallValidateCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001675 const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
1676 bool manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR(
1677 VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001678
sourav parmar83c31b12020-05-06 12:30:54 -07001679 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesKHR(
1680 VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount,
1681 const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool,
1682 uint32_t firstQuery) const;
1683 bool manual_PreCallValidateWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount,
1684 const VkAccelerationStructureKHR *pAccelerationStructures,
1685 VkQueryType queryType, size_t dataSize, void *pData,
1686 size_t stride) const;
1687 bool manual_PreCallValidateGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline,
1688 uint32_t firstGroup, uint32_t groupCount,
1689 size_t dataSize, void *pData) const;
1690
1691 bool manual_PreCallValidateCmdTraceRaysKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001692 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1693 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1694 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1695 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width,
sourav parmar83c31b12020-05-06 12:30:54 -07001696 uint32_t height, uint32_t depth) const;
1697
1698 bool manual_PreCallValidateCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001699 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1700 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1701 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1702 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable,
1703 VkDeviceAddress indirectDeviceAddress) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001704
1705 bool manual_PreCallValidateCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer,
1706 VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer,
1707 VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride,
1708 VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset,
1709 VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer,
1710 VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride,
1711 uint32_t width, uint32_t height, uint32_t depth) const;
1712
sourav parmarcd5fb182020-07-17 12:58:44 -07001713 bool manual_PreCallValidateCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount,
1714 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1715 const VkDeviceAddress *pIndirectDeviceAddresses,
1716 const uint32_t *pIndirectStrides,
1717 const uint32_t *const *ppMaxPrimitiveCounts) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001718
1719 bool manual_PreCallValidateGetDeviceAccelerationStructureCompatibilityKHR(
sourav parmarcd5fb182020-07-17 12:58:44 -07001720 VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo,
1721 VkAccelerationStructureCompatibilityKHR *pCompatibility) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001722
1723 bool manual_PreCallValidateCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount,
1724 const VkViewport *pViewports) const;
1725 bool manual_PreCallValidateCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount,
1726 const VkRect2D *pScissors) const;
1727 bool manual_PreCallValidateCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1728 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets,
1729 const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const;
1730
sourav parmarcd5fb182020-07-17 12:58:44 -07001731 bool ValidateAccelerationStructureBuildGeometryInfoKHR(const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1732 uint32_t infoCount, const char *api_name) const;
1733 bool manual_PreCallValidateCmdBuildAccelerationStructuresKHR(
1734 VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1735 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1736
1737 bool manual_PreCallValidateBuildAccelerationStructuresKHR(
1738 VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount,
1739 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1740 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1741
1742 bool manual_PreCallValidateGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType,
1743 const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo,
1744 const uint32_t *pMaxPrimitiveCounts,
1745 VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) const;
1746
sfricke-samsungecafb192021-01-17 08:21:14 -08001747 bool manual_PreCallValidateCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfoEXT *pCreateInfo,
1748 const VkAllocationCallbacks *pAllocator,
1749 VkPrivateDataSlotEXT *pPrivateDataSlot) const;
Piers Daniellcb6d8032021-04-19 18:51:26 -06001750
1751 bool manual_PreCallValidateCmdSetVertexInputEXT(
1752 VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount,
1753 const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount,
1754 const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) const;
sfricke-samsung51303fb2021-05-09 19:09:13 -07001755
1756 bool manual_PreCallValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
1757 VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size,
1758 const void *pValues) const;
ziga-lunargb1dd8a22021-07-15 17:47:19 +02001759
1760 bool manual_PreCallValidateMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount,
1761 const VkPipelineCache *pSrcCaches) const;
1762
Nathaniel Cesario298d3cb2021-08-03 13:49:02 -06001763 bool manual_PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
1764 const VkClearColorValue *pColor, uint32_t rangeCount,
1765 const VkImageSubresourceRange *pRanges) const;
1766
1767 bool ValidateCmdBeginRenderPass(const char *const func_name, const VkRenderPassBeginInfo *const rp_begin) const;
1768 bool manual_PreCallValidateCmdBeginRenderPass(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1769 VkSubpassContents) const;
1770 bool manual_PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1771 const VkSubpassBeginInfo *) const;
1772 bool manual_PreCallValidateCmdBeginRenderPass2(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1773 const VkSubpassBeginInfo *) const;
1774
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001775 bool manual_PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle,
1776 uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) const;
1777
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001778#include "parameter_validation.h"
1779}; // Class StatelessValidation