blob: dbf906ef33f20f22ddc7838ecec0799618f287f8 [file] [log] [blame]
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001/* Copyright (c) 2015-2019 The Khronos Group Inc.
2 * Copyright (c) 2015-2019 Valve Corporation
3 * Copyright (c) 2015-2019 LunarG, Inc.
4 * Copyright (C) 2015-2019 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";
locke-lunargb1909cd2019-08-01 23:40:05 -060045static const char DECORATE_UNUSED *kVUID_PVPerfWarn_SuboptimalSwapchain = "UNASSIGNED-GeneralParameterPerfWarn-SuboptimalSwapchain";
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070046
47#undef DECORATE_UNUSED
48
49extern const uint32_t GeneratedVulkanHeaderVersion;
50
51extern const VkQueryPipelineStatisticFlags AllVkQueryPipelineStatisticFlagBits;
52extern const VkColorComponentFlags AllVkColorComponentFlagBits;
53extern const VkShaderStageFlags AllVkShaderStageFlagBits;
54extern const VkQueryControlFlags AllVkQueryControlFlagBits;
55extern const VkImageUsageFlags AllVkImageUsageFlagBits;
Mark Lobodzinski876d5b52019-08-06 16:32:27 -060056extern const VkSampleCountFlags AllVkSampleCountFlagBits;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070057
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;
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;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070068
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070069// String returned by string_VkStructureType for an unrecognized type.
70const std::string UnsupportedStructureTypeString = "Unhandled VkStructureType";
71
72// String returned by string_VkResult for an unrecognized type.
73const std::string UnsupportedResultString = "Unhandled VkResult";
74
75// The base value used when computing the offset for an enumeration token value that is added by an extension.
76// When validating enumeration tokens, any value >= to this value is considered to be provided by an extension.
77// See Appendix C.10 "Assigning Extension Token Values" from the Vulkan specification
78const uint32_t ExtEnumBaseValue = 1000000000;
79
80// The value of all VK_xxx_MAX_ENUM tokens
81const uint32_t MaxEnumValue = 0x7FFFFFFF;
82
83// Misc parameters of log_msg that are likely constant per command (or low frequency change)
84struct LogMiscParams {
85 VkDebugReportObjectTypeEXT objectType;
86 uint64_t srcObject;
87 const char *api_name;
88};
89
90class StatelessValidation : public ValidationObject {
Petr Kraus4ed81e32019-09-02 23:41:19 +020091 public:
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070092 VkPhysicalDeviceLimits device_limits = {};
Petr Kraus715bcc72019-08-15 17:17:33 +020093 safe_VkPhysicalDeviceFeatures2 physical_device_features2;
94 const VkPhysicalDeviceFeatures &physical_device_features = physical_device_features2.features;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -070095
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -070096 // Override chassis read/write locks for this validation object
97 // This override takes a deferred lock. i.e. it is not acquired.
Jeff Bolzcaeccc72019-10-15 15:35:26 -050098 virtual read_lock_guard_t read_lock() { return read_lock_guard_t(validation_object_mutex, std::defer_lock); }
99 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 -0700100
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700101 // Device extension properties -- storing properties gathered from VkPhysicalDeviceProperties2KHR::pNext chain
102 struct DeviceExtensionProperties {
103 VkPhysicalDeviceShadingRateImagePropertiesNV shading_rate_image_props;
104 VkPhysicalDeviceMeshShaderPropertiesNV mesh_shader_props;
Jason Macnak5c954952019-07-09 15:46:12 -0700105 VkPhysicalDeviceRayTracingPropertiesNV ray_tracing_props;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700106 };
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
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -0700114 // Though this validation object is predominantly statless, the Framebuffer checks are greatly simplified by creating and
115 // updating a map of the renderpass usage states, and these accesses need thread protection. Use a mutex separate from the
116 // parent object's to maintain that functionality.
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500117 mutable std::mutex renderpass_map_mutex;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700118 std::unordered_map<VkRenderPass, SubpassesUsageStates> renderpasses_states;
119
120 // Constructor for stateles validation tracking
121 // StatelessValidation() : {}
122 /**
123 * Validate a minimum value.
124 *
125 * Verify that the specified value is greater than the specified lower bound.
126 *
127 * @param api_name Name of API call being validated.
128 * @param parameter_name Name of parameter being validated.
129 * @param value Value to validate.
130 * @param lower_bound Lower bound value to use for validation.
131 * @return Boolean value indicating that the call should be skipped.
132 */
133 template <typename T>
134 bool ValidateGreaterThan(const T value, const T lower_bound, const ParameterName &parameter_name, const std::string &vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500135 const LogMiscParams &misc) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700136 bool skip_call = false;
137
138 if (value <= lower_bound) {
139 std::ostringstream ss;
140 ss << misc.api_name << ": parameter " << parameter_name.get_name() << " (= " << value << ") is greater than "
141 << lower_bound;
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700142 skip_call |=
143 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, misc.objectType, misc.srcObject, vuid, "%s", ss.str().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700144 }
145
146 return skip_call;
147 }
148
149 template <typename T>
150 bool ValidateGreaterThanZero(const T value, const ParameterName &parameter_name, const std::string &vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500151 const LogMiscParams &misc) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700152 return ValidateGreaterThan(value, T{0}, parameter_name, vuid, misc);
153 }
154 /**
155 * Validate a required pointer.
156 *
157 * Verify that a required pointer is not NULL.
158 *
159 * @param apiName Name of API call being validated.
160 * @param parameterName Name of parameter being validated.
161 * @param value Pointer to validate.
162 * @return Boolean value indicating that the call should be skipped.
163 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700164 bool validate_required_pointer(const char *apiName, const ParameterName &parameterName, const void *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500165 const std::string &vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700166 bool skip_call = false;
167
168 if (value == NULL) {
169 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
170 "%s: required parameter %s specified as NULL.", apiName, parameterName.get_name().c_str());
171 }
172
173 return skip_call;
174 }
175
176 /**
177 * Validate array count and pointer to array.
178 *
179 * Verify that required count and array parameters are not 0 or NULL. If the
180 * count parameter is not optional, verify that it is not 0. If the array
181 * parameter is NULL, and it is not optional, verify that count is 0.
182 *
183 * @param apiName Name of API call being validated.
184 * @param countName Name of count parameter.
185 * @param arrayName Name of array parameter.
186 * @param count Number of elements in the array.
187 * @param array Array to validate.
188 * @param countRequired The 'count' parameter may not be 0 when true.
189 * @param arrayRequired The 'array' parameter may not be NULL when true.
190 * @return Boolean value indicating that the call should be skipped.
191 */
192 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700193 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, T1 count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600194 const T2 *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500195 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700196 bool skip_call = false;
197
198 // Count parameters not tagged as optional cannot be 0
199 if (countRequired && (count == 0)) {
200 skip_call |=
201 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, count_required_vuid,
202 "%s: parameter %s must be greater than 0.", apiName, countName.get_name().c_str());
203 }
204
205 // Array parameters not tagged as optional cannot be NULL, unless the count is 0
206 if (arrayRequired && (count != 0) && (*array == NULL)) {
207 skip_call |=
208 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, array_required_vuid,
209 "%s: required parameter %s specified as NULL.", apiName, arrayName.get_name().c_str());
210 }
211
212 return skip_call;
213 }
214
215 /**
216 * Validate pointer to array count and pointer to array.
217 *
218 * Verify that required count and array parameters are not NULL. If count
219 * is not NULL and its value is not optional, verify that it is not 0. If the
220 * array parameter is NULL, and it is not optional, verify that count is 0.
221 * The array parameter will typically be optional for this case (where count is
222 * a pointer), allowing the caller to retrieve the available count.
223 *
224 * @param apiName Name of API call being validated.
225 * @param countName Name of count parameter.
226 * @param arrayName Name of array parameter.
227 * @param count Pointer to the number of elements in the array.
228 * @param array Array to validate.
229 * @param countPtrRequired The 'count' parameter may not be NULL when true.
230 * @param countValueRequired The '*count' value may not be 0 when true.
231 * @param arrayRequired The 'array' parameter may not be NULL when true.
232 * @return Boolean value indicating that the call should be skipped.
233 */
234 template <typename T1, typename T2>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700235 bool validate_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, const T1 *count,
236 const T2 *array, bool countPtrRequired, bool countValueRequired, bool arrayRequired,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500237 const char *count_required_vuid, const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700238 bool skip_call = false;
239
240 if (count == NULL) {
241 if (countPtrRequired) {
242 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
243 kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", apiName,
244 countName.get_name().c_str());
245 }
246 } else {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700247 skip_call |= validate_array(apiName, countName, arrayName, *array ? (*count) : 0, &array, countValueRequired,
248 arrayRequired, count_required_vuid, array_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700249 }
250
251 return skip_call;
252 }
253
254 /**
255 * Validate a pointer to a Vulkan structure.
256 *
257 * Verify that a required pointer to a structure is not NULL. If the pointer is
258 * not NULL, verify that each structure's sType field is set to the correct
259 * VkStructureType value.
260 *
261 * @param apiName Name of API call being validated.
262 * @param parameterName Name of struct parameter being validated.
263 * @param sTypeName Name of expected VkStructureType value.
264 * @param value Pointer to the struct to validate.
265 * @param sType VkStructureType for structure validation.
266 * @param required The parameter may not be NULL when true.
267 * @return Boolean value indicating that the call should be skipped.
268 */
269 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700270 bool validate_struct_type(const char *apiName, const ParameterName &parameterName, const char *sTypeName, const T *value,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500271 VkStructureType sType, bool required, const char *struct_vuid, const char *stype_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700272 bool skip_call = false;
273
274 if (value == NULL) {
275 if (required) {
276 skip_call |=
277 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, struct_vuid,
278 "%s: required parameter %s specified as NULL", apiName, parameterName.get_name().c_str());
279 }
280 } else if (value->sType != sType) {
281 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, stype_vuid,
282 "%s: parameter %s->sType must be %s.", apiName, parameterName.get_name().c_str(), sTypeName);
283 }
284
285 return skip_call;
286 }
287
288 /**
289 * Validate an array of Vulkan structures
290 *
291 * Verify that required count and array parameters are not 0 or NULL. If
292 * the array contains 1 or more structures, verify that each structure's
293 * sType field is set to the correct VkStructureType value.
294 *
295 * @param apiName Name of API call being validated.
296 * @param countName Name of count parameter.
297 * @param arrayName Name of array parameter.
298 * @param sTypeName Name of expected VkStructureType value.
299 * @param count Number of elements in the array.
300 * @param array Array to validate.
301 * @param sType VkStructureType for structure validation.
302 * @param countRequired The 'count' parameter may not be 0 when true.
303 * @param arrayRequired The 'array' parameter may not be NULL when true.
304 * @return Boolean value indicating that the call should be skipped.
305 */
306 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700307 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
308 const char *sTypeName, uint32_t count, const T *array, VkStructureType sType,
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800309 bool countRequired, bool arrayRequired, const char *stype_vuid, const char *param_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500310 const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700311 bool skip_call = false;
312
313 if ((count == 0) || (array == NULL)) {
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800314 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
315 count_required_vuid, param_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700316 } else {
317 // Verify that all structs in the array have the correct type
318 for (uint32_t i = 0; i < count; ++i) {
319 if (array[i].sType != sType) {
320 skip_call |=
321 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, stype_vuid,
322 "%s: parameter %s[%d].sType must be %s", apiName, arrayName.get_name().c_str(), i, sTypeName);
323 }
324 }
325 }
326
327 return skip_call;
328 }
329
330 /**
331 * Validate an array of Vulkan structures.
332 *
333 * Verify that required count and array parameters are not NULL. If count
334 * is not NULL and its value is not optional, verify that it is not 0.
335 * If the array contains 1 or more structures, verify that each structure's
336 * sType field is set to the correct VkStructureType value.
337 *
338 * @param apiName Name of API call being validated.
339 * @param countName Name of count parameter.
340 * @param arrayName Name of array parameter.
341 * @param sTypeName Name of expected VkStructureType value.
342 * @param count Pointer to the number of elements in the array.
343 * @param array Array to validate.
344 * @param sType VkStructureType for structure validation.
345 * @param countPtrRequired The 'count' parameter may not be NULL when true.
346 * @param countValueRequired The '*count' value may not be 0 when true.
347 * @param arrayRequired The 'array' parameter may not be NULL when true.
348 * @return Boolean value indicating that the call should be skipped.
349 */
350 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700351 bool validate_struct_type_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
352 const char *sTypeName, uint32_t *count, const T *array, VkStructureType sType,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600353 bool countPtrRequired, bool countValueRequired, bool arrayRequired, const char *stype_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500354 const char *param_vuid, const char *count_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700355 bool skip_call = false;
356
357 if (count == NULL) {
358 if (countPtrRequired) {
359 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
360 kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as NULL", apiName,
361 countName.get_name().c_str());
362 }
363 } else {
364 skip_call |= validate_struct_type_array(apiName, countName, arrayName, sTypeName, (*count), array, sType,
Jasper St. Pierre6c98f8c2019-01-22 15:18:03 -0800365 countValueRequired, arrayRequired, stype_vuid, param_vuid, count_required_vuid);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700366 }
367
368 return skip_call;
369 }
370
371 /**
372 * Validate a Vulkan handle.
373 *
374 * Verify that the specified handle is not VK_NULL_HANDLE.
375 *
376 * @param api_name Name of API call being validated.
377 * @param parameter_name Name of struct parameter being validated.
378 * @param value Handle to validate.
379 * @return Boolean value indicating that the call should be skipped.
380 */
381 template <typename T>
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500382 bool validate_required_handle(const char *api_name, const ParameterName &parameter_name, T value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700383 bool skip_call = false;
384
385 if (value == VK_NULL_HANDLE) {
386 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
387 kVUID_PVError_RequiredParameter, "%s: required parameter %s specified as VK_NULL_HANDLE", api_name,
388 parameter_name.get_name().c_str());
389 }
390
391 return skip_call;
392 }
393
394 /**
395 * Validate an array of Vulkan handles.
396 *
397 * Verify that required count and array parameters are not NULL. If count
398 * is not NULL and its value is not optional, verify that it is not 0.
399 * If the array contains 1 or more handles, verify that no handle is set to
400 * VK_NULL_HANDLE.
401 *
402 * @note This function is only intended to validate arrays of handles when none
403 * of the handles are allowed to be VK_NULL_HANDLE. For arrays of handles
404 * that are allowed to contain VK_NULL_HANDLE, use validate_array() instead.
405 *
406 * @param api_name Name of API call being validated.
407 * @param count_name Name of count parameter.
408 * @param array_name Name of array parameter.
409 * @param count Number of elements in the array.
410 * @param array Array to validate.
411 * @param count_required The 'count' parameter may not be 0 when true.
412 * @param array_required The 'array' parameter may not be NULL when true.
413 * @return Boolean value indicating that the call should be skipped.
414 */
415 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700416 bool validate_handle_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500417 uint32_t count, const T *array, bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700418 bool skip_call = false;
419
420 if ((count == 0) || (array == NULL)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700421 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
422 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700423 } 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 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700455 bool validate_string_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName, uint32_t count,
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600456 const char *const *array, bool countRequired, bool arrayRequired, const char *count_required_vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500457 const char *array_required_vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700458 bool skip_call = false;
459
460 if ((count == 0) || (array == NULL)) {
461 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired,
462 count_required_vuid, array_required_vuid);
463 } else {
464 // Verify that strings in the array are not NULL
465 for (uint32_t i = 0; i < count; ++i) {
466 if (array[i] == NULL) {
467 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
468 kVUID_PVError_RequiredParameter, "%s: required parameter %s[%d] specified as NULL",
469 apiName, arrayName.get_name().c_str(), i);
470 }
471 }
472 }
473
474 return skip_call;
475 }
476
477 // Forward declaration for pNext validation
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500478 bool ValidatePnextStructContents(const char *api_name, const ParameterName &parameter_name,
479 const VkBaseOutStructure *header) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700480
481 /**
482 * Validate a structure's pNext member.
483 *
484 * Verify that the specified pNext value points to the head of a list of
485 * allowed extension structures. If no extension structures are allowed,
486 * verify that pNext is null.
487 *
488 * @param api_name Name of API call being validated.
489 * @param parameter_name Name of parameter being validated.
490 * @param allowed_struct_names Names of allowed structs.
491 * @param next Pointer to validate.
492 * @param allowed_type_count Total number of allowed structure types.
493 * @param allowed_types Array of structure types allowed for pNext.
494 * @param header_version Version of header defining the pNext validation rules.
495 * @return Boolean value indicating that the call should be skipped.
496 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700497 bool validate_struct_pnext(const char *api_name, const ParameterName &parameter_name, const char *allowed_struct_names,
498 const void *next, size_t allowed_type_count, const VkStructureType *allowed_types,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500499 uint32_t header_version, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700500 bool skip_call = false;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700501
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700502 // TODO: The valid pNext structure types are not recursive. Each structure has its own list of valid sTypes for pNext.
503 // Codegen a map of vectors containing the allowable pNext types for each struct and use that here -- also simplifies parms.
504 if (next != NULL) {
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600505 std::unordered_set<const void *> cycle_check;
506 std::unordered_set<VkStructureType, std::hash<int>> unique_stype_check;
507
Jeff Bolz6d3beaa2019-02-09 21:00:05 -0600508 const char *disclaimer =
509 "This warning is based on the Valid Usage documentation for version %d of the Vulkan header. It is possible that "
510 "you "
511 "are "
512 "using a struct from a private extension or an extension that was added to a later version of the Vulkan header, "
513 "in "
514 "which "
515 "case your use of %s is perfectly valid but is not guaranteed to work correctly with validation enabled";
516
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700517 if (allowed_type_count == 0) {
518 std::string message = "%s: value of %s must be NULL. ";
519 message += disclaimer;
520 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
521 message.c_str(), api_name, parameter_name.get_name().c_str(), header_version,
522 parameter_name.get_name().c_str());
523 } else {
524 const VkStructureType *start = allowed_types;
525 const VkStructureType *end = allowed_types + allowed_type_count;
Lockefbdd1af2019-04-16 15:07:23 -0600526 const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(next);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700527
528 cycle_check.insert(next);
529
530 while (current != NULL) {
531 if (((strncmp(api_name, "vkCreateInstance", strlen(api_name)) != 0) ||
532 (current->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO)) &&
533 ((strncmp(api_name, "vkCreateDevice", strlen(api_name)) != 0) ||
534 (current->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO))) {
535 if (cycle_check.find(current->pNext) != cycle_check.end()) {
536 std::string message = "%s: %s chain contains a cycle -- pNext pointer " PRIx64 " is repeated.";
537 skip_call |=
538 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
539 kVUID_PVError_InvalidStructPNext, message.c_str(), api_name,
540 parameter_name.get_name().c_str(), reinterpret_cast<uint64_t>(next));
541 break;
542 } else {
543 cycle_check.insert(current->pNext);
544 }
545
546 std::string type_name = string_VkStructureType(current->sType);
547 if (unique_stype_check.find(current->sType) != unique_stype_check.end()) {
548 std::string message = "%s: %s chain contains duplicate structure types: %s appears multiple times.";
549 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
550 VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, kVUID_PVError_InvalidStructPNext,
551 message.c_str(), api_name, parameter_name.get_name().c_str(), type_name.c_str());
552 } else {
553 unique_stype_check.insert(current->sType);
554 }
555
556 if (std::find(start, end, current->sType) == end) {
557 if (type_name == UnsupportedStructureTypeString) {
558 std::string message =
559 "%s: %s chain includes a structure with unknown VkStructureType (%d); Allowed structures are "
560 "[%s]. ";
561 message += disclaimer;
562 skip_call |=
563 log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
564 0, vuid, message.c_str(), api_name, parameter_name.get_name().c_str(), current->sType,
565 allowed_struct_names, header_version, parameter_name.get_name().c_str());
566 } else {
567 std::string message =
568 "%s: %s chain includes a structure with unexpected VkStructureType %s; Allowed structures are "
569 "[%s]. ";
570 message += disclaimer;
571 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
572 VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, message.c_str(), api_name,
573 parameter_name.get_name().c_str(), type_name.c_str(), allowed_struct_names,
574 header_version, parameter_name.get_name().c_str());
575 }
576 }
577 skip_call |= ValidatePnextStructContents(api_name, parameter_name, current);
578 }
Lockefbdd1af2019-04-16 15:07:23 -0600579 current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700580 }
581 }
582 }
583
584 return skip_call;
585 }
586
587 /**
588 * Validate a VkBool32 value.
589 *
590 * Generate a warning if a VkBool32 value is neither VK_TRUE nor VK_FALSE.
591 *
592 * @param apiName Name of API call being validated.
593 * @param parameterName Name of parameter being validated.
594 * @param value Boolean value to validate.
595 * @return Boolean value indicating that the call should be skipped.
596 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500597 bool validate_bool32(const char *apiName, const ParameterName &parameterName, VkBool32 value) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700598 bool skip_call = false;
599
600 if ((value != VK_TRUE) && (value != VK_FALSE)) {
601 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
602 kVUID_PVError_UnrecognizedValue, "%s: value of %s (%d) is neither VK_TRUE nor VK_FALSE", apiName,
603 parameterName.get_name().c_str(), value);
604 }
605
606 return skip_call;
607 }
608
609 /**
610 * Validate a Vulkan enumeration value.
611 *
612 * Generate a warning if an enumeration token value does not fall within the core enumeration
613 * begin and end token values, and was not added to the enumeration by an extension. Extension
614 * provided enumerations use the equation specified in Appendix C.10 of the Vulkan specification,
615 * with 1,000,000,000 as the base token value.
616 *
617 * @note This function does not expect to process enumerations defining bitmask flag bits.
618 *
619 * @param apiName Name of API call being validated.
620 * @param parameterName Name of parameter being validated.
621 * @param enumName Name of the enumeration being validated.
622 * @param valid_values The list of valid values for the enumeration.
623 * @param value Enumeration value to validate.
624 * @return Boolean value indicating that the call should be skipped.
625 */
626 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700627 bool validate_ranged_enum(const char *apiName, const ParameterName &parameterName, const char *enumName,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500628 const std::vector<T> &valid_values, T value, const char *vuid) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700629 bool skip = false;
630
631 if (std::find(valid_values.begin(), valid_values.end(), value) == valid_values.end()) {
632 skip |=
633 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
634 "%s: value of %s (%d) does not fall within the begin..end range of the core %s enumeration tokens and is "
635 "not an extension added token.",
636 apiName, parameterName.get_name().c_str(), value, enumName);
637 }
638
639 return skip;
640 }
641
642 /**
643 * Validate an array of Vulkan enumeration value.
644 *
645 * Process all enumeration token values in the specified array and generate a warning if a value
646 * does not fall within the core enumeration begin and end token values, and was not added to
647 * the enumeration by an extension. Extension provided enumerations use the equation specified
648 * in Appendix C.10 of the Vulkan specification, with 1,000,000,000 as the base token value.
649 *
650 * @note This function does not expect to process enumerations defining bitmask flag bits.
651 *
652 * @param apiName Name of API call being validated.
653 * @param countName Name of count parameter.
654 * @param arrayName Name of array parameter.
655 * @param enumName Name of the enumeration being validated.
656 * @param valid_values The list of valid values for the enumeration.
657 * @param count Number of enumeration values in the array.
658 * @param array Array of enumeration values to validate.
659 * @param countRequired The 'count' parameter may not be 0 when true.
660 * @param arrayRequired The 'array' parameter may not be NULL when true.
661 * @return Boolean value indicating that the call should be skipped.
662 */
663 template <typename T>
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700664 bool validate_ranged_enum_array(const char *apiName, const ParameterName &countName, const ParameterName &arrayName,
665 const char *enumName, const std::vector<T> &valid_values, uint32_t count, const T *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500666 bool countRequired, bool arrayRequired) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700667 bool skip_call = false;
668
669 if ((count == 0) || (array == NULL)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700670 skip_call |= validate_array(apiName, countName, arrayName, count, &array, countRequired, arrayRequired, kVUIDUndefined,
671 kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700672 } else {
673 for (uint32_t i = 0; i < count; ++i) {
674 if (std::find(valid_values.begin(), valid_values.end(), array[i]) == valid_values.end()) {
675 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
676 kVUID_PVError_UnrecognizedValue,
677 "%s: value of %s[%d] (%d) does not fall within the begin..end range of the core %s "
678 "enumeration tokens and is not an extension added token",
679 apiName, arrayName.get_name().c_str(), i, array[i], enumName);
680 }
681 }
682 }
683
684 return skip_call;
685 }
686
687 /**
688 * Verify that a reserved VkFlags value is zero.
689 *
690 * Verify that the specified value is zero, to check VkFlags values that are reserved for
691 * future use.
692 *
693 * @param api_name Name of API call being validated.
694 * @param parameter_name Name of parameter being validated.
695 * @param value Value to validate.
696 * @return Boolean value indicating that the call should be skipped.
697 */
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500698 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 -0700699 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
Petr Kraus52758be2019-08-12 00:53:58 +0200709 enum FlagType { kRequiredFlags, kOptionalFlags, kRequiredSingleBit, kOptionalSingleBit };
710
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700711 /**
712 * Validate a Vulkan bitmask value.
713 *
714 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
715 * for that type.
716 *
717 * @param api_name Name of API call being validated.
718 * @param parameter_name Name of parameter being validated.
719 * @param flag_bits_name Name of the VkFlags type being validated.
720 * @param all_flags A bit mask combining all valid flag bits for the VkFlags type being validated.
721 * @param value VkFlags value to validate.
Petr Kraus52758be2019-08-12 00:53:58 +0200722 * @param flag_type The type of flag, like optional, or single bit.
723 * @param vuid VUID used for flag that is outside defined bits (or has more than one bit for Bits type).
724 * @param flags_zero_vuid VUID used for non-optional Flags that are zero.
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700725 * @return Boolean value indicating that the call should be skipped.
726 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700727 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 -0500728 VkFlags value, const FlagType flag_type, const char *vuid, const char *flags_zero_vuid = nullptr) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700729 bool skip_call = false;
730
Petr Kraus52758be2019-08-12 00:53:58 +0200731 if ((value & ~all_flags) != 0) {
732 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
733 "%s: value of %s contains flag bits that are not recognized members of %s", api_name,
734 parameter_name.get_name().c_str(), flag_bits_name);
735 }
736
737 const bool required = flag_type == kRequiredFlags || flag_type == kRequiredSingleBit;
738 const char *zero_vuid = flag_type == kRequiredFlags ? flags_zero_vuid : vuid;
739 if (required && value == 0) {
740 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, zero_vuid,
741 "%s: value of %s must not be 0.", api_name, parameter_name.get_name().c_str());
742 }
743
744 const auto HasMaxOneBitSet = [](const VkFlags f) {
745 // Decrement flips bits from right upto first 1.
746 // Rest stays same, and if there was any other 1s &ded together they would be non-zero. QED
747 return f == 0 || !(f & (f - 1));
748 };
749
750 const bool is_bits_type = flag_type == kRequiredSingleBit || flag_type == kOptionalSingleBit;
751 if (is_bits_type && !HasMaxOneBitSet(value)) {
752 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700753 "%s: value of %s contains multiple members of %s when only a single value is allowed", api_name,
754 parameter_name.get_name().c_str(), flag_bits_name);
755 }
756
757 return skip_call;
758 }
759
760 /**
761 * Validate an array of Vulkan bitmask values.
762 *
763 * Generate a warning if a value with a VkFlags derived type does not contain valid flag bits
764 * for that type.
765 *
766 * @param api_name Name of API call being validated.
767 * @param count_name Name of parameter being validated.
768 * @param array_name Name of parameter being validated.
769 * @param flag_bits_name Name of the VkFlags type being validated.
770 * @param all_flags A bitmask combining all valid flag bits for the VkFlags type being validated.
771 * @param count Number of VkFlags values in the array.
772 * @param array Array of VkFlags value to validate.
773 * @param count_required The 'count' parameter may not be 0 when true.
774 * @param array_required The 'array' parameter may not be NULL when true.
775 * @return Boolean value indicating that the call should be skipped.
776 */
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700777 bool validate_flags_array(const char *api_name, const ParameterName &count_name, const ParameterName &array_name,
778 const char *flag_bits_name, VkFlags all_flags, uint32_t count, const VkFlags *array,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500779 bool count_required, bool array_required) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700780 bool skip_call = false;
781
782 if ((count == 0) || (array == NULL)) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700783 skip_call |= validate_array(api_name, count_name, array_name, count, &array, count_required, array_required,
784 kVUIDUndefined, kVUIDUndefined);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700785 } else {
786 // Verify that all VkFlags values in the array
787 for (uint32_t i = 0; i < count; ++i) {
788 if (array[i] == 0) {
789 // Current XML registry logic for validity generation uses the array parameter's optional tag to determine if
790 // elements in the array are allowed be 0
791 if (array_required) {
792 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
793 kVUID_PVError_RequiredParameter, "%s: value of %s[%d] must not be 0", api_name,
794 array_name.get_name().c_str(), i);
795 }
796 } else if ((array[i] & (~all_flags)) != 0) {
797 skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
798 kVUID_PVError_UnrecognizedValue,
799 "%s: value of %s[%d] contains flag bits that are not recognized members of %s", api_name,
800 array_name.get_name().c_str(), i, flag_bits_name);
801 }
802 }
803 }
804
805 return skip_call;
806 }
807
808 template <typename ExtensionState>
Jeff Bolzfdd0d852019-02-03 21:55:12 -0600809 bool validate_extension_reqs(const ExtensionState &extensions, const char *vuid, const char *extension_type,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500810 const char *extension_name) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700811 bool skip = false;
812 if (!extension_name) {
813 return skip; // Robust to invalid char *
814 }
815 auto info = ExtensionState::get_info(extension_name);
816
817 if (!info.state) {
818 return skip; // Unknown extensions cannot be checked so report OK
819 }
820
821 // Check against the required list in the info
822 std::vector<const char *> missing;
823 for (const auto &req : info.requires) {
824 if (!(extensions.*(req.enabled))) {
825 missing.push_back(req.name);
826 }
827 }
828
829 // Report any missing requirements
830 if (missing.size()) {
831 std::string missing_joined_list = string_join(", ", missing);
832 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700833 HandleToUint64(instance), vuid, "Missing extension%s required by the %s extension %s: %s.",
834 ((missing.size() > 1) ? "s" : ""), extension_type, extension_name, missing_joined_list.c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700835 }
836 return skip;
837 }
838
839 enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
840
841 template <typename RenderPassCreateInfoGeneric>
Petr Kraus3e52eba2019-07-10 01:24:10 +0200842 bool ValidateSubpassGraphicsFlags(const debug_report_data *report_data, const RenderPassCreateInfoGeneric *pCreateInfo,
843 uint32_t dependency_index, uint32_t subpass, VkPipelineStageFlags stages, const char *vuid,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500844 const char *target) const {
Petr Krausdfd26442019-08-13 03:25:19 +0200845 const VkPipelineStageFlags kCommonStages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT | VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
846 const VkPipelineStageFlags kFramebufferStages =
847 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
848 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
849 const VkPipelineStageFlags kPrimitiveShadingPipelineStages =
850 kCommonStages | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT |
Petr Kraus3e52eba2019-07-10 01:24:10 +0200851 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT |
852 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT |
Petr Krausdfd26442019-08-13 03:25:19 +0200853 VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT | VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV | kFramebufferStages;
854 const VkPipelineStageFlags kMeshShadingPipelineStages =
855 kCommonStages | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV |
856 VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV | VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV | kFramebufferStages;
857 const VkPipelineStageFlags kFragmentDensityStages = VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT;
858 const VkPipelineStageFlags kConditionalRenderingStages = VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT;
859 const VkPipelineStageFlags kCommandProcessingPipelineStages = kCommonStages | VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX;
860
861 const VkPipelineStageFlags kGraphicsStages = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | kPrimitiveShadingPipelineStages |
862 kMeshShadingPipelineStages | kFragmentDensityStages |
863 kConditionalRenderingStages | kCommandProcessingPipelineStages;
864
Petr Kraus3e52eba2019-07-10 01:24:10 +0200865 bool skip = false;
Petr Krausdfd26442019-08-13 03:25:19 +0200866
867 const auto IsPipeline = [pCreateInfo](uint32_t subpass, const VkPipelineBindPoint stage) {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200868 if (subpass == VK_SUBPASS_EXTERNAL)
869 return false;
870 else
Petr Krausdfd26442019-08-13 03:25:19 +0200871 return pCreateInfo->pSubpasses[subpass].pipelineBindPoint == stage;
Petr Kraus3e52eba2019-07-10 01:24:10 +0200872 };
873
Petr Krausdfd26442019-08-13 03:25:19 +0200874 const bool is_all_graphics_stages = (stages & ~kGraphicsStages) == 0;
875 if (IsPipeline(subpass, VK_PIPELINE_BIND_POINT_GRAPHICS) && !is_all_graphics_stages) {
Petr Kraus3e52eba2019-07-10 01:24:10 +0200876 skip |=
877 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, 0, vuid,
878 "Dependency pDependencies[%" PRIu32
879 "] specifies a %sStageMask that contains stages (%s) that are not part "
880 "of the Graphics pipeline, as specified by the %sSubpass (= %" PRIu32 ") in pipelineBindPoint.",
881 dependency_index, target, string_VkPipelineStageFlags(stages & ~kGraphicsStages).c_str(), target, subpass);
882 }
883
884 return skip;
885 };
886
887 template <typename RenderPassCreateInfoGeneric>
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700888 bool CreateRenderPassGeneric(VkDevice device, const RenderPassCreateInfoGeneric *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700889 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass,
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500890 RenderPassCreateVersion rp_version) const {
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700891 bool skip = false;
892 uint32_t max_color_attachments = device_limits.maxColorAttachments;
893 bool use_rp2 = (rp_version == RENDER_PASS_VERSION_2);
894 const char *vuid;
Piers Daniell9af77cd2019-10-16 13:54:12 -0600895 const auto *separate_depth_stencil_layouts_features =
896 lvl_find_in_chain<VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR>(physical_device_features2.pNext);
897 const auto *attachment_description_stencil_layout =
898 lvl_find_in_chain<VkAttachmentDescriptionStencilLayoutKHR>(pCreateInfo->pNext);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700899
900 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
901 if (pCreateInfo->pAttachments[i].format == VK_FORMAT_UNDEFINED) {
902 std::stringstream ss;
903 ss << (use_rp2 ? "vkCreateRenderPass2KHR" : "vkCreateRenderPass") << ": pCreateInfo->pAttachments[" << i
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700904 << "].format is VK_FORMAT_UNDEFINED. ";
905 vuid =
906 use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-parameter" : "VUID-VkAttachmentDescription-format-parameter";
907 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
908 "%s", ss.str().c_str());
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700909 }
910 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
911 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
Mark Lobodzinskibf599b92018-12-31 12:15:55 -0700912 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-finalLayout-03061"
913 : "VUID-VkAttachmentDescription-finalLayout-00843";
914 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
915 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED or "
916 "VK_IMAGE_LAYOUT_PREINITIALIZED.",
917 i);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -0700918 }
Piers Daniell9af77cd2019-10-16 13:54:12 -0600919 if (!separate_depth_stencil_layouts_features || !separate_depth_stencil_layouts_features->separateDepthStencilLayouts) {
920 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
921 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
922 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
923 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
924 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-separateDepthStencilLayouts-03298"
925 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03284";
926 skip |= log_msg(
927 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
928 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
929 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
930 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
931 i);
932 }
933 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
934 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
935 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
936 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
937 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-separateDepthStencilLayouts-03299"
938 : "VUID-VkAttachmentDescription-separateDepthStencilLayouts-03285";
939 skip |= log_msg(
940 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
941 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
942 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
943 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
944 i);
945 }
946 }
947 if (!FormatIsDepthOrStencil(pCreateInfo->pAttachments[i].format)) {
948 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
949 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
950 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
951 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
952 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03300" : "VUID-VkAttachmentDescription-format-03286";
953 skip |= log_msg(
954 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
955 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
956 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
957 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMA_KHRL",
958 i);
959 }
960 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
961 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
962 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
963 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
964 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03301" : "VUID-VkAttachmentDescription-format-03287";
965 skip |= log_msg(
966 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
967 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
968 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
969 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
970 i);
971 }
972 } else if (FormatIsDepthAndStencil(pCreateInfo->pAttachments[i].format)) {
973 if (use_rp2) {
974 if (!attachment_description_stencil_layout) {
975 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
976 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
977 skip |=
978 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
979 "VUID-VkAttachmentDescription2KHR-format-03302",
980 "pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayoutKHR");
981 }
982 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
983 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
984 skip |=
985 log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
986 "VUID-VkAttachmentDescription2KHR-format-03303",
987 "pCreateInfo->pNext must include an instance of VkAttachmentDescriptionStencilLayoutKHR");
988 }
989 }
990 } else {
991 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
992 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
993 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
994 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
995 skip |= log_msg(
996 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
997 "VUID-VkAttachmentDescription-format-03288",
998 "pCreateInfo->pAttachments[%d].initialLayout 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 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1004 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
1005 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
1006 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
1007 skip |= log_msg(
1008 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
1009 "VUID-VkAttachmentDescription-format-03289",
1010 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, "
1011 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
1012 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
1013 i);
1014 }
1015 }
1016 } else if (FormatIsDepthOnly(pCreateInfo->pAttachments[i].format)) {
1017 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
1018 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
1019 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03304" : "VUID-VkAttachmentDescription-format-03290";
1020 skip |= log_msg(
1021 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
1022 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or"
1023 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
1024 i);
1025 }
1026 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
1027 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR) {
1028 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03305" : "VUID-VkAttachmentDescription-format-03291";
1029 skip |= log_msg(
1030 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
1031 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR, or "
1032 "VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR",
1033 i);
1034 }
1035 } else if (FormatIsStencilOnly(pCreateInfo->pAttachments[i].format)) {
1036 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1037 pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
1038 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03306" : "VUID-VkAttachmentDescription-format-03292";
1039 skip |= log_msg(
1040 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
1041 "pCreateInfo->pAttachments[%d].initialLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or"
1042 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR",
1043 i);
1044 }
1045 if (pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1046 pCreateInfo->pAttachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR) {
1047 vuid = use_rp2 ? "VUID-VkAttachmentDescription2KHR-format-03307" : "VUID-VkAttachmentDescription-format-03293";
1048 skip |= log_msg(
1049 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
1050 "pCreateInfo->pAttachments[%d].finalLayout must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, or "
1051 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMA_KHRL",
1052 i);
1053 }
1054 }
1055 if (use_rp2 && attachment_description_stencil_layout) {
1056 if (attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
1057 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1058 attachment_description_stencil_layout->stencilInitialLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
1059 attachment_description_stencil_layout->stencilInitialLayout ==
1060 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1061 attachment_description_stencil_layout->stencilInitialLayout ==
1062 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1063 attachment_description_stencil_layout->stencilInitialLayout ==
1064 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1065 attachment_description_stencil_layout->stencilInitialLayout ==
1066 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1067 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
1068 "VUID-VkAttachmentDescriptionStencilLayoutKHR-stencilInitialLayout-03308",
1069 "VkAttachmentDescriptionStencilLayoutKHR.stencilInitialLayout must not be "
1070 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
1071 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, "
1072 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1073 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1074 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1075 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.");
1076 }
1077 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
1078 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
1079 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR ||
1080 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
1081 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL ||
1082 attachment_description_stencil_layout->stencilFinalLayout ==
1083 VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL ||
1084 attachment_description_stencil_layout->stencilFinalLayout ==
1085 VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) {
1086 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
1087 "VUID-VkAttachmentDescriptionStencilLayoutKHR-stencilFinalLayout-03309",
1088 "VkAttachmentDescriptionStencilLayoutKHR.stencilFinalLayout must not be "
1089 "VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, "
1090 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR, "
1091 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
1092 "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, "
1093 "VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or "
1094 "VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.");
1095 }
1096 if (attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_UNDEFINED ||
1097 attachment_description_stencil_layout->stencilFinalLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
1098 skip |= log_msg(
1099 report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
1100 "VUID-VkAttachmentDescriptionStencilLayoutKHR-stencilFinalLayout-03310",
1101 "VkAttachmentDescriptionStencilLayoutKHR.stencilFinalLayout must not be VK_IMAGE_LAYOUT_UNDEFINED, or "
1102 "VK_IMAGE_LAYOUT_PREINITIALIZED.");
1103 }
1104 }
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001105 }
1106
1107 for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
1108 if (pCreateInfo->pSubpasses[i].colorAttachmentCount > max_color_attachments) {
1109 vuid = use_rp2 ? "VUID-VkSubpassDescription2KHR-colorAttachmentCount-03063"
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001110 : "VUID-VkSubpassDescription-colorAttachmentCount-00845";
1111 skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid,
1112 "Cannot create a render pass with %d color attachments. Max is %d.",
1113 pCreateInfo->pSubpasses[i].colorAttachmentCount, max_color_attachments);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001114 }
1115 }
Petr Kraus3e52eba2019-07-10 01:24:10 +02001116
1117 for (uint32_t i = 0; i < pCreateInfo->dependencyCount; ++i) {
1118 const auto &dependency = pCreateInfo->pDependencies[i];
1119
1120 // Spec currently only supports Graphics pipeline in render pass -- so only that pipeline is currently checked
1121 vuid =
1122 use_rp2 ? "VUID-VkRenderPassCreateInfo2KHR-pDependencies-03054" : "VUID-VkRenderPassCreateInfo-pDependencies-00837";
1123 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.srcSubpass, dependency.srcStageMask, vuid,
1124 "src");
1125
1126 vuid =
1127 use_rp2 ? "VUID-VkRenderPassCreateInfo2KHR-pDependencies-03055" : "VUID-VkRenderPassCreateInfo-pDependencies-00838";
1128 skip |= ValidateSubpassGraphicsFlags(report_data, pCreateInfo, i, dependency.dstSubpass, dependency.dstStageMask, vuid,
1129 "dst");
1130 }
1131
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001132 return skip;
1133 }
1134
1135 template <typename T>
1136 void RecordRenderPass(VkRenderPass renderPass, const T *pCreateInfo) {
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001137 std::unique_lock<std::mutex> lock(renderpass_map_mutex);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001138 auto &renderpass_state = renderpasses_states[renderPass];
Mark Lobodzinskif27a6bc2019-02-04 13:00:49 -07001139 lock.unlock();
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001140
1141 for (uint32_t subpass = 0; subpass < pCreateInfo->subpassCount; ++subpass) {
1142 bool uses_color = false;
1143 for (uint32_t i = 0; i < pCreateInfo->pSubpasses[subpass].colorAttachmentCount && !uses_color; ++i)
1144 if (pCreateInfo->pSubpasses[subpass].pColorAttachments[i].attachment != VK_ATTACHMENT_UNUSED) uses_color = true;
1145
1146 bool uses_depthstencil = false;
1147 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment)
1148 if (pCreateInfo->pSubpasses[subpass].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
1149 uses_depthstencil = true;
1150
1151 if (uses_color) renderpass_state.subpasses_using_color_attachment.insert(subpass);
1152 if (uses_depthstencil) renderpass_state.subpasses_using_depthstencil_attachment.insert(subpass);
1153 }
1154 }
1155
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001156 bool require_device_extension(bool flag, char const *function_name, char const *extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001157
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001158 bool validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001159
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001160 bool validate_api_version(uint32_t api_version, uint32_t effective_api_version) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001161
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001162 bool validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid,
1163 const char *validateString) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001164
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001165 bool ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001166
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001167 bool ValidateQueueFamilies(uint32_t queue_family_count, const uint32_t *queue_families, const char *cmd_name,
1168 const char *array_parameter_name, const std::string &unique_error_code,
1169 const std::string &valid_error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001170
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001171 bool ValidateDeviceQueueFamily(uint32_t queue_family, const char *cmd_name, const char *parameter_name,
1172 const std::string &error_code, bool optional);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001173
Jason Macnak192fa0e2019-07-26 15:07:16 -07001174 bool ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, VkDebugReportObjectTypeEXT object_type,
1175 uint64_t object_handle, const char *func_name) const;
1176 bool ValidateGeometryAABBNV(const VkGeometryAABBNV &geometry, VkDebugReportObjectTypeEXT object_type, uint64_t object_handle,
1177 const char *func_name) const;
1178 bool ValidateGeometryNV(const VkGeometryNV &geometry, VkDebugReportObjectTypeEXT object_type, uint64_t object_handle,
1179 const char *func_name) const;
1180 bool ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, VkDebugReportObjectTypeEXT object_type,
1181 uint64_t object_handle, const char *func_nam) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001182
Jeff Bolz46c0ea02019-10-09 13:06:29 -05001183 bool OutputExtensionError(const std::string &api_name, const std::string &extension_name) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001184
1185 void PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001186 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001187 void PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001188 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001189 void PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator);
1190 void PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001191 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001192
1193 void PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Mark Lobodzinskicd05c1e2019-01-17 15:33:46 -07001194 VkInstance *pInstance, VkResult result);
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001195
locke-lunargb1909cd2019-08-01 23:40:05 -06001196 void PostCallRecordQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo, VkResult result);
1197
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001198 bool manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001199 const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001200
1201 bool manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001202 VkInstance *pInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001203
1204 bool manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001205 const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001206
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001207 bool manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001208 const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001209
1210 bool manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001211 const VkAllocationCallbacks *pAllocator, VkImage *pImage) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001212
Jeff Bolz6d3beaa2019-02-09 21:00:05 -06001213 bool manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, const ParameterName &parameter_name,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001214 VkDebugReportObjectTypeEXT object_type, uint64_t object) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001215
1216 bool manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1217 const VkGraphicsPipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001218 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001219 bool manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1220 const VkComputePipelineCreateInfo *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001221 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001222
1223 bool manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001224 const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001225 bool manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001226 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001227 VkDescriptorSetLayout *pSetLayout) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001228
Mark Lobodzinskibf599b92018-12-31 12:15:55 -07001229 bool manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
1230 const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001231 const VkCopyDescriptorSet *pDescriptorCopies) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001232
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001233 bool manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001234 const VkDescriptorSet *pDescriptorSets) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001235
1236 bool manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001237 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001238
1239 bool manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001240 const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001241
1242 bool manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001243 const VkCommandBuffer *pCommandBuffers) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001244
Jeff Bolz5c801d12019-10-09 10:38:45 -05001245 bool manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001246
1247 bool manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001248 const VkViewport *pViewports) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001249
1250 bool manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001251 const VkRect2D *pScissors) const;
1252 bool manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001253
1254 bool manual_PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001255 uint32_t firstVertex, uint32_t firstInstance) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001256
1257 bool manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001258 uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001259
1260 bool manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001261 uint32_t count, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001262
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001263 bool manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
1264 const VkClearAttachment *pAttachments, uint32_t rectCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001265 const VkClearRect *pRects) const;
Mark Lobodzinskif77a4ac2019-06-27 15:30:51 -06001266
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001267 bool manual_PreCallValidateCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
1268 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001269 const VkImageCopy *pRegions) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001270
1271 bool manual_PreCallValidateCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
1272 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001273 const VkImageBlit *pRegions, VkFilter filter) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001274
1275 bool manual_PreCallValidateCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
1276 VkImageLayout dstImageLayout, uint32_t regionCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001277 const VkBufferImageCopy *pRegions) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001278
1279 bool manual_PreCallValidateCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001280 VkBuffer dstBuffer, uint32_t regionCount,
1281 const VkBufferImageCopy *pRegions) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001282
1283 bool manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001284 VkDeviceSize dataSize, const void *pData) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001285
1286 bool manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001287 VkDeviceSize size, uint32_t data) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001288
1289 bool manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001290 const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) const;
1291 bool manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001292
1293#ifdef VK_USE_PLATFORM_WIN32_KHR
1294 bool manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001295 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001296#endif // VK_USE_PLATFORM_WIN32_KHR
1297
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001298 bool manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001299 const VkAllocationCallbacks *pAllocator,
1300 VkDescriptorPool *pDescriptorPool) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001301 bool manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001302 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001303
Jeff Bolz5c801d12019-10-09 10:38:45 -05001304 bool manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001305
1306 bool manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
1307 uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001308 uint32_t groupCountZ) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001309 bool manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001310 uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001311 bool manual_PreCallValidateCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
1312 uint32_t viewportCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001313 const VkShadingRatePaletteNV *pShadingRatePalettes) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001314
1315 bool manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType,
1316 uint32_t customSampleOrderCount,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001317 const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001318
Jeff Bolz5c801d12019-10-09 10:38:45 -05001319 bool manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001320 bool manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001321 uint32_t drawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001322
1323 bool manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
1324 VkBuffer countBuffer, VkDeviceSize countBufferOffset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001325 uint32_t maxDrawCount, uint32_t stride) const;
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001326
1327 bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001328 uint32_t *pPropertyCount,
1329 VkExtensionProperties *pProperties) const;
Jeff Bolz7e7e6e02019-01-11 22:53:41 -06001330 bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001331 const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) const;
Ricardo Garciaa4935972019-02-21 17:43:18 +01001332
1333 bool manual_PreCallValidateCreateAccelerationStructureNV(VkDevice device,
1334 const VkAccelerationStructureCreateInfoNV *pCreateInfo,
1335 const VkAllocationCallbacks *pAllocator,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001336 VkAccelerationStructureNV *pAccelerationStructure) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001337 bool manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer,
1338 const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData,
1339 VkDeviceSize instanceOffset, VkBool32 update,
1340 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001341 VkBuffer scratch, VkDeviceSize scratchOffset) const;
Jason Macnak5c954952019-07-09 15:46:12 -07001342 bool manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001343 size_t dataSize, void *pData) const;
Peter Chen85366392019-05-14 15:20:11 -04001344 bool manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
1345 const VkRayTracingPipelineCreateInfoNV *pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001346 const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const;
Chris Mayer9ded5eb2019-09-19 16:33:26 +02001347 bool manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001348 uint32_t viewportCount,
1349 const VkViewportWScalingNV *pViewportWScalings) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001350
1351#ifdef VK_USE_PLATFORM_WIN32_KHR
1352 bool PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001353 VkDeviceGroupPresentModeFlagsKHR *pModes) const;
Mike Schuchardt21638df2019-03-16 10:52:02 -07001354#endif // VK_USE_PLATFORM_WIN32_KHR
Tobias Hectorebb855f2019-07-23 12:17:33 +01001355
1356 bool manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001357 const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const;
Tobias Hectorebb855f2019-07-23 12:17:33 +01001358
Jeff Bolz8125a8b2019-08-16 16:29:45 -05001359 bool manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001360 uint16_t lineStipplePattern) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001361
1362 bool manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Jeff Bolz5c801d12019-10-09 10:38:45 -05001363 VkIndexType indexType) const;
Piers Daniell8fd03f52019-08-21 12:07:53 -06001364
Jeff Bolz5c801d12019-10-09 10:38:45 -05001365 bool manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001366
Jeff Bolz5c801d12019-10-09 10:38:45 -05001367 bool manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const;
Mark Lobodzinski84988402019-09-11 15:27:30 -06001368
Mark Lobodzinskiaf7c0382018-12-18 11:55:55 -07001369#include "parameter_validation.h"
1370}; // Class StatelessValidation