blob: 699b7ec0794f0c06554a5d75452e4c58ca41be48 [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;
Mike Schuchardt00e81452021-11-29 11:11:20 -080060extern const VkPipelineColorBlendStateCreateFlags AllVkPipelineColorBlendStateCreateFlagBits;
61extern const VkPipelineDepthStencilStateCreateFlags AllVkPipelineDepthStencilStateCreateFlagBits;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070062
sourav parmara96ab1a2020-04-25 16:28:23 -070063extern const std::vector<VkGeometryTypeKHR> AllVkGeometryTypeKHREnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070064extern const std::vector<VkCompareOp> AllVkCompareOpEnums;
65extern const std::vector<VkStencilOp> AllVkStencilOpEnums;
66extern const std::vector<VkBlendFactor> AllVkBlendFactorEnums;
67extern const std::vector<VkBlendOp> AllVkBlendOpEnums;
68extern const std::vector<VkLogicOp> AllVkLogicOpEnums;
69extern const std::vector<VkBorderColor> AllVkBorderColorEnums;
70extern const std::vector<VkImageLayout> AllVkImageLayoutEnums;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060071extern const std::vector<VkFormat> AllVkFormatEnums;
72extern const std::vector<VkVertexInputRate> AllVkVertexInputRateEnums;
73extern const std::vector<VkPrimitiveTopology> AllVkPrimitiveTopologyEnums;
sourav parmara96ab1a2020-04-25 16:28:23 -070074extern const std::vector<VkIndexType> AllVkIndexTypeEnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070075
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -060076extern std::vector<std::pair<uint32_t, uint32_t>> custom_stype_info;
77
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070078// String returned by string_VkStructureType for an unrecognized type.
79const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType";
80
81// String returned by string_VkResult for an unrecognized type.
82const std::string UnsupportedResultString = "Unhandled VkResult";
83
84// The base value used when computing the offset for an enumeration token value that is added by an extension.
85// When validating enumeration tokens, any value >= to this value is considered to be provided by an extension.
86// See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification
87const uint32_t ExtEnumBaseValue = 1000000000;
88
89// The value of all VK_xxx_MAX_ENUM tokens
90const uint32_t MaxEnumValue = 0x7FFFFFFF;
91
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070092class StatelessValidation : public ValidationObject {
Petr Kraus4ed81e32019-09-02 23:41:19 +020093 public:
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070094 VkPhysicalDeviceLimits device_limits = {};
Petr Kraus715bcc72019-08-15 17:17:33 +020095 safe_VkPhysicalDeviceFeatures2 physical_device_features2;
Tony-LunarG6c3c5452019-12-13 10:37:38 -070096 void *device_createinfo_pnext;
Petr Kraus715bcc72019-08-15 17:17:33 +020097 const VkPhysicalDeviceFeatures &physical_device_features = physical_device_features2.features;
Jeremy Gebbencbf22862021-03-03 12:01:22 -070098 layer_data::unordered_map<VkPhysicalDevice, VkPhysicalDeviceProperties *> physical_device_properties_map;
99 layer_data::unordered_map<VkPhysicalDevice, layer_data::unordered_set<std::string>> device_extensions_enumerated{};
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700100
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700101 // Override chassis read/write locks for this validation object
102 // This override takes a deferred lock. i.e. it is not acquired.
Jeremy Gebben2e5b41b2021-10-11 16:41:49 -0600103 ReadLockGuard ReadLock() override;
104 WriteLockGuard WriteLock() override;
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700105
sfricke-samsunga6c67fb2020-12-15 20:51:42 -0800106 // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2::pNext chain
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700107 struct DeviceExtensionProperties {
108 VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props;
109 VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props;
Jeff Bolz443c2ca2020-03-19 12:11:51 -0500110 VkPhysicalDeviceRayTracingPropertiesNV ray_tracing_propsNV;
sourav parmarcd5fb182020-07-17 12:58:44 -0700111 VkPhysicalDeviceRayTracingPipelinePropertiesKHR ray_tracing_propsKHR;
112 VkPhysicalDeviceAccelerationStructurePropertiesKHR acc_structure_props;
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -0700113 VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback_props;
Piers Daniellcb6d8032021-04-19 18:51:26 -0600114 VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_attribute_divisor_props;
ziga-lunarga283d022021-08-04 18:35:23 +0200115 VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT blend_operation_advanced_props;
Piers Daniella7f93b62021-11-20 12:32:04 -0700116 VkPhysicalDeviceMaintenance4PropertiesKHR maintenance4_props;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700117 };
118 DeviceExtensionProperties phys_dev_ext_props = {};
119
120 struct SubpassesUsageStates {
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700121 layer_data::unordered_set<uint32_t> subpasses_using_color_attachment;
122 layer_data::unordered_set<uint32_t> subpasses_using_depthstencil_attachment;
Younggwan Kim26b9abd2021-12-07 21:22:03 +0000123 std::vector<VkSubpassDescriptionFlags> subpasses_flags;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700124 };
125
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700126 // Though this validation object is predominantly statless, the Framebuffer checks are greatly simplified by creating and
127 // updating a map of the renderpass usage states, and these accesses need thread protection. Use a mutex separate from the
128 // parent object's to maintain that functionality.
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500129 mutable std::mutex renderpass_map_mutex;
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700130 layer_data::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700131
132 // Constructor for stateles validation tracking
Jeff Bolz165818a2020-05-08 11:19:03 -0500133 StatelessValidation() : device_createinfo_pnext(nullptr) { container_type = LayerObjectTypeParameterValidation; }
134 ~StatelessValidation() {
135 if (device_createinfo_pnext) {
136 FreePnextChain(device_createinfo_pnext);
137 }
138 }
139
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700140 /**
141 * Validate a minimum value.
142 *
143 * Verify that the specified value is greater than the specified lower bound.
144 *
145 * @param api_name Name of API call being validated.
146 * @param parameter_name Name of parameter being validated.
147 * @param value Value to validate.
148 * @param lower_bound Lower bound value to use for validation.
149 * @return Boolean value indicating that the call should be skipped.
150 */
151 template <typename T>
152 bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700153 const char *api_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700154 bool skip_call = false;
155
156 if (value <= lower_bound) {
157 std::ostringstream ss;
Mark Lobodzinski525c1292020-10-30 16:00:00 -0600158 ss << api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is not greater than "
159 << lower_bound;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700160 skip_call |= LogError(device, vuid, "%s", ss.str().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700161 }
162
163 return skip_call;
164 }
165
166 template <typename T>
167 bool ValidateGreaterThanZero(const T value, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700168 const char *api_name) const {
169 return ValidateGreaterThan(value, T{0}, parameter_name, vuid, api_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700170 }
171 /**
172 * Validate a required pointer.
173 *
174 * Verify that a required pointer is not NULL.
175 *
176 * @param apiName Name of API call being validated.
177 * @param parameterName Name of parameter being validated.
178 * @param value Pointer to validate.
179 * @return Boolean value indicating that the call should be skipped.
180 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700181 bool validate_required_pointer(const char *apiName, const ParameterName &parameterName, const void *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500182 const std::string &vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700183 bool skip_call = false;
184
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700185 if (value == nullptr) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700186 skip_call |=
187 LogError(device, vuid, "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700188 }
189
190 return skip_call;
191 }
192
193 /**
194 * Validate array count and pointer to array.
195 *
196 * Verify that required count and array parameters are not 0 or NULL. If the
197 * count parameter is not optional, verify that it is not 0. If the array
198 * parameter is NULL, and it is not optional, verify that count is 0.
199 *
200 * @param apiName Name of API call being validated.
201 * @param countName Name of count parameter.
202 * @param arrayName Name of array parameter.
203 * @param count Number of elements in the array.
204 * @param array Array to validate.
205 * @param countRequired The 'count' parameter may not be 0 when true.
206 * @param arrayRequired The 'array' parameter may not be NULL when true.
207 * @return Boolean value indicating that the call should be skipped.
208 */
209 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700210 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, T1 count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600211 const T2 *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500212 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700213 bool skip_call = false;
214
215 // Count parameters not tagged as optional cannot be 0
216 if (countRequired && (count == 0)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700217 skip_call |= LogError(device, count_required_vuid, "%s: parameter %s must be greater than 0.", apiName,
218 countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700219 }
220
221 // Array parameters not tagged as optional cannot be NULL, unless the count is 0
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700222 if (arrayRequired && (count != 0) && (*array == nullptr)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700223 skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s specified as NULL.", apiName,
224 arrayName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700225 }
226
227 return skip_call;
228 }
229
230 /**
231 * Validate pointer to array count and pointer to array.
232 *
233 * Verify that required count and array parameters are not NULL. If count
234 * is not NULL and its value is not optional, verify that it is not 0. If the
235 * array parameter is NULL, and it is not optional, verify that count is 0.
236 * The array parameter will typically be optional for this case (where count is
237 * a pointer), allowing the caller to retrieve the available count.
238 *
239 * @param apiName Name of API call being validated.
240 * @param countName Name of count parameter.
241 * @param arrayName Name of array parameter.
242 * @param count Pointer to the number of elements in the array.
243 * @param array Array to validate.
244 * @param countPtrRequired The 'count' parameter may not be NULL when true.
245 * @param countValueRequired The '*count' value may not be 0 when true.
246 * @param arrayRequired The 'array' parameter may not be NULL when true.
sfricke-samsung817d27c2020-12-01 22:22:56 -0800247 * @param count_required_vuid The VUID for the '*count' parameter.
248 * @param array_required_vuid The VUID for the 'array' parameter.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700249 * @return Boolean value indicating that the call should be skipped.
250 */
251 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700252 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T1 *count,
253 const T2 *array, bool countPtrRequired, bool countValueRequired, bool arrayRequired,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500254 const char *count_required_vuid, const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700255 bool skip_call = false;
256
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700257 if (count == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700258 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700259 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
260 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700261 }
262 } else {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700263 skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array, countValueRequired,
264 arrayRequired, count_required_vuid, array_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700265 }
266
267 return skip_call;
268 }
269
270 /**
271 * Validate a pointer to a Vulkan structure.
272 *
273 * Verify that a required pointer to a structure is not NULL. If the pointer is
274 * not NULL, verify that each structure's sType field is set to the correct
275 * VkStructureType value.
276 *
277 * @param apiName Name of API call being validated.
278 * @param parameterName Name of struct parameter being validated.
279 * @param sTypeName Name of expected VkStructureType value.
280 * @param value Pointer to the struct to validate.
281 * @param sType VkStructureType for structure validation.
282 * @param required The parameter may not be NULL when true.
283 * @return Boolean value indicating that the call should be skipped.
284 */
285 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700286 bool validate_struct_type(const char *apiName, const ParameterName &parameterName, const char *sTypeName, const T *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500287 VkStructureType sType, bool required, const char *struct_vuid, const char *stype_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700288 bool skip_call = false;
289
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700290 if (value == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700291 if (required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700292 skip_call |= LogError(device, struct_vuid, "%s: required parameter %s specified as NULL", apiName,
293 parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700294 }
295 } else if (value->sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700296 skip_call |= LogError(device, stype_vuid, "%s: parameter %s->sType must be %s.", apiName,
297 parameterName.get_name().c_str(), sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700298 }
299
300 return skip_call;
301 }
302
303 /**
304 * Validate an array of Vulkan structures
305 *
306 * Verify that required count and array parameters are not 0 or NULL. If
307 * the array contains 1 or more structures, verify that each structure's
308 * sType field is set to the correct VkStructureType value.
309 *
310 * @param apiName Name of API call being validated.
311 * @param countName Name of count parameter.
312 * @param arrayName Name of array parameter.
313 * @param sTypeName Name of expected VkStructureType value.
314 * @param count Number of elements in the array.
315 * @param array Array to validate.
316 * @param sType VkStructureType for structure validation.
317 * @param countRequired The 'count' parameter may not be 0 when true.
318 * @param arrayRequired The 'array' parameter may not be NULL when true.
319 * @return Boolean value indicating that the call should be skipped.
320 */
321 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700322 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
323 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800324 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500325 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700326 bool skip_call = false;
327
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700328 if ((count == 0) || (array == nullptr)) {
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800329 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
330 count_required_vuid, param_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700331 } else {
332 // Verify that all structs in the array have the correct type
333 for (uint32_t i = 0; i < count; ++i) {
334 if (array[i].sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700335 skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d].sType must be %s", apiName,
336 arrayName.get_name().c_str(), i, sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700337 }
338 }
339 }
340
341 return skip_call;
342 }
sourav parmarcd5fb182020-07-17 12:58:44 -0700343
344 /**
345 * Validate an pointer type array of Vulkan structures
346 *
347 * Verify that required count and array parameters are not 0 or NULL. If
348 * the array contains 1 or more structures, verify that each structure's
349 * sType field is set to the correct VkStructureType value.
350 *
351 * @param apiName Name of API call being validated.
352 * @param countName Name of count parameter.
353 * @param arrayName Name of array parameter.
354 * @param sTypeName Name of expected VkStructureType value.
355 * @param count Number of elements in the array.
356 * @param array Array to validate.
357 * @param sType VkStructureType for structure validation.
358 * @param countRequired The 'count' parameter may not be 0 when true.
359 * @param arrayRequired The 'array' parameter may not be NULL when true.
360 * @return Boolean value indicating that the call should be skipped.
361 */
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700362 template <typename T>
363 bool validate_struct_pointer_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
sourav parmarcd5fb182020-07-17 12:58:44 -0700364 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
365 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
366 const char *count_required_vuid) const {
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700367 bool skip_call = false;
368
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700369 if ((count == 0) || (array == nullptr)) {
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700370 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
371 count_required_vuid, param_vuid);
372 } else {
373 // Verify that all structs in the array have the correct type
374 for (uint32_t i = 0; i < count; ++i) {
375 if (array[i]->sType != sType) {
376 skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d]->sType must be %s", apiName,
377 arrayName.get_name().c_str(), i, sTypeName);
378 }
379 }
380 }
381
382 return skip_call;
383 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700384
385 /**
386 * Validate an array of Vulkan structures.
387 *
388 * Verify that required count and array parameters are not NULL. If count
389 * is not NULL and its value is not optional, verify that it is not 0.
390 * If the array contains 1 or more structures, verify that each structure's
391 * sType field is set to the correct VkStructureType value.
392 *
393 * @param apiName Name of API call being validated.
394 * @param countName Name of count parameter.
395 * @param arrayName Name of array parameter.
396 * @param sTypeName Name of expected VkStructureType value.
397 * @param count Pointer to the number of elements in the array.
398 * @param array Array to validate.
399 * @param sType VkStructureType for structure validation.
400 * @param countPtrRequired The 'count' parameter may not be NULL when true.
401 * @param countValueRequired The '*count' value may not be 0 when true.
402 * @param arrayRequired The 'array' parameter may not be NULL when true.
403 * @return Boolean value indicating that the call should be skipped.
404 */
405 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700406 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
407 const char *sTypeName, uint32_t *count, const T *array, VkStructureType sType,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600408 bool countPtrRequired, bool countValueRequired, bool arrayRequired, const char *stype_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500409 const char *param_vuid, const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700410 bool skip_call = false;
411
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700412 if (count == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700413 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700414 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
415 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700416 }
417 } else {
418 skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType,
Mark Lobodzinski75a38812019-12-10 15:22:52 -0700419 countValueRequired && (array != nullptr), arrayRequired, stype_vuid, param_vuid,
420 count_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700421 }
422
423 return skip_call;
424 }
425
426 /**
427 * Validate a Vulkan handle.
428 *
429 * Verify that the specified handle is not VK_NULL_HANDLE.
430 *
431 * @param api_name Name of API call being validated.
432 * @param parameter_name Name of struct parameter being validated.
433 * @param value Handle to validate.
434 * @return Boolean value indicating that the call should be skipped.
435 */
436 template <typename T>
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500437 bool validate_required_handle(const char *api_name, const ParameterName &parameter_name, T value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700438 bool skip_call = false;
439
440 if (value == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700441 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE",
442 api_name, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700443 }
444
445 return skip_call;
446 }
447
448 /**
449 * Validate an array of Vulkan handles.
450 *
451 * Verify that required count and array parameters are not NULL. If count
452 * is not NULL and its value is not optional, verify that it is not 0.
453 * If the array contains 1 or more handles, verify that no handle is set to
454 * VK_NULL_HANDLE.
455 *
456 * @note This function is only intended to validate arrays of handles when none
457 * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles
458 * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead.
459 *
460 * @param api_name Name of API call being validated.
461 * @param count_name Name of count parameter.
462 * @param array_name Name of array parameter.
463 * @param count Number of elements in the array.
464 * @param array Array to validate.
465 * @param count_required The 'count' parameter may not be 0 when true.
466 * @param array_required The 'array' parameter may not be NULL when true.
sfricke-samsung817d27c2020-12-01 22:22:56 -0800467 * @param count_required_vuid The VUID for the '*count' parameter.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700468 * @return Boolean value indicating that the call should be skipped.
469 */
470 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700471 bool validate_handle_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
sfricke-samsung817d27c2020-12-01 22:22:56 -0800472 uint32_t count, const T *array, bool count_required, bool array_required,
473 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700474 bool skip_call = false;
475
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700476 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700477 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
sfricke-samsung817d27c2020-12-01 22:22:56 -0800478 count_required_vuid, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700479 } else {
480 // Verify that no handles in the array are VK_NULL_HANDLE
481 for (uint32_t i = 0; i < count; ++i) {
482 if (array[i] == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700483 skip_call |= LogError(device, kVUID_PVError_RequiredParameter,
484 "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name,
485 array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700486 }
487 }
488 }
489
490 return skip_call;
491 }
492
493 /**
494 * Validate string array count and content.
495 *
496 * Verify that required count and array parameters are not 0 or NULL. If the
497 * count parameter is not optional, verify that it is not 0. If the array
498 * parameter is NULL, and it is not optional, verify that count is 0. If the
499 * array parameter is not NULL, verify that none of the strings are NULL.
500 *
501 * @param apiName Name of API call being validated.
502 * @param countName Name of count parameter.
503 * @param arrayName Name of array parameter.
504 * @param count Number of strings in the array.
505 * @param array Array of strings to validate.
506 * @param countRequired The 'count' parameter may not be 0 when true.
507 * @param arrayRequired The 'array' parameter may not be NULL when true.
508 * @return Boolean value indicating that the call should be skipped.
509 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700510 bool validate_string_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600511 const char *const *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500512 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700513 bool skip_call = false;
514
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700515 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700516 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
517 count_required_vuid, array_required_vuid);
518 } else {
519 // Verify that strings in the array are not NULL
520 for (uint32_t i = 0; i < count; ++i) {
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700521 if (array[i] == nullptr) {
Mark Lobodzinski525c1292020-10-30 16:00:00 -0600522 skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s[%d] specified as NULL", apiName,
523 arrayName.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700524 }
525 }
526 }
527
528 return skip_call;
529 }
530
Mark Lobodzinski2e40a132020-08-10 14:51:41 -0600531 // Forward declarations
532 bool CheckPromotedApiAgainstVulkanVersion(VkInstance instance, const char *api_name, const uint32_t promoted_version) const;
533 bool CheckPromotedApiAgainstVulkanVersion(VkPhysicalDevice pdev, const char *api_name, const uint32_t promoted_version) const;
Mark Lobodzinskibece6c12020-08-27 15:34:02 -0600534 bool SupportedByPdev(const VkPhysicalDevice physical_device, const std::string ext_name) const;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -0600535
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600536 bool ValidatePnextStructContents(const char *api_name, const ParameterName &parameter_name, const VkBaseOutStructure *header,
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600537 const char *pnext_vuid, bool is_physdev_api = false, bool is_const_param = true) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700538
539 /**
540 * Validate a structure's pNext member.
541 *
542 * Verify that the specified pNext value points to the head of a list of
543 * allowed extension structures. If no extension structures are allowed,
544 * verify that pNext is null.
545 *
546 * @param api_name Name of API call being validated.
547 * @param parameter_name Name of parameter being validated.
548 * @param allowed_struct_names Names of allowed structs.
549 * @param next Pointer to validate.
550 * @param allowed_type_count Total number of allowed structure types.
551 * @param allowed_types Array of structure types allowed for pNext.
552 * @param header_version Version of header defining the pNext validation rules.
553 * @return Boolean value indicating that the call should be skipped.
554 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700555 bool validate_struct_pnext(const char *api_name, const ParameterName &parameter_name, const char *allowed_struct_names,
556 const void *next, size_t allowed_type_count, const VkStructureType *allowed_types,
Nathaniel Cesarioe0c387b2021-09-02 13:51:34 -0600557 uint32_t header_version, const char *pnext_vuid, const char *stype_vuid,
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600558 const bool is_physdev_api = false, const bool is_const_param = true) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700559 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700560
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700561 if (next != nullptr) {
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700562 layer_data::unordered_set<const void *> cycle_check;
563 layer_data::unordered_set<VkStructureType, layer_data::hash<int>> unique_stype_check;
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600564
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600565 const char *disclaimer =
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600566 "This error is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that "
567 "you are using a struct from a private extension or an extension that was added to a later version of the Vulkan "
568 "header, in which case the use of %s is undefined and may not work correctly with validation enabled";
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600569
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600570 if ((allowed_type_count == 0) && (custom_stype_info.size() == 0)) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700571 std::string message = "%s: value of %s must be NULL. ";
572 message += disclaimer;
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600573 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
574 header_version, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700575 } else {
576 const VkStructureType *start = allowed_types;
577 const VkStructureType *end = allowed_types + allowed_type_count;
Lockefbdd1af2019-04-16 15:07:23 -0600578 const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700579
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700580 while (current != nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700581 if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) ||
582 (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) &&
583 ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) ||
584 (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700585 std::string type_name = string_VkStructureType(current->sType);
Nathaniel Cesario78c1cdd2021-04-01 23:13:33 -0600586 if (unique_stype_check.find(current->sType) != unique_stype_check.end() &&
587 !IsDuplicatePnext(current->sType)) {
sfricke-samsung32a27362020-02-28 09:06:42 -0800588 // stype_vuid will only be null if there are no listed pNext and will hit disclaimer check
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700589 std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times.";
sfricke-samsung32a27362020-02-28 09:06:42 -0800590 skip_call |= LogError(device, stype_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
591 type_name.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700592 } else {
593 unique_stype_check.insert(current->sType);
594 }
595
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600596 // Search custom stype list -- if sType found, skip this entirely
597 bool custom = false;
John Zulauf79f06582021-02-27 18:38:39 -0700598 for (const auto &item : custom_stype_info) {
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600599 if (item.first == current->sType) {
600 custom = true;
601 break;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700602 }
603 }
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600604 if (!custom) {
605 if (std::find(start, end, current->sType) == end) {
606 if (type_name.compare(UnsupportedStructureTypeString) == 0) {
607 std::string message =
608 "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures "
609 "are [%s]. ";
610 message += disclaimer;
611 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
612 parameter_name.get_name().c_str(), current->sType, allowed_struct_names,
613 header_version, parameter_name.get_name().c_str());
614 } else {
615 std::string message =
616 "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures "
617 "are [%s]. ";
618 message += disclaimer;
619 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
620 parameter_name.get_name().c_str(), type_name.c_str(),
621 allowed_struct_names, header_version, parameter_name.get_name().c_str());
622 }
623 }
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600624 skip_call |= ValidatePnextStructContents(api_name, parameter_name, current, pnext_vuid, is_physdev_api,
625 is_const_param);
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600626 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700627 }
Lockefbdd1af2019-04-16 15:07:23 -0600628 current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700629 }
630 }
631 }
632
633 return skip_call;
634 }
635
636 /**
637 * Validate a VkBool32 value.
638 *
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600639 * Generate an error if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700640 *
641 * @param apiName Name of API call being validated.
642 * @param parameterName Name of parameter being validated.
643 * @param value Boolean value to validate.
644 * @return Boolean value indicating that the call should be skipped.
645 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500646 bool validate_bool32(const char *apiName, const ParameterName &parameterName, VkBool32 value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700647 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700648 if ((value != VK_TRUE) && (value != VK_FALSE)) {
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600649 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
650 "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
651 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
652 apiName, parameterName.get_name().c_str(), value);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700653 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700654 return skip_call;
655 }
656
657 /**
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700658 * Validate an array of VkBool32 values.
659 *
660 * Generate an error if any VkBool32 value in an array is neither VK_TRUE nor VK_FALSE.
661 *
662 * @param apiName Name of API call being validated.
663 * @param countName Name of count parameter.
664 * @param arrayName Name of array parameter.
665 * @param count Number of values in the array.
666 * @param array Array of VkBool32 values to validate.
667 * @param countRequired The 'count' parameter may not be 0 when true.
668 * @param arrayRequired The 'array' parameter may not be NULL when true.
669 * @return Boolean value indicating that the call should be skipped.
670 */
671 bool validate_bool32_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
672 const VkBool32 *array, bool countRequired, bool arrayRequired) const {
673 bool skip_call = false;
674
675 if ((count == 0) || (array == nullptr)) {
676 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
677 kVUIDUndefined);
678 } else {
679 for (uint32_t i = 0; i < count; ++i) {
680 if ((array[i] != VK_TRUE) && (array[i] != VK_FALSE)) {
681 skip_call |=
682 LogError(device, kVUID_PVError_UnrecognizedValue,
683 "%s: value of %s[%d] (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
684 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
685 apiName, arrayName.get_name().c_str(), i, array[i]);
686 }
687 }
688 }
689
690 return skip_call;
691 }
692
693 /**
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700694 * Validate a Vulkan enumeration value.
695 *
696 * Generate a warning if an enumeration token value does not fall within the core enumeration
697 * begin and end token values, and was not added to the enumeration by an extension. Extension
698 * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
699 * with 1,000,000,000 as the base token value.
700 *
701 * @note This function does not expect to process enumerations defining bitmask flag bits.
702 *
703 * @param apiName Name of API call being validated.
704 * @param parameterName Name of parameter being validated.
705 * @param enumName Name of the enumeration being validated.
706 * @param valid_values The list of valid values for the enumeration.
707 * @param value Enumeration value to validate.
708 * @return Boolean value indicating that the call should be skipped.
709 */
710 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700711 bool validate_ranged_enum(const char *apiName, const ParameterName &parameterName, const char *enumName,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500712 const std::vector<T> &valid_values, T value, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700713 bool skip = false;
714
715 if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) {
716 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700717 LogError(device, vuid,
718 "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is "
719 "not an extension added token.",
720 apiName, parameterName.get_name().c_str(), value, enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700721 }
722
723 return skip;
724 }
725
726 /**
727 * Validate an array of Vulkan enumeration value.
728 *
729 * Process all enumeration token values in the specified array and generate a warning if a value
730 * does not fall within the core enumeration begin and end token values, and was not added to
731 * the enumeration by an extension. Extension provided enumerations use the equation specified
732 * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
733 *
734 * @note This function does not expect to process enumerations defining bitmask flag bits.
735 *
736 * @param apiName Name of API call being validated.
737 * @param countName Name of count parameter.
738 * @param arrayName Name of array parameter.
739 * @param enumName Name of the enumeration being validated.
740 * @param valid_values The list of valid values for the enumeration.
741 * @param count Number of enumeration values in the array.
742 * @param array Array of enumeration values to validate.
743 * @param countRequired The 'count' parameter may not be 0 when true.
744 * @param arrayRequired The 'array' parameter may not be NULL when true.
745 * @return Boolean value indicating that the call should be skipped.
746 */
747 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700748 bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
749 const char *enumName, const std::vector<T> &valid_values, uint32_t count, const T *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500750 bool countRequired, bool arrayRequired) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700751 bool skip_call = false;
752
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700753 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700754 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
755 kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700756 } else {
757 for (uint32_t i = 0; i < count; ++i) {
758 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700759 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
760 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
761 "enumeration tokens and is not an extension added token",
762 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700763 }
764 }
765 }
766
767 return skip_call;
768 }
769
770 /**
771 * Verify that a reserved VkFlags value is zero.
772 *
773 * Verify that the specified value is zero, to check VkFlags values that are reserved for
774 * future use.
775 *
776 * @param api_name Name of API call being validated.
777 * @param parameter_name Name of parameter being validated.
778 * @param value Value to validate.
779 * @return Boolean value indicating that the call should be skipped.
780 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500781 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 -0700782 bool skip_call = false;
783
784 if (value != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700785 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 -0700786 }
787
788 return skip_call;
789 }
790
Petr Kraus52758be2019-08-12 00:53:58 +0200791 enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit };
792
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700793 // helper to implement validation of both 32 bit and 64 bit flags.
794 template <typename FlagTypedef>
795 bool validate_flags_impl(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name,
796 FlagTypedef all_flags, FlagTypedef value, const FlagType flag_type, const char *vuid,
797 const char *flags_zero_vuid = nullptr) const {
798 bool skip_call = false;
799
800 if ((value & ~all_flags) != 0) {
801 skip_call |= LogError(device, vuid, "%s: value of %s contains flag bits that are not recognized members of %s",
802 api_name, parameter_name.get_name().c_str(), flag_bits_name);
803 }
804
805 const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit;
806 const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid;
807 if (required && value == 0) {
808 skip_call |= LogError(device, zero_vuid, "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str());
809 }
810
811 const auto HasMaxOneBitSet = [](const FlagTypedef f) {
812 // Decrement flips bits from right upto first 1.
813 // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED
814 return f == 0 || !(f & (f - 1));
815 };
816
817 const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit;
818 if (is_bits_type && !HasMaxOneBitSet(value)) {
819 skip_call |=
820 LogError(device, vuid, "%s: value of %s contains multiple members of %s when only a single value is allowed",
821 api_name, parameter_name.get_name().c_str(), flag_bits_name);
822 }
823
824 return skip_call;
825 }
826
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700827 /**
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700828 * Validate a 32 bit Vulkan bitmask value.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700829 *
830 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
831 * for that type.
832 *
833 * @param api_name Name of API call being validated.
834 * @param parameter_name Name of parameter being validated.
835 * @param flag_bits_name Name of the VkFlags type being validated.
836 * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated.
837 * @param value VkFlags value to validate.
Petr Kraus52758be2019-08-12 00:53:58 +0200838 * @param flag_type The type of flag, like optional, or single bit.
839 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
840 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700841 * @return Boolean value indicating that the call should be skipped.
842 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700843 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 -0500844 VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700845 return validate_flags_impl<VkFlags>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
846 flags_zero_vuid);
847 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700848
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700849 /**
850 * Validate a 64 bit Vulkan bitmask value.
851 *
852 * Generate a warning if a value with a VkFlags64 derived type does not contain valid flag bits
853 * for that type.
854 *
855 * @param api_name Name of API call being validated.
856 * @param parameter_name Name of parameter being validated.
857 * @param flag_bits_name Name of the VkFlags64 type being validated.
858 * @param all_flags A bit mask combining all valid flag bits for the VkFlags64 type being validated.
859 * @param value VkFlags64 value to validate.
860 * @param flag_type The type of flag, like optional, or single bit.
861 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
862 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
863 * @return Boolean value indicating that the call should be skipped.
864 */
865 bool validate_flags(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name, VkFlags64 all_flags,
866 VkFlags64 value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
867 return validate_flags_impl<VkFlags64>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
868 flags_zero_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700869 }
870
871 /**
872 * Validate an array of Vulkan bitmask values.
873 *
874 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
875 * for that type.
876 *
877 * @param api_name Name of API call being validated.
878 * @param count_name Name of parameter being validated.
879 * @param array_name Name of parameter being validated.
880 * @param flag_bits_name Name of the VkFlags type being validated.
881 * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated.
882 * @param count Number of VkFlags values in the array.
883 * @param array Array of VkFlags value to validate.
884 * @param count_required The 'count' parameter may not be 0 when true.
885 * @param array_required The 'array' parameter may not be NULL when true.
886 * @return Boolean value indicating that the call should be skipped.
887 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700888 bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
889 const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500890 bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700891 bool skip_call = false;
892
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700893 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700894 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
895 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700896 } else {
897 // Verify that all VkFlags values in the array
898 for (uint32_t i = 0; i < count; ++i) {
899 if (array[i] == 0) {
900 // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if
901 // elements in the array are allowed be 0
902 if (array_required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700903 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0",
904 api_name, array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700905 }
906 } else if ((array[i] & (~all_flags)) != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700907 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
908 "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name,
909 array_name.get_name().c_str(), i, flag_bits_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700910 }
911 }
912 }
913
914 return skip_call;
915 }
916
917 template <typename ExtensionState>
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600918 bool validate_extension_reqs(const ExtensionState &extensions, const char *vuid, const char *extension_type,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500919 const char *extension_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700920 bool skip = false;
921 if (!extension_name) {
922 return skip; // Robust to invalid char *
923 }
924 auto info = ExtensionState::get_info(extension_name);
925
926 if (!info.state) {
927 return skip; // Unknown extensions cannot be checked so report OK
928 }
929
930 // Check against the required list in the info
931 std::vector<const char *> missing;
Petr Krausbce952d2020-04-02 18:40:40 +0200932 for (const auto &req : info.requirements) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700933 if (!(extensions.*(req.enabled))) {
934 missing.push_back(req.name);
935 }
936 }
937
938 // Report any missing requirements
939 if (missing.size()) {
940 std::string missing_joined_list = string_join(", ", missing);
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700941 skip |= LogError(instance, vuid, "Missing extension%s required by the %s extension %s: %s.",
942 ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700943 }
944 return skip;
945 }
946
947 enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
948
949 template <typename RenderPassCreateInfoGeneric>
Petr Kraus3e52eba2019-07-10 01:24:10 +0200950 bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo,
Jeremy Gebben40a22942020-12-22 14:22:06 -0700951 uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags2KHR stages,
952 const char *vuid, const char *target, const char *func_name) const {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200953 bool skip = false;
Jeremy Gebben5f585ae2021-02-02 09:03:06 -0700954 // make sure we consider all of the expanded and un-expanded graphics bits to be valid
Jeremy Gebben40a22942020-12-22 14:22:06 -0700955 const auto kExcludeStages = VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR | VK_PIPELINE_STAGE_2_COPY_BIT_KHR |
956 VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR | VK_PIPELINE_STAGE_2_BLIT_BIT_KHR |
957 VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR;
958 const auto kMetaGraphicsStages = VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR | VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR |
959 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR;
960 const auto kGraphicsStages =
961 (sync_utils::ExpandPipelineStages(VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_QUEUE_GRAPHICS_BIT) | kMetaGraphicsStages) &
962 ~kExcludeStages;
Petr Krausdfd26442019-08-13 03:25:19 +0200963
964 const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) {
Jeremy Gebben12933ef2021-05-12 17:16:27 -0600965 if (subpass == VK_SUBPASS_EXTERNAL || subpass >= pCreateInfo->subpassCount)
Petr Kraus3e52eba2019-07-10 01:24:10 +0200966 return false;
967 else
Petr Krausdfd26442019-08-13 03:25:19 +0200968 return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage;
Petr Kraus3e52eba2019-07-10 01:24:10 +0200969 };
970
Petr Krausdfd26442019-08-13 03:25:19 +0200971 const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0;
972 if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) {
sfricke-samsung46fc6632020-09-12 14:28:58 -0700973 skip |= LogError(VkRenderPass(0), vuid,
974 "%s: Dependency pDependencies[%" PRIu32
975 "] specifies a %sStageMask that contains stages (%s) that are not part "
976 "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.",
Jeremy Gebben40a22942020-12-22 14:22:06 -0700977 func_name, dependency_index, target,
978 sync_utils::StringPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass);
Petr Kraus3e52eba2019-07-10 01:24:10 +0200979 }
980
981 return skip;
982 };
983
984 template <typename RenderPassCreateInfoGeneric>
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700985 bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700986 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500987 RenderPassCreateVersion rp_version) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700988 bool skip = false;
989 uint32_t max_color_attachments = device_limits.maxColorAttachments;
990 bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2);
sfricke-samsung46fc6632020-09-12 14:28:58 -0700991 const char *func_name = (use_rp2) ? "vkCreateRenderPass2" : "vkCreateRenderPass";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700992 const char *vuid;
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700993 VkBool32 separate_depth_stencil_layouts = false;
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700994 const auto *vulkan_12_features = LvlFindInChain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700995 if (vulkan_12_features) {
996 separate_depth_stencil_layouts = vulkan_12_features->separateDepthStencilLayouts;
997 } else {
998 const auto *separate_depth_stencil_layouts_features =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -0700999 LvlFindInChain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001000 if (separate_depth_stencil_layouts_features)
1001 separate_depth_stencil_layouts = separate_depth_stencil_layouts_features->separateDepthStencilLayouts;
1002 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001003
1004 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
Piers Daniell4fde9b72019-11-27 16:19:46 -07001005 const auto *attachment_description_stencil_layout =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -07001006 (use_rp2) ? LvlFindInChain<VkAttachmentDescriptionStencilLayout>(
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001007 reinterpret_cast<VkAttachmentDescription2 const *>(&pCreateInfo->pAttachments[i])->pNext)
Piers Daniell4fde9b72019-11-27 16:19:46 -07001008 : 0;
1009
sfricke-samsungcac6a262020-04-28 07:50:49 -07001010 const VkFormat attachment_format = pCreateInfo->pAttachments[i].format;
1011 const VkImageLayout initial_layout = pCreateInfo->pAttachments[i].initialLayout;
1012 const VkImageLayout final_layout = pCreateInfo->pAttachments[i].finalLayout;
1013 if (attachment_format == VK_FORMAT_UNDEFINED) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001014 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-parameter" : "VUID-VkAttachmentDescription-format-parameter";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001015 skip |= LogWarning(device, vuid, "%s: pCreateInfo->pAttachments[%u].format is VK_FORMAT_UNDEFINED.", func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001016 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001017 if (final_layout == VK_IMAGE_LAYOUT_UNDEFINED || final_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001018 vuid =
1019 use_rp2 ? "VUID-VkAttachmentDescription2-finalLayout-03061" : "VUID-VkAttachmentDescription-finalLayout-00843";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001020 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001021 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001022 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001023 func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001024 }
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001025 if (!separate_depth_stencil_layouts) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001026 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1027 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1028 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1029 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001030 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03298"
Piers Daniell9af77cd2019-10-16 13:54:12 -06001031 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001032 skip |= LogError(
1033 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001034 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1035 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1036 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001037 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001038 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001039 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1040 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1041 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1042 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001043 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03299"
Piers Daniell9af77cd2019-10-16 13:54:12 -06001044 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001045 skip |= LogError(
1046 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001047 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1048 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1049 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001050 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001051 }
1052 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001053 if (!FormatIsDepthOrStencil(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001054 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1055 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1056 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1057 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001058 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03300" : "VUID-VkAttachmentDescription-format-03286";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001059 skip |= LogError(
1060 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001061 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1062 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
Piers Daniell9af77cd2019-10-16 13:54:12 -06001063 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001064 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001065 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001066 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1067 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1068 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1069 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001070 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03301" : "VUID-VkAttachmentDescription-format-03287";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001071 skip |= LogError(
1072 device, vuid,
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001073 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1074 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1075 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001076 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001077 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001078 } else if (FormatIsDepthAndStencil(attachment_format)) {
Piers Daniell9af77cd2019-10-16 13:54:12 -06001079 if (use_rp2) {
1080 if (!attachment_description_stencil_layout) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001081 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1082 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
1083 skip |=
1084 LogError(device, "VUID-VkAttachmentDescription2-format-03302",
1085 "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout",
1086 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001087 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001088 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1089 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
1090 skip |=
1091 LogError(device, "VUID-VkAttachmentDescription2-format-03303",
1092 "%s: pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayout",
1093 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001094 }
1095 }
1096 } else {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001097 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1098 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1099 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1100 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1101 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03288",
1102 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1103 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1104 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1105 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1106 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001107 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001108 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1109 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1110 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1111 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1112 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03289",
1113 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1114 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1115 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1116 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1117 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001118 }
1119 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001120 } else if (FormatIsDepthOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001121 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1122 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001123 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03304" : "VUID-VkAttachmentDescription-format-03290";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001124 skip |= LogError(device, vuid,
1125 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001126 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or"
1127 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001128 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001129 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001130 if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1131 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001132 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03305" : "VUID-VkAttachmentDescription-format-03291";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001133 skip |= LogError(device, vuid,
1134 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001135 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1136 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001137 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001138 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001139 } else if (FormatIsStencilOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001140 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1141 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001142 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03306" : "VUID-VkAttachmentDescription-format-03292";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001143 skip |= LogError(device, vuid,
1144 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001145 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or"
1146 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001147 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001148 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001149 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1150 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001151 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03307" : "VUID-VkAttachmentDescription-format-03293";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001152 skip |= LogError(device, vuid,
1153 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001154 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001155 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL",
1156 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001157 }
1158 }
1159 if (use_rp2 && attachment_description_stencil_layout) {
1160 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001161 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1162 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001163 attachment_description_stencil_layout->stencilInitialLayout ==
1164 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1165 attachment_description_stencil_layout->stencilInitialLayout ==
1166 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1167 attachment_description_stencil_layout->stencilInitialLayout ==
1168 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1169 attachment_description_stencil_layout->stencilInitialLayout ==
1170 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001171 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001172 "%s: VkAttachmentDescriptionStencilLayout.stencilInitialLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001173 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001174 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001175 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1176 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1177 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001178 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1179 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001180 }
1181 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001182 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1183 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001184 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1185 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1186 attachment_description_stencil_layout->stencilFinalLayout ==
1187 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1188 attachment_description_stencil_layout->stencilFinalLayout ==
1189 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001190 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001191 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001192 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001193 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001194 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1195 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1196 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001197 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1198 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001199 }
1200 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
1201 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001202 skip |= LogError(
1203 device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001204 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001205 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
1206 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001207 }
1208 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001209
1210 if (FormatIsDepthOrStencil(attachment_format)) {
1211 if (initial_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1212 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03295" : "VUID-VkAttachmentDescription-format-03281";
1213 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001214 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001215 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001216 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001217 }
1218 if (final_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1219 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03297" : "VUID-VkAttachmentDescription-format-03283";
1220 skip |= LogError(device, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001221 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001222 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001223 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001224 }
1225 }
1226 if (FormatIsColor(attachment_format)) {
1227 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1228 initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1229 initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1230 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1231 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03294" : "VUID-VkAttachmentDescription-format-03280";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001232 skip |= LogError(device, vuid,
1233 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1234 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1235 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1236 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1237 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1238 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001239 }
1240 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1241 final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1242 final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1243 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1244 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03296" : "VUID-VkAttachmentDescription-format-03282";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001245 skip |= LogError(device, vuid,
1246 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1247 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1248 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1249 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1250 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1251 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001252 }
1253 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001254 }
1255
1256 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
1257 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001258 vuid = use_rp2 ? "VUID-VkSubpassDescription2-colorAttachmentCount-03063"
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001259 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001260 skip |=
1261 LogError(device, vuid,
1262 "%s: Cannot create a render pass with %d color attachments in pCreateInfo->pSubpasses[%u]. Max is %d.",
1263 func_name, pCreateInfo->pSubpasses[i].colorAttachmentCount, i, max_color_attachments);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001264 }
1265 }
Petr Kraus3e52eba2019-07-10 01:24:10 +02001266
1267 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) {
1268 const auto &dependency = pCreateInfo->pDependencies[i];
1269
sfricke-samsung55f01952020-03-24 08:16:41 -07001270 // Need to check first so layer doesn't segfault from out of bound array access
1271 // src subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001272 if ((dependency.srcSubpass != VK_SUBPASS_EXTERNAL) && (dependency.srcSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001273 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-srcSubpass-02526" : "VUID-VkRenderPassCreateInfo-srcSubpass-02517";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001274 skip |= LogError(device, vuid,
1275 "%s: pCreateInfo->pDependencies[%u].srcSubpass index (%u) has to be less than subpassCount (%u)",
1276 func_name, i, dependency.srcSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001277 }
1278
sfricke-samsung55f01952020-03-24 08:16:41 -07001279 // dst subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001280 if ((dependency.dstSubpass != VK_SUBPASS_EXTERNAL) && (dependency.dstSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001281 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-dstSubpass-02527" : "VUID-VkRenderPassCreateInfo-dstSubpass-02518";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001282 skip |= LogError(device, vuid,
1283 "%s: pCreateInfo->pDependencies[%u].dstSubpass index (%u) has to be less than subpassCount (%u)",
1284 func_name, i, dependency.dstSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001285 }
1286
Petr Kraus3e52eba2019-07-10 01:24:10 +02001287 // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked
Mike Schuchardt65847d92019-12-20 13:50:47 -08001288 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001289 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001290 "src", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001291
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001292 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001293 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001294 "dst", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001295 }
1296
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001297 return skip;
1298 }
1299
1300 template <typename T>
1301 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001302 std::unique_lock<std::mutex> lock(renderpass_map_mutex);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001303 auto &renderpass_state = renderpasses_states[renderPass];
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001304 lock.unlock();
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001305
Younggwan Kim26b9abd2021-12-07 21:22:03 +00001306 renderpass_state.subpasses_flags.resize(pCreateInfo->subpassCount);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001307 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
1308 bool uses_color = false;
1309 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
1310 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
1311
1312 bool uses_depthstencil = false;
1313 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
1314 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
1315 uses_depthstencil = true;
1316
1317 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
1318 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
Younggwan Kim26b9abd2021-12-07 21:22:03 +00001319 renderpass_state.subpasses_flags[subpass] = pCreateInfo->pSubpasses[subpass].flags;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001320 }
1321 }
1322
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001323 // Pre/PostCallRecord declarations
1324 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1325 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1326 VkResult result) override;
Mike Schuchardt2df08912020-12-15 16:28:09 -08001327 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001328 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1329 VkResult result) override;
1330 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1331 const VkAllocationCallbacks *pAllocator) override;
Tony-LunarG3c287f62020-12-17 12:39:49 -07001332 void PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo,
1333 VkCommandBuffer *pCommandBuffers, VkResult result) override;
1334 void PostCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
1335 const VkCommandBuffer *pCommandBuffers) override;
1336 void PostCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1337 const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001338 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
1339 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) override;
1340 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
1341 VkInstance *pInstance, VkResult result) override;
1342
Nathaniel Cesario645a15b2021-01-08 22:40:21 -07001343 void CommonPostCallRecordEnumeratePhysicalDevice(const VkPhysicalDevice *phys_devices, const int count);
1344 void PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
1345 VkPhysicalDevice *pPhysicalDevices, VkResult result) override;
1346
1347 void PostCallRecordEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
1348 VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties,
1349 VkResult result) override;
1350
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001351 bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001352
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001353 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001354
Tony-LunarG866843d2020-05-13 11:22:42 -06001355 bool validate_validation_features(const VkInstanceCreateInfo *pCreateInfo,
1356 const VkValidationFeaturesEXT *validation_features) const;
1357
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001358 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001359
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001360 bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid,
1361 const char *validateString) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001362
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001363 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001364
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001365 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name,
1366 const char *array_parameter_name, const std::string &unique_error_code,
1367 const std::string &valid_error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001368
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001369 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name,
1370 const std::string &error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001371
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001372 bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkAccelerationStructureNV object_handle,
1373 const char *func_name) const;
1374 bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkAccelerationStructureNV object_handle,
Jason Macnak192fa0e2019-07-26 15:07:16 -07001375 const char *func_name) const;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001376 bool ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, const char *func_name) const;
1377 bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkAccelerationStructureNV object_handle,
Mark Lobodzinski17dc4602020-05-29 07:48:40 -06001378 const char *func_nam, bool is_cmd) const;
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001379 bool ValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1380 const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion,
1381 const char *apiName) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001382 bool ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1383 bool khr) const;
1384 bool ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1385 bool khr) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001386
sfricke-samsunga1d00272021-03-10 21:37:41 -08001387 bool ValidateSwapchainCreateInfo(const char *func_name, VkSwapchainCreateInfoKHR const *pCreateInfo) const;
1388
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001389 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001390
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001391 void PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -06001392
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001393 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001394 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001395
1396 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001397 VkInstance *pInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001398
1399 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001400 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001401
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001402 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001403 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001404
1405 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001406 const VkAllocationCallbacks *pAllocator, VkImage *pImage) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001407
Jeff Bolz99e3f632020-03-24 22:59:22 -05001408 bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1409 const VkAllocationCallbacks *pAllocator, VkImageView *pView) const;
1410
Jeff Bolz6d3beaa2019-02-09 21:00:05 -06001411 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName &parameter_name,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001412 VkCommandBuffer object) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001413
sfricke-samsung51303fb2021-05-09 19:09:13 -07001414 bool manual_PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo,
1415 const VkAllocationCallbacks *pAllocator,
1416 VkPipelineLayout *pPipelineLayout) const;
ziga-lunargc6341372021-07-28 12:57:42 +02001417
1418 bool ValidatePipelineShaderStageCreateInfo(const char *func_name, const char *msg,
1419 const VkPipelineShaderStageCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001420 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1421 const VkGraphicsPipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001422 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001423 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1424 const VkComputePipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001425 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001426
1427 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001428 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const;
ziga-lunarg8a4d3192021-10-13 19:54:19 +02001429 bool ValidateMutableDescriptorTypeCreateInfo(const VkDescriptorSetLayoutCreateInfo &create_info,
1430 const VkMutableDescriptorTypeCreateInfoVALVE &mutable_create_info,
1431 const char *func_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001432 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001433 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001434 VkDescriptorSetLayout *pSetLayout) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001435
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001436 bool validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount,
1437 const VkWriteDescriptorSet *pDescriptorWrites, const bool validateDstSet = true) const;
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001438 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1439 const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001440 const VkCopyDescriptorSet *pDescriptorCopies) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001441
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001442 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001443 const VkDescriptorSet *pDescriptorSets) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001444
1445 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001446 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001447
sfricke-samsung681ab7b2020-10-29 01:53:35 -07001448 bool manual_PreCallValidateCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
1449 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
1450
Mike Schuchardt2df08912020-12-15 16:28:09 -08001451 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001452 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001453
1454 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001455 const VkCommandBuffer *pCommandBuffers) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001456
Jeff Bolz5c801d12019-10-09 10:38:45 -05001457 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001458
1459 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001460 const VkViewport *pViewports) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001461
1462 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001463 const VkRect2D *pScissors) const;
1464 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001465
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001466 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1467 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001468
1469 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001470 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001471
sfricke-samsungf692b972020-05-02 08:00:45 -07001472 bool manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1473 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1474 uint32_t stride) const;
1475
1476 bool manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1477 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1478 uint32_t stride) const;
1479
1480 bool manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1481 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1482 uint32_t maxDrawCount, uint32_t stride) const;
1483
1484 bool manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1485 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1486 uint32_t maxDrawCount, uint32_t stride) const;
1487
Tony-LunarG4490de42021-06-21 15:49:19 -06001488 bool manual_PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1489 const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount,
1490 uint32_t firstInstance, uint32_t stride) const;
1491
1492 bool manual_PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1493 const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount,
1494 uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset) const;
1495
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001496 bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1497 const VkClearAttachment *pAttachments, uint32_t rectCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001498 const VkClearRect *pRects) const;
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001499
Andrew Fobel3abeb992020-01-20 16:33:22 -05001500 bool ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1501 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1502 VkImageFormatProperties2 *pImageFormatProperties,
1503 const char *apiName) const;
1504 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1505 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1506 VkImageFormatProperties2 *pImageFormatProperties) const;
1507 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1508 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1509 VkImageFormatProperties2 *pImageFormatProperties) const;
Lionel Landwerlin5fe52752020-07-22 08:18:14 +03001510 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
1511 VkImageType type, VkImageTiling tiling,
1512 VkImageUsageFlags usage, VkImageCreateFlags flags,
1513 VkImageFormatProperties *pImageFormatProperties) const;
Andrew Fobel3abeb992020-01-20 16:33:22 -05001514
ziga-lunarg73b5ef22021-07-29 20:25:06 +02001515 bool manual_PreCallValidateGetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
1516 const VkPhysicalDeviceVideoFormatInfoKHR *pVideoFormatInfo,
1517 uint32_t *pVideoFormatPropertyCount,
1518 VkVideoFormatPropertiesKHR *pVideoFormatProperties) const;
1519
sfricke-samsung3999ef62020-02-09 17:05:59 -08001520 bool manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
1521 uint32_t regionCount, const VkBufferCopy *pRegions) const;
1522
Jeff Leger178b1e52020-10-05 12:22:23 -04001523 bool manual_PreCallValidateCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2KHR *pCopyBufferInfo) const;
1524
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001525 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001526 VkDeviceSize dataSize, const void *pData) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001527
1528 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001529 VkDeviceSize size, uint32_t data) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001530
1531 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001532 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const;
sfricke-samsunga1d00272021-03-10 21:37:41 -08001533 bool manual_PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
1534 const VkSwapchainCreateInfoKHR *pCreateInfos,
1535 const VkAllocationCallbacks *pAllocator,
1536 VkSwapchainKHR *pSwapchains) const;
Jeff Bolz5c801d12019-10-09 10:38:45 -05001537 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const;
sfricke-samsung5c1b7392020-12-13 22:17:15 -08001538 bool manual_PreCallValidateCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
1539 const VkDisplayModeCreateInfoKHR *pCreateInfo,
1540 const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001541
1542#ifdef VK_USE_PLATFORM_WIN32_KHR
1543 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001544 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001545#endif // VK_USE_PLATFORM_WIN32_KHR
1546
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001547 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001548 const VkAllocationCallbacks *pAllocator,
1549 VkDescriptorPool *pDescriptorPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001550 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001551 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001552
Jeff Bolz5c801d12019-10-09 10:38:45 -05001553 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001554
1555 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1556 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001557 uint32_t groupCountZ) const;
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001558 bool manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1559 VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount,
1560 const VkWriteDescriptorSet *pDescriptorWrites) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001561 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001562 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001563 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1564 uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001565 const VkShadingRatePaletteNV *pShadingRatePalettes) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001566
1567 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1568 uint32_t customSampleOrderCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001569 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001570
Jeff Bolz5c801d12019-10-09 10:38:45 -05001571 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001572 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001573 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001574
1575 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1576 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001577 uint32_t maxDrawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001578
1579 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001580 uint32_t *pPropertyCount,
1581 VkExtensionProperties *pProperties) const;
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001582 bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001583 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const;
Ricardo Garciaa4935972019-02-21 17:43:18 +01001584
1585 bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device,
1586 const VkAccelerationStructureCreateInfoNV *pCreateInfo,
1587 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001588 VkAccelerationStructureNV *pAccelerationStructure) const;
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001589 bool manual_PreCallValidateCreateAccelerationStructureKHR(VkDevice device,
1590 const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
1591 const VkAllocationCallbacks *pAllocator,
1592 VkAccelerationStructureKHR *pAccelerationStructure) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001593 bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer,
1594 const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData,
1595 VkDeviceSize instanceOffset, VkBool32 update,
1596 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001597 VkBuffer scratch, VkDeviceSize scratchOffset) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001598 bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001599 size_t dataSize, void *pData) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001600
1601 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer,
1602 uint32_t accelerationStructureCount,
1603 const VkAccelerationStructureNV *pAccelerationStructures,
1604 VkQueryType queryType, VkQueryPool queryPool,
1605 uint32_t firstQuery) const;
Peter Chen85366392019-05-14 15:20:11 -04001606 bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1607 const VkRayTracingPipelineCreateInfoNV *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001608 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001609 bool manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1610 VkPipelineCache pipelineCache, uint32_t createInfoCount,
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001611 const VkRayTracingPipelineCreateInfoKHR *pCreateInfos,
1612 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Chris Mayer9ded5eb2019-09-19 16:33:26 +02001613 bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001614 uint32_t viewportCount,
1615 const VkViewportWScalingNV *pViewportWScalings) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001616
1617#ifdef VK_USE_PLATFORM_WIN32_KHR
1618 bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
Jamie Madillaa076da2020-12-22 15:34:34 -05001619 VkDeviceGroupPresentModeFlagsKHR *pModes) const override;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001620#endif // VK_USE_PLATFORM_WIN32_KHR
Tobias Hectorebb855f2019-07-23 12:17:33 +01001621
1622 bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001623 const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const;
Tobias Hectorebb855f2019-07-23 12:17:33 +01001624
Jeff Bolz8125a8b2019-08-16 16:29:45 -05001625 bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001626 uint16_t lineStipplePattern) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001627
1628 bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001629 VkIndexType indexType) const;
sfricke-samsung4ada8d42020-02-09 17:43:11 -08001630 bool manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1631 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001632
Jeff Bolz5c801d12019-10-09 10:38:45 -05001633 bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001634
Jeff Bolz5c801d12019-10-09 10:38:45 -05001635 bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001636
Petr Kraus3d720392019-11-13 02:52:39 +01001637 bool manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout,
1638 VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) const;
1639
1640 bool manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
1641 uint32_t *pImageIndex) const;
1642
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001643 bool manual_PreCallValidateCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1644 uint32_t bindingCount, const VkBuffer *pBuffers,
1645 const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) const;
1646
1647 bool manual_PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1648 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1649 const VkDeviceSize *pCounterBufferOffsets) const;
1650
1651 bool manual_PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1652 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1653 const VkDeviceSize *pCounterBufferOffsets) const;
1654
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -07001655 bool manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount,
1656 uint32_t firstInstance, VkBuffer counterBuffer,
1657 VkDeviceSize counterBufferOffset, uint32_t counterOffset,
1658 uint32_t vertexStride) const;
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001659
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001660 bool manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1661 const VkAllocationCallbacks *pAllocator,
1662 VkSamplerYcbcrConversion *pYcbcrConversion) const;
1663 bool manual_PreCallValidateCreateSamplerYcbcrConversionKHR(VkDevice device,
1664 const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1665 const VkAllocationCallbacks *pAllocator,
1666 VkSamplerYcbcrConversion *pYcbcrConversion) const;
sfricke-samsung1708a8c2020-02-10 00:35:06 -08001667 bool manual_PreCallValidateImportSemaphoreFdKHR(VkDevice device,
1668 const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001669
sourav parmarcd5fb182020-07-17 12:58:44 -07001670 bool manual_PreCallValidateCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001671 const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1672
1673 bool manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR(
1674 VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1675
sourav parmarcd5fb182020-07-17 12:58:44 -07001676 bool manual_PreCallValidateCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1677 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001678
1679 bool manual_PreCallValidateCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
1680 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
1681 bool ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, const char *api_name) const;
1682 bool ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo,
Mark Lobodzinskiaad69e42020-05-12 08:44:21 -06001683 const char *api_name, bool is_cmd = false) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001684
sourav parmarcd5fb182020-07-17 12:58:44 -07001685 bool manual_PreCallValidateCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001686 const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
1687 bool manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR(
1688 VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001689
sourav parmar83c31b12020-05-06 12:30:54 -07001690 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesKHR(
1691 VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount,
1692 const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool,
1693 uint32_t firstQuery) const;
1694 bool manual_PreCallValidateWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount,
1695 const VkAccelerationStructureKHR *pAccelerationStructures,
1696 VkQueryType queryType, size_t dataSize, void *pData,
1697 size_t stride) const;
1698 bool manual_PreCallValidateGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline,
1699 uint32_t firstGroup, uint32_t groupCount,
1700 size_t dataSize, void *pData) const;
1701
1702 bool manual_PreCallValidateCmdTraceRaysKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001703 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1704 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1705 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1706 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width,
sourav parmar83c31b12020-05-06 12:30:54 -07001707 uint32_t height, uint32_t depth) const;
1708
1709 bool manual_PreCallValidateCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001710 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1711 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1712 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1713 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable,
1714 VkDeviceAddress indirectDeviceAddress) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001715
1716 bool manual_PreCallValidateCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer,
1717 VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer,
1718 VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride,
1719 VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset,
1720 VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer,
1721 VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride,
1722 uint32_t width, uint32_t height, uint32_t depth) const;
1723
sourav parmarcd5fb182020-07-17 12:58:44 -07001724 bool manual_PreCallValidateCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount,
1725 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1726 const VkDeviceAddress *pIndirectDeviceAddresses,
1727 const uint32_t *pIndirectStrides,
1728 const uint32_t *const *ppMaxPrimitiveCounts) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001729
1730 bool manual_PreCallValidateGetDeviceAccelerationStructureCompatibilityKHR(
sourav parmarcd5fb182020-07-17 12:58:44 -07001731 VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo,
1732 VkAccelerationStructureCompatibilityKHR *pCompatibility) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001733
1734 bool manual_PreCallValidateCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount,
1735 const VkViewport *pViewports) const;
1736 bool manual_PreCallValidateCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount,
1737 const VkRect2D *pScissors) const;
1738 bool manual_PreCallValidateCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1739 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets,
1740 const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const;
1741
sourav parmarcd5fb182020-07-17 12:58:44 -07001742 bool ValidateAccelerationStructureBuildGeometryInfoKHR(const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1743 uint32_t infoCount, const char *api_name) const;
1744 bool manual_PreCallValidateCmdBuildAccelerationStructuresKHR(
1745 VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1746 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1747
1748 bool manual_PreCallValidateBuildAccelerationStructuresKHR(
1749 VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount,
1750 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1751 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1752
1753 bool manual_PreCallValidateGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType,
1754 const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo,
1755 const uint32_t *pMaxPrimitiveCounts,
1756 VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) const;
1757
sfricke-samsungecafb192021-01-17 08:21:14 -08001758 bool manual_PreCallValidateCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfoEXT *pCreateInfo,
1759 const VkAllocationCallbacks *pAllocator,
1760 VkPrivateDataSlotEXT *pPrivateDataSlot) const;
Piers Daniellcb6d8032021-04-19 18:51:26 -06001761
1762 bool manual_PreCallValidateCmdSetVertexInputEXT(
1763 VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount,
1764 const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount,
1765 const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) const;
sfricke-samsung51303fb2021-05-09 19:09:13 -07001766
1767 bool manual_PreCallValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
1768 VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size,
1769 const void *pValues) const;
ziga-lunargb1dd8a22021-07-15 17:47:19 +02001770
1771 bool manual_PreCallValidateMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount,
1772 const VkPipelineCache *pSrcCaches) const;
1773
Nathaniel Cesario298d3cb2021-08-03 13:49:02 -06001774 bool manual_PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
1775 const VkClearColorValue *pColor, uint32_t rangeCount,
1776 const VkImageSubresourceRange *pRanges) const;
1777
1778 bool ValidateCmdBeginRenderPass(const char *const func_name, const VkRenderPassBeginInfo *const rp_begin) const;
1779 bool manual_PreCallValidateCmdBeginRenderPass(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1780 VkSubpassContents) const;
1781 bool manual_PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1782 const VkSubpassBeginInfo *) const;
1783 bool manual_PreCallValidateCmdBeginRenderPass2(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1784 const VkSubpassBeginInfo *) const;
1785
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001786 bool manual_PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle,
1787 uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) const;
ziga-lunarg3c37dfb2021-08-24 12:51:07 +02001788 bool manual_PreCallValidateGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount,
ziga-lunargcf340c42021-08-19 00:13:38 +02001789 size_t dataSize, void *pData, VkDeviceSize stride,
1790 VkQueryResultFlags flags) const;
1791 bool manual_PreCallValidateCmdBeginConditionalRenderingEXT(
1792 VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin) const;
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001793
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001794#include "parameter_validation.h"
1795}; // Class StatelessValidation