blob: 8a36b7822acf699de7ba269d0cbff46dd6e53c06 [file] [log] [blame]
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001/* Copyright (c) 2015-2018 The Khronos Group Inc.
2 * Copyright (c) 2015-2018 Valve Corporation
3 * Copyright (c) 2015-2018 LunarG, Inc.
4 * Copyright (C) 2015-2018 Google Inc.
5 *
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
24#include <bitset>
25
26#include "parameter_name.h"
27#include "vk_typemap_helper.h"
28
29// Suppress unused warning on Linux
30#if defined(__GNUC__)
31#define DECORATE_UNUSED __attribute__((unused))
32#else
33#define DECORATE_UNUSED
34#endif
35
36static const char DECORATE_UNUSED *kVUID_PVError_NONE = "UNASSIGNED-GeneralParameterError-Info";
37static const char DECORATE_UNUSED *kVUID_PVError_InvalidUsage = "UNASSIGNED-GeneralParameterError-InvalidUsage";
38static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructSType = "UNASSIGNED-GeneralParameterError-InvalidStructSType";
39static const char DECORATE_UNUSED *kVUID_PVError_InvalidStructPNext = "UNASSIGNED-GeneralParameterError-InvalidStructPNext";
40static const char DECORATE_UNUSED *kVUID_PVError_RequiredParameter = "UNASSIGNED-GeneralParameterError-RequiredParameter";
41static const char DECORATE_UNUSED *kVUID_PVError_ReservedParameter = "UNASSIGNED-GeneralParameterError-ReservedParameter";
42static const char DECORATE_UNUSED *kVUID_PVError_UnrecognizedValue = "UNASSIGNED-GeneralParameterError-UnrecognizedValue";
43static const char DECORATE_UNUSED *kVUID_PVError_DeviceLimit = "UNASSIGNED-GeneralParameterError-DeviceLimit";
44static const char DECORATE_UNUSED *kVUID_PVError_DeviceFeature = "UNASSIGNED-GeneralParameterError-DeviceFeature";
45static const char DECORATE_UNUSED *kVUID_PVError_FailureCode = "UNASSIGNED-GeneralParameterError-FailureCode";
46static const char DECORATE_UNUSED *kVUID_PVError_ExtensionNotEnabled = "UNASSIGNED-GeneralParameterError-ExtensionNotEnabled";
47
48#undef DECORATE_UNUSED
49
50extern const uint32_t GeneratedVulkanHeaderVersion;
51
52extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits;
53extern const VkColorComponentFlags AllVkColorComponentFlagBits;
54extern const VkShaderStageFlags AllVkShaderStageFlagBits;
55extern const VkQueryControlFlags AllVkQueryControlFlagBits;
56extern const VkImageUsageFlags AllVkImageUsageFlagBits;
57
58extern 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;
65
66struct GenericHeader {
67 VkStructureType sType;
68 const void *pNext;
69};
70
71// String returned by string_VkStructureType for an unrecognized type.
72const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType";
73
74// String returned by string_VkResult for an unrecognized type.
75const std::string UnsupportedResultString = "Unhandled VkResult";
76
77// The base value used when computing the offset for an enumeration token value that is added by an extension.
78// When validating enumeration tokens, any value >= to this value is considered to be provided by an extension.
79// See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification
80const uint32_t ExtEnumBaseValue = 1000000000;
81
82// The value of all VK_xxx_MAX_ENUM tokens
83const uint32_t MaxEnumValue = 0x7FFFFFFF;
84
85// Misc parameters of log_msg that are likely constant per command (or low frequency change)
86struct LogMiscParams {
87 VkDebugReportObjectTypeEXT objectType;
88 uint64_t srcObject;
89 const char *api_name;
90};
91
92class StatelessValidation : public ValidationObject {
93 public:
94 // Map for queue family index to queue count
95 std::unordered_map<uint32_t, uint32_t> queueFamilyIndexMap;
96
97 VkPhysicalDeviceLimits device_limits = {};
98 VkPhysicalDeviceFeatures physical_device_features = {};
99 VkDevice device = VK_NULL_HANDLE;
100 uint32_t api_version;
101
102 // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2KHR::pNext chain
103 struct DeviceExtensionProperties {
104 VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props;
105 VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props;
106 };
107 DeviceExtensionProperties phys_dev_ext_props = {};
108
109 struct SubpassesUsageStates {
110 std::unordered_set<uint32_t> subpasses_using_color_attachment;
111 std::unordered_set<uint32_t> subpasses_using_depthstencil_attachment;
112 };
113
114 std::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states;
115
116 // Constructor for stateles validation tracking
117 // StatelessValidation() : {}
118 /**
119 * Validate a minimum value.
120 *
121 * Verify that the specified value is greater than the specified lower bound.
122 *
123 * @param api_name Name of API call being validated.
124 * @param parameter_name Name of parameter being validated.
125 * @param value Value to validate.
126 * @param lower_bound Lower bound value to use for validation.
127 * @return Boolean value indicating that the call should be skipped.
128 */
129 template <typename T>
130 bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName &parameter_name, const std::string &vuid,
131 const LogMiscParams &misc) {
132 bool skip_call = false;
133
134 if (value <= lower_bound) {
135 std::ostringstream ss;
136 ss << misc.api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is greater than "
137 << lower_bound;
138 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, misc.objectType, misc.srcObject, vuid, "%s",
139 ss.str().c_str());
140 }
141
142 return skip_call;
143 }
144
145 template <typename T>
146 bool ValidateGreaterThanZero(const T value, const ParameterName &parameter_name, const std::string &vuid,
147 const LogMiscParams &misc) {
148 return ValidateGreaterThan(value, T{0}, parameter_name, vuid, misc);
149 }
150 /**
151 * Validate a required pointer.
152 *
153 * Verify that a required pointer is not NULL.
154 *
155 * @param apiName Name of API call being validated.
156 * @param parameterName Name of parameter being validated.
157 * @param value Pointer to validate.
158 * @return Boolean value indicating that the call should be skipped.
159 */
160 bool validate_required_pointer(const char *apiName, const ParameterName &parameterName,
161 const void *value, const std::string &vuid) {
162 bool skip_call = false;
163
164 if (value == NULL) {
165 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
166 "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str());
167 }
168
169 return skip_call;
170 }
171
172 /**
173 * Validate array count and pointer to array.
174 *
175 * Verify that required count and array parameters are not 0 or NULL. If the
176 * count parameter is not optional, verify that it is not 0. If the array
177 * parameter is NULL, and it is not optional, verify that count is 0.
178 *
179 * @param apiName Name of API call being validated.
180 * @param countName Name of count parameter.
181 * @param arrayName Name of array parameter.
182 * @param count Number of elements in the array.
183 * @param array Array to validate.
184 * @param countRequired The 'count' parameter may not be 0 when true.
185 * @param arrayRequired The 'array' parameter may not be NULL when true.
186 * @return Boolean value indicating that the call should be skipped.
187 */
188 template <typename T1, typename T2>
189 bool validate_array(const char *apiName, const ParameterName &countName,
190 const ParameterName &arrayName, T1 count, const T2 *array, bool countRequired, bool arrayRequired,
191 const std::string &count_required_vuid, const std::string &array_required_vuid) {
192 bool skip_call = false;
193
194 // Count parameters not tagged as optional cannot be 0
195 if (countRequired && (count == 0)) {
196 skip_call |=
197 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, count_required_vuid,
198 "%s: parameter %s must be greater than 0.", apiName, countName.get_name().c_str());
199 }
200
201 // Array parameters not tagged as optional cannot be NULL, unless the count is 0
202 if (arrayRequired && (count != 0) && (*array == NULL)) {
203 skip_call |=
204 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, array_required_vuid,
205 "%s: required parameter %s specified as NULL.", apiName, arrayName.get_name().c_str());
206 }
207
208 return skip_call;
209 }
210
211 /**
212 * Validate pointer to array count and pointer to array.
213 *
214 * Verify that required count and array parameters are not NULL. If count
215 * is not NULL and its value is not optional, verify that it is not 0. If the
216 * array parameter is NULL, and it is not optional, verify that count is 0.
217 * The array parameter will typically be optional for this case (where count is
218 * a pointer), allowing the caller to retrieve the available count.
219 *
220 * @param apiName Name of API call being validated.
221 * @param countName Name of count parameter.
222 * @param arrayName Name of array parameter.
223 * @param count Pointer to the number of elements in the array.
224 * @param array Array to validate.
225 * @param countPtrRequired The 'count' parameter may not be NULL when true.
226 * @param countValueRequired The '*count' value may not be 0 when true.
227 * @param arrayRequired The 'array' parameter may not be NULL when true.
228 * @return Boolean value indicating that the call should be skipped.
229 */
230 template <typename T1, typename T2>
231 bool validate_array(const char *apiName, const ParameterName &countName,
232 const ParameterName &arrayName, const T1 *count, const T2 *array, bool countPtrRequired,
233 bool countValueRequired, bool arrayRequired, const std::string &count_required_vuid,
234 const std::string &array_required_vuid) {
235 bool skip_call = false;
236
237 if (count == NULL) {
238 if (countPtrRequired) {
239 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
240 kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", apiName,
241 countName.get_name().c_str());
242 }
243 } else {
244 skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array,
245 countValueRequired, arrayRequired, count_required_vuid, array_required_vuid);
246 }
247
248 return skip_call;
249 }
250
251 /**
252 * Validate a pointer to a Vulkan structure.
253 *
254 * Verify that a required pointer to a structure is not NULL. If the pointer is
255 * not NULL, verify that each structure's sType field is set to the correct
256 * VkStructureType value.
257 *
258 * @param apiName Name of API call being validated.
259 * @param parameterName Name of struct parameter being validated.
260 * @param sTypeName Name of expected VkStructureType value.
261 * @param value Pointer to the struct to validate.
262 * @param sType VkStructureType for structure validation.
263 * @param required The parameter may not be NULL when true.
264 * @return Boolean value indicating that the call should be skipped.
265 */
266 template <typename T>
267 bool validate_struct_type(const char *apiName, const ParameterName &parameterName,
268 const char *sTypeName, const T *value, VkStructureType sType, bool required,
269 const std::string &struct_vuid, const std::string &stype_vuid) {
270 bool skip_call = false;
271
272 if (value == NULL) {
273 if (required) {
274 skip_call |=
275 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, struct_vuid,
276 "%s: required parameter %s specified as NULL", apiName, parameterName.get_name().c_str());
277 }
278 } else if (value->sType != sType) {
279 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, stype_vuid,
280 "%s: parameter %s->sType must be %s.", apiName, parameterName.get_name().c_str(), sTypeName);
281 }
282
283 return skip_call;
284 }
285
286 /**
287 * Validate an array of Vulkan structures
288 *
289 * Verify that required count and array parameters are not 0 or NULL. If
290 * the array contains 1 or more structures, verify that each structure's
291 * sType field is set to the correct VkStructureType value.
292 *
293 * @param apiName Name of API call being validated.
294 * @param countName Name of count parameter.
295 * @param arrayName Name of array parameter.
296 * @param sTypeName Name of expected VkStructureType value.
297 * @param count Number of elements in the array.
298 * @param array Array to validate.
299 * @param sType VkStructureType for structure validation.
300 * @param countRequired The 'count' parameter may not be 0 when true.
301 * @param arrayRequired The 'array' parameter may not be NULL when true.
302 * @return Boolean value indicating that the call should be skipped.
303 */
304 template <typename T>
305 bool validate_struct_type_array(const char *apiName, const ParameterName &countName,
306 const ParameterName &arrayName, const char *sTypeName, uint32_t count, const T *array,
307 VkStructureType sType, bool countRequired, bool arrayRequired, const std::string &stype_vuid,
308 const std::string &param_vuid) {
309 bool skip_call = false;
310
311 if ((count == 0) || (array == NULL)) {
312 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
313 kVUIDUndefined, param_vuid);
314 } else {
315 // Verify that all structs in the array have the correct type
316 for (uint32_t i = 0; i < count; ++i) {
317 if (array[i].sType != sType) {
318 skip_call |=
319 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, stype_vuid,
320 "%s: parameter %s[%d].sType must be %s", apiName, arrayName.get_name().c_str(), i, sTypeName);
321 }
322 }
323 }
324
325 return skip_call;
326 }
327
328 /**
329 * Validate an array of Vulkan structures.
330 *
331 * Verify that required count and array parameters are not NULL. If count
332 * is not NULL and its value is not optional, verify that it is not 0.
333 * If the array contains 1 or more structures, verify that each structure's
334 * sType field is set to the correct VkStructureType value.
335 *
336 * @param apiName Name of API call being validated.
337 * @param countName Name of count parameter.
338 * @param arrayName Name of array parameter.
339 * @param sTypeName Name of expected VkStructureType value.
340 * @param count Pointer to the number of elements in the array.
341 * @param array Array to validate.
342 * @param sType VkStructureType for structure validation.
343 * @param countPtrRequired The 'count' parameter may not be NULL when true.
344 * @param countValueRequired The '*count' value may not be 0 when true.
345 * @param arrayRequired The 'array' parameter may not be NULL when true.
346 * @return Boolean value indicating that the call should be skipped.
347 */
348 template <typename T>
349 bool validate_struct_type_array(const char *apiName, const ParameterName &countName,
350 const ParameterName &arrayName, const char *sTypeName, uint32_t *count, const T *array,
351 VkStructureType sType, bool countPtrRequired, bool countValueRequired, bool arrayRequired,
352 const std::string &stype_vuid, const std::string &param_vuid) {
353 bool skip_call = false;
354
355 if (count == NULL) {
356 if (countPtrRequired) {
357 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
358 kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", apiName,
359 countName.get_name().c_str());
360 }
361 } else {
362 skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType,
363 countValueRequired, arrayRequired, stype_vuid, param_vuid);
364 }
365
366 return skip_call;
367 }
368
369 /**
370 * Validate a Vulkan handle.
371 *
372 * Verify that the specified handle is not VK_NULL_HANDLE.
373 *
374 * @param api_name Name of API call being validated.
375 * @param parameter_name Name of struct parameter being validated.
376 * @param value Handle to validate.
377 * @return Boolean value indicating that the call should be skipped.
378 */
379 template <typename T>
380 bool validate_required_handle(const char *api_name, const ParameterName &parameter_name,
381 T value) {
382 bool skip_call = false;
383
384 if (value == VK_NULL_HANDLE) {
385 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
386 kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE", api_name,
387 parameter_name.get_name().c_str());
388 }
389
390 return skip_call;
391 }
392
393 /**
394 * Validate an array of Vulkan handles.
395 *
396 * Verify that required count and array parameters are not NULL. If count
397 * is not NULL and its value is not optional, verify that it is not 0.
398 * If the array contains 1 or more handles, verify that no handle is set to
399 * VK_NULL_HANDLE.
400 *
401 * @note This function is only intended to validate arrays of handles when none
402 * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles
403 * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead.
404 *
405 * @param api_name Name of API call being validated.
406 * @param count_name Name of count parameter.
407 * @param array_name Name of array parameter.
408 * @param count Number of elements in the array.
409 * @param array Array to validate.
410 * @param count_required The 'count' parameter may not be 0 when true.
411 * @param array_required The 'array' parameter may not be NULL when true.
412 * @return Boolean value indicating that the call should be skipped.
413 */
414 template <typename T>
415 bool validate_handle_array(const char *api_name, const ParameterName &count_name,
416 const ParameterName &array_name, uint32_t count, const T *array, bool count_required,
417 bool array_required) {
418 bool skip_call = false;
419
420 if ((count == 0) || (array == NULL)) {
421 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required,
422 array_required, kVUIDUndefined, kVUIDUndefined);
423 } else {
424 // Verify that no handles in the array are VK_NULL_HANDLE
425 for (uint32_t i = 0; i < count; ++i) {
426 if (array[i] == VK_NULL_HANDLE) {
427 skip_call |=
428 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
429 kVUID_PVError_RequiredParameter, "%s: required parameter %s[%d] specified as VK_NULL_HANDLE",
430 api_name, array_name.get_name().c_str(), i);
431 }
432 }
433 }
434
435 return skip_call;
436 }
437
438 /**
439 * Validate string array count and content.
440 *
441 * Verify that required count and array parameters are not 0 or NULL. If the
442 * count parameter is not optional, verify that it is not 0. If the array
443 * parameter is NULL, and it is not optional, verify that count is 0. If the
444 * array parameter is not NULL, verify that none of the strings are NULL.
445 *
446 * @param apiName Name of API call being validated.
447 * @param countName Name of count parameter.
448 * @param arrayName Name of array parameter.
449 * @param count Number of strings in the array.
450 * @param array Array of strings to validate.
451 * @param countRequired The 'count' parameter may not be 0 when true.
452 * @param arrayRequired The 'array' parameter may not be NULL when true.
453 * @return Boolean value indicating that the call should be skipped.
454 */
455 bool validate_string_array(const char *apiName, const ParameterName &countName,
456 const ParameterName &arrayName, uint32_t count, const char *const *array, bool countRequired,
457 bool arrayRequired, const std::string &count_required_vuid,
458 const std::string &array_required_vuid) {
459 bool skip_call = false;
460
461 if ((count == 0) || (array == NULL)) {
462 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
463 count_required_vuid, array_required_vuid);
464 } else {
465 // Verify that strings in the array are not NULL
466 for (uint32_t i = 0; i < count; ++i) {
467 if (array[i] == NULL) {
468 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
469 kVUID_PVError_RequiredParameter, "%s: required parameter %s[%d] specified as NULL",
470 apiName, arrayName.get_name().c_str(), i);
471 }
472 }
473 }
474
475 return skip_call;
476 }
477
478 // Forward declaration for pNext validation
479 bool ValidatePnextStructContents(const char *api_name, const ParameterName &parameter_name,
480 const GenericHeader *header);
481
482 /**
483 * Validate a structure's pNext member.
484 *
485 * Verify that the specified pNext value points to the head of a list of
486 * allowed extension structures. If no extension structures are allowed,
487 * verify that pNext is null.
488 *
489 * @param api_name Name of API call being validated.
490 * @param parameter_name Name of parameter being validated.
491 * @param allowed_struct_names Names of allowed structs.
492 * @param next Pointer to validate.
493 * @param allowed_type_count Total number of allowed structure types.
494 * @param allowed_types Array of structure types allowed for pNext.
495 * @param header_version Version of header defining the pNext validation rules.
496 * @return Boolean value indicating that the call should be skipped.
497 */
498 bool validate_struct_pnext(const char *api_name, const ParameterName &parameter_name,
499 const char *allowed_struct_names, const void *next, size_t allowed_type_count,
500 const VkStructureType *allowed_types, uint32_t header_version, const std::string &vuid) {
501 bool skip_call = false;
502 std::unordered_set<const void *> cycle_check;
503 std::unordered_set<VkStructureType, std::hash<int>> unique_stype_check;
504
505 const char disclaimer[] =
506 "This warning is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that you "
507 "are "
508 "using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in "
509 "which "
510 "case your use of %s is perfectly valid but is not guaranteed to work correctly with validation enabled";
511
512 // TODO: The valid pNext structure types are not recursive. Each structure has its own list of valid sTypes for pNext.
513 // Codegen a map of vectors containing the allowable pNext types for each struct and use that here -- also simplifies parms.
514 if (next != NULL) {
515 if (allowed_type_count == 0) {
516 std::string message = "%s: value of %s must be NULL. ";
517 message += disclaimer;
518 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
519 message.c_str(), api_name, parameter_name.get_name().c_str(), header_version,
520 parameter_name.get_name().c_str());
521 } else {
522 const VkStructureType *start = allowed_types;
523 const VkStructureType *end = allowed_types + allowed_type_count;
524 const GenericHeader *current = reinterpret_cast<const GenericHeader *>(next);
525
526 cycle_check.insert(next);
527
528 while (current != NULL) {
529 if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) ||
530 (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) &&
531 ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) ||
532 (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) {
533 if (cycle_check.find(current->pNext) != cycle_check.end()) {
534 std::string message = "%s: %s chain contains a cycle -- pNext pointer " PRIx64 " is repeated.";
535 skip_call |=
536 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
537 kVUID_PVError_InvalidStructPNext, message.c_str(), api_name,
538 parameter_name.get_name().c_str(), reinterpret_cast<uint64_t>(next));
539 break;
540 } else {
541 cycle_check.insert(current->pNext);
542 }
543
544 std::string type_name = string_VkStructureType(current->sType);
545 if (unique_stype_check.find(current->sType) != unique_stype_check.end()) {
546 std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times.";
547 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
548 VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, kVUID_PVError_InvalidStructPNext,
549 message.c_str(), api_name, parameter_name.get_name().c_str(), type_name.c_str());
550 } else {
551 unique_stype_check.insert(current->sType);
552 }
553
554 if (std::find(start, end, current->sType) == end) {
555 if (type_name == UnsupportedStructureTypeString) {
556 std::string message =
557 "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures are "
558 "[%s]. ";
559 message += disclaimer;
560 skip_call |=
561 log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
562 0, vuid, message.c_str(), api_name, parameter_name.get_name().c_str(), current->sType,
563 allowed_struct_names, header_version, parameter_name.get_name().c_str());
564 } else {
565 std::string message =
566 "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures are "
567 "[%s]. ";
568 message += disclaimer;
569 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
570 VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, message.c_str(), api_name,
571 parameter_name.get_name().c_str(), type_name.c_str(), allowed_struct_names,
572 header_version, parameter_name.get_name().c_str());
573 }
574 }
575 skip_call |= ValidatePnextStructContents(api_name, parameter_name, current);
576 }
577 current = reinterpret_cast<const GenericHeader *>(current->pNext);
578 }
579 }
580 }
581
582 return skip_call;
583 }
584
585 /**
586 * Validate a VkBool32 value.
587 *
588 * Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
589 *
590 * @param apiName Name of API call being validated.
591 * @param parameterName Name of parameter being validated.
592 * @param value Boolean value to validate.
593 * @return Boolean value indicating that the call should be skipped.
594 */
595 bool validate_bool32(const char *apiName, const ParameterName &parameterName,
596 VkBool32 value) {
597 bool skip_call = false;
598
599 if ((value != VK_TRUE) && (value != VK_FALSE)) {
600 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
601 kVUID_PVError_UnrecognizedValue, "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE", apiName,
602 parameterName.get_name().c_str(), value);
603 }
604
605 return skip_call;
606 }
607
608 /**
609 * Validate a Vulkan enumeration value.
610 *
611 * Generate a warning if an enumeration token value does not fall within the core enumeration
612 * begin and end token values, and was not added to the enumeration by an extension. Extension
613 * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
614 * with 1,000,000,000 as the base token value.
615 *
616 * @note This function does not expect to process enumerations defining bitmask flag bits.
617 *
618 * @param apiName Name of API call being validated.
619 * @param parameterName Name of parameter being validated.
620 * @param enumName Name of the enumeration being validated.
621 * @param valid_values The list of valid values for the enumeration.
622 * @param value Enumeration value to validate.
623 * @return Boolean value indicating that the call should be skipped.
624 */
625 template <typename T>
626 bool validate_ranged_enum(const char *apiName, const ParameterName &parameterName,
627 const char *enumName, const std::vector<T> &valid_values, T value, const std::string &vuid) {
628 bool skip = false;
629
630 if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) {
631 skip |=
632 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
633 "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is "
634 "not an extension added token.",
635 apiName, parameterName.get_name().c_str(), value, enumName);
636 }
637
638 return skip;
639 }
640
641 /**
642 * Validate an array of Vulkan enumeration value.
643 *
644 * Process all enumeration token values in the specified array and generate a warning if a value
645 * does not fall within the core enumeration begin and end token values, and was not added to
646 * the enumeration by an extension. Extension provided enumerations use the equation specified
647 * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
648 *
649 * @note This function does not expect to process enumerations defining bitmask flag bits.
650 *
651 * @param apiName Name of API call being validated.
652 * @param countName Name of count parameter.
653 * @param arrayName Name of array parameter.
654 * @param enumName Name of the enumeration being validated.
655 * @param valid_values The list of valid values for the enumeration.
656 * @param count Number of enumeration values in the array.
657 * @param array Array of enumeration values to validate.
658 * @param countRequired The 'count' parameter may not be 0 when true.
659 * @param arrayRequired The 'array' parameter may not be NULL when true.
660 * @return Boolean value indicating that the call should be skipped.
661 */
662 template <typename T>
663 bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName,
664 const ParameterName &arrayName, const char *enumName, const std::vector<T> &valid_values,
665 uint32_t count, const T *array, bool countRequired, bool arrayRequired) {
666 bool skip_call = false;
667
668 if ((count == 0) || (array == NULL)) {
669 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
670 kVUIDUndefined, kVUIDUndefined);
671 } else {
672 for (uint32_t i = 0; i < count; ++i) {
673 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
674 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
675 kVUID_PVError_UnrecognizedValue,
676 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
677 "enumeration tokens and is not an extension added token",
678 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
679 }
680 }
681 }
682
683 return skip_call;
684 }
685
686 /**
687 * Verify that a reserved VkFlags value is zero.
688 *
689 * Verify that the specified value is zero, to check VkFlags values that are reserved for
690 * future use.
691 *
692 * @param api_name Name of API call being validated.
693 * @param parameter_name Name of parameter being validated.
694 * @param value Value to validate.
695 * @return Boolean value indicating that the call should be skipped.
696 */
697 bool validate_reserved_flags(const char *api_name, const ParameterName &parameter_name,
698 VkFlags value, const std::string &vuid) {
699 bool skip_call = false;
700
701 if (value != 0) {
702 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
703 "%s: parameter %s must be 0.", api_name, parameter_name.get_name().c_str());
704 }
705
706 return skip_call;
707 }
708
709 /**
710 * Validate a Vulkan bitmask value.
711 *
712 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
713 * for that type.
714 *
715 * @param api_name Name of API call being validated.
716 * @param parameter_name Name of parameter being validated.
717 * @param flag_bits_name Name of the VkFlags type being validated.
718 * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated.
719 * @param value VkFlags value to validate.
720 * @param flags_required The 'value' parameter may not be 0 when true.
721 * @param singleFlag The 'value' parameter may not contain more than one bit from all_flags.
722 * @return Boolean value indicating that the call should be skipped.
723 */
724 bool validate_flags(const char *api_name, const ParameterName &parameter_name,
725 const char *flag_bits_name, VkFlags all_flags, VkFlags value, bool flags_required, bool singleFlag,
726 const std::string &vuid) {
727 bool skip_call = false;
728
729 if (value == 0) {
730 if (flags_required) {
731 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
732 "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str());
733 }
734 } else if ((value & (~all_flags)) != 0) {
735 skip_call |=
736 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
737 kVUID_PVError_UnrecognizedValue, "%s: value of %s contains flag bits that are not recognized members of %s",
738 api_name, parameter_name.get_name().c_str(), flag_bits_name);
739 } else if (singleFlag && (std::bitset<sizeof(VkFlags) * 8>(value).count() > 1)) {
740 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
741 kVUID_PVError_UnrecognizedValue,
742 "%s: value of %s contains multiple members of %s when only a single value is allowed", api_name,
743 parameter_name.get_name().c_str(), flag_bits_name);
744 }
745
746 return skip_call;
747 }
748
749 /**
750 * Validate an array of Vulkan bitmask values.
751 *
752 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
753 * for that type.
754 *
755 * @param api_name Name of API call being validated.
756 * @param count_name Name of parameter being validated.
757 * @param array_name Name of parameter being validated.
758 * @param flag_bits_name Name of the VkFlags type being validated.
759 * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated.
760 * @param count Number of VkFlags values in the array.
761 * @param array Array of VkFlags value to validate.
762 * @param count_required The 'count' parameter may not be 0 when true.
763 * @param array_required The 'array' parameter may not be NULL when true.
764 * @return Boolean value indicating that the call should be skipped.
765 */
766 bool validate_flags_array(const char *api_name, const ParameterName &count_name,
767 const ParameterName &array_name, const char *flag_bits_name, VkFlags all_flags, uint32_t count,
768 const VkFlags *array, bool count_required, bool array_required) {
769 bool skip_call = false;
770
771 if ((count == 0) || (array == NULL)) {
772 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required,
773 array_required, kVUIDUndefined, kVUIDUndefined);
774 } else {
775 // Verify that all VkFlags values in the array
776 for (uint32_t i = 0; i < count; ++i) {
777 if (array[i] == 0) {
778 // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if
779 // elements in the array are allowed be 0
780 if (array_required) {
781 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
782 kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0", api_name,
783 array_name.get_name().c_str(), i);
784 }
785 } else if ((array[i] & (~all_flags)) != 0) {
786 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
787 kVUID_PVError_UnrecognizedValue,
788 "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name,
789 array_name.get_name().c_str(), i, flag_bits_name);
790 }
791 }
792 }
793
794 return skip_call;
795 }
796
797 template <typename ExtensionState>
798 bool validate_extension_reqs(const ExtensionState &extensions,
799 const std::string &vuid, const char *extension_type, const char *extension_name) {
800 bool skip = false;
801 if (!extension_name) {
802 return skip; // Robust to invalid char *
803 }
804 auto info = ExtensionState::get_info(extension_name);
805
806 if (!info.state) {
807 return skip; // Unknown extensions cannot be checked so report OK
808 }
809
810 // Check against the required list in the info
811 std::vector<const char *> missing;
812 for (const auto &req : info.requires) {
813 if (!(extensions.*(req.enabled))) {
814 missing.push_back(req.name);
815 }
816 }
817
818 // Report any missing requirements
819 if (missing.size()) {
820 std::string missing_joined_list = string_join(", ", missing);
821 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT,
822 HandleToUint64(instance), vuid, "Missing extension%s required by the %s extension %s: %s.",
823 ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str());
824 }
825 return skip;
826 }
827
828 enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
829
830 template <typename RenderPassCreateInfoGeneric>
831 bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo,
832 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
833 RenderPassCreateVersion rp_version) {
834 bool skip = false;
835 uint32_t max_color_attachments = device_limits.maxColorAttachments;
836 bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2);
837 const char *vuid;
838
839 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
840 if (pCreateInfo->pAttachments[i].format == VK_FORMAT_UNDEFINED) {
841 std::stringstream ss;
842 ss << (use_rp2 ? "vkCreateRenderPass2KHR" : "vkCreateRenderPass") << ": pCreateInfo->pAttachments[" << i
843 << "].format is VK_FORMAT_UNDEFINED. ";
844 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-parameter" : "VUID-VkAttachmentDescription-format-parameter";
845 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
846 vuid, "%s", ss.str().c_str());
847 }
848 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
849 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
850 vuid =
851 use_rp2 ? "VUID-VkAttachmentDescription2KHR-finalLayout-03061" : "VUID-VkAttachmentDescription-finalLayout-00843";
852 skip |=
853 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
854 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
855 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
856 i);
857 }
858 }
859
860 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
861 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
862 vuid = use_rp2 ? "VUID-VkSubpassDescription2KHR-colorAttachmentCount-03063"
863 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
864 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
865 vuid, "Cannot create a render pass with %d color attachments. Max is %d.",
866 pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments);
867 }
868 }
869 return skip;
870 }
871
872 template <typename T>
873 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
874 auto &renderpass_state = renderpasses_states[renderPass];
875
876 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
877 bool uses_color = false;
878 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
879 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
880
881 bool uses_depthstencil = false;
882 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
883 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
884 uses_depthstencil = true;
885
886 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
887 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
888 }
889 }
890
891 bool require_device_extension(bool flag, char const *function_name, char const *extension_name);
892
893
894 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo);
895
896 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version);
897
898 bool validate_string(const char *apiName, const ParameterName &stringName,
899 const std::string &vuid, const char *validateString);
900
901 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order);
902
903 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families,
904 const char *cmd_name, const char *array_parameter_name, const std::string &unique_error_code,
905 const std::string &valid_error_code, bool optional);
906
907 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name,
908 const char *parameter_name, const std::string &error_code, bool optional);
909
910 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name);
911
912 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
913 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass);
914 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo,
915 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass);
916 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator);
917 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
918 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice);
919
920 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
921 VkInstance *pInstance);
922
923 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
924 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool);
925
926 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
927 VkInstance *pInstance);
928
929 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
930 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice);
931
932 bool manual_PreCallValidateGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue);
933
934 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
935 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer);
936
937 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
938 const VkAllocationCallbacks *pAllocator, VkImage *pImage);
939
940 bool manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
941 const VkAllocationCallbacks *pAllocator, VkImageView *pView);
942
943 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name,
944 const char *param_name, VkDebugReportObjectTypeEXT object_type, uint64_t object);
945
946 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
947 const VkGraphicsPipelineCreateInfo *pCreateInfos,
948 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines);
949 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
950 const VkComputePipelineCreateInfo *pCreateInfos,
951 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines);
952
953 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
954 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler);
955 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
956 const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout);
957
958 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites,
959 uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies);
960 ;
961 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
962 const VkDescriptorSet *pDescriptorSets);
963
964 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
965 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass);
966
967 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo,
968 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass);
969
970 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
971 const VkCommandBuffer *pCommandBuffers);
972
973 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo);
974
975 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
976 const VkViewport *pViewports);
977
978 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
979 const VkRect2D *pScissors);
980 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth);
981
982 bool manual_PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount,
983 uint32_t firstVertex, uint32_t firstInstance);
984
985 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count,
986 uint32_t stride);
987
988 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
989 uint32_t count, uint32_t stride);
990
991 bool manual_PreCallValidateCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
992 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
993 const VkImageCopy *pRegions);
994
995 bool manual_PreCallValidateCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
996 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
997 const VkImageBlit *pRegions, VkFilter filter);
998
999 bool manual_PreCallValidateCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
1000 VkImageLayout dstImageLayout, uint32_t regionCount,
1001 const VkBufferImageCopy *pRegions);
1002
1003 bool manual_PreCallValidateCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
1004 VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions);
1005
1006 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
1007 VkDeviceSize dataSize, const void *pData);
1008
1009 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
1010 VkDeviceSize size, uint32_t data);
1011
1012 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
1013 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain);
1014 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo);
1015
1016#ifdef VK_USE_PLATFORM_WIN32_KHR
1017 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
1018 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
1019#endif // VK_USE_PLATFORM_WIN32_KHR
1020
1021 bool manual_PreCallValidateDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo);
1022
1023 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
1024 const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool);
1025 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
1026 uint32_t groupCountZ);
1027
1028 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset);
1029
1030 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1031 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
1032 uint32_t groupCountZ);
1033 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
1034 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors);
1035 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1036 uint32_t viewportCount,
1037 const VkShadingRatePaletteNV *pShadingRatePalettes);
1038
1039 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1040 uint32_t customSampleOrderCount,
1041 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders);
1042
1043 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask);
1044 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1045 uint32_t drawCount, uint32_t stride);
1046
1047 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1048 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
1049 uint32_t maxDrawCount, uint32_t stride);
1050 bool manual_PreCallValidateCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
1051 const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool);
1052
1053 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
1054 uint32_t *pPropertyCount, VkExtensionProperties *pProperties);
1055#include "parameter_validation.h"
1056}; // Class StatelessValidation