blob: d7f0abd0b00ea2abac0fd9e6a89e41c1f8e4e307 [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
1028 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
sjfricke091f6f62022-05-19 14:46:37 +09001029 // if not null, also confirms rp2 is being used
Piers Daniell4fde9b72019-11-27 16:19:46 -07001030 const auto *attachment_description_stencil_layout =
Mark Lobodzinski1f887d32020-12-30 15:31:33 -07001031 (use_rp2) ? LvlFindInChain<VkAttachmentDescriptionStencilLayout>(
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001032 reinterpret_cast<VkAttachmentDescription2 const *>(&pCreateInfo->pAttachments[i])->pNext)
sjfricke091f6f62022-05-19 14:46:37 +09001033 : nullptr;
Piers Daniell4fde9b72019-11-27 16:19:46 -07001034
sfricke-samsungcac6a262020-04-28 07:50:49 -07001035 const VkFormat attachment_format = pCreateInfo->pAttachments[i].format;
1036 const VkImageLayout initial_layout = pCreateInfo->pAttachments[i].initialLayout;
1037 const VkImageLayout final_layout = pCreateInfo->pAttachments[i].finalLayout;
1038 if (attachment_format == VK_FORMAT_UNDEFINED) {
Mark Young89d4a822022-08-23 09:00:54 -06001039 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06698",
1040 "%s: pCreateInfo->pAttachments[%" PRIu32 "].format is VK_FORMAT_UNDEFINED.", func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001041 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001042 if (final_layout == VK_IMAGE_LAYOUT_UNDEFINED || final_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Young89d4a822022-08-23 09:00:54 -06001043 skip |= LogError(device, "VUID-VkAttachmentDescription-finalLayout-00843",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001044 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001045 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001046 func_name, i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001047 }
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001048 if (!separate_depth_stencil_layouts) {
sjfricke091f6f62022-05-19 14:46:37 +09001049 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1050 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1051 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1052 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001053 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001054 device, "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001055 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1056 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1057 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001058 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001059 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001060 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1061 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1062 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1063 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001064 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001065 device, "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001066 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1067 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1068 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001069 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001070 }
1071 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001072 if (!FormatIsDepthOrStencil(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001073 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1074 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1075 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1076 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001077 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001078 device, "VUID-VkAttachmentDescription-format-03286",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001079 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1080 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
Piers Daniell9af77cd2019-10-16 13:54:12 -06001081 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001082 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001083 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001084 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1085 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
1086 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1087 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001088 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001089 device, "VUID-VkAttachmentDescription-format-03287",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001090 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, "
1091 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or "
1092 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001093 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001094 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001095 } else if (FormatIsDepthAndStencil(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001096 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1097 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001098 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06906",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001099 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001100 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001101 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001102 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001103 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001104 if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1105 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001106 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06907",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001107 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001108 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or "
1109 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1110 func_name, i);
1111 }
1112 } else if (FormatIsDepthOnly(attachment_format)) {
1113 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1114 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1115 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03290",
1116 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1117 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or"
1118 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
1119 func_name, i);
1120 }
1121 if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL ||
1122 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL) {
1123 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03291",
1124 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1125 "VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001126 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001127 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001128 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001129 } else if (FormatIsStencilOnly(attachment_format)) {
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001130 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1131 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001132 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03292",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001133 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001134 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or"
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001135 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001136 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001137 }
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001138 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1139 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001140 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03293",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001141 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001142 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001143 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL",
1144 func_name, i);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001145 }
1146 }
sjfricke091f6f62022-05-19 14:46:37 +09001147 if (attachment_description_stencil_layout) {
Piers Daniell9af77cd2019-10-16 13:54:12 -06001148 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001149 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1150 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001151 attachment_description_stencil_layout->stencilInitialLayout ==
1152 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1153 attachment_description_stencil_layout->stencilInitialLayout ==
1154 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1155 attachment_description_stencil_layout->stencilInitialLayout ==
1156 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1157 attachment_description_stencil_layout->stencilInitialLayout ==
1158 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001159 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001160 "%s: VkAttachmentDescriptionStencilLayout.stencilInitialLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001161 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001162 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001163 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1164 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1165 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001166 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1167 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001168 }
1169 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001170 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL ||
1171 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL ||
Piers Daniell9af77cd2019-10-16 13:54:12 -06001172 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1173 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1174 attachment_description_stencil_layout->stencilFinalLayout ==
1175 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1176 attachment_description_stencil_layout->stencilFinalLayout ==
1177 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001178 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001179 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001180 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001181 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, "
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001182 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1183 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1184 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001185 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.",
1186 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001187 }
1188 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
1189 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001190 skip |= LogError(
1191 device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310",
sfricke-samsunga6c67fb2020-12-15 20:51:42 -08001192 "%s: VkAttachmentDescriptionStencilLayout.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001193 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
1194 func_name);
Piers Daniell9af77cd2019-10-16 13:54:12 -06001195 }
1196 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001197
1198 if (FormatIsDepthOrStencil(attachment_format)) {
1199 if (initial_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001200 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03281",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001201 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001202 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001203 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001204 }
1205 if (final_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
Mark Young89d4a822022-08-23 09:00:54 -06001206 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03283",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001207 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
sfricke-samsungcac6a262020-04-28 07:50:49 -07001208 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001209 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001210 }
1211 }
1212 if (FormatIsColor(attachment_format)) {
1213 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
Mark Young89d4a822022-08-23 09:00:54 -06001214 initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) {
1215 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03280",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001216 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001217 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or "
1218 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL when using a Color format",
1219 func_name, i);
1220
1221 } else if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1222 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1223 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06487",
1224 "%s: pCreateInfo->pAttachments[%d].initialLayout must not be "
1225 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001226 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1227 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001228 }
1229 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
Mark Young89d4a822022-08-23 09:00:54 -06001230 final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) {
1231 skip |= LogError(device, "VUID-VkAttachmentDescription-format-03282",
sfricke-samsung46fc6632020-09-12 14:28:58 -07001232 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
Mark Young89d4a822022-08-23 09:00:54 -06001233 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or "
1234 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL when using a Color format",
1235 func_name, i);
1236 } else if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1237 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1238 skip |= LogError(device, "VUID-VkAttachmentDescription-format-06488",
1239 "%s: pCreateInfo->pAttachments[%d].finalLayout must not be "
1240 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL or "
sfricke-samsung46fc6632020-09-12 14:28:58 -07001241 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1242 func_name, i);
sfricke-samsungcac6a262020-04-28 07:50:49 -07001243 }
1244 }
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001245 if (FormatIsColor(attachment_format) || FormatHasDepth(attachment_format)) {
1246 if (pCreateInfo->pAttachments[i].loadOp == VK_ATTACHMENT_LOAD_OP_LOAD &&
sjfricke091f6f62022-05-19 14:46:37 +09001247 initial_layout == VK_IMAGE_LAYOUT_UNDEFINED) {
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001248 skip |= LogError(
Mark Young89d4a822022-08-23 09:00:54 -06001249 device, "VUID-VkAttachmentDescription-format-06699",
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001250 "%s: pCreateInfo->pAttachments[%" PRIu32
1251 "] format is %s and loadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but initialLayout is VK_IMAGE_LAYOUT_UNDEFINED.",
sjfricke091f6f62022-05-19 14:46:37 +09001252 func_name, i, string_VkFormat(attachment_format));
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001253 }
1254 }
sjfricke091f6f62022-05-19 14:46:37 +09001255 if (FormatHasStencil(attachment_format) && pCreateInfo->pAttachments[i].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD) {
1256 if (initial_layout == VK_IMAGE_LAYOUT_UNDEFINED) {
1257 if (use_rp2) {
1258 skip |= LogError(device, "VUID-VkAttachmentDescription2-pNext-06704",
1259 "%s: pCreateInfo->pAttachments[%" PRIu32
1260 "] format includes stencil aspect and stencilLoadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but "
1261 "the initialLayout is VK_IMAGE_LAYOUT_UNDEFINED.",
1262 func_name, i);
1263 } else if (!IsExtEnabled(device_extensions.vk_khr_separate_depth_stencil_layouts)) {
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001264 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-06703" : "VUID-VkAttachmentDescription-format-06700";
1265 skip |= LogError(device, vuid,
1266 "%s: pCreateInfo->pAttachments[%" PRIu32
1267 "] format is %s and stencilLoadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but initialLayout is "
1268 "VK_IMAGE_LAYOUT_UNDEFINED.",
sjfricke091f6f62022-05-19 14:46:37 +09001269 func_name, i, string_VkFormat(attachment_format));
ziga-lunarg8004b4a2022-05-11 20:15:41 +02001270 }
1271 }
sjfricke091f6f62022-05-19 14:46:37 +09001272
1273 // rp2 can have seperate depth/stencil layout and need to look in pNext
ziga-lunarga5a1b352022-04-08 23:48:47 +02001274 if (attachment_description_stencil_layout) {
1275 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
1276 skip |=
1277 LogError(device, "VUID-VkAttachmentDescription2-pNext-06705",
1278 "%s: pCreateInfo->pAttachments[%" PRIu32
1279 "] format includes stencil aspect and stencilLoadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but "
1280 "the VkAttachmentDescriptionStencilLayout::stencilInitialLayout is VK_IMAGE_LAYOUT_UNDEFINED.",
1281 func_name, i);
1282 }
ziga-lunarga5a1b352022-04-08 23:48:47 +02001283 }
1284 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001285 }
1286
1287 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
1288 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001289 vuid = use_rp2 ? "VUID-VkSubpassDescription2-colorAttachmentCount-03063"
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001290 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001291 skip |=
1292 LogError(device, vuid,
1293 "%s: Cannot create a render pass with %d color attachments in pCreateInfo->pSubpasses[%u]. Max is %d.",
1294 func_name, pCreateInfo->pSubpasses[i].colorAttachmentCount, i, max_color_attachments);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001295 }
1296 }
Petr Kraus3e52eba2019-07-10 01:24:10 +02001297
1298 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) {
1299 const auto &dependency = pCreateInfo->pDependencies[i];
1300
sfricke-samsung55f01952020-03-24 08:16:41 -07001301 // Need to check first so layer doesn't segfault from out of bound array access
1302 // src subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001303 if ((dependency.srcSubpass != VK_SUBPASS_EXTERNAL) && (dependency.srcSubpass >= pCreateInfo->subpassCount)) {
Mike Schuchardta9711d22022-06-30 14:03:22 -07001304 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-srcSubpass-02526" : "VUID-VkRenderPassCreateInfo-pDependencies-06866";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001305 skip |= LogError(device, vuid,
1306 "%s: pCreateInfo->pDependencies[%u].srcSubpass index (%u) has to be less than subpassCount (%u)",
1307 func_name, i, dependency.srcSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001308 }
1309
sfricke-samsung55f01952020-03-24 08:16:41 -07001310 // dst subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001311 if ((dependency.dstSubpass != VK_SUBPASS_EXTERNAL) && (dependency.dstSubpass >= pCreateInfo->subpassCount)) {
Mike Schuchardta9711d22022-06-30 14:03:22 -07001312 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-dstSubpass-02527" : "VUID-VkRenderPassCreateInfo-pDependencies-06867";
sfricke-samsung46fc6632020-09-12 14:28:58 -07001313 skip |= LogError(device, vuid,
1314 "%s: pCreateInfo->pDependencies[%u].dstSubpass index (%u) has to be less than subpassCount (%u)",
1315 func_name, i, dependency.dstSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001316 }
1317
Petr Kraus3e52eba2019-07-10 01:24:10 +02001318 // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked
Mike Schuchardt65847d92019-12-20 13:50:47 -08001319 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001320 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001321 "src", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001322
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001323 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001324 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid,
sfricke-samsung46fc6632020-09-12 14:28:58 -07001325 "dst", func_name);
Petr Kraus3e52eba2019-07-10 01:24:10 +02001326 }
1327
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001328 return skip;
1329 }
1330
1331 template <typename T>
1332 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001333 std::unique_lock<std::mutex> lock(renderpass_map_mutex);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001334 auto &renderpass_state = renderpasses_states[renderPass];
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001335 lock.unlock();
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001336
Younggwan Kim26b9abd2021-12-07 21:22:03 +00001337 renderpass_state.subpasses_flags.resize(pCreateInfo->subpassCount);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001338 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
1339 bool uses_color = false;
sjfricke69877a72022-08-10 09:20:01 +09001340 renderpass_state.color_attachment_count = pCreateInfo->pSubpasses[subpass].colorAttachmentCount;
1341
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001342 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
1343 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
1344
1345 bool uses_depthstencil = false;
1346 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
1347 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
1348 uses_depthstencil = true;
1349
1350 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
1351 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
Younggwan Kim26b9abd2021-12-07 21:22:03 +00001352 renderpass_state.subpasses_flags[subpass] = pCreateInfo->pSubpasses[subpass].flags;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001353 }
1354 }
1355
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001356 // Pre/PostCallRecord declarations
1357 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
1358 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1359 VkResult result) override;
Mike Schuchardt2df08912020-12-15 16:28:09 -08001360 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001361 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
1362 VkResult result) override;
1363 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
1364 const VkAllocationCallbacks *pAllocator) override;
Tony-LunarG3c287f62020-12-17 12:39:49 -07001365 void PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo,
1366 VkCommandBuffer *pCommandBuffers, VkResult result) override;
1367 void PostCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
1368 const VkCommandBuffer *pCommandBuffers) override;
1369 void PostCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
1370 const VkAllocationCallbacks *pAllocator) override;
ziga-lunarg685d5d62022-05-14 00:38:06 +02001371 void GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 &pProperties) const;
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001372 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
1373 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) override;
1374 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
1375 VkInstance *pInstance, VkResult result) override;
1376
Nathaniel Cesario645a15b2021-01-08 22:40:21 -07001377 void CommonPostCallRecordEnumeratePhysicalDevice(const VkPhysicalDevice *phys_devices, const int count);
1378 void PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
1379 VkPhysicalDevice *pPhysicalDevices, VkResult result) override;
1380
1381 void PostCallRecordEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
1382 VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties,
1383 VkResult result) override;
1384
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001385 bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001386
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001387 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001388
Tony-LunarG866843d2020-05-13 11:22:42 -06001389 bool validate_validation_features(const VkInstanceCreateInfo *pCreateInfo,
1390 const VkValidationFeaturesEXT *validation_features) const;
1391
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001392 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001393
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001394 bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid,
1395 const char *validateString) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001396
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001397 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001398
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001399 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name,
1400 const char *array_parameter_name, const std::string &unique_error_code,
1401 const std::string &valid_error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001402
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001403 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name,
1404 const std::string &error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001405
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001406 bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkAccelerationStructureNV object_handle,
1407 const char *func_name) const;
1408 bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkAccelerationStructureNV object_handle,
Jason Macnak192fa0e2019-07-26 15:07:16 -07001409 const char *func_name) const;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001410 bool ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, const char *func_name) const;
1411 bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkAccelerationStructureNV object_handle,
Mark Lobodzinski17dc4602020-05-29 07:48:40 -06001412 const char *func_nam, bool is_cmd) const;
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001413 bool ValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1414 const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion,
1415 const char *apiName) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001416 bool ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
sjfricke91d9bda2022-08-01 21:44:17 +09001417 CMD_TYPE cmd_type) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001418 bool ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
sjfricke91d9bda2022-08-01 21:44:17 +09001419 CMD_TYPE cmd_type) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001420
sfricke-samsunga1d00272021-03-10 21:37:41 -08001421 bool ValidateSwapchainCreateInfo(const char *func_name, VkSwapchainCreateInfoKHR const *pCreateInfo) const;
1422
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001423 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001424
Mark Lobodzinski21b91fe2020-12-03 15:44:24 -07001425 void PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) override;
Mark Lobodzinski2e40a132020-08-10 14:51:41 -06001426
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001427 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001428 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001429
1430 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001431 VkInstance *pInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001432
1433 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001434 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001435
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001436 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001437 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001438
1439 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001440 const VkAllocationCallbacks *pAllocator, VkImage *pImage) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001441
Jeff Bolz99e3f632020-03-24 22:59:22 -05001442 bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1443 const VkAllocationCallbacks *pAllocator, VkImageView *pView) const;
1444
Jeff Bolz6d3beaa2019-02-09 21:00:05 -06001445 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName &parameter_name,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001446 VkCommandBuffer object) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001447
sfricke-samsung51303fb2021-05-09 19:09:13 -07001448 bool manual_PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo,
1449 const VkAllocationCallbacks *pAllocator,
1450 VkPipelineLayout *pPipelineLayout) const;
ziga-lunargc6341372021-07-28 12:57:42 +02001451
1452 bool ValidatePipelineShaderStageCreateInfo(const char *func_name, const char *msg,
1453 const VkPipelineShaderStageCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001454 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1455 const VkGraphicsPipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001456 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001457 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1458 const VkComputePipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001459 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001460
1461 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001462 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const;
ziga-lunarg8a4d3192021-10-13 19:54:19 +02001463 bool ValidateMutableDescriptorTypeCreateInfo(const VkDescriptorSetLayoutCreateInfo &create_info,
Mike Schuchardt2d523e52022-09-15 12:25:58 -07001464 const VkMutableDescriptorTypeCreateInfoEXT &mutable_create_info,
ziga-lunarg8a4d3192021-10-13 19:54:19 +02001465 const char *func_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001466 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001467 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001468 VkDescriptorSetLayout *pSetLayout) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001469
Tony-LunarG115f89d2022-06-15 10:53:22 -06001470 bool manual_PreCallValidateCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
1471 const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) const;
1472
1473 bool manual_PreCallValidateCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
1474 const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) const;
1475
1476 bool manual_PreCallValidateCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
1477 const VkAllocationCallbacks *pAllocator, VkBufferView *pBufferView) const;
1478
1479#ifdef VK_USE_PLATFORM_METAL_EXT
1480 bool ExportMetalObjectsPNextUtil(VkExportMetalObjectTypeFlagBitsEXT bit, const char *vuid, const char *api_call,
1481 const char *sType, const void *pNext) const;
1482#endif // VK_USE_PLATFORM_METAL_EXT
1483
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001484 bool validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount,
Mike Schuchardt979898a2022-01-11 10:46:59 -08001485 const VkWriteDescriptorSet *pDescriptorWrites, const bool isPushDescriptor) const;
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001486 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1487 const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001488 const VkCopyDescriptorSet *pDescriptorCopies) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001489
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001490 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001491 const VkDescriptorSet *pDescriptorSets) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001492
1493 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001494 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001495
sfricke-samsung681ab7b2020-10-29 01:53:35 -07001496 bool manual_PreCallValidateCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
1497 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
1498
Mike Schuchardt2df08912020-12-15 16:28:09 -08001499 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001500 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001501
1502 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001503 const VkCommandBuffer *pCommandBuffers) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001504
Jeff Bolz5c801d12019-10-09 10:38:45 -05001505 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001506
1507 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001508 const VkViewport *pViewports) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001509
1510 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001511 const VkRect2D *pScissors) const;
1512 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001513
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001514 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1515 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001516
1517 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Tony-LunarGc0c3df52020-11-20 13:47:10 -07001518 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001519
sfricke-samsungf692b972020-05-02 08:00:45 -07001520 bool manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1521 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1522 uint32_t stride) const;
1523
sjfricke91d9bda2022-08-01 21:44:17 +09001524 bool manual_PreCallValidateCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1525 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1526 uint32_t stride) const;
1527
sfricke-samsungf692b972020-05-02 08:00:45 -07001528 bool manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1529 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1530 uint32_t stride) const;
1531
1532 bool manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1533 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1534 uint32_t maxDrawCount, uint32_t stride) const;
1535
sjfricke91d9bda2022-08-01 21:44:17 +09001536 bool manual_PreCallValidateCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1537 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1538 uint32_t maxDrawCount, uint32_t stride) const;
1539
sfricke-samsungf692b972020-05-02 08:00:45 -07001540 bool manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1541 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1542 uint32_t maxDrawCount, uint32_t stride) const;
1543
Tony-LunarG4490de42021-06-21 15:49:19 -06001544 bool manual_PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1545 const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount,
1546 uint32_t firstInstance, uint32_t stride) const;
1547
1548 bool manual_PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
1549 const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount,
1550 uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset) const;
1551
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001552 bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1553 const VkClearAttachment *pAttachments, uint32_t rectCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001554 const VkClearRect *pRects) const;
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001555
Andrew Fobel3abeb992020-01-20 16:33:22 -05001556 bool ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1557 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1558 VkImageFormatProperties2 *pImageFormatProperties,
1559 const char *apiName) const;
1560 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1561 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1562 VkImageFormatProperties2 *pImageFormatProperties) const;
1563 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1564 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1565 VkImageFormatProperties2 *pImageFormatProperties) const;
Lionel Landwerlin5fe52752020-07-22 08:18:14 +03001566 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
1567 VkImageType type, VkImageTiling tiling,
1568 VkImageUsageFlags usage, VkImageCreateFlags flags,
1569 VkImageFormatProperties *pImageFormatProperties) const;
Andrew Fobel3abeb992020-01-20 16:33:22 -05001570
sfricke-samsung3999ef62020-02-09 17:05:59 -08001571 bool manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
1572 uint32_t regionCount, const VkBufferCopy *pRegions) const;
1573
Jeff Leger178b1e52020-10-05 12:22:23 -04001574 bool manual_PreCallValidateCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2KHR *pCopyBufferInfo) const;
1575
Tony-LunarGef035472021-11-02 10:23:33 -06001576 bool manual_PreCallValidateCmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 *pCopyBufferInfo) const;
1577
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001578 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001579 VkDeviceSize dataSize, const void *pData) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001580
1581 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001582 VkDeviceSize size, uint32_t data) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001583
1584 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001585 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const;
sfricke-samsunga1d00272021-03-10 21:37:41 -08001586 bool manual_PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
1587 const VkSwapchainCreateInfoKHR *pCreateInfos,
1588 const VkAllocationCallbacks *pAllocator,
1589 VkSwapchainKHR *pSwapchains) const;
Jeff Bolz5c801d12019-10-09 10:38:45 -05001590 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const;
sfricke-samsung5c1b7392020-12-13 22:17:15 -08001591 bool manual_PreCallValidateCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
1592 const VkDisplayModeCreateInfoKHR *pCreateInfo,
1593 const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001594
1595#ifdef VK_USE_PLATFORM_WIN32_KHR
1596 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001597 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001598#endif // VK_USE_PLATFORM_WIN32_KHR
1599
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001600 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001601 const VkAllocationCallbacks *pAllocator,
1602 VkDescriptorPool *pDescriptorPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001603 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001604 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001605
Jeff Bolz5c801d12019-10-09 10:38:45 -05001606 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001607
1608 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1609 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001610 uint32_t groupCountZ) const;
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001611 bool manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1612 VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount,
1613 const VkWriteDescriptorSet *pDescriptorWrites) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001614 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001615 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001616 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1617 uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001618 const VkShadingRatePaletteNV *pShadingRatePalettes) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001619
1620 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1621 uint32_t customSampleOrderCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001622 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001623
Jeff Bolz5c801d12019-10-09 10:38:45 -05001624 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001625 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001626 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001627
1628 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1629 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001630 uint32_t maxDrawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001631
1632 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001633 uint32_t *pPropertyCount,
1634 VkExtensionProperties *pProperties) const;
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001635 bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001636 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const;
Ricardo Garciaa4935972019-02-21 17:43:18 +01001637
1638 bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device,
1639 const VkAccelerationStructureCreateInfoNV *pCreateInfo,
1640 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001641 VkAccelerationStructureNV *pAccelerationStructure) const;
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001642 bool manual_PreCallValidateCreateAccelerationStructureKHR(VkDevice device,
1643 const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
1644 const VkAllocationCallbacks *pAllocator,
1645 VkAccelerationStructureKHR *pAccelerationStructure) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001646 bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer,
1647 const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData,
1648 VkDeviceSize instanceOffset, VkBool32 update,
1649 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001650 VkBuffer scratch, VkDeviceSize scratchOffset) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001651 bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001652 size_t dataSize, void *pData) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001653
1654 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer,
1655 uint32_t accelerationStructureCount,
1656 const VkAccelerationStructureNV *pAccelerationStructures,
1657 VkQueryType queryType, VkQueryPool queryPool,
1658 uint32_t firstQuery) const;
Peter Chen85366392019-05-14 15:20:11 -04001659 bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1660 const VkRayTracingPipelineCreateInfoNV *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001661 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001662 bool manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1663 VkPipelineCache pipelineCache, uint32_t createInfoCount,
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001664 const VkRayTracingPipelineCreateInfoKHR *pCreateInfos,
1665 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Chris Mayer9ded5eb2019-09-19 16:33:26 +02001666 bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001667 uint32_t viewportCount,
1668 const VkViewportWScalingNV *pViewportWScalings) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001669
1670#ifdef VK_USE_PLATFORM_WIN32_KHR
1671 bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
Jamie Madillaa076da2020-12-22 15:34:34 -05001672 VkDeviceGroupPresentModeFlagsKHR *pModes) const override;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001673#endif // VK_USE_PLATFORM_WIN32_KHR
Tobias Hectorebb855f2019-07-23 12:17:33 +01001674
1675 bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001676 const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const;
Tobias Hectorebb855f2019-07-23 12:17:33 +01001677
Jeff Bolz8125a8b2019-08-16 16:29:45 -05001678 bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001679 uint16_t lineStipplePattern) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001680
1681 bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001682 VkIndexType indexType) const;
sfricke-samsung4ada8d42020-02-09 17:43:11 -08001683 bool manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1684 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001685
Jeff Bolz5c801d12019-10-09 10:38:45 -05001686 bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001687
Jeff Bolz5c801d12019-10-09 10:38:45 -05001688 bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001689
Petr Kraus3d720392019-11-13 02:52:39 +01001690 bool manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout,
1691 VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) const;
1692
1693 bool manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
1694 uint32_t *pImageIndex) const;
1695
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001696 bool manual_PreCallValidateCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding,
1697 uint32_t bindingCount, const VkBuffer *pBuffers,
1698 const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) const;
1699
1700 bool manual_PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1701 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1702 const VkDeviceSize *pCounterBufferOffsets) const;
1703
1704 bool manual_PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer,
1705 uint32_t counterBufferCount, const VkBuffer *pCounterBuffers,
1706 const VkDeviceSize *pCounterBufferOffsets) const;
1707
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -07001708 bool manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount,
1709 uint32_t firstInstance, VkBuffer counterBuffer,
1710 VkDeviceSize counterBufferOffset, uint32_t counterOffset,
1711 uint32_t vertexStride) const;
Jeremy Hayes9bda85a2020-05-21 16:36:17 -06001712
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001713 bool manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1714 const VkAllocationCallbacks *pAllocator,
1715 VkSamplerYcbcrConversion *pYcbcrConversion) const;
1716 bool manual_PreCallValidateCreateSamplerYcbcrConversionKHR(VkDevice device,
1717 const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1718 const VkAllocationCallbacks *pAllocator,
1719 VkSamplerYcbcrConversion *pYcbcrConversion) const;
sfricke-samsung1708a8c2020-02-10 00:35:06 -08001720 bool manual_PreCallValidateImportSemaphoreFdKHR(VkDevice device,
1721 const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001722
sourav parmarcd5fb182020-07-17 12:58:44 -07001723 bool manual_PreCallValidateCopyAccelerationStructureToMemoryKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001724 const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1725
1726 bool manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR(
1727 VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1728
sourav parmarcd5fb182020-07-17 12:58:44 -07001729 bool manual_PreCallValidateCopyAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
1730 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001731
1732 bool manual_PreCallValidateCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
1733 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
1734 bool ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, const char *api_name) const;
1735 bool ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo,
Mark Lobodzinskiaad69e42020-05-12 08:44:21 -06001736 const char *api_name, bool is_cmd = false) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001737
sourav parmarcd5fb182020-07-17 12:58:44 -07001738 bool manual_PreCallValidateCopyMemoryToAccelerationStructureKHR(VkDevice device, VkDeferredOperationKHR deferredOperation,
sourav parmara96ab1a2020-04-25 16:28:23 -07001739 const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
1740 bool manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR(
1741 VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001742
sourav parmar83c31b12020-05-06 12:30:54 -07001743 bool manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesKHR(
1744 VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount,
1745 const VkAccelerationStructureKHR *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool,
1746 uint32_t firstQuery) const;
1747 bool manual_PreCallValidateWriteAccelerationStructuresPropertiesKHR(VkDevice device, uint32_t accelerationStructureCount,
1748 const VkAccelerationStructureKHR *pAccelerationStructures,
1749 VkQueryType queryType, size_t dataSize, void *pData,
1750 size_t stride) const;
1751 bool manual_PreCallValidateGetRayTracingCaptureReplayShaderGroupHandlesKHR(VkDevice device, VkPipeline pipeline,
1752 uint32_t firstGroup, uint32_t groupCount,
1753 size_t dataSize, void *pData) const;
1754
1755 bool manual_PreCallValidateCmdTraceRaysKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001756 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1757 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1758 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1759 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, uint32_t width,
sourav parmar83c31b12020-05-06 12:30:54 -07001760 uint32_t height, uint32_t depth) const;
1761
1762 bool manual_PreCallValidateCmdTraceRaysIndirectKHR(VkCommandBuffer commandBuffer,
sourav parmarcd5fb182020-07-17 12:58:44 -07001763 const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable,
1764 const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable,
1765 const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable,
1766 const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable,
1767 VkDeviceAddress indirectDeviceAddress) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001768
sfricke-samsungf91881c2022-03-31 01:12:00 -05001769 bool manual_PreCallValidateCmdTraceRaysIndirect2KHR(VkCommandBuffer commandBuffer, VkDeviceAddress indirectDeviceAddress) const;
1770
sourav parmar83c31b12020-05-06 12:30:54 -07001771 bool manual_PreCallValidateCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer,
1772 VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer,
1773 VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride,
1774 VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset,
1775 VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer,
1776 VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride,
1777 uint32_t width, uint32_t height, uint32_t depth) const;
1778
sourav parmarcd5fb182020-07-17 12:58:44 -07001779 bool manual_PreCallValidateCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount,
1780 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1781 const VkDeviceAddress *pIndirectDeviceAddresses,
1782 const uint32_t *pIndirectStrides,
1783 const uint32_t *const *ppMaxPrimitiveCounts) const;
sourav parmar83c31b12020-05-06 12:30:54 -07001784
1785 bool manual_PreCallValidateGetDeviceAccelerationStructureCompatibilityKHR(
sourav parmarcd5fb182020-07-17 12:58:44 -07001786 VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo,
1787 VkAccelerationStructureCompatibilityKHR *pCompatibility) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001788 bool ValidateCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport *pViewports,
1789 bool is_ext) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001790 bool manual_PreCallValidateCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount,
1791 const VkViewport *pViewports) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001792 bool manual_PreCallValidateCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount,
1793 const VkViewport *pViewports) const;
1794
1795 bool ValidateCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D *pScissors,
1796 bool is_ext) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001797 bool manual_PreCallValidateCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount,
1798 const VkRect2D *pScissors) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001799 bool manual_PreCallValidateCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount,
1800 const VkRect2D *pScissors) const;
1801 bool ValidateCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1802 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes,
1803 const VkDeviceSize *pStrides, bool is_2ext) const;
Piers Daniell39842ee2020-07-10 16:42:33 -06001804 bool manual_PreCallValidateCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1805 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets,
1806 const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const;
Tony-LunarG3f953ba2021-10-15 15:35:39 -06001807 bool manual_PreCallValidateCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1808 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets,
1809 const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) const;
sourav parmarcd5fb182020-07-17 12:58:44 -07001810 bool ValidateAccelerationStructureBuildGeometryInfoKHR(const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1811 uint32_t infoCount, const char *api_name) const;
1812 bool manual_PreCallValidateCmdBuildAccelerationStructuresKHR(
1813 VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1814 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1815
1816 bool manual_PreCallValidateBuildAccelerationStructuresKHR(
1817 VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount,
1818 const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
1819 const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const;
1820
1821 bool manual_PreCallValidateGetAccelerationStructureBuildSizesKHR(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType,
1822 const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo,
1823 const uint32_t *pMaxPrimitiveCounts,
1824 VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) const;
1825
Piers Daniellcb6d8032021-04-19 18:51:26 -06001826 bool manual_PreCallValidateCmdSetVertexInputEXT(
1827 VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount,
1828 const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount,
1829 const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) const;
sfricke-samsung51303fb2021-05-09 19:09:13 -07001830
1831 bool manual_PreCallValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
1832 VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size,
1833 const void *pValues) const;
ziga-lunargb1dd8a22021-07-15 17:47:19 +02001834
1835 bool manual_PreCallValidateMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount,
1836 const VkPipelineCache *pSrcCaches) const;
1837
Nathaniel Cesario298d3cb2021-08-03 13:49:02 -06001838 bool manual_PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
1839 const VkClearColorValue *pColor, uint32_t rangeCount,
1840 const VkImageSubresourceRange *pRanges) const;
1841
1842 bool ValidateCmdBeginRenderPass(const char *const func_name, const VkRenderPassBeginInfo *const rp_begin) const;
1843 bool manual_PreCallValidateCmdBeginRenderPass(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1844 VkSubpassContents) const;
1845 bool manual_PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1846 const VkSubpassBeginInfo *) const;
1847 bool manual_PreCallValidateCmdBeginRenderPass2(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin,
1848 const VkSubpassBeginInfo *) const;
1849
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001850 bool manual_PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle,
1851 uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) const;
ziga-lunarg3c37dfb2021-08-24 12:51:07 +02001852 bool manual_PreCallValidateGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount,
ziga-lunargcf340c42021-08-19 00:13:38 +02001853 size_t dataSize, void *pData, VkDeviceSize stride,
1854 VkQueryResultFlags flags) const;
1855 bool manual_PreCallValidateCmdBeginConditionalRenderingEXT(
1856 VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin) const;
ziga-lunargc7bb56a2021-08-10 09:28:52 +02001857
ziga-lunarg50f8e6b2021-12-18 20:24:35 +01001858 bool ValidateDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirementsKHR *pInfo,
1859 const char *func_name) const;
1860
Mike Schuchardt05b028d2022-01-05 14:15:00 -08001861 bool manual_PreCallValidateGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
1862 uint32_t *pSurfaceFormatCount,
1863 VkSurfaceFormatKHR *pSurfaceFormats) const;
1864
1865 bool manual_PreCallValidateGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
1866 uint32_t *pPresentModeCount,
1867 VkPresentModeKHR *pPresentModes) const;
1868
1869 bool manual_PreCallValidateGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice,
1870 const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
1871 VkSurfaceCapabilities2KHR *pSurfaceCapabilities) const;
1872
1873 bool manual_PreCallValidateGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice,
1874 const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
1875 uint32_t *pSurfaceFormatCount,
1876 VkSurfaceFormat2KHR *pSurfaceFormats) const;
1877#ifdef VK_USE_PLATFORM_WIN32_KHR
1878 bool manual_PreCallValidateGetPhysicalDeviceSurfacePresentModes2EXT(VkPhysicalDevice physicalDevice,
1879 const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
1880 uint32_t *pPresentModeCount,
1881 VkPresentModeKHR *pPresentModes) const;
1882#endif // VK_USE_PLATFORM_WIN32_KHR
1883
ziga-lunarg50f8e6b2021-12-18 20:24:35 +01001884 bool manual_PreCallValidateGetDeviceImageMemoryRequirementsKHR(VkDevice device, const VkDeviceImageMemoryRequirements *pInfo,
1885 VkMemoryRequirements2 *pMemoryRequirements) const;
1886 bool manual_PreCallValidateGetDeviceImageSparseMemoryRequirementsKHR(
1887 VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, uint32_t *pSparseMemoryRequirementCount,
1888 VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) const;
1889
Tony-LunarG115f89d2022-06-15 10:53:22 -06001890#ifdef VK_USE_PLATFORM_METAL_EXT
1891 bool manual_PreCallValidateExportMetalObjectsEXT(VkDevice device, VkExportMetalObjectsInfoEXT *pMetalObjectsInfo) const;
1892#endif // VK_USE_PLATFORM_METAL_EXT
1893
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001894#include "parameter_validation.h"
1895}; // Class StatelessValidation