blob: 668c269198bf5837628f59662c75fcd5e3b42b4b [file] [log] [blame]
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001/* Copyright (c) 2015-2020 The Khronos Group Inc.
2 * Copyright (c) 2015-2020 Valve Corporation
3 * Copyright (c) 2015-2020 LunarG, Inc.
4 * Copyright (C) 2015-2020 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"
26
27// Suppress unused warning on Linux
28#if defined(__GNUC__)
29#define DECORATE_UNUSED __attribute__((unused))
30#else
31#define DECORATE_UNUSED
32#endif
33
34static const char DECORATE_UNUSED *kVUID_PVError_NONE = "UNASSIGNED-GeneralParameterError-Info";
35static const char DECORATE_UNUSED *kVUID_PVError_InvalidUsage = "UNASSIGNED-GeneralParameterError-InvalidUsage";
36static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructSType = "UNASSIGNED-GeneralParameterError-InvalidStructSType";
37static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructPNext = "UNASSIGNED-GeneralParameterError-InvalidStructPNext";
38static const char DECORATE_UNUSED *kVUID_PVError_RequiredParameter = "UNASSIGNED-GeneralParameterError-RequiredParameter";
39static const char DECORATE_UNUSED *kVUID_PVError_ReservedParameter = "UNASSIGNED-GeneralParameterError-ReservedParameter";
40static const char DECORATE_UNUSED *kVUID_PVError_UnrecognizedValue = "UNASSIGNED-GeneralParameterError-UnrecognizedValue";
41static const char DECORATE_UNUSED *kVUID_PVError_DeviceLimit = "UNASSIGNED-GeneralParameterError-DeviceLimit";
42static const char DECORATE_UNUSED *kVUID_PVError_DeviceFeature = "UNASSIGNED-GeneralParameterError-DeviceFeature";
43static const char DECORATE_UNUSED *kVUID_PVError_FailureCode = "UNASSIGNED-GeneralParameterError-FailureCode";
44static const char DECORATE_UNUSED *kVUID_PVError_ExtensionNotEnabled = "UNASSIGNED-GeneralParameterError-ExtensionNotEnabled";
45
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070046extern const uint32_t GeneratedVulkanHeaderVersion;
47
48extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits;
49extern const VkColorComponentFlags AllVkColorComponentFlagBits;
50extern const VkShaderStageFlags AllVkShaderStageFlagBits;
51extern const VkQueryControlFlags AllVkQueryControlFlagBits;
52extern const VkImageUsageFlags AllVkImageUsageFlagBits;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060053extern const VkSampleCountFlags AllVkSampleCountFlagBits;
sourav parmara96ab1a2020-04-25 16:28:23 -070054extern const VkBuildAccelerationStructureFlagsNV AllVkBuildAccelerationStructureFlagBitsNV;
55extern const VkGeometryFlagsKHR AllVkGeometryFlagBitsKHR;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070056
sourav parmara96ab1a2020-04-25 16:28:23 -070057extern const std::vector<VkGeometryTypeKHR> AllVkGeometryTypeKHREnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070058extern const std::vector<VkCompareOp> AllVkCompareOpEnums;
59extern const std::vector<VkStencilOp> AllVkStencilOpEnums;
60extern const std::vector<VkBlendFactor> AllVkBlendFactorEnums;
61extern const std::vector<VkBlendOp> AllVkBlendOpEnums;
62extern const std::vector<VkLogicOp> AllVkLogicOpEnums;
63extern const std::vector<VkBorderColor> AllVkBorderColorEnums;
64extern const std::vector<VkImageLayout> AllVkImageLayoutEnums;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060065extern const std::vector<VkFormat> AllVkFormatEnums;
66extern const std::vector<VkVertexInputRate> AllVkVertexInputRateEnums;
67extern const std::vector<VkPrimitiveTopology> AllVkPrimitiveTopologyEnums;
sourav parmara96ab1a2020-04-25 16:28:23 -070068extern const std::vector<VkIndexType> AllVkIndexTypeEnums;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070069
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070070// String returned by string_VkStructureType for an unrecognized type.
71const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType";
72
73// String returned by string_VkResult for an unrecognized type.
74const std::string UnsupportedResultString = "Unhandled VkResult";
75
76// The base value used when computing the offset for an enumeration token value that is added by an extension.
77// When validating enumeration tokens, any value >= to this value is considered to be provided by an extension.
78// See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification
79const uint32_t ExtEnumBaseValue = 1000000000;
80
81// The value of all VK_xxx_MAX_ENUM tokens
82const uint32_t MaxEnumValue = 0x7FFFFFFF;
83
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070084class StatelessValidation : public ValidationObject {
Petr Kraus4ed81e32019-09-02 23:41:19 +020085 public:
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070086 VkPhysicalDeviceLimits device_limits = {};
Petr Kraus715bcc72019-08-15 17:17:33 +020087 safe_VkPhysicalDeviceFeatures2 physical_device_features2;
Tony-LunarG6c3c5452019-12-13 10:37:38 -070088 void *device_createinfo_pnext;
Petr Kraus715bcc72019-08-15 17:17:33 +020089 const VkPhysicalDeviceFeatures &physical_device_features = physical_device_features2.features;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070090
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -070091 // Override chassis read/write locks for this validation object
92 // This override takes a deferred lock. i.e. it is not acquired.
Jeff Bolzcaeccc72019-10-15 15:35:26 -050093 virtual read_lock_guard_t read_lock() { return read_lock_guard_t(validation_object_mutex, std::defer_lock); }
94 virtual write_lock_guard_t write_lock() { return write_lock_guard_t(validation_object_mutex, std::defer_lock); }
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -070095
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070096 // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2KHR::pNext chain
97 struct DeviceExtensionProperties {
98 VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props;
99 VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props;
Jeff Bolz443c2ca2020-03-19 12:11:51 -0500100 VkPhysicalDeviceRayTracingPropertiesNV ray_tracing_propsNV;
101 VkPhysicalDeviceRayTracingPropertiesKHR ray_tracing_propsKHR;
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -0700102 VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback_props;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700103 };
104 DeviceExtensionProperties phys_dev_ext_props = {};
105
106 struct SubpassesUsageStates {
107 std::unordered_set<uint32_t> subpasses_using_color_attachment;
108 std::unordered_set<uint32_t> subpasses_using_depthstencil_attachment;
109 };
110
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700111 // Though this validation object is predominantly statless, the Framebuffer checks are greatly simplified by creating and
112 // updating a map of the renderpass usage states, and these accesses need thread protection. Use a mutex separate from the
113 // parent object's to maintain that functionality.
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500114 mutable std::mutex renderpass_map_mutex;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700115 std::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states;
116
117 // Constructor for stateles validation tracking
Jeff Bolz165818a2020-05-08 11:19:03 -0500118 StatelessValidation() : device_createinfo_pnext(nullptr) { container_type = LayerObjectTypeParameterValidation; }
119 ~StatelessValidation() {
120 if (device_createinfo_pnext) {
121 FreePnextChain(device_createinfo_pnext);
122 }
123 }
124
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700125 /**
126 * Validate a minimum value.
127 *
128 * Verify that the specified value is greater than the specified lower bound.
129 *
130 * @param api_name Name of API call being validated.
131 * @param parameter_name Name of parameter being validated.
132 * @param value Value to validate.
133 * @param lower_bound Lower bound value to use for validation.
134 * @return Boolean value indicating that the call should be skipped.
135 */
136 template <typename T>
137 bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700138 const char *api_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700139 bool skip_call = false;
140
141 if (value <= lower_bound) {
142 std::ostringstream ss;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700143 ss << api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is greater than " << lower_bound;
144 skip_call |= LogError(device, vuid, "%s", ss.str().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700145 }
146
147 return skip_call;
148 }
149
150 template <typename T>
151 bool ValidateGreaterThanZero(const T value, const ParameterName &parameter_name, const std::string &vuid,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700152 const char *api_name) const {
153 return ValidateGreaterThan(value, T{0}, parameter_name, vuid, api_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700154 }
155 /**
156 * Validate a required pointer.
157 *
158 * Verify that a required pointer is not NULL.
159 *
160 * @param apiName Name of API call being validated.
161 * @param parameterName Name of parameter being validated.
162 * @param value Pointer to validate.
163 * @return Boolean value indicating that the call should be skipped.
164 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700165 bool validate_required_pointer(const char *apiName, const ParameterName &parameterName, const void *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500166 const std::string &vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700167 bool skip_call = false;
168
169 if (value == NULL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700170 skip_call |=
171 LogError(device, vuid, "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700172 }
173
174 return skip_call;
175 }
176
177 /**
178 * Validate array count and pointer to array.
179 *
180 * Verify that required count and array parameters are not 0 or NULL. If the
181 * count parameter is not optional, verify that it is not 0. If the array
182 * parameter is NULL, and it is not optional, verify that count is 0.
183 *
184 * @param apiName Name of API call being validated.
185 * @param countName Name of count parameter.
186 * @param arrayName Name of array parameter.
187 * @param count Number of elements in the array.
188 * @param array Array to validate.
189 * @param countRequired The 'count' parameter may not be 0 when true.
190 * @param arrayRequired The 'array' parameter may not be NULL when true.
191 * @return Boolean value indicating that the call should be skipped.
192 */
193 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700194 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, T1 count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600195 const T2 *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500196 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700197 bool skip_call = false;
198
199 // Count parameters not tagged as optional cannot be 0
200 if (countRequired && (count == 0)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700201 skip_call |= LogError(device, count_required_vuid, "%s: parameter %s must be greater than 0.", apiName,
202 countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700203 }
204
205 // Array parameters not tagged as optional cannot be NULL, unless the count is 0
206 if (arrayRequired && (count != 0) && (*array == NULL)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700207 skip_call |= LogError(device, array_required_vuid, "%s: required parameter %s specified as NULL.", apiName,
208 arrayName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700209 }
210
211 return skip_call;
212 }
213
214 /**
215 * Validate pointer to array count and pointer to array.
216 *
217 * Verify that required count and array parameters are not NULL. If count
218 * is not NULL and its value is not optional, verify that it is not 0. If the
219 * array parameter is NULL, and it is not optional, verify that count is 0.
220 * The array parameter will typically be optional for this case (where count is
221 * a pointer), allowing the caller to retrieve the available count.
222 *
223 * @param apiName Name of API call being validated.
224 * @param countName Name of count parameter.
225 * @param arrayName Name of array parameter.
226 * @param count Pointer to the number of elements in the array.
227 * @param array Array to validate.
228 * @param countPtrRequired The 'count' parameter may not be NULL when true.
229 * @param countValueRequired The '*count' value may not be 0 when true.
230 * @param arrayRequired The 'array' parameter may not be NULL when true.
231 * @return Boolean value indicating that the call should be skipped.
232 */
233 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700234 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T1 *count,
235 const T2 *array, bool countPtrRequired, bool countValueRequired, bool arrayRequired,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500236 const char *count_required_vuid, const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700237 bool skip_call = false;
238
239 if (count == NULL) {
240 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700241 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
242 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700243 }
244 } else {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700245 skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array, countValueRequired,
246 arrayRequired, count_required_vuid, array_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700247 }
248
249 return skip_call;
250 }
251
252 /**
253 * Validate a pointer to a Vulkan structure.
254 *
255 * Verify that a required pointer to a structure is not NULL. If the pointer is
256 * not NULL, verify that each structure's sType field is set to the correct
257 * VkStructureType value.
258 *
259 * @param apiName Name of API call being validated.
260 * @param parameterName Name of struct parameter being validated.
261 * @param sTypeName Name of expected VkStructureType value.
262 * @param value Pointer to the struct to validate.
263 * @param sType VkStructureType for structure validation.
264 * @param required The parameter may not be NULL when true.
265 * @return Boolean value indicating that the call should be skipped.
266 */
267 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700268 bool validate_struct_type(const char *apiName, const ParameterName &parameterName, const char *sTypeName, const T *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500269 VkStructureType sType, bool required, const char *struct_vuid, const char *stype_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700270 bool skip_call = false;
271
272 if (value == NULL) {
273 if (required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700274 skip_call |= LogError(device, struct_vuid, "%s: required parameter %s specified as NULL", apiName,
275 parameterName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700276 }
277 } else if (value->sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700278 skip_call |= LogError(device, stype_vuid, "%s: parameter %s->sType must be %s.", apiName,
279 parameterName.get_name().c_str(), sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700280 }
281
282 return skip_call;
283 }
284
285 /**
286 * Validate an array of Vulkan structures
287 *
288 * Verify that required count and array parameters are not 0 or NULL. If
289 * the array contains 1 or more structures, verify that each structure's
290 * sType field is set to the correct VkStructureType value.
291 *
292 * @param apiName Name of API call being validated.
293 * @param countName Name of count parameter.
294 * @param arrayName Name of array parameter.
295 * @param sTypeName Name of expected VkStructureType value.
296 * @param count Number of elements in the array.
297 * @param array Array to validate.
298 * @param sType VkStructureType for structure validation.
299 * @param countRequired The 'count' parameter may not be 0 when true.
300 * @param arrayRequired The 'array' parameter may not be NULL when true.
301 * @return Boolean value indicating that the call should be skipped.
302 */
303 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700304 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
305 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800306 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500307 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700308 bool skip_call = false;
309
310 if ((count == 0) || (array == NULL)) {
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800311 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
312 count_required_vuid, param_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700313 } else {
314 // Verify that all structs in the array have the correct type
315 for (uint32_t i = 0; i < count; ++i) {
316 if (array[i].sType != sType) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700317 skip_call |= LogError(device, stype_vuid, "%s: parameter %s[%d].sType must be %s", apiName,
318 arrayName.get_name().c_str(), i, sTypeName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700319 }
320 }
321 }
322
323 return skip_call;
324 }
325
326 /**
327 * Validate an array of Vulkan structures.
328 *
329 * Verify that required count and array parameters are not NULL. If count
330 * is not NULL and its value is not optional, verify that it is not 0.
331 * If the array contains 1 or more structures, verify that each structure's
332 * sType field is set to the correct VkStructureType value.
333 *
334 * @param apiName Name of API call being validated.
335 * @param countName Name of count parameter.
336 * @param arrayName Name of array parameter.
337 * @param sTypeName Name of expected VkStructureType value.
338 * @param count Pointer to the number of elements in the array.
339 * @param array Array to validate.
340 * @param sType VkStructureType for structure validation.
341 * @param countPtrRequired The 'count' parameter may not be NULL when true.
342 * @param countValueRequired The '*count' value may not be 0 when true.
343 * @param arrayRequired The 'array' parameter may not be NULL when true.
344 * @return Boolean value indicating that the call should be skipped.
345 */
346 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700347 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
348 const char *sTypeName, uint32_t *count, const T *array, VkStructureType sType,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600349 bool countPtrRequired, bool countValueRequired, bool arrayRequired, const char *stype_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500350 const char *param_vuid, const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700351 bool skip_call = false;
352
353 if (count == NULL) {
354 if (countPtrRequired) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700355 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL",
356 apiName, countName.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700357 }
358 } else {
359 skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType,
Mark Lobodzinski75a38812019-12-10 15:22:52 -0700360 countValueRequired && (array != nullptr), arrayRequired, stype_vuid, param_vuid,
361 count_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700362 }
363
364 return skip_call;
365 }
366
367 /**
368 * Validate a Vulkan handle.
369 *
370 * Verify that the specified handle is not VK_NULL_HANDLE.
371 *
372 * @param api_name Name of API call being validated.
373 * @param parameter_name Name of struct parameter being validated.
374 * @param value Handle to validate.
375 * @return Boolean value indicating that the call should be skipped.
376 */
377 template <typename T>
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500378 bool validate_required_handle(const char *api_name, const ParameterName &parameter_name, T value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700379 bool skip_call = false;
380
381 if (value == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700382 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE",
383 api_name, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700384 }
385
386 return skip_call;
387 }
388
389 /**
390 * Validate an array of Vulkan handles.
391 *
392 * Verify that required count and array parameters are not NULL. If count
393 * is not NULL and its value is not optional, verify that it is not 0.
394 * If the array contains 1 or more handles, verify that no handle is set to
395 * VK_NULL_HANDLE.
396 *
397 * @note This function is only intended to validate arrays of handles when none
398 * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles
399 * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead.
400 *
401 * @param api_name Name of API call being validated.
402 * @param count_name Name of count parameter.
403 * @param array_name Name of array parameter.
404 * @param count Number of elements in the array.
405 * @param array Array to validate.
406 * @param count_required The 'count' parameter may not be 0 when true.
407 * @param array_required The 'array' parameter may not be NULL when true.
408 * @return Boolean value indicating that the call should be skipped.
409 */
410 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700411 bool validate_handle_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500412 uint32_t count, const T *array, bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700413 bool skip_call = false;
414
415 if ((count == 0) || (array == NULL)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700416 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
417 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700418 } else {
419 // Verify that no handles in the array are VK_NULL_HANDLE
420 for (uint32_t i = 0; i < count; ++i) {
421 if (array[i] == VK_NULL_HANDLE) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700422 skip_call |= LogError(device, kVUID_PVError_RequiredParameter,
423 "%s: required parameter %s[%d] specified as VK_NULL_HANDLE", api_name,
424 array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700425 }
426 }
427 }
428
429 return skip_call;
430 }
431
432 /**
433 * Validate string array count and content.
434 *
435 * Verify that required count and array parameters are not 0 or NULL. If the
436 * count parameter is not optional, verify that it is not 0. If the array
437 * parameter is NULL, and it is not optional, verify that count is 0. If the
438 * array parameter is not NULL, verify that none of the strings are NULL.
439 *
440 * @param apiName Name of API call being validated.
441 * @param countName Name of count parameter.
442 * @param arrayName Name of array parameter.
443 * @param count Number of strings in the array.
444 * @param array Array of strings to validate.
445 * @param countRequired The 'count' parameter may not be 0 when true.
446 * @param arrayRequired The 'array' parameter may not be NULL when true.
447 * @return Boolean value indicating that the call should be skipped.
448 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700449 bool validate_string_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600450 const char *const *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500451 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700452 bool skip_call = false;
453
454 if ((count == 0) || (array == NULL)) {
455 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
456 count_required_vuid, array_required_vuid);
457 } else {
458 // Verify that strings in the array are not NULL
459 for (uint32_t i = 0; i < count; ++i) {
460 if (array[i] == NULL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700461 skip_call |=
462 LogError(device, kVUID_PVError_RequiredParameter, "%s: required parameter %s[%d] specified as NULL",
463 apiName, arrayName.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700464 }
465 }
466 }
467
468 return skip_call;
469 }
470
471 // Forward declaration for pNext validation
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500472 bool ValidatePnextStructContents(const char *api_name, const ParameterName &parameter_name,
473 const VkBaseOutStructure *header) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700474
475 /**
476 * Validate a structure's pNext member.
477 *
478 * Verify that the specified pNext value points to the head of a list of
479 * allowed extension structures. If no extension structures are allowed,
480 * verify that pNext is null.
481 *
482 * @param api_name Name of API call being validated.
483 * @param parameter_name Name of parameter being validated.
484 * @param allowed_struct_names Names of allowed structs.
485 * @param next Pointer to validate.
486 * @param allowed_type_count Total number of allowed structure types.
487 * @param allowed_types Array of structure types allowed for pNext.
488 * @param header_version Version of header defining the pNext validation rules.
489 * @return Boolean value indicating that the call should be skipped.
490 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700491 bool validate_struct_pnext(const char *api_name, const ParameterName &parameter_name, const char *allowed_struct_names,
492 const void *next, size_t allowed_type_count, const VkStructureType *allowed_types,
sfricke-samsung32a27362020-02-28 09:06:42 -0800493 uint32_t header_version, const char *pnext_vuid, const char *stype_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700494 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700495
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700496 // TODO: The valid pNext structure types are not recursive. Each structure has its own list of valid sTypes for pNext.
497 // Codegen a map of vectors containing the allowable pNext types for each struct and use that here -- also simplifies parms.
498 if (next != NULL) {
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600499 std::unordered_set<const void *> cycle_check;
500 std::unordered_set<VkStructureType, std::hash<int>> unique_stype_check;
501
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600502 const char *disclaimer =
503 "This warning is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that "
504 "you "
505 "are "
506 "using a struct from a private extension or an extension that was added to a later version of the Vulkan header, "
507 "in "
508 "which "
509 "case your use of %s is perfectly valid but is not guaranteed to work correctly with validation enabled";
510
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700511 if (allowed_type_count == 0) {
512 std::string message = "%s: value of %s must be NULL. ";
513 message += disclaimer;
sfricke-samsung32a27362020-02-28 09:06:42 -0800514 skip_call |= LogWarning(device, pnext_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
515 header_version, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700516 } else {
517 const VkStructureType *start = allowed_types;
518 const VkStructureType *end = allowed_types + allowed_type_count;
Lockefbdd1af2019-04-16 15:07:23 -0600519 const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700520
521 cycle_check.insert(next);
522
523 while (current != NULL) {
524 if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) ||
525 (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) &&
526 ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) ||
527 (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) {
528 if (cycle_check.find(current->pNext) != cycle_check.end()) {
529 std::string message = "%s: %s chain contains a cycle -- pNext pointer " PRIx64 " is repeated.";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700530 skip_call |= LogError(device, kVUID_PVError_InvalidStructPNext, message.c_str(), api_name,
531 parameter_name.get_name().c_str(), reinterpret_cast<uint64_t>(next));
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700532 break;
533 } else {
534 cycle_check.insert(current->pNext);
535 }
536
537 std::string type_name = string_VkStructureType(current->sType);
538 if (unique_stype_check.find(current->sType) != unique_stype_check.end()) {
sfricke-samsung32a27362020-02-28 09:06:42 -0800539 // stype_vuid will only be null if there are no listed pNext and will hit disclaimer check
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700540 std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times.";
sfricke-samsung32a27362020-02-28 09:06:42 -0800541 skip_call |= LogError(device, stype_vuid, message.c_str(), api_name, parameter_name.get_name().c_str(),
542 type_name.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700543 } else {
544 unique_stype_check.insert(current->sType);
545 }
546
547 if (std::find(start, end, current->sType) == end) {
548 if (type_name == UnsupportedStructureTypeString) {
549 std::string message =
550 "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures are "
551 "[%s]. ";
552 message += disclaimer;
sfricke-samsung32a27362020-02-28 09:06:42 -0800553 skip_call |= LogWarning(device, pnext_vuid, message.c_str(), api_name,
554 parameter_name.get_name().c_str(), current->sType, allowed_struct_names,
555 header_version, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700556 } else {
557 std::string message =
558 "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures are "
559 "[%s]. ";
560 message += disclaimer;
sfricke-samsung32a27362020-02-28 09:06:42 -0800561 skip_call |= LogWarning(device, pnext_vuid, message.c_str(), api_name,
562 parameter_name.get_name().c_str(), type_name.c_str(), allowed_struct_names,
563 header_version, parameter_name.get_name().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700564 }
565 }
566 skip_call |= ValidatePnextStructContents(api_name, parameter_name, current);
567 }
Lockefbdd1af2019-04-16 15:07:23 -0600568 current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700569 }
570 }
571 }
572
573 return skip_call;
574 }
575
576 /**
577 * Validate a VkBool32 value.
578 *
579 * Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
580 *
581 * @param apiName Name of API call being validated.
582 * @param parameterName Name of parameter being validated.
583 * @param value Boolean value to validate.
584 * @return Boolean value indicating that the call should be skipped.
585 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500586 bool validate_bool32(const char *apiName, const ParameterName &parameterName, VkBool32 value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700587 bool skip_call = false;
588
589 if ((value != VK_TRUE) && (value != VK_FALSE)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700590 skip_call |= LogWarning(device, kVUID_PVError_UnrecognizedValue, "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE",
591 apiName, parameterName.get_name().c_str(), value);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700592 }
593
594 return skip_call;
595 }
596
597 /**
598 * Validate a Vulkan enumeration value.
599 *
600 * Generate a warning if an enumeration token value does not fall within the core enumeration
601 * begin and end token values, and was not added to the enumeration by an extension. Extension
602 * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
603 * with 1,000,000,000 as the base token value.
604 *
605 * @note This function does not expect to process enumerations defining bitmask flag bits.
606 *
607 * @param apiName Name of API call being validated.
608 * @param parameterName Name of parameter being validated.
609 * @param enumName Name of the enumeration being validated.
610 * @param valid_values The list of valid values for the enumeration.
611 * @param value Enumeration value to validate.
612 * @return Boolean value indicating that the call should be skipped.
613 */
614 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700615 bool validate_ranged_enum(const char *apiName, const ParameterName &parameterName, const char *enumName,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500616 const std::vector<T> &valid_values, T value, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700617 bool skip = false;
618
619 if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) {
620 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700621 LogError(device, vuid,
622 "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is "
623 "not an extension added token.",
624 apiName, parameterName.get_name().c_str(), value, enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700625 }
626
627 return skip;
628 }
629
630 /**
631 * Validate an array of Vulkan enumeration value.
632 *
633 * Process all enumeration token values in the specified array and generate a warning if a value
634 * does not fall within the core enumeration begin and end token values, and was not added to
635 * the enumeration by an extension. Extension provided enumerations use the equation specified
636 * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
637 *
638 * @note This function does not expect to process enumerations defining bitmask flag bits.
639 *
640 * @param apiName Name of API call being validated.
641 * @param countName Name of count parameter.
642 * @param arrayName Name of array parameter.
643 * @param enumName Name of the enumeration being validated.
644 * @param valid_values The list of valid values for the enumeration.
645 * @param count Number of enumeration values in the array.
646 * @param array Array of enumeration values to validate.
647 * @param countRequired The 'count' parameter may not be 0 when true.
648 * @param arrayRequired The 'array' parameter may not be NULL when true.
649 * @return Boolean value indicating that the call should be skipped.
650 */
651 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700652 bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
653 const char *enumName, const std::vector<T> &valid_values, uint32_t count, const T *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500654 bool countRequired, bool arrayRequired) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700655 bool skip_call = false;
656
657 if ((count == 0) || (array == NULL)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700658 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
659 kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700660 } else {
661 for (uint32_t i = 0; i < count; ++i) {
662 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700663 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
664 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
665 "enumeration tokens and is not an extension added token",
666 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700667 }
668 }
669 }
670
671 return skip_call;
672 }
673
674 /**
675 * Verify that a reserved VkFlags value is zero.
676 *
677 * Verify that the specified value is zero, to check VkFlags values that are reserved for
678 * future use.
679 *
680 * @param api_name Name of API call being validated.
681 * @param parameter_name Name of parameter being validated.
682 * @param value Value to validate.
683 * @return Boolean value indicating that the call should be skipped.
684 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500685 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 -0700686 bool skip_call = false;
687
688 if (value != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700689 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 -0700690 }
691
692 return skip_call;
693 }
694
Petr Kraus52758be2019-08-12 00:53:58 +0200695 enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit };
696
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700697 /**
698 * Validate a Vulkan bitmask value.
699 *
700 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
701 * for that type.
702 *
703 * @param api_name Name of API call being validated.
704 * @param parameter_name Name of parameter being validated.
705 * @param flag_bits_name Name of the VkFlags type being validated.
706 * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated.
707 * @param value VkFlags value to validate.
Petr Kraus52758be2019-08-12 00:53:58 +0200708 * @param flag_type The type of flag, like optional, or single bit.
709 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
710 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700711 * @return Boolean value indicating that the call should be skipped.
712 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700713 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 -0500714 VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700715 bool skip_call = false;
716
Petr Kraus52758be2019-08-12 00:53:58 +0200717 if ((value & ~all_flags) != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700718 skip_call |= LogError(device, vuid, "%s: value of %s contains flag bits that are not recognized members of %s",
719 api_name, parameter_name.get_name().c_str(), flag_bits_name);
Petr Kraus52758be2019-08-12 00:53:58 +0200720 }
721
722 const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit;
723 const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid;
724 if (required && value == 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700725 skip_call |= LogError(device, zero_vuid, "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str());
Petr Kraus52758be2019-08-12 00:53:58 +0200726 }
727
728 const auto HasMaxOneBitSet = [](const VkFlags f) {
729 // Decrement flips bits from right upto first 1.
730 // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED
731 return f == 0 || !(f & (f - 1));
732 };
733
734 const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit;
735 if (is_bits_type && !HasMaxOneBitSet(value)) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700736 skip_call |=
737 LogError(device, vuid, "%s: value of %s contains multiple members of %s when only a single value is allowed",
738 api_name, parameter_name.get_name().c_str(), flag_bits_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700739 }
740
741 return skip_call;
742 }
743
744 /**
745 * Validate an array of Vulkan bitmask values.
746 *
747 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
748 * for that type.
749 *
750 * @param api_name Name of API call being validated.
751 * @param count_name Name of parameter being validated.
752 * @param array_name Name of parameter being validated.
753 * @param flag_bits_name Name of the VkFlags type being validated.
754 * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated.
755 * @param count Number of VkFlags values in the array.
756 * @param array Array of VkFlags value to validate.
757 * @param count_required The 'count' parameter may not be 0 when true.
758 * @param array_required The 'array' parameter may not be NULL when true.
759 * @return Boolean value indicating that the call should be skipped.
760 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700761 bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
762 const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500763 bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700764 bool skip_call = false;
765
766 if ((count == 0) || (array == NULL)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700767 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
768 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700769 } else {
770 // Verify that all VkFlags values in the array
771 for (uint32_t i = 0; i < count; ++i) {
772 if (array[i] == 0) {
773 // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if
774 // elements in the array are allowed be 0
775 if (array_required) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700776 skip_call |= LogError(device, kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0",
777 api_name, array_name.get_name().c_str(), i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700778 }
779 } else if ((array[i] & (~all_flags)) != 0) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700780 skip_call |= LogError(device, kVUID_PVError_UnrecognizedValue,
781 "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name,
782 array_name.get_name().c_str(), i, flag_bits_name);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700783 }
784 }
785 }
786
787 return skip_call;
788 }
789
790 template <typename ExtensionState>
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600791 bool validate_extension_reqs(const ExtensionState &extensions, const char *vuid, const char *extension_type,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500792 const char *extension_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700793 bool skip = false;
794 if (!extension_name) {
795 return skip; // Robust to invalid char *
796 }
797 auto info = ExtensionState::get_info(extension_name);
798
799 if (!info.state) {
800 return skip; // Unknown extensions cannot be checked so report OK
801 }
802
803 // Check against the required list in the info
804 std::vector<const char *> missing;
Petr Krausbce952d2020-04-02 18:40:40 +0200805 for (const auto &req : info.requirements) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700806 if (!(extensions.*(req.enabled))) {
807 missing.push_back(req.name);
808 }
809 }
810
811 // Report any missing requirements
812 if (missing.size()) {
813 std::string missing_joined_list = string_join(", ", missing);
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700814 skip |= LogError(instance, vuid, "Missing extension%s required by the %s extension %s: %s.",
815 ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700816 }
817 return skip;
818 }
819
820 enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
821
822 template <typename RenderPassCreateInfoGeneric>
Petr Kraus3e52eba2019-07-10 01:24:10 +0200823 bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo,
824 uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags stages, const char *vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500825 const char *target) const {
Petr Krausdfd26442019-08-13 03:25:19 +0200826 const VkPipelineStageFlags kCommonStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
827 const VkPipelineStageFlags kFramebufferStages =
828 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
829 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
830 const VkPipelineStageFlags kPrimitiveShadingPipelineStages =
831 kCommonStages | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT |
Petr Kraus3e52eba2019-07-10 01:24:10 +0200832 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT |
833 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT |
Petr Krausdfd26442019-08-13 03:25:19 +0200834 VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT | VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV | kFramebufferStages;
835 const VkPipelineStageFlags kMeshShadingPipelineStages =
836 kCommonStages | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV |
837 VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV | VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV | kFramebufferStages;
838 const VkPipelineStageFlags kFragmentDensityStages = VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT;
839 const VkPipelineStageFlags kConditionalRenderingStages = VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT;
Mike Schuchardtf4c0cb52020-03-17 00:40:13 -0700840 const VkPipelineStageFlags kCommandProcessingPipelineStages = kCommonStages | VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV;
Petr Krausdfd26442019-08-13 03:25:19 +0200841
842 const VkPipelineStageFlags kGraphicsStages = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | kPrimitiveShadingPipelineStages |
843 kMeshShadingPipelineStages | kFragmentDensityStages |
844 kConditionalRenderingStages | kCommandProcessingPipelineStages;
845
Petr Kraus3e52eba2019-07-10 01:24:10 +0200846 bool skip = false;
Petr Krausdfd26442019-08-13 03:25:19 +0200847
848 const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200849 if (subpass == VK_SUBPASS_EXTERNAL)
850 return false;
851 else
Petr Krausdfd26442019-08-13 03:25:19 +0200852 return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage;
Petr Kraus3e52eba2019-07-10 01:24:10 +0200853 };
854
Petr Krausdfd26442019-08-13 03:25:19 +0200855 const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0;
856 if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200857 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700858 LogError(VkRenderPass(0), vuid,
859 "Dependency pDependencies[%" PRIu32
860 "] specifies a %sStageMask that contains stages (%s) that are not part "
861 "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.",
862 dependency_index, target, string_VkPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass);
Petr Kraus3e52eba2019-07-10 01:24:10 +0200863 }
864
865 return skip;
866 };
867
868 template <typename RenderPassCreateInfoGeneric>
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700869 bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700870 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500871 RenderPassCreateVersion rp_version) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700872 bool skip = false;
873 uint32_t max_color_attachments = device_limits.maxColorAttachments;
874 bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2);
875 const char *vuid;
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700876 VkBool32 separate_depth_stencil_layouts = false;
877 const auto *vulkan_12_features = lvl_find_in_chain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext);
878 if (vulkan_12_features) {
879 separate_depth_stencil_layouts = vulkan_12_features->separateDepthStencilLayouts;
880 } else {
881 const auto *separate_depth_stencil_layouts_features =
882 lvl_find_in_chain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR>(device_createinfo_pnext);
883 if (separate_depth_stencil_layouts_features)
884 separate_depth_stencil_layouts = separate_depth_stencil_layouts_features->separateDepthStencilLayouts;
885 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700886
887 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
Piers Daniell4fde9b72019-11-27 16:19:46 -0700888 const auto *attachment_description_stencil_layout =
889 (use_rp2) ? lvl_find_in_chain<VkAttachmentDescriptionStencilLayoutKHR>(
890 reinterpret_cast<VkAttachmentDescription2KHR const *>(&pCreateInfo->pAttachments[i])->pNext)
891 : 0;
892
sfricke-samsungcac6a262020-04-28 07:50:49 -0700893 const VkFormat attachment_format = pCreateInfo->pAttachments[i].format;
894 const VkImageLayout initial_layout = pCreateInfo->pAttachments[i].initialLayout;
895 const VkImageLayout final_layout = pCreateInfo->pAttachments[i].finalLayout;
896 if (attachment_format == VK_FORMAT_UNDEFINED) {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700897 std::stringstream ss;
898 ss << (use_rp2 ? "vkCreateRenderPass2KHR" : "vkCreateRenderPass") << ": pCreateInfo->pAttachments[" << i
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700899 << "].format is VK_FORMAT_UNDEFINED. ";
Mike Schuchardt65847d92019-12-20 13:50:47 -0800900 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-parameter" : "VUID-VkAttachmentDescription-format-parameter";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700901 skip |= LogWarning(device, vuid, "%s", ss.str().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700902 }
sfricke-samsungcac6a262020-04-28 07:50:49 -0700903 if (final_layout == VK_IMAGE_LAYOUT_UNDEFINED || final_layout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mike Schuchardt65847d92019-12-20 13:50:47 -0800904 vuid =
905 use_rp2 ? "VUID-VkAttachmentDescription2-finalLayout-03061" : "VUID-VkAttachmentDescription-finalLayout-00843";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700906 skip |= LogError(device, vuid,
907 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
908 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
909 i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700910 }
Tony-LunarGb036c2f2019-12-05 14:38:25 -0700911 if (!separate_depth_stencil_layouts) {
Piers Daniell9af77cd2019-10-16 13:54:12 -0600912 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
913 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
914 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
915 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -0800916 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03298"
Piers Daniell9af77cd2019-10-16 13:54:12 -0600917 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700918 skip |= LogError(
919 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -0600920 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
921 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
922 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
923 i);
924 }
sfricke-samsungcac6a262020-04-28 07:50:49 -0700925 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
926 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
927 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
928 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -0800929 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-separateDepthStencilLayouts-03299"
Piers Daniell9af77cd2019-10-16 13:54:12 -0600930 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700931 skip |= LogError(
932 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -0600933 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
934 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
935 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
936 i);
937 }
938 }
sfricke-samsungcac6a262020-04-28 07:50:49 -0700939 if (!FormatIsDepthOrStencil(attachment_format)) {
940 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
941 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
942 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
943 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -0800944 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03300" : "VUID-VkAttachmentDescription-format-03286";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700945 skip |= LogError(
946 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -0600947 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
948 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
949 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL",
950 i);
951 }
sfricke-samsungcac6a262020-04-28 07:50:49 -0700952 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
953 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
954 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
955 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -0800956 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03301" : "VUID-VkAttachmentDescription-format-03287";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700957 skip |= LogError(
958 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -0600959 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
960 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
961 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
962 i);
963 }
sfricke-samsungcac6a262020-04-28 07:50:49 -0700964 } else if (FormatIsDepthAndStencil(attachment_format)) {
Piers Daniell9af77cd2019-10-16 13:54:12 -0600965 if (use_rp2) {
966 if (!attachment_description_stencil_layout) {
sfricke-samsungcac6a262020-04-28 07:50:49 -0700967 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
968 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
Piers Daniell9af77cd2019-10-16 13:54:12 -0600969 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700970 LogError(device, "VUID-VkAttachmentDescription2-format-03302",
971 "pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayoutKHR");
Piers Daniell9af77cd2019-10-16 13:54:12 -0600972 }
sfricke-samsungcac6a262020-04-28 07:50:49 -0700973 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
974 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
Piers Daniell9af77cd2019-10-16 13:54:12 -0600975 skip |=
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700976 LogError(device, "VUID-VkAttachmentDescription2-format-03303",
977 "pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayoutKHR");
Piers Daniell9af77cd2019-10-16 13:54:12 -0600978 }
979 }
980 } else {
sfricke-samsungcac6a262020-04-28 07:50:49 -0700981 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
982 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
983 initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
984 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700985 skip |= LogError(
986 device, "VUID-VkAttachmentDescription-format-03288",
Piers Daniell9af77cd2019-10-16 13:54:12 -0600987 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
988 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
989 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
990 i);
991 }
sfricke-samsungcac6a262020-04-28 07:50:49 -0700992 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
993 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
994 final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
995 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -0700996 skip |= LogError(
997 device, "VUID-VkAttachmentDescription-format-03289",
Piers Daniell9af77cd2019-10-16 13:54:12 -0600998 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
999 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
1000 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
1001 i);
1002 }
1003 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001004 } else if (FormatIsDepthOnly(attachment_format)) {
1005 if (initial_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
1006 initial_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001007 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03304" : "VUID-VkAttachmentDescription-format-03290";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001008 skip |= LogError(
1009 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -06001010 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or"
1011 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
1012 i);
1013 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001014 if (final_layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
1015 final_layout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001016 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03305" : "VUID-VkAttachmentDescription-format-03291";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001017 skip |= LogError(
1018 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -06001019 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
1020 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
1021 i);
1022 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001023 } else if (FormatIsStencilOnly(attachment_format)) {
1024 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1025 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001026 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03306" : "VUID-VkAttachmentDescription-format-03292";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001027 skip |= LogError(
1028 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -06001029 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or"
1030 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR",
1031 i);
1032 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001033 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1034 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001035 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03307" : "VUID-VkAttachmentDescription-format-03293";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001036 skip |= LogError(
1037 device, vuid,
Piers Daniell9af77cd2019-10-16 13:54:12 -06001038 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or "
1039 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL",
1040 i);
1041 }
1042 }
1043 if (use_rp2 && attachment_description_stencil_layout) {
1044 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
1045 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1046 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
1047 attachment_description_stencil_layout->stencilInitialLayout ==
1048 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1049 attachment_description_stencil_layout->stencilInitialLayout ==
1050 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1051 attachment_description_stencil_layout->stencilInitialLayout ==
1052 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1053 attachment_description_stencil_layout->stencilInitialLayout ==
1054 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001055 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308",
1056 "VkAttachmentDescriptionStencilLayoutKHR.stencilInitialLayout must not be "
1057 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
1058 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, "
1059 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1060 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1061 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1062 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.");
Piers Daniell9af77cd2019-10-16 13:54:12 -06001063 }
1064 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
1065 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1066 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
1067 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1068 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1069 attachment_description_stencil_layout->stencilFinalLayout ==
1070 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1071 attachment_description_stencil_layout->stencilFinalLayout ==
1072 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001073 skip |= LogError(device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309",
1074 "VkAttachmentDescriptionStencilLayoutKHR.stencilFinalLayout must not be "
1075 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
1076 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, "
1077 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1078 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1079 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1080 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.");
Piers Daniell9af77cd2019-10-16 13:54:12 -06001081 }
1082 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
1083 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001084 skip |= LogError(
1085 device, "VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310",
Piers Daniell9af77cd2019-10-16 13:54:12 -06001086 "VkAttachmentDescriptionStencilLayoutKHR.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or "
1087 "VK_IMAGE_LAYOUT_PREINITIALIZED.");
1088 }
1089 }
sfricke-samsungcac6a262020-04-28 07:50:49 -07001090
1091 if (FormatIsDepthOrStencil(attachment_format)) {
1092 if (initial_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1093 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03295" : "VUID-VkAttachmentDescription-format-03281";
1094 skip |= LogError(device, vuid,
1095 "pCreateInfo->pAttachments[%d].initialLayout must not be "
1096 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
1097 i);
1098 }
1099 if (final_layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
1100 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03297" : "VUID-VkAttachmentDescription-format-03283";
1101 skip |= LogError(device, vuid,
1102 "pCreateInfo->pAttachments[%d].finalLayout must not be "
1103 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL when using a Depth or Stencil format",
1104 i);
1105 }
1106 }
1107 if (FormatIsColor(attachment_format)) {
1108 if (initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1109 initial_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1110 initial_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1111 initial_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1112 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03294" : "VUID-VkAttachmentDescription-format-03280";
1113 skip |= LogError(
1114 device, vuid,
1115 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1116 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1117 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1118 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1119 i);
1120 }
1121 if (final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1122 final_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1123 final_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1124 final_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1125 vuid = use_rp2 ? "VUID-VkAttachmentDescription2-format-03296" : "VUID-VkAttachmentDescription-format-03282";
1126 skip |= LogError(
1127 device, vuid,
1128 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1129 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1130 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1131 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL when using a Color format",
1132 i);
1133 }
1134 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001135 }
1136
1137 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
1138 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
Mike Schuchardt65847d92019-12-20 13:50:47 -08001139 vuid = use_rp2 ? "VUID-VkSubpassDescription2-colorAttachmentCount-03063"
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001140 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001141 skip |= LogError(device, vuid, "Cannot create a render pass with %d color attachments. Max is %d.",
1142 pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001143 }
1144 }
Petr Kraus3e52eba2019-07-10 01:24:10 +02001145
1146 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) {
1147 const auto &dependency = pCreateInfo->pDependencies[i];
1148
sfricke-samsung55f01952020-03-24 08:16:41 -07001149 // Need to check first so layer doesn't segfault from out of bound array access
1150 // src subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001151 if ((dependency.srcSubpass != VK_SUBPASS_EXTERNAL) && (dependency.srcSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001152 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-srcSubpass-02526" : "VUID-VkRenderPassCreateInfo-srcSubpass-02517";
1153 skip |= LogError(device, vuid, "Dependency %u srcSubpass index (%u) has to be less than subpassCount (%u)", i,
1154 dependency.srcSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001155 }
1156
sfricke-samsung55f01952020-03-24 08:16:41 -07001157 // dst subpass bound check
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001158 if ((dependency.dstSubpass != VK_SUBPASS_EXTERNAL) && (dependency.dstSubpass >= pCreateInfo->subpassCount)) {
sfricke-samsung55f01952020-03-24 08:16:41 -07001159 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-dstSubpass-02527" : "VUID-VkRenderPassCreateInfo-dstSubpass-02518";
1160 skip |= LogError(device, vuid, "Dependency %u dstSubpass index (%u) has to be less than subpassCount (%u)", i,
1161 dependency.dstSubpass, pCreateInfo->subpassCount);
Mark Lobodzinskif5a10b62020-03-09 13:16:13 -06001162 }
1163
Petr Kraus3e52eba2019-07-10 01:24:10 +02001164 // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked
Mike Schuchardt65847d92019-12-20 13:50:47 -08001165 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001166 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid,
1167 "src");
1168
Tony-LunarGb036c2f2019-12-05 14:38:25 -07001169 vuid = use_rp2 ? "VUID-VkRenderPassCreateInfo2-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838";
Petr Kraus3e52eba2019-07-10 01:24:10 +02001170 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid,
1171 "dst");
1172 }
1173
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001174 return skip;
1175 }
1176
1177 template <typename T>
1178 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001179 std::unique_lock<std::mutex> lock(renderpass_map_mutex);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001180 auto &renderpass_state = renderpasses_states[renderPass];
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001181 lock.unlock();
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001182
1183 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
1184 bool uses_color = false;
1185 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
1186 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
1187
1188 bool uses_depthstencil = false;
1189 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
1190 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
1191 uses_depthstencil = true;
1192
1193 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
1194 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
1195 }
1196 }
1197
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001198 bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001199
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001200 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001201
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001202 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001203
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001204 bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid,
1205 const char *validateString) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001206
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001207 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001208
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001209 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name,
1210 const char *array_parameter_name, const std::string &unique_error_code,
1211 const std::string &valid_error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001212
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001213 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name,
1214 const std::string &error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001215
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001216 bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkAccelerationStructureNV object_handle,
1217 const char *func_name) const;
1218 bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkAccelerationStructureNV object_handle,
Jason Macnak192fa0e2019-07-26 15:07:16 -07001219 const char *func_name) const;
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001220 bool ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, const char *func_name) const;
1221 bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkAccelerationStructureNV object_handle,
1222 const char *func_nam) const;
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001223 bool ValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1224 const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion,
1225 const char *apiName) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001226 bool ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1227 bool khr) const;
1228 bool ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, VkDeviceSize countBufferOffset,
1229 bool khr) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001230
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001231 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001232
1233 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001234 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001235 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001236 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001237 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator);
1238 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001239 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001240
1241 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001242 VkInstance *pInstance, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001243
1244 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001245 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001246
1247 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001248 VkInstance *pInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001249
1250 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001251 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001252
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001253 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001254 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001255
1256 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001257 const VkAllocationCallbacks *pAllocator, VkImage *pImage) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001258
Jeff Bolz99e3f632020-03-24 22:59:22 -05001259 bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
1260 const VkAllocationCallbacks *pAllocator, VkImageView *pView) const;
1261
Jeff Bolz6d3beaa2019-02-09 21:00:05 -06001262 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName &parameter_name,
Mark Lobodzinski5d8244a2020-01-23 13:00:43 -07001263 VkCommandBuffer object) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001264
1265 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1266 const VkGraphicsPipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001267 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001268 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1269 const VkComputePipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001270 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001271
1272 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001273 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001274 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001275 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001276 VkDescriptorSetLayout *pSetLayout) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001277
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001278 bool validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount,
1279 const VkWriteDescriptorSet *pDescriptorWrites, const bool validateDstSet = true) const;
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001280 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1281 const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001282 const VkCopyDescriptorSet *pDescriptorCopies) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001283
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001284 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001285 const VkDescriptorSet *pDescriptorSets) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001286
1287 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001288 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001289
1290 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001291 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001292
1293 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001294 const VkCommandBuffer *pCommandBuffers) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001295
Jeff Bolz5c801d12019-10-09 10:38:45 -05001296 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001297
1298 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001299 const VkViewport *pViewports) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001300
1301 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001302 const VkRect2D *pScissors) const;
1303 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001304
1305 bool manual_PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001306 uint32_t firstVertex, uint32_t firstInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001307
1308 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001309 uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001310
1311 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001312 uint32_t count, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001313
sfricke-samsungf692b972020-05-02 08:00:45 -07001314 bool manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1315 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1316 uint32_t stride) const;
1317
1318 bool manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1319 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
1320 uint32_t stride) const;
1321
1322 bool manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1323 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1324 uint32_t maxDrawCount, uint32_t stride) const;
1325
1326 bool manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1327 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1328 uint32_t maxDrawCount, uint32_t stride) const;
1329
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001330 bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1331 const VkClearAttachment *pAttachments, uint32_t rectCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001332 const VkClearRect *pRects) const;
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001333
Andrew Fobel3abeb992020-01-20 16:33:22 -05001334 bool ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1335 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1336 VkImageFormatProperties2 *pImageFormatProperties,
1337 const char *apiName) const;
1338 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
1339 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1340 VkImageFormatProperties2 *pImageFormatProperties) const;
1341 bool manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1342 const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
1343 VkImageFormatProperties2 *pImageFormatProperties) const;
1344
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001345 bool manual_PreCallValidateCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
1346 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001347 const VkImageCopy *pRegions) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001348
1349 bool manual_PreCallValidateCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
1350 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001351 const VkImageBlit *pRegions, VkFilter filter) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001352
sfricke-samsung3999ef62020-02-09 17:05:59 -08001353 bool manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
1354 uint32_t regionCount, const VkBufferCopy *pRegions) const;
1355
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001356 bool manual_PreCallValidateCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
1357 VkImageLayout dstImageLayout, uint32_t regionCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001358 const VkBufferImageCopy *pRegions) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001359
1360 bool manual_PreCallValidateCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001361 VkBuffer dstBuffer, uint32_t regionCount,
1362 const VkBufferImageCopy *pRegions) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001363
1364 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001365 VkDeviceSize dataSize, const void *pData) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001366
1367 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001368 VkDeviceSize size, uint32_t data) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001369
1370 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001371 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const;
1372 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001373
1374#ifdef VK_USE_PLATFORM_WIN32_KHR
1375 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001376 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001377#endif // VK_USE_PLATFORM_WIN32_KHR
1378
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001379 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001380 const VkAllocationCallbacks *pAllocator,
1381 VkDescriptorPool *pDescriptorPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001382 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001383 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001384
Jeff Bolz5c801d12019-10-09 10:38:45 -05001385 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001386
1387 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1388 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001389 uint32_t groupCountZ) const;
Jeremy Hayes390ff6f2020-02-10 13:48:57 -07001390 bool manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
1391 VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount,
1392 const VkWriteDescriptorSet *pDescriptorWrites) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001393 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001394 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001395 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1396 uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001397 const VkShadingRatePaletteNV *pShadingRatePalettes) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001398
1399 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1400 uint32_t customSampleOrderCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001401 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001402
Jeff Bolz5c801d12019-10-09 10:38:45 -05001403 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001404 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001405 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001406
1407 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1408 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001409 uint32_t maxDrawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001410
1411 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001412 uint32_t *pPropertyCount,
1413 VkExtensionProperties *pProperties) const;
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001414 bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001415 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const;
Ricardo Garciaa4935972019-02-21 17:43:18 +01001416
1417 bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device,
1418 const VkAccelerationStructureCreateInfoNV *pCreateInfo,
1419 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001420 VkAccelerationStructureNV *pAccelerationStructure) const;
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001421 bool manual_PreCallValidateCreateAccelerationStructureKHR(VkDevice device,
1422 const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
1423 const VkAllocationCallbacks *pAllocator,
1424 VkAccelerationStructureKHR *pAccelerationStructure) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001425 bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer,
1426 const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData,
1427 VkDeviceSize instanceOffset, VkBool32 update,
1428 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001429 VkBuffer scratch, VkDeviceSize scratchOffset) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001430 bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001431 size_t dataSize, void *pData) const;
Peter Chen85366392019-05-14 15:20:11 -04001432 bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1433 const VkRayTracingPipelineCreateInfoNV *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001434 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Jeff Bolz443c2ca2020-03-19 12:11:51 -05001435 bool manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkPipelineCache pipelineCache,
1436 uint32_t createInfoCount,
1437 const VkRayTracingPipelineCreateInfoKHR *pCreateInfos,
1438 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Chris Mayer9ded5eb2019-09-19 16:33:26 +02001439 bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001440 uint32_t viewportCount,
1441 const VkViewportWScalingNV *pViewportWScalings) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001442
1443#ifdef VK_USE_PLATFORM_WIN32_KHR
1444 bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001445 VkDeviceGroupPresentModeFlagsKHR *pModes) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001446#endif // VK_USE_PLATFORM_WIN32_KHR
Tobias Hectorebb855f2019-07-23 12:17:33 +01001447
1448 bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001449 const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const;
Tobias Hectorebb855f2019-07-23 12:17:33 +01001450
Jeff Bolz8125a8b2019-08-16 16:29:45 -05001451 bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001452 uint16_t lineStipplePattern) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001453
1454 bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001455 VkIndexType indexType) const;
sfricke-samsung4ada8d42020-02-09 17:43:11 -08001456 bool manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount,
1457 const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001458
Jeff Bolz5c801d12019-10-09 10:38:45 -05001459 bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001460
Jeff Bolz5c801d12019-10-09 10:38:45 -05001461 bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001462
Petr Kraus3d720392019-11-13 02:52:39 +01001463 bool manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout,
1464 VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) const;
1465
1466 bool manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
1467 uint32_t *pImageIndex) const;
1468
Mark Lobodzinski953b7bc2019-12-19 13:50:10 -07001469 bool manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount,
1470 uint32_t firstInstance, VkBuffer counterBuffer,
1471 VkDeviceSize counterBufferOffset, uint32_t counterOffset,
1472 uint32_t vertexStride) const;
sfricke-samsung11ea8ed2020-01-07 22:24:56 -08001473 bool manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1474 const VkAllocationCallbacks *pAllocator,
1475 VkSamplerYcbcrConversion *pYcbcrConversion) const;
1476 bool manual_PreCallValidateCreateSamplerYcbcrConversionKHR(VkDevice device,
1477 const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
1478 const VkAllocationCallbacks *pAllocator,
1479 VkSamplerYcbcrConversion *pYcbcrConversion) const;
sfricke-samsung1708a8c2020-02-10 00:35:06 -08001480 bool manual_PreCallValidateImportSemaphoreFdKHR(VkDevice device,
1481 const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const;
sourav parmara96ab1a2020-04-25 16:28:23 -07001482
1483 bool manual_PreCallValidateCopyAccelerationStructureToMemoryKHR(VkDevice device,
1484 const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1485
1486 bool manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR(
1487 VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const;
1488
1489 bool manual_PreCallValidateCopyAccelerationStructureKHR(VkDevice device, const VkCopyAccelerationStructureInfoKHR *pInfo) const;
1490
1491 bool manual_PreCallValidateCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
1492 const VkCopyAccelerationStructureInfoKHR *pInfo) const;
1493 bool ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, const char *api_name) const;
1494 bool ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo,
1495 const char *api_name) const;
1496
1497 bool manual_PreCallValidateCopyMemoryToAccelerationStructureKHR(VkDevice device,
1498 const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
1499 bool manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR(
1500 VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const;
sfricke-samsungf692b972020-05-02 08:00:45 -07001501
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001502#include "parameter_validation.h"
1503}; // Class StatelessValidation