blob: 81d1caea505f05121b8187e373bd8743074e07b7 [file] [log] [blame]
Mike Schuchardt05b028d2022-01-05 14:15:00 -08001/* Copyright (c) 2015-2022 The Khronos Group Inc.
2 * Copyright (c) 2015-2022 Valve Corporation
3 * Copyright (c) 2015-2022 LunarG, Inc.
4 * Copyright (C) 2015-2022 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"
sjfricke91d9bda2022-08-01 21:44:17 +090027#include "cmd_buffer_state.h"
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070028
29// Suppress unused warning on Linux
30#if defined(__GNUC__)
31#define DECORATE_UNUSED __attribute__((unused))
32#else
33#define DECORATE_UNUSED
34#endif
35
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070036static const char DECORATE_UNUSED *kVUID_PVError_RequiredParameter = "UNASSIGNED-GeneralParameterError-RequiredParameter";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070037static const char DECORATE_UNUSED *kVUID_PVError_UnrecognizedValue = "UNASSIGNED-GeneralParameterError-UnrecognizedValue";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070038static const char DECORATE_UNUSED *kVUID_PVError_ExtensionNotEnabled = "UNASSIGNED-GeneralParameterError-ExtensionNotEnabled";
Mark Lobodzinski2e40a132020-08-10 14:51:41 -060039static const char DECORATE_UNUSED *kVUID_PVError_ApiVersionViolation = "UNASSIGNED-API-Version-Violation";
Mark Lobodzinskiacf4ab42020-10-30 15:30:10 -060040// static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructPNext = "UNASSIGNED-GeneralParameterError-InvalidStructPNext";
41// static const char DECORATE_UNUSED *kVUID_PVError_NONE = "UNASSIGNED-GeneralParameterError-Info";
42// static const char DECORATE_UNUSED *kVUID_PVError_InvalidUsage = "UNASSIGNED-GeneralParameterError-InvalidUsage";
43// static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructSType = "UNASSIGNED-GeneralParameterError-InvalidStructSType";
44// static const char DECORATE_UNUSED *kVUID_PVError_ReservedParameter = "UNASSIGNED-GeneralParameterError-ReservedParameter";
45// static const char DECORATE_UNUSED *kVUID_PVError_DeviceLimit = "UNASSIGNED-GeneralParameterError-DeviceLimit";
46// static const char DECORATE_UNUSED *kVUID_PVError_FailureCode = "UNASSIGNED-GeneralParameterError-FailureCode";
47// static const char DECORATE_UNUSED *kVUID_PVError_DeviceFeature = "UNASSIGNED-GeneralParameterError-DeviceFeature";
48
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070049extern const uint32_t GeneratedVulkanHeaderVersion;
50
sfricke-samsungd854f4c2021-07-03 23:25:05 -070051// Some flags and enums are never used in and won't be generated by default
52// Add to 'noautovalidity_type_exceptions' in parameter_validation_generator.py if needed
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070053extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits;
54extern const VkColorComponentFlags AllVkColorComponentFlagBits;
55extern const VkShaderStageFlags AllVkShaderStageFlagBits;
56extern const VkQueryControlFlags AllVkQueryControlFlagBits;
57extern const VkImageUsageFlags AllVkImageUsageFlagBits;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060058extern const VkSampleCountFlags AllVkSampleCountFlagBits;
sourav parmara96ab1a2020-04-25 16:28:23 -070059extern const VkBuildAccelerationStructureFlagsNV AllVkBuildAccelerationStructureFlagBitsNV;
60extern const VkGeometryFlagsKHR AllVkGeometryFlagBitsKHR;
Mike Schuchardt00e81452021-11-29 11:11:20 -080061extern const VkPipelineColorBlendStateCreateFlags AllVkPipelineColorBlendStateCreateFlagBits;
62extern const VkPipelineDepthStencilStateCreateFlags AllVkPipelineDepthStencilStateCreateFlagBits;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070063
sourav parmara96ab1a2020-04-25 16:28:23 -070064extern const std::vector<VkGeometryTypeKHR> AllVkGeometryTypeKHREnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070065extern const std::vector<VkCompareOp> AllVkCompareOpEnums;
66extern const std::vector<VkStencilOp> AllVkStencilOpEnums;
67extern const std::vector<VkBlendFactor> AllVkBlendFactorEnums;
68extern const std::vector<VkBlendOp> AllVkBlendOpEnums;
69extern const std::vector<VkLogicOp> AllVkLogicOpEnums;
70extern const std::vector<VkBorderColor> AllVkBorderColorEnums;
71extern const std::vector<VkImageLayout> AllVkImageLayoutEnums;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060072extern const std::vector<VkFormat> AllVkFormatEnums;
73extern const std::vector<VkVertexInputRate> AllVkVertexInputRateEnums;
74extern const std::vector<VkPrimitiveTopology> AllVkPrimitiveTopologyEnums;
sourav parmara96ab1a2020-04-25 16:28:23 -070075extern const std::vector<VkIndexType> AllVkIndexTypeEnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070076
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -060077extern std::vector<std::pair<uint32_t, uint32_t>> custom_stype_info;
78
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070079// String returned by string_VkStructureType for an unrecognized type.
80const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType";
81
82// String returned by string_VkResult for an unrecognized type.
83const std::string UnsupportedResultString = "Unhandled VkResult";
84
85// The base value used when computing the offset for an enumeration token value that is added by an extension.
86// When validating enumeration tokens, any value >= to this value is considered to be provided by an extension.
87// See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification
88const uint32_t ExtEnumBaseValue = 1000000000;
89
90// The value of all VK_xxx_MAX_ENUM tokens
91const uint32_t MaxEnumValue = 0x7FFFFFFF;
92
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070093class StatelessValidation : public ValidationObject {
Petr Kraus4ed81e32019-09-02 23:41:19 +020094 public:
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070095 VkPhysicalDeviceLimits device_limits = {};
Petr Kraus715bcc72019-08-15 17:17:33 +020096 safe_VkPhysicalDeviceFeatures2 physical_device_features2;
Tony-LunarG6c3c5452019-12-13 10:37:38 -070097 void *device_createinfo_pnext;
Petr Kraus715bcc72019-08-15 17:17:33 +020098 const VkPhysicalDeviceFeatures &physical_device_features = physical_device_features2.features;
Jeremy Gebbencbf22862021-03-03 12:01:22 -070099 layer_data::unordered_map<VkPhysicalDevice, VkPhysicalDeviceProperties *> physical_device_properties_map;
100 layer_data::unordered_map<VkPhysicalDevice, layer_data::unordered_set<std::string>> device_extensions_enumerated{};
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700101
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700102 // Override chassis read/write locks for this validation object
103 // This override takes a deferred lock. i.e. it is not acquired.
Jeremy Gebben2e5b41b2021-10-11 16:41:49 -0600104 ReadLockGuard ReadLock() override;
105 WriteLockGuard WriteLock() override;
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700106
sfricke-samsunga6c67fb2020-12-15 20:51:42 -0800107 // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2::pNext chain
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700108 struct DeviceExtensionProperties {
109 VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props;
110 VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props;
Jeff Bolz443c2ca2020-03-19 12:11:51 -0500111 VkPhysicalDeviceRayTracingPropertiesNV ray_tracing_propsNV;
sourav parmarcd5fb182020-07-17 12:58:44 -0700112 VkPhysicalDeviceRayTracingPipelinePropertiesKHR ray_tracing_propsKHR;
113 VkPhysicalDeviceAccelerationStructurePropertiesKHR acc_structure_props;
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -0700114 VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback_props;
Piers Daniellcb6d8032021-04-19 18:51:26 -0600115 VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_attribute_divisor_props;
ziga-lunarga283d022021-08-04 18:35:23 +0200116 VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT blend_operation_advanced_props;
Piers Daniella7f93b62021-11-20 12:32:04 -0700117 VkPhysicalDeviceMaintenance4PropertiesKHR maintenance4_props;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700118 };
119 DeviceExtensionProperties phys_dev_ext_props = {};
120
121 struct SubpassesUsageStates {
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700122 layer_data::unordered_set<uint32_t> subpasses_using_color_attachment;
123 layer_data::unordered_set<uint32_t> subpasses_using_depthstencil_attachment;
Younggwan Kim26b9abd2021-12-07 21:22:03 +0000124 std::vector<VkSubpassDescriptionFlags> subpasses_flags;
sjfricke69877a72022-08-10 09:20:01 +0900125 uint32_t color_attachment_count;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700126 };
127
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700128 // Though this validation object is predominantly statless, the Framebuffer checks are greatly simplified by creating and
129 // updating a map of the renderpass usage states, and these accesses need thread protection. Use a mutex separate from the
130 // parent object's to maintain that functionality.
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500131 mutable std::mutex renderpass_map_mutex;
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700132 layer_data::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700133
134 // Constructor for stateles validation tracking
Jeff Bolz165818a2020-05-08 11:19:03 -0500135 StatelessValidation() : device_createinfo_pnext(nullptr) { container_type = LayerObjectTypeParameterValidation; }
136 ~StatelessValidation() {
137 if (device_createinfo_pnext) {
138 FreePnextChain(device_createinfo_pnext);
139 }
140 }
141
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700142 /**
143 * Validate a minimum value.
144 *
145 * Verify that the specified value is greater than the specified lower bound.
146 *
147 * @param api_name Name of API call being validated.
148 * @param parameter_name Name of parameter being validated.
149 * @param value Value to validate.
150 * @param lower_bound Lower bound value to use for validation.
151 * @return Boolean value indicating that the call should be skipped.
152 */
153 template <typename T>
154 bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700155 const char *api_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700156 bool skip_call = false;
157
158 if (value <= lower_bound) {
159 std::ostringstream ss;
Mark Lobodzinski525c1292020-10-30 16:00:00 -0600160 ss << api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is not greater than "
161 << lower_bound;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700162 skip_call |= LogError(device, vuid, "%s", ss.str().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700163 }
164
165 return skip_call;
166 }
167
168 template <typename T>
169 bool ValidateGreaterThanZero(const T value, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700170 const char *api_name) const {
171 return ValidateGreaterThan(value, T{0}, parameter_name, vuid, api_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700172 }
173 /**
174 * Validate a required pointer.
175 *
176 * Verify that a required pointer is not NULL.
177 *
178 * @param apiName Name of API call being validated.
179 * @param parameterName Name of parameter being validated.
180 * @param value Pointer to validate.
181 * @return Boolean value indicating that the call should be skipped.
182 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700183 bool validate_required_pointer(const char *apiName, const ParameterName &parameterName, const void *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500184 const std::string &vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700185 bool skip_call = false;
186
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700187 if (value == nullptr) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700188 skip_call |=
189 LogError(device, vuid, "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700190 }
191
192 return skip_call;
193 }
194
195 /**
196 * Validate array count and pointer to array.
197 *
198 * Verify that required count and array parameters are not 0 or NULL. If the
199 * count parameter is not optional, verify that it is not 0. If the array
200 * parameter is NULL, and it is not optional, verify that count is 0.
201 *
202 * @param apiName Name of API call being validated.
203 * @param countName Name of count parameter.
204 * @param arrayName Name of array parameter.
205 * @param count Number of elements in the array.
206 * @param array Array to validate.
207 * @param countRequired The 'count' parameter may not be 0 when true.
208 * @param arrayRequired The 'array' parameter may not be NULL when true.
209 * @return Boolean value indicating that the call should be skipped.
210 */
211 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700212 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, T1 count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600213 const T2 *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500214 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700215 bool skip_call = false;
216
217 // Count parameters not tagged as optional cannot be 0
218 if (countRequired && (count == 0)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700219 skip_call |= LogError(device, count_required_vuid, "%s: parameter %s must be greater than 0.", apiName,
220 countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700221 }
222
223 // Array parameters not tagged as optional cannot be NULL, unless the count is 0
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700224 if (arrayRequired && (count != 0) && (*array == nullptr)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700225 skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s specified as NULL.", apiName,
226 arrayName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700227 }
228
229 return skip_call;
230 }
231
232 /**
233 * Validate pointer to array count and pointer to array.
234 *
235 * Verify that required count and array parameters are not NULL. If count
236 * is not NULL and its value is not optional, verify that it is not 0. If the
237 * array parameter is NULL, and it is not optional, verify that count is 0.
238 * The array parameter will typically be optional for this case (where count is
239 * a pointer), allowing the caller to retrieve the available count.
240 *
241 * @param apiName Name of API call being validated.
242 * @param countName Name of count parameter.
243 * @param arrayName Name of array parameter.
244 * @param count Pointer to the number of elements in the array.
245 * @param array Array to validate.
246 * @param countPtrRequired The 'count' parameter may not be NULL when true.
247 * @param countValueRequired The '*count' value may not be 0 when true.
248 * @param arrayRequired The 'array' parameter may not be NULL when true.
sfricke-samsung817d27c2020-12-01 22:22:56 -0800249 * @param count_required_vuid The VUID for the '*count' parameter.
250 * @param array_required_vuid The VUID for the 'array' parameter.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700251 * @return Boolean value indicating that the call should be skipped.
252 */
253 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700254 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T1 *count,
255 const T2 *array, bool countPtrRequired, bool countValueRequired, bool arrayRequired,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500256 const char *count_required_vuid, const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700257 bool skip_call = false;
258
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700259 if (count == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700260 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700261 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
262 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700263 }
264 } else {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700265 skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array, countValueRequired,
266 arrayRequired, count_required_vuid, array_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700267 }
268
269 return skip_call;
270 }
271
272 /**
273 * Validate a pointer to a Vulkan structure.
274 *
275 * Verify that a required pointer to a structure is not NULL. If the pointer is
276 * not NULL, verify that each structure's sType field is set to the correct
277 * VkStructureType value.
278 *
279 * @param apiName Name of API call being validated.
280 * @param parameterName Name of struct parameter being validated.
281 * @param sTypeName Name of expected VkStructureType value.
282 * @param value Pointer to the struct to validate.
283 * @param sType VkStructureType for structure validation.
284 * @param required The parameter may not be NULL when true.
285 * @return Boolean value indicating that the call should be skipped.
286 */
287 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700288 bool validate_struct_type(const char *apiName, const ParameterName &parameterName, const char *sTypeName, const T *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500289 VkStructureType sType, bool required, const char *struct_vuid, const char *stype_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700290 bool skip_call = false;
291
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700292 if (value == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700293 if (required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700294 skip_call |= LogError(device, struct_vuid, "%s: required parameter %s specified as NULL", apiName,
295 parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700296 }
297 } else if (value->sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700298 skip_call |= LogError(device, stype_vuid, "%s: parameter %s->sType must be %s.", apiName,
299 parameterName.get_name().c_str(), sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700300 }
301
302 return skip_call;
303 }
304
305 /**
306 * Validate an array of Vulkan structures
307 *
308 * Verify that required count and array parameters are not 0 or NULL. If
309 * the array contains 1 or more structures, verify that each structure's
310 * sType field is set to the correct VkStructureType value.
311 *
312 * @param apiName Name of API call being validated.
313 * @param countName Name of count parameter.
314 * @param arrayName Name of array parameter.
315 * @param sTypeName Name of expected VkStructureType value.
316 * @param count Number of elements in the array.
317 * @param array Array to validate.
318 * @param sType VkStructureType for structure validation.
319 * @param countRequired The 'count' parameter may not be 0 when true.
320 * @param arrayRequired The 'array' parameter may not be NULL when true.
321 * @return Boolean value indicating that the call should be skipped.
322 */
323 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700324 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
325 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800326 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500327 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700328 bool skip_call = false;
329
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700330 if ((count == 0) || (array == nullptr)) {
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800331 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
332 count_required_vuid, param_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700333 } else {
334 // Verify that all structs in the array have the correct type
335 for (uint32_t i = 0; i < count; ++i) {
336 if (array[i].sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700337 skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d].sType must be %s", apiName,
338 arrayName.get_name().c_str(), i, sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700339 }
340 }
341 }
342
343 return skip_call;
344 }
sourav parmarcd5fb182020-07-17 12:58:44 -0700345
346 /**
347 * Validate an pointer type array of Vulkan structures
348 *
349 * Verify that required count and array parameters are not 0 or NULL. If
350 * the array contains 1 or more structures, verify that each structure's
351 * sType field is set to the correct VkStructureType value.
352 *
353 * @param apiName Name of API call being validated.
354 * @param countName Name of count parameter.
355 * @param arrayName Name of array parameter.
356 * @param sTypeName Name of expected VkStructureType value.
357 * @param count Number of elements in the array.
358 * @param array Array to validate.
359 * @param sType VkStructureType for structure validation.
360 * @param countRequired The 'count' parameter may not be 0 when true.
361 * @param arrayRequired The 'array' parameter may not be NULL when true.
362 * @return Boolean value indicating that the call should be skipped.
363 */
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700364 template <typename T>
365 bool validate_struct_pointer_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
sourav parmarcd5fb182020-07-17 12:58:44 -0700366 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
367 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
368 const char *count_required_vuid) const {
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700369 bool skip_call = false;
370
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700371 if ((count == 0) || (array == nullptr)) {
Mike Schuchardtbf67ad22020-07-06 17:29:55 -0700372 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
373 count_required_vuid, param_vuid);
374 } else {
375 // Verify that all structs in the array have the correct type
376 for (uint32_t i = 0; i < count; ++i) {
377 if (array[i]->sType != sType) {
378 skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d]->sType must be %s", apiName,
379 arrayName.get_name().c_str(), i, sTypeName);
380 }
381 }
382 }
383
384 return skip_call;
385 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700386
387 /**
388 * Validate an array of Vulkan structures.
389 *
390 * Verify that required count and array parameters are not NULL. If count
391 * is not NULL and its value is not optional, verify that it is not 0.
392 * If the array contains 1 or more structures, verify that each structure's
393 * sType field is set to the correct VkStructureType value.
394 *
395 * @param apiName Name of API call being validated.
396 * @param countName Name of count parameter.
397 * @param arrayName Name of array parameter.
398 * @param sTypeName Name of expected VkStructureType value.
399 * @param count Pointer to the number of elements in the array.
400 * @param array Array to validate.
401 * @param sType VkStructureType for structure validation.
402 * @param countPtrRequired The 'count' parameter may not be NULL when true.
403 * @param countValueRequired The '*count' value may not be 0 when true.
404 * @param arrayRequired The 'array' parameter may not be NULL when true.
405 * @return Boolean value indicating that the call should be skipped.
406 */
407 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700408 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
409 const char *sTypeName, uint32_t *count, const T *array, VkStructureType sType,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600410 bool countPtrRequired, bool countValueRequired, bool arrayRequired, const char *stype_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500411 const char *param_vuid, const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700412 bool skip_call = false;
413
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700414 if (count == nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700415 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700416 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
417 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700418 }
419 } else {
420 skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType,
Mark Lobodzinski75a38812019-12-10 15:22:52 -0700421 countValueRequired && (array != nullptr), arrayRequired, stype_vuid, param_vuid,
422 count_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700423 }
424
425 return skip_call;
426 }
427
428 /**
429 * Validate a Vulkan handle.
430 *
431 * Verify that the specified handle is not VK_NULL_HANDLE.
432 *
433 * @param api_name Name of API call being validated.
434 * @param parameter_name Name of struct parameter being validated.
435 * @param value Handle to validate.
436 * @return Boolean value indicating that the call should be skipped.
437 */
438 template <typename T>
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500439 bool validate_required_handle(const char *api_name, const ParameterName &parameter_name, T value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700440 bool skip_call = false;
441
442 if (value == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700443 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE",
444 api_name, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700445 }
446
447 return skip_call;
448 }
449
450 /**
451 * Validate an array of Vulkan handles.
452 *
453 * Verify that required count and array parameters are not NULL. If count
454 * is not NULL and its value is not optional, verify that it is not 0.
455 * If the array contains 1 or more handles, verify that no handle is set to
456 * VK_NULL_HANDLE.
457 *
458 * @note This function is only intended to validate arrays of handles when none
459 * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles
460 * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead.
461 *
462 * @param api_name Name of API call being validated.
463 * @param count_name Name of count parameter.
464 * @param array_name Name of array parameter.
465 * @param count Number of elements in the array.
466 * @param array Array to validate.
467 * @param count_required The 'count' parameter may not be 0 when true.
468 * @param array_required The 'array' parameter may not be NULL when true.
sfricke-samsung817d27c2020-12-01 22:22:56 -0800469 * @param count_required_vuid The VUID for the '*count' parameter.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700470 * @return Boolean value indicating that the call should be skipped.
471 */
472 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700473 bool validate_handle_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
sfricke-samsung817d27c2020-12-01 22:22:56 -0800474 uint32_t count, const T *array, bool count_required, bool array_required,
475 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700476 bool skip_call = false;
477
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700478 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700479 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
sfricke-samsung817d27c2020-12-01 22:22:56 -0800480 count_required_vuid, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700481 } else {
482 // Verify that no handles in the array are VK_NULL_HANDLE
483 for (uint32_t i = 0; i < count; ++i) {
484 if (array[i] == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700485 skip_call |= LogError(device, kVUID_PVError_RequiredParameter,
486 "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name,
487 array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700488 }
489 }
490 }
491
492 return skip_call;
493 }
494
495 /**
496 * Validate string array count and content.
497 *
498 * Verify that required count and array parameters are not 0 or NULL. If the
499 * count parameter is not optional, verify that it is not 0. If the array
500 * parameter is NULL, and it is not optional, verify that count is 0. If the
501 * array parameter is not NULL, verify that none of the strings are NULL.
502 *
503 * @param apiName Name of API call being validated.
504 * @param countName Name of count parameter.
505 * @param arrayName Name of array parameter.
506 * @param count Number of strings in the array.
507 * @param array Array of strings to validate.
508 * @param countRequired The 'count' parameter may not be 0 when true.
509 * @param arrayRequired The 'array' parameter may not be NULL when true.
510 * @return Boolean value indicating that the call should be skipped.
511 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700512 bool validate_string_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600513 const char *const *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500514 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700515 bool skip_call = false;
516
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700517 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700518 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
519 count_required_vuid, array_required_vuid);
520 } else {
521 // Verify that strings in the array are not NULL
522 for (uint32_t i = 0; i < count; ++i) {
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700523 if (array[i] == nullptr) {
Mark Lobodzinski525c1292020-10-30 16:00:00 -0600524 skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s[%d] specified as NULL", apiName,
525 arrayName.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700526 }
527 }
528 }
529
530 return skip_call;
531 }
532
Mark Lobodzinski2e40a132020-08-10 14:51:41 -0600533 // Forward declarations
534 bool CheckPromotedApiAgainstVulkanVersion(VkInstance instance, const char *api_name, const uint32_t promoted_version) const;
535 bool CheckPromotedApiAgainstVulkanVersion(VkPhysicalDevice pdev, const char *api_name, const uint32_t promoted_version) const;
Mark Lobodzinskibece6c12020-08-27 15:34:02 -0600536 bool SupportedByPdev(const VkPhysicalDevice physical_device, const std::string ext_name) const;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -0600537
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600538 bool ValidatePnextStructContents(const char *api_name, const ParameterName &parameter_name, const VkBaseOutStructure *header,
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600539 const char *pnext_vuid, bool is_physdev_api = false, bool is_const_param = true) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700540
541 /**
542 * Validate a structure's pNext member.
543 *
544 * Verify that the specified pNext value points to the head of a list of
545 * allowed extension structures. If no extension structures are allowed,
546 * verify that pNext is null.
547 *
548 * @param api_name Name of API call being validated.
549 * @param parameter_name Name of parameter being validated.
550 * @param allowed_struct_names Names of allowed structs.
551 * @param next Pointer to validate.
552 * @param allowed_type_count Total number of allowed structure types.
553 * @param allowed_types Array of structure types allowed for pNext.
554 * @param header_version Version of header defining the pNext validation rules.
555 * @return Boolean value indicating that the call should be skipped.
556 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700557 bool validate_struct_pnext(const char *api_name, const ParameterName &parameter_name, const char *allowed_struct_names,
558 const void *next, size_t allowed_type_count, const VkStructureType *allowed_types,
Nathaniel Cesarioe0c387b2021-09-02 13:51:34 -0600559 uint32_t header_version, const char *pnext_vuid, const char *stype_vuid,
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600560 const bool is_physdev_api = false, const bool is_const_param = true) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700561 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700562
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700563 if (next != nullptr) {
Jeremy Gebbencbf22862021-03-03 12:01:22 -0700564 layer_data::unordered_set<const void *> cycle_check;
565 layer_data::unordered_set<VkStructureType, layer_data::hash<int>> unique_stype_check;
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600566
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600567 const char *disclaimer =
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600568 "This error is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that "
569 "you are using a struct from a private extension or an extension that was added to a later version of the Vulkan "
570 "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 -0600571
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600572 if ((allowed_type_count == 0) && (custom_stype_info.size() == 0)) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700573 std::string message = "%s: value of %s must be NULL. ";
574 message += disclaimer;
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600575 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
576 header_version, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700577 } else {
578 const VkStructureType *start = allowed_types;
579 const VkStructureType *end = allowed_types + allowed_type_count;
Lockefbdd1af2019-04-16 15:07:23 -0600580 const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700581
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700582 while (current != nullptr) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700583 if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) ||
584 (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) &&
585 ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) ||
586 (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700587 std::string type_name = string_VkStructureType(current->sType);
Nathaniel Cesario78c1cdd2021-04-01 23:13:33 -0600588 if (unique_stype_check.find(current->sType) != unique_stype_check.end() &&
589 !IsDuplicatePnext(current->sType)) {
sfricke-samsung32a27362020-02-28 09:06:42 -0800590 // stype_vuid will only be null if there are no listed pNext and will hit disclaimer check
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700591 std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times.";
sfricke-samsung32a27362020-02-28 09:06:42 -0800592 skip_call |= LogError(device, stype_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
593 type_name.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700594 } else {
595 unique_stype_check.insert(current->sType);
596 }
597
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600598 // Search custom stype list -- if sType found, skip this entirely
599 bool custom = false;
John Zulauf79f06582021-02-27 18:38:39 -0700600 for (const auto &item : custom_stype_info) {
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600601 if (item.first == current->sType) {
602 custom = true;
603 break;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700604 }
605 }
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600606 if (!custom) {
607 if (std::find(start, end, current->sType) == end) {
608 if (type_name.compare(UnsupportedStructureTypeString) == 0) {
609 std::string message =
610 "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures "
611 "are [%s]. ";
612 message += disclaimer;
613 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
614 parameter_name.get_name().c_str(), current->sType, allowed_struct_names,
615 header_version, parameter_name.get_name().c_str());
616 } else {
617 std::string message =
618 "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures "
619 "are [%s]. ";
620 message += disclaimer;
621 skip_call |= LogError(device, pnext_vuid, message.c_str(), api_name,
622 parameter_name.get_name().c_str(), type_name.c_str(),
623 allowed_struct_names, header_version, parameter_name.get_name().c_str());
624 }
625 }
Nathaniel Cesario5f45f0e2021-09-09 17:44:32 -0600626 skip_call |= ValidatePnextStructContents(api_name, parameter_name, current, pnext_vuid, is_physdev_api,
627 is_const_param);
Mark Lobodzinski3e66ae82020-08-12 16:27:29 -0600628 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700629 }
Lockefbdd1af2019-04-16 15:07:23 -0600630 current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700631 }
632 }
633 }
634
635 return skip_call;
636 }
637
638 /**
639 * Validate a VkBool32 value.
640 *
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600641 * Generate an error if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700642 *
643 * @param apiName Name of API call being validated.
644 * @param parameterName Name of parameter being validated.
645 * @param value Boolean value to validate.
646 * @return Boolean value indicating that the call should be skipped.
647 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500648 bool validate_bool32(const char *apiName, const ParameterName &parameterName, VkBool32 value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700649 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700650 if ((value != VK_TRUE) && (value != VK_FALSE)) {
Mark Lobodzinski9d857502020-10-19 09:47:11 -0600651 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
652 "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
653 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
654 apiName, parameterName.get_name().c_str(), value);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700655 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700656 return skip_call;
657 }
658
659 /**
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700660 * Validate an array of VkBool32 values.
661 *
662 * Generate an error if any VkBool32 value in an array is neither VK_TRUE nor VK_FALSE.
663 *
664 * @param apiName Name of API call being validated.
665 * @param countName Name of count parameter.
666 * @param arrayName Name of array parameter.
667 * @param count Number of values in the array.
668 * @param array Array of VkBool32 values to validate.
669 * @param countRequired The 'count' parameter may not be 0 when true.
670 * @param arrayRequired The 'array' parameter may not be NULL when true.
671 * @return Boolean value indicating that the call should be skipped.
672 */
673 bool validate_bool32_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
674 const VkBool32 *array, bool countRequired, bool arrayRequired) const {
675 bool skip_call = false;
676
677 if ((count == 0) || (array == nullptr)) {
678 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
679 kVUIDUndefined);
680 } else {
681 for (uint32_t i = 0; i < count; ++i) {
682 if ((array[i] != VK_TRUE) && (array[i] != VK_FALSE)) {
683 skip_call |=
684 LogError(device, kVUID_PVError_UnrecognizedValue,
685 "%s: value of %s[%d] (%d) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other "
686 "values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.",
687 apiName, arrayName.get_name().c_str(), i, array[i]);
688 }
689 }
690 }
691
692 return skip_call;
693 }
694
695 /**
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700696 * Validate a Vulkan enumeration value.
697 *
698 * Generate a warning if an enumeration token value does not fall within the core enumeration
699 * begin and end token values, and was not added to the enumeration by an extension. Extension
700 * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
701 * with 1,000,000,000 as the base token value.
702 *
703 * @note This function does not expect to process enumerations defining bitmask flag bits.
704 *
705 * @param apiName Name of API call being validated.
706 * @param parameterName Name of parameter being validated.
707 * @param enumName Name of the enumeration being validated.
708 * @param valid_values The list of valid values for the enumeration.
709 * @param value Enumeration value to validate.
710 * @return Boolean value indicating that the call should be skipped.
711 */
712 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700713 bool validate_ranged_enum(const char *apiName, const ParameterName &parameterName, const char *enumName,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500714 const std::vector<T> &valid_values, T value, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700715 bool skip = false;
716
717 if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) {
718 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700719 LogError(device, vuid,
720 "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is "
721 "not an extension added token.",
722 apiName, parameterName.get_name().c_str(), value, enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700723 }
724
725 return skip;
726 }
727
728 /**
729 * Validate an array of Vulkan enumeration value.
730 *
731 * Process all enumeration token values in the specified array and generate a warning if a value
732 * does not fall within the core enumeration begin and end token values, and was not added to
733 * the enumeration by an extension. Extension provided enumerations use the equation specified
734 * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
735 *
736 * @note This function does not expect to process enumerations defining bitmask flag bits.
737 *
738 * @param apiName Name of API call being validated.
739 * @param countName Name of count parameter.
740 * @param arrayName Name of array parameter.
741 * @param enumName Name of the enumeration being validated.
742 * @param valid_values The list of valid values for the enumeration.
743 * @param count Number of enumeration values in the array.
744 * @param array Array of enumeration values to validate.
745 * @param countRequired The 'count' parameter may not be 0 when true.
746 * @param arrayRequired The 'array' parameter may not be NULL when true.
747 * @return Boolean value indicating that the call should be skipped.
748 */
749 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700750 bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
751 const char *enumName, const std::vector<T> &valid_values, uint32_t count, const T *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500752 bool countRequired, bool arrayRequired) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700753 bool skip_call = false;
754
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700755 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700756 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
757 kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700758 } else {
759 for (uint32_t i = 0; i < count; ++i) {
760 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700761 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
762 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
763 "enumeration tokens and is not an extension added token",
764 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700765 }
766 }
767 }
768
769 return skip_call;
770 }
771
Nathaniel Cesario45efaac2022-04-11 17:04:33 -0600772 template <typename T>
773 bool validate_ranged_enum_array(const char *apiName, const char *vuid, const ParameterName &countName,
774 const ParameterName &arrayName, const char *enumName, const std::vector<T> &valid_values,
775 uint32_t count, const T *array, bool countRequired, bool arrayRequired) const {
776 bool skip_call = false;
777
778 if ((count == 0) || (array == nullptr)) {
779 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, vuid, vuid);
780 } else {
781 for (uint32_t i = 0; i < count; ++i) {
782 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
783 skip_call |= LogError(device, vuid,
784 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
785 "enumeration tokens and is not an extension added token",
786 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
787 }
788 }
789 }
790
791 return skip_call;
792 }
793
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700794 /**
795 * Verify that a reserved VkFlags value is zero.
796 *
797 * Verify that the specified value is zero, to check VkFlags values that are reserved for
798 * future use.
799 *
800 * @param api_name Name of API call being validated.
801 * @param parameter_name Name of parameter being validated.
802 * @param value Value to validate.
803 * @return Boolean value indicating that the call should be skipped.
804 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500805 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 -0700806 bool skip_call = false;
807
808 if (value != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700809 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 -0700810 }
811
812 return skip_call;
813 }
814
Petr Kraus52758be2019-08-12 00:53:58 +0200815 enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit };
816
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700817 // helper to implement validation of both 32 bit and 64 bit flags.
818 template <typename FlagTypedef>
819 bool validate_flags_impl(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name,
820 FlagTypedef all_flags, FlagTypedef value, const FlagType flag_type, const char *vuid,
821 const char *flags_zero_vuid = nullptr) const {
822 bool skip_call = false;
823
824 if ((value & ~all_flags) != 0) {
825 skip_call |= LogError(device, vuid, "%s: value of %s contains flag bits that are not recognized members of %s",
826 api_name, parameter_name.get_name().c_str(), flag_bits_name);
827 }
828
829 const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit;
830 const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid;
831 if (required && value == 0) {
832 skip_call |= LogError(device, zero_vuid, "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str());
833 }
834
835 const auto HasMaxOneBitSet = [](const FlagTypedef f) {
836 // Decrement flips bits from right upto first 1.
837 // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED
838 return f == 0 || !(f & (f - 1));
839 };
840
841 const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit;
842 if (is_bits_type && !HasMaxOneBitSet(value)) {
843 skip_call |=
844 LogError(device, vuid, "%s: value of %s contains multiple members of %s when only a single value is allowed",
845 api_name, parameter_name.get_name().c_str(), flag_bits_name);
846 }
847
848 return skip_call;
849 }
850
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700851 /**
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700852 * Validate a 32 bit Vulkan bitmask value.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700853 *
854 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
855 * for that type.
856 *
857 * @param api_name Name of API call being validated.
858 * @param parameter_name Name of parameter being validated.
859 * @param flag_bits_name Name of the VkFlags type being validated.
860 * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated.
861 * @param value VkFlags value to validate.
Petr Kraus52758be2019-08-12 00:53:58 +0200862 * @param flag_type The type of flag, like optional, or single bit.
863 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
864 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700865 * @return Boolean value indicating that the call should be skipped.
866 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700867 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 -0500868 VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700869 return validate_flags_impl<VkFlags>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
870 flags_zero_vuid);
871 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700872
Jeremy Gebben97e718e2021-02-15 07:39:51 -0700873 /**
874 * Validate a 64 bit Vulkan bitmask value.
875 *
876 * Generate a warning if a value with a VkFlags64 derived type does not contain valid flag bits
877 * for that type.
878 *
879 * @param api_name Name of API call being validated.
880 * @param parameter_name Name of parameter being validated.
881 * @param flag_bits_name Name of the VkFlags64 type being validated.
882 * @param all_flags A bit mask combining all valid flag bits for the VkFlags64 type being validated.
883 * @param value VkFlags64 value to validate.
884 * @param flag_type The type of flag, like optional, or single bit.
885 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
886 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
887 * @return Boolean value indicating that the call should be skipped.
888 */
889 bool validate_flags(const char *api_name, const ParameterName &parameter_name, const char *flag_bits_name, VkFlags64 all_flags,
890 VkFlags64 value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
891 return validate_flags_impl<VkFlags64>(api_name, parameter_name, flag_bits_name, all_flags, value, flag_type, vuid,
892 flags_zero_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700893 }
894
895 /**
896 * Validate an array of Vulkan bitmask values.
897 *
898 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
899 * for that type.
900 *
901 * @param api_name Name of API call being validated.
902 * @param count_name Name of parameter being validated.
903 * @param array_name Name of parameter being validated.
904 * @param flag_bits_name Name of the VkFlags type being validated.
905 * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated.
906 * @param count Number of VkFlags values in the array.
907 * @param array Array of VkFlags value to validate.
908 * @param count_required The 'count' parameter may not be 0 when true.
909 * @param array_required The 'array' parameter may not be NULL when true.
910 * @return Boolean value indicating that the call should be skipped.
911 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700912 bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
913 const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500914 bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700915 bool skip_call = false;
916
Mike Schuchardtf39a8dc2021-04-19 08:55:48 -0700917 if ((count == 0) || (array == nullptr)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700918 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
919 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700920 } else {
921 // Verify that all VkFlags values in the array
922 for (uint32_t i = 0; i < count; ++i) {
923 if (array[i] == 0) {
924 // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if
925 // elements in the array are allowed be 0
926 if (array_required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700927 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0",
928 api_name, array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700929 }
930 } else if ((array[i] & (~all_flags)) != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700931 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
932 "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name,
933 array_name.get_name().c_str(), i, flag_bits_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700934 }
935 }
936 }
937
938 return skip_call;
939 }
940
941 template <typename ExtensionState>
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600942 bool validate_extension_reqs(const ExtensionState &extensions, const char *vuid, const char *extension_type,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500943 const char *extension_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700944 bool skip = false;
945 if (!extension_name) {
946 return skip; // Robust to invalid char *
947 }
948 auto info = ExtensionState::get_info(extension_name);
949
950 if (!info.state) {
951 return skip; // Unknown extensions cannot be checked so report OK
952 }
953
954 // Check against the required list in the info
955 std::vector<const char *> missing;
Petr Krausbce952d2020-04-02 18:40:40 +0200956 for (const auto &req : info.requirements) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700957 if (!(extensions.*(req.enabled))) {
958 missing.push_back(req.name);
959 }
960 }
961
962 // Report any missing requirements
963 if (missing.size()) {
964 std::string missing_joined_list = string_join(", ", missing);
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700965 skip |= LogError(instance, vuid, "Missing extension%s required by the %s extension %s: %s.",
966 ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700967 }
968 return skip;
969 }
970
971 enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
972
973 template <typename RenderPassCreateInfoGeneric>
Petr Kraus3e52eba2019-07-10 01:24:10 +0200974 bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo,
Jeremy Gebben40a22942020-12-22 14:22:06 -0700975 uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags2KHR stages,
976 const char *vuid, const char *target, const char *func_name) const {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200977 bool skip = false;
Jeremy Gebben5f585ae2021-02-02 09:03:06 -0700978 // make sure we consider all of the expanded and un-expanded graphics bits to be valid
Jeremy Gebben40a22942020-12-22 14:22:06 -0700979 const auto kExcludeStages = VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR | VK_PIPELINE_STAGE_2_COPY_BIT_KHR |
980 VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR | VK_PIPELINE_STAGE_2_BLIT_BIT_KHR |
981 VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR;
982 const auto kMetaGraphicsStages = VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR | VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR |
983 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR;
984 const auto kGraphicsStages =
985 (sync_utils::ExpandPipelineStages(VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_QUEUE_GRAPHICS_BIT) | kMetaGraphicsStages) &
986 ~kExcludeStages;
Petr Krausdfd26442019-08-13 03:25:19 +0200987
988 const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) {
Jeremy Gebben12933ef2021-05-12 17:16:27 -0600989 if (subpass == VK_SUBPASS_EXTERNAL || subpass >= pCreateInfo->subpassCount)
Petr Kraus3e52eba2019-07-10 01:24:10 +0200990 return false;
991 else
Petr Krausdfd26442019-08-13 03:25:19 +0200992 return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage;
Petr Kraus3e52eba2019-07-10 01:24:10 +0200993 };
994
Petr Krausdfd26442019-08-13 03:25:19 +0200995 const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0;
996 if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) {
sfricke-samsung46fc6632020-09-12 14:28:58 -0700997 skip |= LogError(VkRenderPass(0), vuid,
998 "%s: Dependency pDependencies[%" PRIu32
999 "] specifies a %sStageMask that contains stages (%s) that are not part "
1000 "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.",
Jeremy Gebben40a22942020-12-22 14:22:06 -07001001 func_name, dependency_index, target,
1002 sync_utils::StringPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001003 }
1004
1005 return skip;
1006 };
1007
1008 template <typename RenderPassCreateInfoGeneric>
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001009 bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001010 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001011 RenderPassCreateVersion rp_version) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001012 bool skip = false;
1013 uint32_t max_color_attachments = device_limits.maxColorAttachments;
1014 bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2);
sfricke-samsung46fc6632020-09-12 14:28:58 -07001015 const char *func_name = (use_rp2) ? "vkCreateRenderPass2" : "vkCreateRenderPass";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001016 const char *vuid;
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001017 VkBool32 separate_depth_stencil_layouts = false;
Mark Lobodzinski1f887d32020-12-30 15:31:33 -07001018 const auto *vulkan_12_features = LvlFindInChain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001019 if (vulkan_12_features) {
1020 separate_depth_stencil_layouts = vulkan_12_features->separateDepthStencilLayouts;
1021 } else {
1022 const auto *separate_depth_stencil_layouts_features =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -07001023 LvlFindInChain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures>(device_createinfo_pnext);
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001024 if (separate_depth_stencil_layouts_features)
1025 separate_depth_stencil_layouts = separate_depth_stencil_layouts_features->separateDepthStencilLayouts;
1026 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001027
Tony-LunarG6845c182022-09-16 16:01:24 -06001028 VkBool32 attachment_feedback_loop_layout = false;
1029 const auto *attachment_feedback_loop_layout_features =
1030 LvlFindInChain<VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT>(device_createinfo_pnext);
1031 if (attachment_feedback_loop_layout_features)
1032 attachment_feedback_loop_layout = attachment_feedback_loop_layout_features->attachmentFeedbackLoopLayout;
1033
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001034 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
sjfricke091f6f62022-05-19 14:46:37 +09001035 // if not null, also confirms rp2 is being used
Piers Daniell4fde9b72019-11-27 16:19:46 -07001036 const auto *attachment_description_stencil_layout =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -07001037 (use_rp2) ? LvlFindInChain<VkAttachmentDescriptionStencilLayout>(
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001038 reinterpret_cast<VkAttachmentDescription2 const *>(&pCreateInfo->pAttachments[i])->pNext)
sjfricke091f6f62022-05-19 14:46:37 +09001039 : nullptr;
Piers Daniell4fde9b72019-11-27 16:19:46 -07001040
sfricke-samsungcac6a262020-04-28 07:50:49 -07001041 const VkFormat attachment_format = pCreateInfo->pAttachments[i].format;
1042 const VkImageLayout initial_layout = pCreateInfo->pAttachments[i].initialLayout;
1043 const VkImageLayout final_layout = pCreateInfo->pAttachments[i].finalLayout;
1044 if (attachment_format == VK_FORMAT_UNDEFINED) {
Mark Young89d4a822022-08-23 09:00:54 -06001045 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06698",
1046 "%s: pCreateInfo->pAttachments[%" PRIu32 "].format is VK_FORMAT_UNDEFINED.", func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001047 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001048 if (final_layout == VK_IMAGE_LAYOUT_UNDEFINED || final_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Young89d4a822022-08-23 09:00:54 -06001049 skip |= LogError(device, "VUID-VkAttachmentDescription-finalLayout-00843",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001050 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001051 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001052 func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001053 }
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001054 if (!separate_depth_stencil_layouts) {
sjfricke091f6f62022-05-19 14:46:37 +09001055 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1056 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1057 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1058 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001059 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001060 device, "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284",
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 "
1063 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
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) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001070 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001071 device, "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001072 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1073 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1074 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001075 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001076 }
1077 }
Tony-LunarG6845c182022-09-16 16:01:24 -06001078 if (!attachment_feedback_loop_layout) {
1079 if (initial_layout == VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT) {
1080 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-attachmentFeedbackLoopLayout-07309"
1081 : "VUID-VkAttachmentDescription-attachmentFeedbackLoopLayout-07309";
1082 skip |= LogError(device, vuid,
1083 "%s: pCreateInfo->pAttachments[%" PRIu32
1084 "] initialLayout is VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT but the "
1085 "attachmentFeedbackLoopLayout feature is not enabled",
1086 func_name, i);
1087 }
1088 if (final_layout == VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT) {
1089 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-attachmentFeedbackLoopLayout-07310"
1090 : "VUID-VkAttachmentDescription-attachmentFeedbackLoopLayout-07310";
1091 skip |= LogError(device, vuid,
1092 "%s: pCreateInfo->pAttachments[%" PRIu32
1093 "] finalLayout is VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT but the "
1094 "attachmentFeedbackLoopLayout feature is not enabled",
1095 func_name, i);
1096 }
1097 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001098 if (!FormatIsDepthOrStencil(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001099 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1100 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1101 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1102 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001103 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001104 device, "VUID-VkAttachmentDescription-format-03286",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001105 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1106 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
Piers Daniell9af77cd2019-10-16 13:54:12 -06001107 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001108 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001109 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001110 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1111 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1112 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1113 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001114 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001115 device, "VUID-VkAttachmentDescription-format-03287",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001116 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1117 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1118 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001119 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001120 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001121 } else if (FormatIsDepthAndStencil(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001122 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1123 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001124 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06906",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001125 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001126 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001127 "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) {
Mark Young89d4a822022-08-23 09:00:54 -06001132 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06907",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001133 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001134 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or "
1135 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1136 func_name, i);
1137 }
1138 } else if (FormatIsDepthOnly(attachment_format)) {
1139 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1140 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1141 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03290",
1142 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1143 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or"
1144 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1145 func_name, i);
1146 }
1147 if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1148 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1149 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03291",
1150 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1151 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001152 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001153 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001154 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001155 } else if (FormatIsStencilOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001156 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1157 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001158 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03292",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001159 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001160 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or"
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001161 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001162 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001163 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001164 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1165 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001166 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03293",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001167 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001168 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001169 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL",
1170 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001171 }
1172 }
sjfricke091f6f62022-05-19 14:46:37 +09001173 if (attachment_description_stencil_layout) {
Piers Daniell9af77cd2019-10-16 13:54:12 -06001174 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001175 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1176 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001177 attachment_description_stencil_layout->stencilInitialLayout ==
1178 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1179 attachment_description_stencil_layout->stencilInitialLayout ==
1180 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1181 attachment_description_stencil_layout->stencilInitialLayout ==
1182 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1183 attachment_description_stencil_layout->stencilInitialLayout ==
1184 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001185 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001186 "%s: VkAttachmentDescriptionStencilLayout.stencilInitialLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001187 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001188 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001189 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1190 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1191 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001192 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1193 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001194 }
1195 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001196 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1197 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001198 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1199 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1200 attachment_description_stencil_layout->stencilFinalLayout ==
1201 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1202 attachment_description_stencil_layout->stencilFinalLayout ==
1203 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001204 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001205 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001206 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001207 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001208 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1209 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1210 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001211 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1212 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001213 }
1214 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
1215 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001216 skip |= LogError(
1217 device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001218 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001219 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
1220 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001221 }
1222 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001223
1224 if (FormatIsDepthOrStencil(attachment_format)) {
1225 if (initial_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001226 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03281",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001227 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001228 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001229 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001230 }
1231 if (final_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001232 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03283",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001233 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001234 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001235 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001236 }
1237 }
1238 if (FormatIsColor(attachment_format)) {
1239 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
Mark Young89d4a822022-08-23 09:00:54 -06001240 initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) {
1241 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03280",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001242 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001243 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or "
1244 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL when using a Color format",
1245 func_name, i);
1246
1247 } else if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1248 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1249 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06487",
1250 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1251 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001252 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1253 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001254 }
1255 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
Mark Young89d4a822022-08-23 09:00:54 -06001256 final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) {
1257 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03282",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001258 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001259 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or "
1260 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL when using a Color format",
1261 func_name, i);
1262 } else if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1263 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1264 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06488",
1265 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1266 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001267 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1268 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001269 }
1270 }
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001271 if (FormatIsColor(attachment_format) || FormatHasDepth(attachment_format)) {
1272 if (pCreateInfo->pAttachments[i].loadOp == VK_ATTACHMENT_LOAD_OP_LOAD &&
sjfricke091f6f62022-05-19 14:46:37 +09001273 initial_layout == VK_IMAGE_LAYOUT_UNDEFINED) {
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001274 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001275 device, "VUID-VkAttachmentDescription-format-06699",
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001276 "%s: pCreateInfo->pAttachments[%" PRIu32
1277 "] format is %s and loadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but initialLayout is VK_IMAGE_LAYOUT_UNDEFINED.",
sjfricke091f6f62022-05-19 14:46:37 +09001278 func_name, i, string_VkFormat(attachment_format));
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001279 }
1280 }
sjfricke091f6f62022-05-19 14:46:37 +09001281 if (FormatHasStencil(attachment_format) && pCreateInfo->pAttachments[i].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD) {
1282 if (initial_layout == VK_IMAGE_LAYOUT_UNDEFINED) {
1283 if (use_rp2) {
1284 skip |= LogError(device, "VUID-VkAttachmentDescription2-pNext-06704",
1285 "%s: pCreateInfo->pAttachments[%" PRIu32
1286 "] format includes stencil aspect and stencilLoadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but "
1287 "the initialLayout is VK_IMAGE_LAYOUT_UNDEFINED.",
1288 func_name, i);
1289 } else if (!IsExtEnabled(device_extensions.vk_khr_separate_depth_stencil_layouts)) {
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001290 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-06703" : "VUID-VkAttachmentDescription-format-06700";
1291 skip |= LogError(device, vuid,
1292 "%s: pCreateInfo->pAttachments[%" PRIu32
1293 "] format is %s and stencilLoadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but initialLayout is "
1294 "VK_IMAGE_LAYOUT_UNDEFINED.",
sjfricke091f6f62022-05-19 14:46:37 +09001295 func_name, i, string_VkFormat(attachment_format));
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001296 }
1297 }
sjfricke091f6f62022-05-19 14:46:37 +09001298
1299 // rp2 can have seperate depth/stencil layout and need to look in pNext
ziga-lunarga5a1b352022-04-08 23:48:47 +02001300 if (attachment_description_stencil_layout) {
1301 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
1302 skip |=
1303 LogError(device, "VUID-VkAttachmentDescription2-pNext-06705",
1304 "%s: pCreateInfo->pAttachments[%" PRIu32
1305 "] format includes stencil aspect and stencilLoadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but "
1306 "the VkAttachmentDescriptionStencilLayout::stencilInitialLayout is VK_IMAGE_LAYOUT_UNDEFINED.",
1307 func_name, i);
1308 }
ziga-lunarga5a1b352022-04-08 23:48:47 +02001309 }
1310 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001311 }
1312
1313 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
1314 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001315 vuid = use_rp2 ? "VUID-VkSubpassDescription2-colorAttachmentCount-03063"
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001316 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001317 skip |=
1318 LogError(device, vuid,
1319 "%s: Cannot create a render pass with %d color attachments in pCreateInfo->pSubpasses[%u]. Max is %d.",
1320 func_name, pCreateInfo->pSubpasses[i].colorAttachmentCount, i, max_color_attachments);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001321 }
1322 }
Petr Kraus3e52eba2019-07-10 01:24:10 +02001323
1324 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) {
1325 const auto &dependency = pCreateInfo->pDependencies[i];
1326
sfricke-samsung55f01952020-03-24 08:16:41 -07001327 // Need to check first so layer doesn't segfault from out of bound array access
1328 // src subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001329 if ((dependency.srcSubpass != VK_SUBPASS_EXTERNAL) && (dependency.srcSubpass >= pCreateInfo->subpassCount)) {
Mike Schuchardta9711d22022-06-30 14:03:22 -07001330 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-srcSubpass-02526" : "VUID-VkRenderPassCreateInfo-pDependencies-06866";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001331 skip |= LogError(device, vuid,
1332 "%s: pCreateInfo->pDependencies[%u].srcSubpass index (%u) has to be less than subpassCount (%u)",
1333 func_name, i, dependency.srcSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001334 }
1335
sfricke-samsung55f01952020-03-24 08:16:41 -07001336 // dst subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001337 if ((dependency.dstSubpass != VK_SUBPASS_EXTERNAL) && (dependency.dstSubpass >= pCreateInfo->subpassCount)) {
Mike Schuchardta9711d22022-06-30 14:03:22 -07001338 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-dstSubpass-02527" : "VUID-VkRenderPassCreateInfo-pDependencies-06867";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001339 skip |= LogError(device, vuid,
1340 "%s: pCreateInfo->pDependencies[%u].dstSubpass index (%u) has to be less than subpassCount (%u)",
1341 func_name, i, dependency.dstSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001342 }
1343
Petr Kraus3e52eba2019-07-10 01:24:10 +02001344 // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked
Mike Schuchardt65847d92019-12-20 13:50:47 -08001345 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001346 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001347 "src", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001348
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001349 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001350 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001351 "dst", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001352 }
1353
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001354 return skip;
1355 }
1356
1357 template <typename T>
1358 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001359 std::unique_lock<std::mutex> lock(renderpass_map_mutex);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001360 auto &renderpass_state = renderpasses_states[renderPass];
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001361 lock.unlock();
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001362
Younggwan Kim26b9abd2021-12-07 21:22:03 +00001363 renderpass_state.subpasses_flags.resize(pCreateInfo->subpassCount);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001364 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
1365 bool uses_color = false;
sjfricke69877a72022-08-10 09:20:01 +09001366 renderpass_state.color_attachment_count = pCreateInfo->pSubpasses[subpass].colorAttachmentCount;
1367
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001368 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
1369 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
1370
1371 bool uses_depthstencil = false;
1372 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
1373 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
1374 uses_depthstencil = true;
1375
1376 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
1377 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
Younggwan Kim26b9abd2021-12-07 21:22:03 +00001378 renderpass_state.subpasses_flags[subpass] = pCreateInfo->pSubpasses[subpass].flags;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001379 }
1380 }
1381
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001382 // Pre/PostCallRecord declarations
1383 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1384 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1385 VkResult result) override;
Mike Schuchardt2df08912020-12-15 16:28:09 -08001386 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001387 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1388 VkResult result) override;
1389 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1390 const VkAllocationCallbacks *pAllocator) override;
Tony-LunarG3c287f62020-12-17 12:39:49 -07001391 void PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo,
1392 VkCommandBuffer *pCommandBuffers, VkResult result) override;
1393 void PostCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
1394 const VkCommandBuffer *pCommandBuffers) override;
1395 void PostCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1396 const VkAllocationCallbacks *pAllocator) override;
ziga-lunarg685d5d62022-05-14 00:38:06 +02001397 void GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 &pProperties) const;
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001398 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
1399 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) override;
1400 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
1401 VkInstance *pInstance, VkResult result) override;
1402
Nathaniel Cesario645a15b2021-01-08 22:40:21 -07001403 void CommonPostCallRecordEnumeratePhysicalDevice(const VkPhysicalDevice *phys_devices, const int count);
1404 void PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
1405 VkPhysicalDevice *pPhysicalDevices, VkResult result) override;
1406
1407 void PostCallRecordEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
1408 VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties,
1409 VkResult result) override;
1410
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001411 bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001412
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001413 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001414
Tony-LunarG866843d2020-05-13 11:22:42 -06001415 bool validate_validation_features(const VkInstanceCreateInfo *pCreateInfo,
1416 const VkValidationFeaturesEXT *validation_features) const;
1417
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001418 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001419
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001420 bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid,
1421 const char *validateString) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001422
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001423 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001424
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001425 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name,
1426 const char *array_parameter_name, const std::string &unique_error_code,
1427 const std::string &valid_error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001428
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001429 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name,
1430 const std::string &error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001431
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001432 bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkAccelerationStructureNV object_handle,
1433 const char *func_name) const;
1434 bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkAccelerationStructureNV object_handle,
Jason Macnak192fa0e2019-07-26 15:07:16 -07001435 const char *func_name) const;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001436 bool ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, const char *func_name) const;
1437 bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkAccelerationStructureNV object_handle,
Mark Lobodzinski17dc4602020-05-29 07:48:40 -06001438 const char *func_nam, bool is_cmd) const;
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001439 bool ValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1440 const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion,
1441 const char *apiName) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001442 bool ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
sjfricke91d9bda2022-08-01 21:44:17 +09001443 CMD_TYPE cmd_type) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001444 bool ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
sjfricke91d9bda2022-08-01 21:44:17 +09001445 CMD_TYPE cmd_type) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001446
sfricke-samsunga1d00272021-03-10 21:37:41 -08001447 bool ValidateSwapchainCreateInfo(const char *func_name, VkSwapchainCreateInfoKHR const *pCreateInfo) const;
1448
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001449 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001450
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001451 void PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -06001452
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001453 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001454 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001455
1456 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001457 VkInstance *pInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001458
1459 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001460 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001461
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001462 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001463 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001464
1465 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001466 const VkAllocationCallbacks *pAllocator, VkImage *pImage) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001467
Jeff Bolz99e3f632020-03-24 22:59:22 -05001468 bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1469 const VkAllocationCallbacks *pAllocator, VkImageView *pView) const;
1470
Jeff Bolz6d3beaa2019-02-09 21:00:05 -06001471 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName &parameter_name,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001472 VkCommandBuffer object) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001473
sfricke-samsung51303fb2021-05-09 19:09:13 -07001474 bool manual_PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo,
1475 const VkAllocationCallbacks *pAllocator,
1476 VkPipelineLayout *pPipelineLayout) const;
ziga-lunargc6341372021-07-28 12:57:42 +02001477
1478 bool ValidatePipelineShaderStageCreateInfo(const char *func_name, const char *msg,
1479 const VkPipelineShaderStageCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001480 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1481 const VkGraphicsPipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001482 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001483 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1484 const VkComputePipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001485 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001486
1487 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001488 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const;
ziga-lunarg8a4d3192021-10-13 19:54:19 +02001489 bool ValidateMutableDescriptorTypeCreateInfo(const VkDescriptorSetLayoutCreateInfo &create_info,
Mike Schuchardt2d523e52022-09-15 12:25:58 -07001490 const VkMutableDescriptorTypeCreateInfoEXT &mutable_create_info,
ziga-lunarg8a4d3192021-10-13 19:54:19 +02001491 const char *func_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001492 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001493 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001494 VkDescriptorSetLayout *pSetLayout) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001495
Tony-LunarG115f89d2022-06-15 10:53:22 -06001496 bool manual_PreCallValidateCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1497 const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) const;
1498
1499 bool manual_PreCallValidateCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1500 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) const;
1501
1502 bool manual_PreCallValidateCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1503 const VkAllocationCallbacks *pAllocator, VkBufferView *pBufferView) const;
1504
1505#ifdef VK_USE_PLATFORM_METAL_EXT
1506 bool ExportMetalObjectsPNextUtil(VkExportMetalObjectTypeFlagBitsEXT bit, const char *vuid, const char *api_call,
1507 const char *sType, const void *pNext) const;
1508#endif // VK_USE_PLATFORM_METAL_EXT
1509
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001510 bool validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount,
Mike Schuchardt979898a2022-01-11 10:46:59 -08001511 const VkWriteDescriptorSet *pDescriptorWrites, const bool isPushDescriptor) const;
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001512 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1513 const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001514 const VkCopyDescriptorSet *pDescriptorCopies) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001515
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001516 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001517 const VkDescriptorSet *pDescriptorSets) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001518
1519 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001520 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001521
sfricke-samsung681ab7b2020-10-29 01:53:35 -07001522 bool manual_PreCallValidateCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
1523 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
1524
Mike Schuchardt2df08912020-12-15 16:28:09 -08001525 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001526 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001527
1528 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001529 const VkCommandBuffer *pCommandBuffers) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001530
Jeff Bolz5c801d12019-10-09 10:38:45 -05001531 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001532
1533 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001534 const VkViewport *pViewports) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001535
1536 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001537 const VkRect2D *pScissors) const;
1538 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001539
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001540 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1541 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001542
1543 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001544 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001545
sfricke-samsungf692b972020-05-02 08:00:45 -07001546 bool manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1547 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1548 uint32_t stride) const;
1549
sjfricke91d9bda2022-08-01 21:44:17 +09001550 bool manual_PreCallValidateCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1551 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1552 uint32_t stride) const;
1553
sfricke-samsungf692b972020-05-02 08:00:45 -07001554 bool manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1555 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1556 uint32_t stride) const;
1557
1558 bool manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1559 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1560 uint32_t maxDrawCount, uint32_t stride) const;
1561
sjfricke91d9bda2022-08-01 21:44:17 +09001562 bool manual_PreCallValidateCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1563 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1564 uint32_t maxDrawCount, uint32_t stride) const;
1565
sfricke-samsungf692b972020-05-02 08:00:45 -07001566 bool manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1567 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1568 uint32_t maxDrawCount, uint32_t stride) const;
1569
Tony-LunarG4490de42021-06-21 15:49:19 -06001570 bool manual_PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1571 const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount,
1572 uint32_t firstInstance, uint32_t stride) const;
1573
1574 bool manual_PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1575 const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount,
1576 uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset) const;
1577
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001578 bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1579 const VkClearAttachment *pAttachments, uint32_t rectCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001580 const VkClearRect *pRects) const;
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001581
Andrew Fobel3abeb992020-01-20 16:33:22 -05001582 bool ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1583 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1584 VkImageFormatProperties2 *pImageFormatProperties,
1585 const char *apiName) const;
1586 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1587 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1588 VkImageFormatProperties2 *pImageFormatProperties) const;
1589 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1590 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1591 VkImageFormatProperties2 *pImageFormatProperties) const;
Lionel Landwerlin5fe52752020-07-22 08:18:14 +03001592 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
1593 VkImageType type, VkImageTiling tiling,
1594 VkImageUsageFlags usage, VkImageCreateFlags flags,
1595 VkImageFormatProperties *pImageFormatProperties) const;
Andrew Fobel3abeb992020-01-20 16:33:22 -05001596
sfricke-samsung3999ef62020-02-09 17:05:59 -08001597 bool manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
1598 uint32_t regionCount, const VkBufferCopy *pRegions) const;
1599
Jeff Leger178b1e52020-10-05 12:22:23 -04001600 bool manual_PreCallValidateCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2KHR *pCopyBufferInfo) const;
1601
Tony-LunarGef035472021-11-02 10:23:33 -06001602 bool manual_PreCallValidateCmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 *pCopyBufferInfo) const;
1603
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001604 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001605 VkDeviceSize dataSize, const void *pData) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001606
1607 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001608 VkDeviceSize size, uint32_t data) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001609
1610 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001611 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const;
sfricke-samsunga1d00272021-03-10 21:37:41 -08001612 bool manual_PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
1613 const VkSwapchainCreateInfoKHR *pCreateInfos,
1614 const VkAllocationCallbacks *pAllocator,
1615 VkSwapchainKHR *pSwapchains) const;
Jeff Bolz5c801d12019-10-09 10:38:45 -05001616 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const;
sfricke-samsung5c1b7392020-12-13 22:17:15 -08001617 bool manual_PreCallValidateCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
1618 const VkDisplayModeCreateInfoKHR *pCreateInfo,
1619 const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001620
1621#ifdef VK_USE_PLATFORM_WIN32_KHR
1622 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001623 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001624#endif // VK_USE_PLATFORM_WIN32_KHR
1625
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001626 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001627 const VkAllocationCallbacks *pAllocator,
1628 VkDescriptorPool *pDescriptorPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001629 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001630 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001631
Jeff Bolz5c801d12019-10-09 10:38:45 -05001632 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001633
1634 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1635 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001636 uint32_t groupCountZ) const;
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001637 bool manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1638 VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount,
1639 const VkWriteDescriptorSet *pDescriptorWrites) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001640 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001641 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001642 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1643 uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001644 const VkShadingRatePaletteNV *pShadingRatePalettes) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001645
1646 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1647 uint32_t customSampleOrderCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001648 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001649
Jeff Bolz5c801d12019-10-09 10:38:45 -05001650 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001651 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001652 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001653
1654 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1655 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001656 uint32_t maxDrawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001657
1658 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001659 uint32_t *pPropertyCount,
1660 VkExtensionProperties *pProperties) const;
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001661 bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001662 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const;
Ricardo Garciaa4935972019-02-21 17:43:18 +01001663
1664 bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device,
1665 const VkAccelerationStructureCreateInfoNV *pCreateInfo,
1666 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001667 VkAccelerationStructureNV *pAccelerationStructure) const;
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001668 bool manual_PreCallValidateCreateAccelerationStructureKHR(VkDevice device,
1669 const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
1670 const VkAllocationCallbacks *pAllocator,
1671 VkAccelerationStructureKHR *pAccelerationStructure) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001672 bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer,
1673 const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData,
1674 VkDeviceSize instanceOffset, VkBool32 update,
1675 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001676 VkBuffer scratch, VkDeviceSize scratchOffset) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001677 bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001678 size_t dataSize, void *pData) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001679
1680 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer,
1681 uint32_t accelerationStructureCount,
1682 const VkAccelerationStructureNV *pAccelerationStructures,
1683 VkQueryType queryType, VkQueryPool queryPool,
1684 uint32_t firstQuery) const;
Peter Chen85366392019-05-14 15:20:11 -04001685 bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1686 const VkRayTracingPipelineCreateInfoNV *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001687 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001688 bool manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1689 VkPipelineCache pipelineCache, uint32_t createInfoCount,
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001690 const VkRayTracingPipelineCreateInfoKHR *pCreateInfos,
1691 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Chris Mayer9ded5eb2019-09-19 16:33:26 +02001692 bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001693 uint32_t viewportCount,
1694 const VkViewportWScalingNV *pViewportWScalings) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001695
1696#ifdef VK_USE_PLATFORM_WIN32_KHR
1697 bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
Jamie Madillaa076da2020-12-22 15:34:34 -05001698 VkDeviceGroupPresentModeFlagsKHR *pModes) const override;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001699#endif // VK_USE_PLATFORM_WIN32_KHR
Tobias Hectorebb855f2019-07-23 12:17:33 +01001700
1701 bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001702 const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const;
Tobias Hectorebb855f2019-07-23 12:17:33 +01001703
Jeff Bolz8125a8b2019-08-16 16:29:45 -05001704 bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001705 uint16_t lineStipplePattern) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001706
1707 bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001708 VkIndexType indexType) const;
sfricke-samsung4ada8d42020-02-09 17:43:11 -08001709 bool manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1710 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001711
Jeff Bolz5c801d12019-10-09 10:38:45 -05001712 bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001713
Jeff Bolz5c801d12019-10-09 10:38:45 -05001714 bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001715
Petr Kraus3d720392019-11-13 02:52:39 +01001716 bool manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout,
1717 VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) const;
1718
1719 bool manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
1720 uint32_t *pImageIndex) const;
1721
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001722 bool manual_PreCallValidateCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1723 uint32_t bindingCount, const VkBuffer *pBuffers,
1724 const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) const;
1725
1726 bool manual_PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1727 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1728 const VkDeviceSize *pCounterBufferOffsets) const;
1729
1730 bool manual_PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1731 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1732 const VkDeviceSize *pCounterBufferOffsets) const;
1733
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -07001734 bool manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount,
1735 uint32_t firstInstance, VkBuffer counterBuffer,
1736 VkDeviceSize counterBufferOffset, uint32_t counterOffset,
1737 uint32_t vertexStride) const;
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001738
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001739 bool manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1740 const VkAllocationCallbacks *pAllocator,
1741 VkSamplerYcbcrConversion *pYcbcrConversion) const;
1742 bool manual_PreCallValidateCreateSamplerYcbcrConversionKHR(VkDevice device,
1743 const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1744 const VkAllocationCallbacks *pAllocator,
1745 VkSamplerYcbcrConversion *pYcbcrConversion) const;
Jeremy Gebben284b68f2022-09-21 15:43:16 -06001746
1747 bool ValidateExternalSemaphoreHandleType(VkSemaphore semaphore, const char *vuid, const char *caller,
1748 VkExternalSemaphoreHandleTypeFlagBits handle_type,
1749 VkExternalSemaphoreHandleTypeFlags allowed_types) const;
1750 bool ValidateExternalFenceHandleType(VkFence fence, const char *vuid, const char *caller,
1751 VkExternalFenceHandleTypeFlagBits handle_type,
1752 VkExternalFenceHandleTypeFlags allowed_types) const;
sfricke-samsung1708a8c2020-02-10 00:35:06 -08001753 bool manual_PreCallValidateImportSemaphoreFdKHR(VkDevice device,
1754 const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const;
Jeremy Gebben284b68f2022-09-21 15:43:16 -06001755 bool manual_PreCallValidateGetSemaphoreFdKHR(VkDevice device, const VkSemaphoreGetFdInfoKHR *pGetFdInfo, int *pFd) const;
1756
1757 bool manual_PreCallValidateImportFenceFdKHR(VkDevice device, const VkImportFenceFdInfoKHR *pImportFenceFdInfo) const;
1758 bool manual_PreCallValidateGetFenceFdKHR(VkDevice device, const VkFenceGetFdInfoKHR *pGetFdInfo, int *pFd) const;
1759
1760#ifdef VK_USE_PLATFORM_WIN32_KHR
1761 bool manual_PreCallValidateImportSemaphoreWin32HandleKHR(
1762 VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR *pImportSemaphoreWin32HandleInfo) const;
1763 bool manual_PreCallValidateGetSemaphoreWin32HandleKHR(VkDevice device,
1764 const VkSemaphoreGetWin32HandleInfoKHR *pGetWin32HandleInfo,
1765 HANDLE *pHandle) const;
1766
1767 bool manual_PreCallValidateImportFenceWin32HandleKHR(VkDevice device,
1768 const VkImportFenceWin32HandleInfoKHR *pImportFenceWin32HandleInfo) const;
1769 bool manual_PreCallValidateGetFenceWin32HandleKHR(VkDevice device, const VkFenceGetWin32HandleInfoKHR *pGetWin32HandleInfo,
1770 HANDLE *pHandle) const;
1771#endif
sourav parmara96ab1a2020-04-25 16:28:23 -07001772
sourav parmarcd5fb182020-07-17 12:58:44 -07001773 bool manual_PreCallValidateCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001774 const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1775
1776 bool manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR(
1777 VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1778
sourav parmarcd5fb182020-07-17 12:58:44 -07001779 bool manual_PreCallValidateCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1780 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001781
1782 bool manual_PreCallValidateCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
1783 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
1784 bool ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, const char *api_name) const;
1785 bool ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo,
Mark Lobodzinskiaad69e42020-05-12 08:44:21 -06001786 const char *api_name, bool is_cmd = false) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001787
sourav parmarcd5fb182020-07-17 12:58:44 -07001788 bool manual_PreCallValidateCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001789 const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
1790 bool manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR(
1791 VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001792
sourav parmar83c31b12020-05-06 12:30:54 -07001793 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesKHR(
1794 VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount,
1795 const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool,
1796 uint32_t firstQuery) const;
1797 bool manual_PreCallValidateWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount,
1798 const VkAccelerationStructureKHR *pAccelerationStructures,
1799 VkQueryType queryType, size_t dataSize, void *pData,
1800 size_t stride) const;
1801 bool manual_PreCallValidateGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline,
1802 uint32_t firstGroup, uint32_t groupCount,
1803 size_t dataSize, void *pData) const;
1804
1805 bool manual_PreCallValidateCmdTraceRaysKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001806 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1807 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1808 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1809 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width,
sourav parmar83c31b12020-05-06 12:30:54 -07001810 uint32_t height, uint32_t depth) const;
1811
1812 bool manual_PreCallValidateCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001813 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1814 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1815 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1816 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable,
1817 VkDeviceAddress indirectDeviceAddress) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001818
sfricke-samsungf91881c2022-03-31 01:12:00 -05001819 bool manual_PreCallValidateCmdTraceRaysIndirect2KHR(VkCommandBuffer commandBuffer, VkDeviceAddress indirectDeviceAddress) const;
1820
sourav parmar83c31b12020-05-06 12:30:54 -07001821 bool manual_PreCallValidateCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer,
1822 VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer,
1823 VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride,
1824 VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset,
1825 VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer,
1826 VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride,
1827 uint32_t width, uint32_t height, uint32_t depth) const;
1828
sourav parmarcd5fb182020-07-17 12:58:44 -07001829 bool manual_PreCallValidateCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount,
1830 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1831 const VkDeviceAddress *pIndirectDeviceAddresses,
1832 const uint32_t *pIndirectStrides,
1833 const uint32_t *const *ppMaxPrimitiveCounts) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001834
1835 bool manual_PreCallValidateGetDeviceAccelerationStructureCompatibilityKHR(
sourav parmarcd5fb182020-07-17 12:58:44 -07001836 VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo,
1837 VkAccelerationStructureCompatibilityKHR *pCompatibility) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001838 bool ValidateCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport *pViewports,
1839 bool is_ext) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001840 bool manual_PreCallValidateCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount,
1841 const VkViewport *pViewports) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001842 bool manual_PreCallValidateCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount,
1843 const VkViewport *pViewports) const;
1844
1845 bool ValidateCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D *pScissors,
1846 bool is_ext) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001847 bool manual_PreCallValidateCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount,
1848 const VkRect2D *pScissors) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001849 bool manual_PreCallValidateCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount,
1850 const VkRect2D *pScissors) const;
1851 bool ValidateCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1852 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes,
1853 const VkDeviceSize *pStrides, bool is_2ext) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001854 bool manual_PreCallValidateCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1855 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets,
1856 const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001857 bool manual_PreCallValidateCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1858 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets,
1859 const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001860 bool ValidateAccelerationStructureBuildGeometryInfoKHR(const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1861 uint32_t infoCount, const char *api_name) const;
1862 bool manual_PreCallValidateCmdBuildAccelerationStructuresKHR(
1863 VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1864 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1865
1866 bool manual_PreCallValidateBuildAccelerationStructuresKHR(
1867 VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount,
1868 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1869 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1870
1871 bool manual_PreCallValidateGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType,
1872 const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo,
1873 const uint32_t *pMaxPrimitiveCounts,
1874 VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) const;
1875
Piers Daniellcb6d8032021-04-19 18:51:26 -06001876 bool manual_PreCallValidateCmdSetVertexInputEXT(
1877 VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount,
1878 const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount,
1879 const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) const;
sfricke-samsung51303fb2021-05-09 19:09:13 -07001880
1881 bool manual_PreCallValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
1882 VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size,
1883 const void *pValues) const;
ziga-lunargb1dd8a22021-07-15 17:47:19 +02001884
1885 bool manual_PreCallValidateMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount,
1886 const VkPipelineCache *pSrcCaches) const;
1887
Nathaniel Cesario298d3cb2021-08-03 13:49:02 -06001888 bool manual_PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
1889 const VkClearColorValue *pColor, uint32_t rangeCount,
1890 const VkImageSubresourceRange *pRanges) const;
1891
1892 bool ValidateCmdBeginRenderPass(const char *const func_name, const VkRenderPassBeginInfo *const rp_begin) const;
1893 bool manual_PreCallValidateCmdBeginRenderPass(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1894 VkSubpassContents) const;
1895 bool manual_PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1896 const VkSubpassBeginInfo *) const;
1897 bool manual_PreCallValidateCmdBeginRenderPass2(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1898 const VkSubpassBeginInfo *) const;
1899
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001900 bool manual_PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle,
1901 uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) const;
ziga-lunarg3c37dfb2021-08-24 12:51:07 +02001902 bool manual_PreCallValidateGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount,
ziga-lunargcf340c42021-08-19 00:13:38 +02001903 size_t dataSize, void *pData, VkDeviceSize stride,
1904 VkQueryResultFlags flags) const;
1905 bool manual_PreCallValidateCmdBeginConditionalRenderingEXT(
1906 VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin) const;
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001907
ziga-lunarg50f8e6b2021-12-18 20:24:35 +01001908 bool ValidateDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirementsKHR *pInfo,
1909 const char *func_name) const;
1910
Mike Schuchardt05b028d2022-01-05 14:15:00 -08001911 bool manual_PreCallValidateGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
1912 uint32_t *pSurfaceFormatCount,
1913 VkSurfaceFormatKHR *pSurfaceFormats) const;
1914
1915 bool manual_PreCallValidateGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
1916 uint32_t *pPresentModeCount,
1917 VkPresentModeKHR *pPresentModes) const;
1918
1919 bool manual_PreCallValidateGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice,
1920 const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
1921 VkSurfaceCapabilities2KHR *pSurfaceCapabilities) const;
1922
1923 bool manual_PreCallValidateGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice,
1924 const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
1925 uint32_t *pSurfaceFormatCount,
1926 VkSurfaceFormat2KHR *pSurfaceFormats) const;
1927#ifdef VK_USE_PLATFORM_WIN32_KHR
1928 bool manual_PreCallValidateGetPhysicalDeviceSurfacePresentModes2EXT(VkPhysicalDevice physicalDevice,
1929 const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
1930 uint32_t *pPresentModeCount,
1931 VkPresentModeKHR *pPresentModes) const;
1932#endif // VK_USE_PLATFORM_WIN32_KHR
1933
ziga-lunarg50f8e6b2021-12-18 20:24:35 +01001934 bool manual_PreCallValidateGetDeviceImageMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo,
1935 VkMemoryRequirements2 *pMemoryRequirements) const;
1936 bool manual_PreCallValidateGetDeviceImageSparseMemoryRequirementsKHR(
1937 VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, uint32_t *pSparseMemoryRequirementCount,
1938 VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) const;
1939
Tony-LunarG115f89d2022-06-15 10:53:22 -06001940#ifdef VK_USE_PLATFORM_METAL_EXT
1941 bool manual_PreCallValidateExportMetalObjectsEXT(VkDevice device, VkExportMetalObjectsInfoEXT *pMetalObjectsInfo) const;
1942#endif // VK_USE_PLATFORM_METAL_EXT
1943
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001944#include "parameter_validation.h"
1945}; // Class StatelessValidation