Shahbaz Youssefi | 6be1141 | 2019-01-10 15:29:30 -0500 | [diff] [blame] | 1 | /* 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 Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 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: Mark Lobodzinski <mark@LunarG.com> |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 19 | * Author: John Zulauf <jzulauf@lunarg.com> |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #define NOMINMAX |
Shahbaz Youssefi | 6be1141 | 2019-01-10 15:29:30 -0500 | [diff] [blame] | 23 | |
| 24 | #include <math.h> |
| 25 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 26 | #include "chassis.h" |
| 27 | #include "stateless_validation.h" |
Mark Lobodzinski | e514d1a | 2019-03-12 08:47:45 -0600 | [diff] [blame] | 28 | #include "layer_chassis_dispatch.h" |
Tobias Hector | d942eb9 | 2018-10-22 15:18:56 +0100 | [diff] [blame] | 29 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 30 | static const int MaxParamCheckerStringLength = 256; |
| 31 | |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 32 | template <typename T> |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 33 | inline bool in_inclusive_range(const T &value, const T &min, const T &max) { |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 34 | // Using only < for generality and || for early abort |
| 35 | return !((value < min) || (max < value)); |
| 36 | } |
| 37 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 38 | bool StatelessValidation::validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid, |
| 39 | const char *validateString) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 40 | bool skip = false; |
| 41 | |
| 42 | VkStringErrorFlags result = vk_string_validate(MaxParamCheckerStringLength, validateString); |
| 43 | |
| 44 | if (result == VK_STRING_ERROR_NONE) { |
| 45 | return skip; |
| 46 | } else if (result & VK_STRING_ERROR_LENGTH) { |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 47 | skip = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 48 | "%s: string %s exceeds max length %d", apiName, stringName.get_name().c_str(), MaxParamCheckerStringLength); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 49 | } else if (result & VK_STRING_ERROR_BAD_DATA) { |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 50 | skip = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, vuid, |
| 51 | "%s: string %s contains invalid characters or is badly formed", apiName, stringName.get_name().c_str()); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 52 | } |
| 53 | return skip; |
| 54 | } |
| 55 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 56 | bool StatelessValidation::validate_api_version(uint32_t api_version, uint32_t effective_api_version) { |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 57 | bool skip = false; |
| 58 | uint32_t api_version_nopatch = VK_MAKE_VERSION(VK_VERSION_MAJOR(api_version), VK_VERSION_MINOR(api_version), 0); |
| 59 | if (api_version_nopatch != effective_api_version) { |
| 60 | if (api_version_nopatch < VK_API_VERSION_1_0) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 61 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 62 | HandleToUint64(instance), kVUIDUndefined, |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 63 | "Invalid CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number (0x%08x). " |
| 64 | "Using VK_API_VERSION_%" PRIu32 "_%" PRIu32 ".", |
| 65 | api_version, VK_VERSION_MAJOR(effective_api_version), VK_VERSION_MINOR(effective_api_version)); |
| 66 | } else { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 67 | skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, |
| 68 | HandleToUint64(instance), kVUIDUndefined, |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 69 | "Unrecognized CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number (0x%08x). " |
| 70 | "Assuming VK_API_VERSION_%" PRIu32 "_%" PRIu32 ".", |
| 71 | api_version, VK_VERSION_MAJOR(effective_api_version), VK_VERSION_MINOR(effective_api_version)); |
| 72 | } |
| 73 | } |
| 74 | return skip; |
| 75 | } |
| 76 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 77 | bool StatelessValidation::validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) { |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 78 | bool skip = false; |
| 79 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 80 | skip |= validate_extension_reqs(instance_extensions, "VUID-vkCreateInstance-ppEnabledExtensionNames-01388", "instance", |
| 81 | pCreateInfo->ppEnabledExtensionNames[i]); |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | return skip; |
| 85 | } |
| 86 | |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 87 | template <typename ExtensionState> |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 88 | bool extension_state_by_name(const ExtensionState &extensions, const char *extension_name) { |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 89 | if (!extension_name) return false; // null strings specify nothing |
| 90 | auto info = ExtensionState::get_info(extension_name); |
| 91 | bool state = info.state ? extensions.*(info.state) : false; // unknown extensions can't be enabled in extension struct |
| 92 | return state; |
| 93 | } |
| 94 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 95 | bool StatelessValidation::manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
| 96 | const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 97 | bool skip = false; |
| 98 | // Note: From the spec-- |
| 99 | // Providing a NULL VkInstanceCreateInfo::pApplicationInfo or providing an apiVersion of 0 is equivalent to providing |
| 100 | // an apiVersion of VK_MAKE_VERSION(1, 0, 0). (a.k.a. VK_API_VERSION_1_0) |
| 101 | uint32_t local_api_version = (pCreateInfo->pApplicationInfo && pCreateInfo->pApplicationInfo->apiVersion) |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 102 | ? pCreateInfo->pApplicationInfo->apiVersion |
| 103 | : VK_API_VERSION_1_0; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 104 | skip |= validate_api_version(local_api_version, api_version); |
| 105 | skip |= validate_instance_extensions(pCreateInfo); |
| 106 | return skip; |
| 107 | } |
| 108 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 109 | void StatelessValidation::PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 110 | const VkAllocationCallbacks *pAllocator, VkInstance *pInstance, |
| 111 | VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 112 | auto instance_data = GetLayerDataPtr(get_dispatch_key(*pInstance), layer_data_map); |
| 113 | // Copy extension data into local object |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 114 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 115 | this->instance_extensions = instance_data->instance_extensions; |
| 116 | } |
| 117 | |
| 118 | void StatelessValidation::PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 119 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 120 | auto device_data = GetLayerDataPtr(get_dispatch_key(*pDevice), layer_data_map); |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 121 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 122 | ValidationObject *validation_data = GetValidationObject(device_data->object_dispatch, LayerObjectTypeParameterValidation); |
| 123 | StatelessValidation *stateless_validation = static_cast<StatelessValidation *>(validation_data); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 124 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 125 | // Parmeter validation also uses extension data |
| 126 | stateless_validation->device_extensions = this->device_extensions; |
| 127 | |
| 128 | VkPhysicalDeviceProperties device_properties = {}; |
| 129 | // Need to get instance and do a getlayerdata call... |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 130 | DispatchGetPhysicalDeviceProperties(physicalDevice, &device_properties); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 131 | memcpy(&stateless_validation->device_limits, &device_properties.limits, sizeof(VkPhysicalDeviceLimits)); |
| 132 | |
| 133 | if (device_extensions.vk_nv_shading_rate_image) { |
| 134 | // Get the needed shading rate image limits |
| 135 | auto shading_rate_image_props = lvl_init_struct<VkPhysicalDeviceShadingRateImagePropertiesNV>(); |
| 136 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&shading_rate_image_props); |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 137 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 138 | phys_dev_ext_props.shading_rate_image_props = shading_rate_image_props; |
| 139 | } |
| 140 | |
| 141 | if (device_extensions.vk_nv_mesh_shader) { |
| 142 | // Get the needed mesh shader limits |
| 143 | auto mesh_shader_props = lvl_init_struct<VkPhysicalDeviceMeshShaderPropertiesNV>(); |
| 144 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&mesh_shader_props); |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 145 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 146 | phys_dev_ext_props.mesh_shader_props = mesh_shader_props; |
| 147 | } |
| 148 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame^] | 149 | if (device_extensions.vk_nv_ray_tracing) { |
| 150 | // Get the needed ray tracing limits |
| 151 | auto ray_tracing_props = lvl_init_struct<VkPhysicalDeviceRayTracingPropertiesNV>(); |
| 152 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&ray_tracing_props); |
| 153 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 154 | phys_dev_ext_props.ray_tracing_props = ray_tracing_props; |
| 155 | } |
| 156 | |
Jasper St. Pierre | a49b4be | 2019-02-05 17:48:57 -0800 | [diff] [blame] | 157 | stateless_validation->phys_dev_ext_props = this->phys_dev_ext_props; |
| 158 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 159 | // Save app-enabled features in this device's validation object |
| 160 | // The enabled features can come from either pEnabledFeatures, or from the pNext chain |
| 161 | const VkPhysicalDeviceFeatures *enabled_features_found = pCreateInfo->pEnabledFeatures; |
| 162 | if ((nullptr == enabled_features_found) && device_extensions.vk_khr_get_physical_device_properties_2) { |
| 163 | const auto *features2 = lvl_find_in_chain<VkPhysicalDeviceFeatures2KHR>(pCreateInfo->pNext); |
| 164 | if (features2) { |
| 165 | enabled_features_found = &(features2->features); |
| 166 | } |
| 167 | } |
| 168 | if (enabled_features_found) { |
| 169 | stateless_validation->physical_device_features = *enabled_features_found; |
| 170 | } else { |
| 171 | memset(&stateless_validation->physical_device_features, 0, sizeof(VkPhysicalDeviceFeatures)); |
| 172 | } |
| 173 | } |
| 174 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 175 | bool StatelessValidation::manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 176 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 177 | bool skip = false; |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 178 | bool maint1 = false; |
| 179 | bool negative_viewport = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 180 | |
| 181 | if ((pCreateInfo->enabledLayerCount > 0) && (pCreateInfo->ppEnabledLayerNames != NULL)) { |
| 182 | for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 183 | skip |= validate_string("vkCreateDevice", "pCreateInfo->ppEnabledLayerNames", |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 184 | "VUID-VkDeviceCreateInfo-ppEnabledLayerNames-parameter", pCreateInfo->ppEnabledLayerNames[i]); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 188 | if ((pCreateInfo->enabledExtensionCount > 0) && (pCreateInfo->ppEnabledExtensionNames != NULL)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 189 | maint1 = extension_state_by_name(device_extensions, VK_KHR_MAINTENANCE1_EXTENSION_NAME); |
| 190 | negative_viewport = extension_state_by_name(device_extensions, VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME); |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 191 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 192 | for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 193 | skip |= validate_string("vkCreateDevice", "pCreateInfo->ppEnabledExtensionNames", |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 194 | "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-parameter", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 195 | pCreateInfo->ppEnabledExtensionNames[i]); |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 196 | skip |= validate_extension_reqs(device_extensions, "VUID-vkCreateDevice-ppEnabledExtensionNames-01387", "device", |
| 197 | pCreateInfo->ppEnabledExtensionNames[i]); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 198 | } |
| 199 | } |
| 200 | |
| 201 | if (maint1 && negative_viewport) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 202 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 203 | "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-00374", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 204 | "VkDeviceCreateInfo->ppEnabledExtensionNames must not simultaneously include VK_KHR_maintenance1 and " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 205 | "VK_AMD_negative_viewport_height."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | if (pCreateInfo->pNext != NULL && pCreateInfo->pEnabledFeatures) { |
| 209 | // Check for get_physical_device_properties2 struct |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 210 | const auto *features2 = lvl_find_in_chain<VkPhysicalDeviceFeatures2KHR>(pCreateInfo->pNext); |
| 211 | if (features2) { |
| 212 | // Cannot include VkPhysicalDeviceFeatures2KHR and have non-null pEnabledFeatures |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 213 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 214 | kVUID_PVError_InvalidUsage, |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 215 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceFeatures2KHR struct when " |
| 216 | "pCreateInfo->pEnabledFeatures is non-NULL."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 217 | } |
| 218 | } |
| 219 | |
Locke | 77fad1c | 2019-04-16 13:09:03 -0600 | [diff] [blame] | 220 | auto features2 = lvl_find_in_chain<VkPhysicalDeviceFeatures2>(pCreateInfo->pNext); |
| 221 | if (features2) { |
| 222 | if (!instance_extensions.vk_khr_get_physical_device_properties_2) { |
| 223 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 224 | kVUID_PVError_ExtensionNotEnabled, |
| 225 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceFeatures2 struct, " |
| 226 | "VK_KHR_get_physical_device_properties2 must be enabled when it creates an instance."); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | auto vertex_attribute_divisor_features = |
| 231 | lvl_find_in_chain<VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT>(pCreateInfo->pNext); |
| 232 | if (vertex_attribute_divisor_features) { |
| 233 | bool extension_found = false; |
| 234 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) { |
| 235 | if (0 == strncmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, |
| 236 | VK_MAX_EXTENSION_NAME_SIZE)) { |
| 237 | extension_found = true; |
| 238 | break; |
| 239 | } |
| 240 | } |
| 241 | if (!extension_found) { |
| 242 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 243 | kVUID_PVError_ExtensionNotEnabled, |
| 244 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT " |
| 245 | "struct, VK_EXT_vertex_attribute_divisor must be enabled when it creates a device."); |
| 246 | } |
| 247 | } |
| 248 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 249 | // Validate pCreateInfo->pQueueCreateInfos |
| 250 | if (pCreateInfo->pQueueCreateInfos) { |
| 251 | std::unordered_set<uint32_t> set; |
| 252 | |
| 253 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 254 | const uint32_t requested_queue_family = pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex; |
| 255 | if (requested_queue_family == VK_QUEUE_FAMILY_IGNORED) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 256 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 257 | HandleToUint64(physicalDevice), "VUID-VkDeviceQueueCreateInfo-queueFamilyIndex-00381", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 258 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 259 | "].queueFamilyIndex is VK_QUEUE_FAMILY_IGNORED, but it is required to provide a valid queue family " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 260 | "index value.", |
| 261 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 262 | } else if (set.count(requested_queue_family)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 263 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 264 | HandleToUint64(physicalDevice), "VUID-VkDeviceCreateInfo-queueFamilyIndex-00372", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 265 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueFamilyIndex (=%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 266 | ") is not unique within pCreateInfo->pQueueCreateInfos array.", |
| 267 | i, requested_queue_family); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 268 | } else { |
| 269 | set.insert(requested_queue_family); |
| 270 | } |
| 271 | |
| 272 | if (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities != nullptr) { |
| 273 | for (uint32_t j = 0; j < pCreateInfo->pQueueCreateInfos[i].queueCount; ++j) { |
| 274 | const float queue_priority = pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j]; |
| 275 | if (!(queue_priority >= 0.f) || !(queue_priority <= 1.f)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 276 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 277 | HandleToUint64(physicalDevice), "VUID-VkDeviceQueueCreateInfo-pQueuePriorities-00383", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 278 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].pQueuePriorities[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 279 | "] (=%f) is not between 0 and 1 (inclusive).", |
| 280 | i, j, queue_priority); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 281 | } |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | return skip; |
| 288 | } |
| 289 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 290 | bool StatelessValidation::require_device_extension(bool flag, char const *function_name, char const *extension_name) { |
| 291 | if (!flag) { |
| 292 | return log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 293 | kVUID_PVError_ExtensionNotEnabled, |
| 294 | "%s() called even though the %s extension was not enabled for this VkDevice.", function_name, |
| 295 | extension_name); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 296 | } |
| 297 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 298 | return false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 299 | } |
| 300 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 301 | bool StatelessValidation::manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 302 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 303 | bool skip = false; |
| 304 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 305 | const LogMiscParams log_misc{VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, VK_NULL_HANDLE, "vkCreateBuffer"}; |
Petr Kraus | e5c3765 | 2018-01-05 04:05:12 +0100 | [diff] [blame] | 306 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 307 | if (pCreateInfo != nullptr) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 308 | skip |= ValidateGreaterThanZero(pCreateInfo->size, "pCreateInfo->size", "VUID-VkBufferCreateInfo-size-00912", log_misc); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 309 | |
| 310 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 311 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 312 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 313 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 314 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 315 | "VUID-VkBufferCreateInfo-sharingMode-00914", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 316 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 317 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 321 | // queueFamilyIndexCount uint32_t values |
| 322 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 323 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 324 | "VUID-VkBufferCreateInfo-sharingMode-00913", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 325 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 326 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 327 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 328 | } |
| 329 | } |
| 330 | |
| 331 | // If flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 332 | // VK_BUFFER_CREATE_SPARSE_BINDING_BIT |
| 333 | if (((pCreateInfo->flags & (VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 334 | ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) != VK_BUFFER_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 335 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 336 | "VUID-VkBufferCreateInfo-flags-00918", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 337 | "vkCreateBuffer: if pCreateInfo->flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 338 | "VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, it must also contain VK_BUFFER_CREATE_SPARSE_BINDING_BIT."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 339 | } |
| 340 | } |
| 341 | |
| 342 | return skip; |
| 343 | } |
| 344 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 345 | bool StatelessValidation::manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 346 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 347 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 348 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 349 | const LogMiscParams log_misc{VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, VK_NULL_HANDLE, "vkCreateImage"}; |
Petr Kraus | e5c3765 | 2018-01-05 04:05:12 +0100 | [diff] [blame] | 350 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 351 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 352 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 353 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 354 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 355 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 356 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 357 | "VUID-VkImageCreateInfo-sharingMode-00942", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 358 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 359 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 363 | // queueFamilyIndexCount uint32_t values |
| 364 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 365 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 366 | "VUID-VkImageCreateInfo-sharingMode-00941", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 367 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 368 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 369 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 370 | } |
| 371 | } |
| 372 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 373 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.width, "pCreateInfo->extent.width", |
| 374 | "VUID-VkImageCreateInfo-extent-00944", log_misc); |
| 375 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.height, "pCreateInfo->extent.height", |
| 376 | "VUID-VkImageCreateInfo-extent-00945", log_misc); |
| 377 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.depth, "pCreateInfo->extent.depth", |
| 378 | "VUID-VkImageCreateInfo-extent-00946", log_misc); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 379 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 380 | skip |= ValidateGreaterThanZero(pCreateInfo->mipLevels, "pCreateInfo->mipLevels", "VUID-VkImageCreateInfo-mipLevels-00947", |
| 381 | log_misc); |
| 382 | skip |= ValidateGreaterThanZero(pCreateInfo->arrayLayers, "pCreateInfo->arrayLayers", |
| 383 | "VUID-VkImageCreateInfo-arrayLayers-00948", log_misc); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 384 | |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 385 | // InitialLayout must be PREINITIALIZED or UNDEFINED |
Dave Houlton | e19e20d | 2018-02-02 16:32:41 -0700 | [diff] [blame] | 386 | if ((pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_UNDEFINED) && |
| 387 | (pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_PREINITIALIZED)) { |
| 388 | skip |= log_msg( |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 389 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 390 | "VUID-VkImageCreateInfo-initialLayout-00993", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 391 | "vkCreateImage(): initialLayout is %s, must be VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED.", |
| 392 | string_VkImageLayout(pCreateInfo->initialLayout)); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 393 | } |
| 394 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 395 | // If imageType is VK_IMAGE_TYPE_1D, both extent.height and extent.depth must be 1 |
Petr Kraus | 3ac9e81 | 2018-03-13 12:31:08 +0100 | [diff] [blame] | 396 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && |
| 397 | ((pCreateInfo->extent.height != 1) || (pCreateInfo->extent.depth != 1))) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 398 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 399 | "VUID-VkImageCreateInfo-imageType-00956", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 400 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both pCreateInfo->extent.height and " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 401 | "pCreateInfo->extent.depth must be 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) { |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 405 | if (pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
| 406 | if (pCreateInfo->extent.width != pCreateInfo->extent.height) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 407 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 408 | VK_NULL_HANDLE, "VUID-VkImageCreateInfo-imageType-00954", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 409 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but " |
| 410 | "pCreateInfo->extent.width (=%" PRIu32 ") and pCreateInfo->extent.height (=%" PRIu32 |
| 411 | ") are not equal.", |
| 412 | pCreateInfo->extent.width, pCreateInfo->extent.height); |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 413 | } |
| 414 | |
| 415 | if (pCreateInfo->arrayLayers < 6) { |
| 416 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 417 | VK_NULL_HANDLE, "VUID-VkImageCreateInfo-imageType-00954", |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 418 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 419 | "pCreateInfo->arrayLayers (=%" PRIu32 ") is not greater than or equal to 6.", |
| 420 | pCreateInfo->arrayLayers); |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 421 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | if (pCreateInfo->extent.depth != 1) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 425 | skip |= |
| 426 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 427 | "VUID-VkImageCreateInfo-imageType-00957", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 428 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_2D, pCreateInfo->extent.depth must be 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 429 | } |
| 430 | } |
| 431 | |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 432 | // 3D image may have only 1 layer |
| 433 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_3D) && (pCreateInfo->arrayLayers != 1)) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 434 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 435 | "VUID-VkImageCreateInfo-imageType-00961", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 436 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_3D, pCreateInfo->arrayLayers must be 1."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | // If multi-sample, validate type, usage, tiling and mip levels. |
| 440 | if ((pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) && |
| 441 | ((pCreateInfo->imageType != VK_IMAGE_TYPE_2D) || (pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) || |
Shannon McPherson | a886c2a | 2018-10-12 14:38:20 -0600 | [diff] [blame] | 442 | (pCreateInfo->mipLevels != 1) || (pCreateInfo->tiling != VK_IMAGE_TILING_OPTIMAL))) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 443 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Shannon McPherson | a886c2a | 2018-10-12 14:38:20 -0600 | [diff] [blame] | 444 | "VUID-VkImageCreateInfo-samples-02257", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 445 | "vkCreateImage(): Multi-sample image with incompatible type, usage, tiling, or mips."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 446 | } |
| 447 | |
| 448 | if (0 != (pCreateInfo->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT)) { |
| 449 | VkImageUsageFlags legal_flags = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | |
| 450 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); |
| 451 | // At least one of the legal attachment bits must be set |
| 452 | if (0 == (pCreateInfo->usage & legal_flags)) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 453 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 454 | "VUID-VkImageCreateInfo-usage-00966", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 455 | "vkCreateImage(): Transient attachment image without a compatible attachment flag set."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 456 | } |
| 457 | // No flags other than the legal attachment bits may be set |
| 458 | legal_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 459 | if (0 != (pCreateInfo->usage & ~legal_flags)) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 460 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 461 | "VUID-VkImageCreateInfo-usage-00963", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 462 | "vkCreateImage(): Transient attachment image with incompatible usage flags set."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 463 | } |
| 464 | } |
| 465 | |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 466 | // mipLevels must be less than or equal to the number of levels in the complete mipmap chain |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 467 | uint32_t maxDim = std::max(std::max(pCreateInfo->extent.width, pCreateInfo->extent.height), pCreateInfo->extent.depth); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 468 | // Max mip levels is different for corner-sampled images vs normal images. |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 469 | uint32_t maxMipLevels = (pCreateInfo->flags & VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV) ? (uint32_t)(ceil(log2(maxDim))) |
| 470 | : (uint32_t)(floor(log2(maxDim)) + 1); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 471 | if (maxDim > 0 && pCreateInfo->mipLevels > maxMipLevels) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 472 | skip |= |
| 473 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 474 | "VUID-VkImageCreateInfo-mipLevels-00958", |
| 475 | "vkCreateImage(): pCreateInfo->mipLevels must be less than or equal to " |
| 476 | "floor(log2(max(pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth)))+1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 477 | } |
| 478 | |
Mark Lobodzinski | 69259c5 | 2018-09-18 15:14:58 -0600 | [diff] [blame] | 479 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) && (pCreateInfo->imageType != VK_IMAGE_TYPE_3D)) { |
| 480 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, VK_NULL_HANDLE, |
| 481 | "VUID-VkImageCreateInfo-flags-00950", |
| 482 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT but " |
| 483 | "pCreateInfo->imageType is not VK_IMAGE_TYPE_3D."); |
| 484 | } |
| 485 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 486 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) && (!physical_device_features.sparseBinding)) { |
Petr Kraus | b6f9780 | 2018-03-13 12:31:39 +0100 | [diff] [blame] | 487 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, VK_NULL_HANDLE, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 488 | "VUID-VkImageCreateInfo-flags-00969", |
Petr Kraus | b6f9780 | 2018-03-13 12:31:39 +0100 | [diff] [blame] | 489 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_BINDING_BIT, but the " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 490 | "VkPhysicalDeviceFeatures::sparseBinding feature is disabled."); |
Petr Kraus | b6f9780 | 2018-03-13 12:31:39 +0100 | [diff] [blame] | 491 | } |
| 492 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 493 | // If flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 494 | // VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
| 495 | if (((pCreateInfo->flags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 496 | ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) != VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 497 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 498 | "VUID-VkImageCreateInfo-flags-00987", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 499 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 500 | "VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain VK_IMAGE_CREATE_SPARSE_BINDING_BIT."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | // Check for combinations of attributes that are incompatible with having VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT set |
| 504 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) != 0) { |
| 505 | // Linear tiling is unsupported |
| 506 | if (VK_IMAGE_TILING_LINEAR == pCreateInfo->tiling) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 507 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 508 | kVUID_PVError_InvalidUsage, |
| 509 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT then image " |
| 510 | "tiling of VK_IMAGE_TILING_LINEAR is not supported"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | // Sparse 1D image isn't valid |
| 514 | if (VK_IMAGE_TYPE_1D == pCreateInfo->imageType) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 515 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 516 | "VUID-VkImageCreateInfo-imageType-00970", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 517 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 1D image."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | // Sparse 2D image when device doesn't support it |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 521 | if ((VK_FALSE == physical_device_features.sparseResidencyImage2D) && (VK_IMAGE_TYPE_2D == pCreateInfo->imageType)) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 522 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 523 | "VUID-VkImageCreateInfo-imageType-00971", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 524 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2D image if corresponding " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 525 | "feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 526 | } |
| 527 | |
| 528 | // Sparse 3D image when device doesn't support it |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 529 | if ((VK_FALSE == physical_device_features.sparseResidencyImage3D) && (VK_IMAGE_TYPE_3D == pCreateInfo->imageType)) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 530 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 531 | "VUID-VkImageCreateInfo-imageType-00972", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 532 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 3D image if corresponding " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 533 | "feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | // Multi-sample 2D image when device doesn't support it |
| 537 | if (VK_IMAGE_TYPE_2D == pCreateInfo->imageType) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 538 | if ((VK_FALSE == physical_device_features.sparseResidency2Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 539 | (VK_SAMPLE_COUNT_2_BIT == pCreateInfo->samples)) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 540 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 541 | "VUID-VkImageCreateInfo-imageType-00973", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 542 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2-sample image if " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 543 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 544 | } else if ((VK_FALSE == physical_device_features.sparseResidency4Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 545 | (VK_SAMPLE_COUNT_4_BIT == pCreateInfo->samples)) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 546 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 547 | "VUID-VkImageCreateInfo-imageType-00974", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 548 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 4-sample image if " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 549 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 550 | } else if ((VK_FALSE == physical_device_features.sparseResidency8Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 551 | (VK_SAMPLE_COUNT_8_BIT == pCreateInfo->samples)) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 552 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 553 | "VUID-VkImageCreateInfo-imageType-00975", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 554 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 8-sample image if " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 555 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 556 | } else if ((VK_FALSE == physical_device_features.sparseResidency16Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 557 | (VK_SAMPLE_COUNT_16_BIT == pCreateInfo->samples)) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 558 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 559 | "VUID-VkImageCreateInfo-imageType-00976", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 560 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 16-sample image if " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 561 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 562 | } |
| 563 | } |
| 564 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 565 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 566 | if (pCreateInfo->usage & VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV) { |
| 567 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D) { |
| 568 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 569 | "VUID-VkImageCreateInfo-imageType-02082", |
| 570 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 571 | "imageType must be VK_IMAGE_TYPE_2D."); |
| 572 | } |
| 573 | if (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) { |
| 574 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 575 | "VUID-VkImageCreateInfo-samples-02083", |
| 576 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 577 | "samples must be VK_SAMPLE_COUNT_1_BIT."); |
| 578 | } |
| 579 | if (pCreateInfo->tiling != VK_IMAGE_TILING_OPTIMAL) { |
| 580 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 581 | "VUID-VkImageCreateInfo-tiling-02084", |
| 582 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 583 | "tiling must be VK_IMAGE_TILING_OPTIMAL."); |
| 584 | } |
| 585 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 586 | |
| 587 | if (pCreateInfo->flags & VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 588 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D && pCreateInfo->imageType != VK_IMAGE_TYPE_3D) { |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 589 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 590 | "VUID-VkImageCreateInfo-flags-02050", |
| 591 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV, " |
| 592 | "imageType must be VK_IMAGE_TYPE_2D or VK_IMAGE_TYPE_3D."); |
| 593 | } |
| 594 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 595 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) || FormatIsDepthOrStencil(pCreateInfo->format)) { |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 596 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 597 | "VUID-VkImageCreateInfo-flags-02051", |
| 598 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV, " |
| 599 | "it must not also contain VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT and format must " |
| 600 | "not be a depth/stencil format."); |
| 601 | } |
| 602 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 603 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D && (pCreateInfo->extent.width == 1 || pCreateInfo->extent.height == 1)) { |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 604 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 605 | "VUID-VkImageCreateInfo-flags-02052", |
| 606 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV and " |
| 607 | "imageType is VK_IMAGE_TYPE_2D, extent.width and extent.height must be " |
| 608 | "greater than 1."); |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 609 | } else if (pCreateInfo->imageType == VK_IMAGE_TYPE_3D && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 610 | (pCreateInfo->extent.width == 1 || pCreateInfo->extent.height == 1 || pCreateInfo->extent.depth == 1)) { |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 611 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 612 | "VUID-VkImageCreateInfo-flags-02053", |
| 613 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV and " |
| 614 | "imageType is VK_IMAGE_TYPE_3D, extent.width, extent.height, and extent.depth " |
| 615 | "must be greater than 1."); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 616 | } |
| 617 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 618 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 619 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 620 | return skip; |
| 621 | } |
| 622 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 623 | bool StatelessValidation::manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 624 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 625 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 626 | |
| 627 | if (pCreateInfo != nullptr) { |
Dave Houlton | bd2e262 | 2018-04-10 16:41:14 -0600 | [diff] [blame] | 628 | // Validate chained VkImageViewUsageCreateInfo struct, if present |
| 629 | if (nullptr != pCreateInfo->pNext) { |
| 630 | auto chained_ivuci_struct = lvl_find_in_chain<VkImageViewUsageCreateInfoKHR>(pCreateInfo->pNext); |
| 631 | if (chained_ivuci_struct) { |
| 632 | if (0 == chained_ivuci_struct->usage) { |
| 633 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 634 | "VUID-VkImageViewUsageCreateInfo-usage-requiredbitmask", |
Dave Houlton | 0f3795b | 2018-04-13 15:04:35 -0600 | [diff] [blame] | 635 | "vkCreateImageView: Chained VkImageViewUsageCreateInfo usage field must not be 0."); |
Dave Houlton | bd2e262 | 2018-04-10 16:41:14 -0600 | [diff] [blame] | 636 | } else if (chained_ivuci_struct->usage & ~AllVkImageUsageFlagBits) { |
| 637 | std::stringstream ss; |
| 638 | ss << "vkCreateImageView: Chained VkImageViewUsageCreateInfo usage field (0x" << std::hex |
| 639 | << chained_ivuci_struct->usage << ") contains invalid flag bits."; |
| 640 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 641 | "VUID-VkImageViewUsageCreateInfo-usage-parameter", "%s", ss.str().c_str()); |
Dave Houlton | bd2e262 | 2018-04-10 16:41:14 -0600 | [diff] [blame] | 642 | } |
| 643 | } |
| 644 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 645 | } |
| 646 | return skip; |
| 647 | } |
| 648 | |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 649 | bool StatelessValidation::manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, |
| 650 | const ParameterName ¶meter_name, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 651 | VkDebugReportObjectTypeEXT object_type, uint64_t object = 0) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 652 | bool skip = false; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 653 | |
| 654 | // Note: for numerical correctness |
| 655 | // - float comparisons should expect NaN (comparison always false). |
| 656 | // - VkPhysicalDeviceLimits::maxViewportDimensions is uint32_t, not float -> careful. |
| 657 | |
| 658 | const auto f_lte_u32_exact = [](const float v1_f, const uint32_t v2_u32) { |
John Zulauf | ac0876c | 2018-02-19 10:09:35 -0700 | [diff] [blame] | 659 | if (std::isnan(v1_f)) return false; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 660 | if (v1_f <= 0.0f) return true; |
| 661 | |
| 662 | float intpart; |
| 663 | const float fract = modff(v1_f, &intpart); |
| 664 | |
| 665 | assert(std::numeric_limits<float>::radix == 2); |
| 666 | const float u32_max_plus1 = ldexpf(1.0f, 32); // hopefully exact |
| 667 | if (intpart >= u32_max_plus1) return false; |
| 668 | |
| 669 | uint32_t v1_u32 = static_cast<uint32_t>(intpart); |
| 670 | if (v1_u32 < v2_u32) |
| 671 | return true; |
| 672 | else if (v1_u32 == v2_u32 && fract == 0.0f) |
| 673 | return true; |
| 674 | else |
| 675 | return false; |
| 676 | }; |
| 677 | |
| 678 | const auto f_lte_u32_direct = [](const float v1_f, const uint32_t v2_u32) { |
| 679 | const float v2_f = static_cast<float>(v2_u32); // not accurate for > radix^digits; and undefined rounding mode |
| 680 | return (v1_f <= v2_f); |
| 681 | }; |
| 682 | |
| 683 | // width |
| 684 | bool width_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 685 | const auto max_w = device_limits.maxViewportDimensions[0]; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 686 | |
| 687 | if (!(viewport.width > 0.0f)) { |
| 688 | width_healthy = false; |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 689 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-width-01770", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 690 | "%s: %s.width (=%f) is not greater than 0.0.", fn_name, parameter_name.get_name().c_str(), viewport.width); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 691 | } else if (!(f_lte_u32_exact(viewport.width, max_w) || f_lte_u32_direct(viewport.width, max_w))) { |
| 692 | width_healthy = false; |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 693 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-width-01771", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 694 | "%s: %s.width (=%f) exceeds VkPhysicalDeviceLimits::maxViewportDimensions[0] (=%" PRIu32 ").", fn_name, |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 695 | parameter_name.get_name().c_str(), viewport.width, max_w); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 696 | } else if (!f_lte_u32_exact(viewport.width, max_w) && f_lte_u32_direct(viewport.width, max_w)) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 697 | skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, object_type, object, kVUID_PVError_NONE, |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 698 | "%s: %s.width (=%f) technically exceeds VkPhysicalDeviceLimits::maxViewportDimensions[0] (=%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 699 | "), but it is within the static_cast<float>(maxViewportDimensions[0]) limit.", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 700 | fn_name, parameter_name.get_name().c_str(), viewport.width, max_w); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 701 | } |
| 702 | |
| 703 | // height |
| 704 | bool height_healthy = true; |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 705 | const bool negative_height_enabled = api_version >= VK_API_VERSION_1_1 || device_extensions.vk_khr_maintenance1 || |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 706 | device_extensions.vk_amd_negative_viewport_height; |
| 707 | const auto max_h = device_limits.maxViewportDimensions[1]; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 708 | |
| 709 | if (!negative_height_enabled && !(viewport.height > 0.0f)) { |
| 710 | height_healthy = false; |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 711 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-height-01772", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 712 | "%s: %s.height (=%f) is not greater 0.0.", fn_name, parameter_name.get_name().c_str(), viewport.height); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 713 | } else if (!(f_lte_u32_exact(fabsf(viewport.height), max_h) || f_lte_u32_direct(fabsf(viewport.height), max_h))) { |
| 714 | height_healthy = false; |
| 715 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 716 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-height-01773", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 717 | "%s: Absolute value of %s.height (=%f) exceeds VkPhysicalDeviceLimits::maxViewportDimensions[1] (=%" PRIu32 |
| 718 | ").", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 719 | fn_name, parameter_name.get_name().c_str(), viewport.height, max_h); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 720 | } else if (!f_lte_u32_exact(fabsf(viewport.height), max_h) && f_lte_u32_direct(fabsf(viewport.height), max_h)) { |
| 721 | height_healthy = false; |
| 722 | |
| 723 | skip |= log_msg( |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 724 | report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, object_type, object, kVUID_PVError_NONE, |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 725 | "%s: Absolute value of %s.height (=%f) technically exceeds VkPhysicalDeviceLimits::maxViewportDimensions[1] (=%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 726 | "), but it is within the static_cast<float>(maxViewportDimensions[1]) limit.", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 727 | fn_name, parameter_name.get_name().c_str(), viewport.height, max_h); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | // x |
| 731 | bool x_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 732 | if (!(viewport.x >= device_limits.viewportBoundsRange[0])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 733 | x_healthy = false; |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 734 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-x-01774", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 735 | "%s: %s.x (=%f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", fn_name, |
| 736 | parameter_name.get_name().c_str(), viewport.x, device_limits.viewportBoundsRange[0]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | // x + width |
| 740 | if (x_healthy && width_healthy) { |
| 741 | const float right_bound = viewport.x + viewport.width; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 742 | if (!(right_bound <= device_limits.viewportBoundsRange[1])) { |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 743 | skip |= |
| 744 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-x-01232", |
| 745 | "%s: %s.x + %s.width (=%f + %f = %f) is greater than VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", |
| 746 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.x, viewport.width, |
| 747 | right_bound, device_limits.viewportBoundsRange[1]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 748 | } |
| 749 | } |
| 750 | |
| 751 | // y |
| 752 | bool y_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 753 | if (!(viewport.y >= device_limits.viewportBoundsRange[0])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 754 | y_healthy = false; |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 755 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-y-01775", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 756 | "%s: %s.y (=%f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", fn_name, |
| 757 | parameter_name.get_name().c_str(), viewport.y, device_limits.viewportBoundsRange[0]); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 758 | } else if (negative_height_enabled && !(viewport.y <= device_limits.viewportBoundsRange[1])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 759 | y_healthy = false; |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 760 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-y-01776", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 761 | "%s: %s.y (=%f) exceeds VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", fn_name, |
| 762 | parameter_name.get_name().c_str(), viewport.y, device_limits.viewportBoundsRange[1]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | // y + height |
| 766 | if (y_healthy && height_healthy) { |
| 767 | const float boundary = viewport.y + viewport.height; |
| 768 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 769 | if (!(boundary <= device_limits.viewportBoundsRange[1])) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 770 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-y-01233", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 771 | "%s: %s.y + %s.height (=%f + %f = %f) exceeds VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 772 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.y, |
| 773 | viewport.height, boundary, device_limits.viewportBoundsRange[1]); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 774 | } else if (negative_height_enabled && !(boundary >= device_limits.viewportBoundsRange[0])) { |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 775 | skip |= |
| 776 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-y-01777", |
| 777 | "%s: %s.y + %s.height (=%f + %f = %f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", |
| 778 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.y, viewport.height, |
| 779 | boundary, device_limits.viewportBoundsRange[0]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 780 | } |
| 781 | } |
| 782 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 783 | if (!device_extensions.vk_ext_depth_range_unrestricted) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 784 | // minDepth |
| 785 | if (!(viewport.minDepth >= 0.0) || !(viewport.minDepth <= 1.0)) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 786 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-minDepth-01234", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 787 | |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 788 | "%s: VK_EXT_depth_range_unrestricted extension is not enabled and %s.minDepth (=%f) is not within the " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 789 | "[0.0, 1.0] range.", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 790 | fn_name, parameter_name.get_name().c_str(), viewport.minDepth); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 791 | } |
| 792 | |
| 793 | // maxDepth |
| 794 | if (!(viewport.maxDepth >= 0.0) || !(viewport.maxDepth <= 1.0)) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 795 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object, "VUID-VkViewport-maxDepth-01235", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 796 | |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 797 | "%s: VK_EXT_depth_range_unrestricted extension is not enabled and %s.maxDepth (=%f) is not within the " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 798 | "[0.0, 1.0] range.", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 799 | fn_name, parameter_name.get_name().c_str(), viewport.maxDepth); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 800 | } |
| 801 | } |
| 802 | |
| 803 | return skip; |
| 804 | } |
| 805 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 806 | struct SampleOrderInfo { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 807 | VkShadingRatePaletteEntryNV shadingRate; |
| 808 | uint32_t width; |
| 809 | uint32_t height; |
| 810 | }; |
| 811 | |
| 812 | // All palette entries with more than one pixel per fragment |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 813 | static SampleOrderInfo sampleOrderInfos[] = { |
| 814 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV, 1, 2}, |
| 815 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV, 2, 1}, |
| 816 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV, 2, 2}, |
| 817 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV, 4, 2}, |
| 818 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV, 2, 4}, |
| 819 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV, 4, 4}, |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 820 | }; |
| 821 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 822 | bool StatelessValidation::ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 823 | bool skip = false; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 824 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 825 | SampleOrderInfo *sampleOrderInfo; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 826 | uint32_t infoIdx = 0; |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 827 | for (sampleOrderInfo = nullptr; infoIdx < ARRAY_SIZE(sampleOrderInfos); ++infoIdx) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 828 | if (sampleOrderInfos[infoIdx].shadingRate == order->shadingRate) { |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 829 | sampleOrderInfo = &sampleOrderInfos[infoIdx]; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 830 | break; |
| 831 | } |
| 832 | } |
| 833 | |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 834 | if (sampleOrderInfo == nullptr) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 835 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 836 | "VUID-VkCoarseSampleOrderCustomNV-shadingRate-02073", |
| 837 | "VkCoarseSampleOrderCustomNV shadingRate must be a shading rate " |
| 838 | "that generates fragments with more than one pixel."); |
| 839 | return skip; |
| 840 | } |
| 841 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 842 | if (order->sampleCount == 0 || (order->sampleCount & (order->sampleCount - 1)) || |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 843 | !(order->sampleCount & device_limits.framebufferNoAttachmentsSampleCounts)) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 844 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 845 | "VUID-VkCoarseSampleOrderCustomNV-sampleCount-02074", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 846 | "VkCoarseSampleOrderCustomNV sampleCount (=%" PRIu32 |
| 847 | ") must " |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 848 | "correspond to a sample count enumerated in VkSampleCountFlags whose corresponding bit " |
| 849 | "is set in framebufferNoAttachmentsSampleCounts.", |
| 850 | order->sampleCount); |
| 851 | } |
| 852 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 853 | if (order->sampleLocationCount != order->sampleCount * sampleOrderInfo->width * sampleOrderInfo->height) { |
| 854 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 855 | "VUID-VkCoarseSampleOrderCustomNV-sampleLocationCount-02075", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 856 | "VkCoarseSampleOrderCustomNV sampleLocationCount (=%" PRIu32 |
| 857 | ") must " |
| 858 | "be equal to the product of sampleCount (=%" PRIu32 |
| 859 | "), the fragment width for shadingRate " |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 860 | "(=%" PRIu32 "), and the fragment height for shadingRate (=%" PRIu32 ").", |
| 861 | order->sampleLocationCount, order->sampleCount, sampleOrderInfo->width, sampleOrderInfo->height); |
| 862 | } |
| 863 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 864 | if (order->sampleLocationCount > phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 865 | skip |= log_msg( |
| 866 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 867 | "VUID-VkCoarseSampleOrderCustomNV-sampleLocationCount-02076", |
| 868 | "VkCoarseSampleOrderCustomNV sampleLocationCount (=%" PRIu32 |
| 869 | ") must " |
| 870 | "be less than or equal to VkPhysicalDeviceShadingRateImagePropertiesNV shadingRateMaxCoarseSamples (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 871 | order->sampleLocationCount, phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 872 | } |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 873 | |
| 874 | // Accumulate a bitmask tracking which (x,y,sample) tuples are seen. Expect |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 875 | // the first width*height*sampleCount bits to all be set. Note: There is no |
| 876 | // guarantee that 64 bits is enough, but practically it's unlikely for an |
| 877 | // implementation to support more than 32 bits for samplemask. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 878 | assert(phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples <= 64); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 879 | uint64_t sampleLocationsMask = 0; |
| 880 | for (uint32_t i = 0; i < order->sampleLocationCount; ++i) { |
| 881 | const VkCoarseSampleLocationNV *sampleLoc = &order->pSampleLocations[i]; |
| 882 | if (sampleLoc->pixelX >= sampleOrderInfo->width) { |
| 883 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 884 | "VUID-VkCoarseSampleLocationNV-pixelX-02078", |
| 885 | "pixelX must be less than the width (in pixels) of the fragment."); |
| 886 | } |
| 887 | if (sampleLoc->pixelY >= sampleOrderInfo->height) { |
| 888 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 889 | "VUID-VkCoarseSampleLocationNV-pixelY-02079", |
| 890 | "pixelY must be less than the height (in pixels) of the fragment."); |
| 891 | } |
| 892 | if (sampleLoc->sample >= order->sampleCount) { |
| 893 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 894 | "VUID-VkCoarseSampleLocationNV-sample-02080", |
| 895 | "sample must be less than the number of coverage samples in each pixel belonging to the fragment."); |
| 896 | } |
| 897 | uint32_t idx = sampleLoc->sample + order->sampleCount * (sampleLoc->pixelX + sampleOrderInfo->width * sampleLoc->pixelY); |
| 898 | sampleLocationsMask |= 1ULL << idx; |
| 899 | } |
| 900 | |
| 901 | uint64_t expectedMask = (order->sampleLocationCount == 64) ? ~0ULL : ((1ULL << order->sampleLocationCount) - 1); |
| 902 | if (sampleLocationsMask != expectedMask) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 903 | skip |= log_msg( |
| 904 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 905 | "VUID-VkCoarseSampleOrderCustomNV-pSampleLocations-02077", |
| 906 | "The array pSampleLocations must contain exactly one entry for " |
| 907 | "every combination of valid values for pixelX, pixelY, and sample in the structure VkCoarseSampleOrderCustomNV."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 908 | } |
| 909 | |
| 910 | return skip; |
| 911 | } |
| 912 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 913 | bool StatelessValidation::manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, |
| 914 | uint32_t createInfoCount, |
| 915 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 916 | const VkAllocationCallbacks *pAllocator, |
| 917 | VkPipeline *pPipelines) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 918 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 919 | |
| 920 | if (pCreateInfos != nullptr) { |
| 921 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 922 | bool has_dynamic_viewport = false; |
| 923 | bool has_dynamic_scissor = false; |
| 924 | bool has_dynamic_line_width = false; |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 925 | bool has_dynamic_viewport_w_scaling_nv = false; |
| 926 | bool has_dynamic_discard_rectangle_ext = false; |
| 927 | bool has_dynamic_sample_locations_ext = false; |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 928 | bool has_dynamic_exclusive_scissor_nv = false; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 929 | bool has_dynamic_shading_rate_palette_nv = false; |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 930 | if (pCreateInfos[i].pDynamicState != nullptr) { |
| 931 | const auto &dynamic_state_info = *pCreateInfos[i].pDynamicState; |
| 932 | for (uint32_t state_index = 0; state_index < dynamic_state_info.dynamicStateCount; ++state_index) { |
| 933 | const auto &dynamic_state = dynamic_state_info.pDynamicStates[state_index]; |
| 934 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT) has_dynamic_viewport = true; |
| 935 | if (dynamic_state == VK_DYNAMIC_STATE_SCISSOR) has_dynamic_scissor = true; |
| 936 | if (dynamic_state == VK_DYNAMIC_STATE_LINE_WIDTH) has_dynamic_line_width = true; |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 937 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV) has_dynamic_viewport_w_scaling_nv = true; |
| 938 | if (dynamic_state == VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT) has_dynamic_discard_rectangle_ext = true; |
| 939 | if (dynamic_state == VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT) has_dynamic_sample_locations_ext = true; |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 940 | if (dynamic_state == VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV) has_dynamic_exclusive_scissor_nv = true; |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 941 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV) |
| 942 | has_dynamic_shading_rate_palette_nv = true; |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 943 | } |
| 944 | } |
| 945 | |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 946 | auto feedback_struct = lvl_find_in_chain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
| 947 | if ((feedback_struct != nullptr) && |
| 948 | (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
| 949 | skip |= |
| 950 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, |
| 951 | "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02668", |
| 952 | "vkCreateGraphicsPipelines(): in pCreateInfo[%" PRIu32 |
| 953 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
| 954 | "(=%" PRIu32 ") must equal VkGraphicsPipelineCreateInfo::stageCount(=%" PRIu32 ").", |
| 955 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
| 956 | } |
| 957 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 958 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 959 | if (pCreateInfos[i].pVertexInputState != nullptr) { |
| 960 | auto const &vertex_input_state = pCreateInfos[i].pVertexInputState; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 961 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 962 | if (vertex_input_state->vertexBindingDescriptionCount > device_limits.maxVertexInputBindings) { |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 963 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 964 | "VUID-VkPipelineVertexInputStateCreateInfo-vertexBindingDescriptionCount-00613", |
| 965 | "vkCreateGraphicsPipelines: pararameter " |
| 966 | "pCreateInfo[%d].pVertexInputState->vertexBindingDescriptionCount (%u) is " |
| 967 | "greater than VkPhysicalDeviceLimits::maxVertexInputBindings (%u).", |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 968 | i, vertex_input_state->vertexBindingDescriptionCount, device_limits.maxVertexInputBindings); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 969 | } |
| 970 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 971 | if (vertex_input_state->vertexAttributeDescriptionCount > device_limits.maxVertexInputAttributes) { |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 972 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 973 | "VUID-VkPipelineVertexInputStateCreateInfo-vertexAttributeDescriptionCount-00614", |
| 974 | "vkCreateGraphicsPipelines: pararameter " |
Peter Kohaut | 9e92c5c | 2018-07-17 10:32:17 +0200 | [diff] [blame] | 975 | "pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptionCount (%u) is " |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 976 | "greater than VkPhysicalDeviceLimits::maxVertexInputAttributes (%u).", |
Mark Lobodzinski | b41e165 | 2019-04-18 08:30:27 -0600 | [diff] [blame] | 977 | i, vertex_input_state->vertexAttributeDescriptionCount, device_limits.maxVertexInputAttributes); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 978 | } |
| 979 | |
| 980 | std::unordered_set<uint32_t> vertex_bindings(vertex_input_state->vertexBindingDescriptionCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 981 | for (uint32_t d = 0; d < vertex_input_state->vertexBindingDescriptionCount; ++d) { |
| 982 | auto const &vertex_bind_desc = vertex_input_state->pVertexBindingDescriptions[d]; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 983 | auto const &binding_it = vertex_bindings.find(vertex_bind_desc.binding); |
| 984 | if (binding_it != vertex_bindings.cend()) { |
| 985 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 986 | "VUID-VkPipelineVertexInputStateCreateInfo-pVertexBindingDescriptions-00616", |
| 987 | "vkCreateGraphicsPipelines: parameter " |
| 988 | "pCreateInfo[%d].pVertexInputState->pVertexBindingDescription[%d].binding " |
| 989 | "(%" PRIu32 ") is not distinct.", |
| 990 | i, d, vertex_bind_desc.binding); |
| 991 | } |
| 992 | vertex_bindings.insert(vertex_bind_desc.binding); |
| 993 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 994 | if (vertex_bind_desc.binding >= device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 995 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 996 | "VUID-VkVertexInputBindingDescription-binding-00618", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 997 | "vkCreateGraphicsPipelines: parameter " |
| 998 | "pCreateInfos[%u].pVertexInputState->pVertexBindingDescriptions[%u].binding (%u) is " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 999 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings (%u).", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1000 | i, d, vertex_bind_desc.binding, device_limits.maxVertexInputBindings); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1001 | } |
| 1002 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1003 | if (vertex_bind_desc.stride > device_limits.maxVertexInputBindingStride) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1004 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1005 | "VUID-VkVertexInputBindingDescription-stride-00619", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1006 | "vkCreateGraphicsPipelines: parameter " |
| 1007 | "pCreateInfos[%u].pVertexInputState->pVertexBindingDescriptions[%u].stride (%u) is greater " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1008 | "than VkPhysicalDeviceLimits::maxVertexInputBindingStride (%u).", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1009 | i, d, vertex_bind_desc.stride, device_limits.maxVertexInputBindingStride); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1010 | } |
| 1011 | } |
| 1012 | |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1013 | std::unordered_set<uint32_t> attribute_locations(vertex_input_state->vertexAttributeDescriptionCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1014 | for (uint32_t d = 0; d < vertex_input_state->vertexAttributeDescriptionCount; ++d) { |
| 1015 | auto const &vertex_attrib_desc = vertex_input_state->pVertexAttributeDescriptions[d]; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1016 | auto const &location_it = attribute_locations.find(vertex_attrib_desc.location); |
| 1017 | if (location_it != attribute_locations.cend()) { |
| 1018 | skip |= log_msg( |
| 1019 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1020 | "VUID-VkPipelineVertexInputStateCreateInfo-pVertexAttributeDescriptions-00617", |
| 1021 | "vkCreateGraphicsPipelines: parameter " |
| 1022 | "pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptions[%d].location (%u) is not distinct.", |
| 1023 | i, d, vertex_attrib_desc.location); |
| 1024 | } |
| 1025 | attribute_locations.insert(vertex_attrib_desc.location); |
| 1026 | |
| 1027 | auto const &binding_it = vertex_bindings.find(vertex_attrib_desc.binding); |
| 1028 | if (binding_it == vertex_bindings.cend()) { |
| 1029 | skip |= log_msg( |
| 1030 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1031 | "VUID-VkPipelineVertexInputStateCreateInfo-binding-00615", |
| 1032 | "vkCreateGraphicsPipelines: parameter " |
| 1033 | " pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptions[%d].binding (%u) does not exist " |
| 1034 | "in any pCreateInfo[%d].pVertexInputState->pVertexBindingDescription.", |
| 1035 | i, d, vertex_attrib_desc.binding, i); |
| 1036 | } |
| 1037 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1038 | if (vertex_attrib_desc.location >= device_limits.maxVertexInputAttributes) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1039 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1040 | "VUID-VkVertexInputAttributeDescription-location-00620", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1041 | "vkCreateGraphicsPipelines: parameter " |
| 1042 | "pCreateInfos[%u].pVertexInputState->pVertexAttributeDescriptions[%u].location (%u) is " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1043 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputAttributes (%u).", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1044 | i, d, vertex_attrib_desc.location, device_limits.maxVertexInputAttributes); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1045 | } |
| 1046 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1047 | if (vertex_attrib_desc.binding >= device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1048 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1049 | "VUID-VkVertexInputAttributeDescription-binding-00621", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1050 | "vkCreateGraphicsPipelines: parameter " |
| 1051 | "pCreateInfos[%u].pVertexInputState->pVertexAttributeDescriptions[%u].binding (%u) is " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1052 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings (%u).", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1053 | i, d, vertex_attrib_desc.binding, device_limits.maxVertexInputBindings); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1054 | } |
| 1055 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1056 | if (vertex_attrib_desc.offset > device_limits.maxVertexInputAttributeOffset) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 1057 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1058 | "VUID-VkVertexInputAttributeDescription-offset-00622", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 1059 | "vkCreateGraphicsPipelines: parameter " |
| 1060 | "pCreateInfos[%u].pVertexInputState->pVertexAttributeDescriptions[%u].offset (%u) is " |
| 1061 | "greater than VkPhysicalDeviceLimits::maxVertexInputAttributeOffset (%u).", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1062 | i, d, vertex_attrib_desc.offset, device_limits.maxVertexInputAttributeOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1063 | } |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | if (pCreateInfos[i].pStages != nullptr) { |
| 1068 | bool has_control = false; |
| 1069 | bool has_eval = false; |
| 1070 | |
| 1071 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 1072 | if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
| 1073 | has_control = true; |
| 1074 | } else if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
| 1075 | has_eval = true; |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 | // pTessellationState is ignored without both tessellation control and tessellation evaluation shaders stages |
| 1080 | if (has_control && has_eval) { |
| 1081 | if (pCreateInfos[i].pTessellationState == nullptr) { |
| 1082 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1083 | "VUID-VkGraphicsPipelineCreateInfo-pStages-00731", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1084 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pStages includes a tessellation control " |
| 1085 | "shader stage and a tessellation evaluation shader stage, " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1086 | "pCreateInfos[%d].pTessellationState must not be NULL.", |
| 1087 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1088 | } else { |
Locke | e04009e | 2019-03-08 12:22:35 -0700 | [diff] [blame] | 1089 | const VkStructureType allowed_type = |
| 1090 | VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1091 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1092 | "vkCreateGraphicsPipelines", |
Locke | e04009e | 2019-03-08 12:22:35 -0700 | [diff] [blame] | 1093 | ParameterName("pCreateInfos[%i].pTessellationState->pNext", ParameterName::IndexVector{i}), |
| 1094 | "VkPipelineTessellationDomainOriginStateCreateInfo", pCreateInfos[i].pTessellationState->pNext, 1, |
| 1095 | &allowed_type, GeneratedVulkanHeaderVersion, "VUID-VkGraphicsPipelineCreateInfo-pNext-pNext"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1096 | |
| 1097 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1098 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1099 | ParameterName("pCreateInfos[%i].pTessellationState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1100 | pCreateInfos[i].pTessellationState->flags, |
| 1101 | "VUID-VkPipelineTessellationStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1102 | |
| 1103 | if (pCreateInfos[i].pTessellationState->sType != |
| 1104 | VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO) { |
| 1105 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1106 | "VUID-VkPipelineTessellationStateCreateInfo-sType-sType", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1107 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pTessellationState->sType must " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1108 | "be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO.", |
| 1109 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1110 | } |
| 1111 | |
| 1112 | if (pCreateInfos[i].pTessellationState->patchControlPoints == 0 || |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1113 | pCreateInfos[i].pTessellationState->patchControlPoints > device_limits.maxTessellationPatchSize) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1114 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1115 | "VUID-VkPipelineTessellationStateCreateInfo-patchControlPoints-01214", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1116 | "vkCreateGraphicsPipelines: invalid parameter " |
| 1117 | "pCreateInfos[%d].pTessellationState->patchControlPoints value %u. patchControlPoints " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1118 | "should be >0 and <=%u.", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1119 | i, pCreateInfos[i].pTessellationState->patchControlPoints, |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1120 | device_limits.maxTessellationPatchSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1121 | } |
| 1122 | } |
| 1123 | } |
| 1124 | } |
| 1125 | |
| 1126 | // pViewportState, pMultisampleState, pDepthStencilState, and pColorBlendState ignored when rasterization is disabled |
| 1127 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 1128 | (pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) { |
| 1129 | if (pCreateInfos[i].pViewportState == nullptr) { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1130 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1131 | VK_NULL_HANDLE, "VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00750", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1132 | "vkCreateGraphicsPipelines: Rasterization is enabled (pCreateInfos[%" PRIu32 |
| 1133 | "].pRasterizationState->rasterizerDiscardEnable is VK_FALSE), but pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1134 | "].pViewportState (=NULL) is not a valid pointer.", |
| 1135 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1136 | } else { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1137 | const auto &viewport_state = *pCreateInfos[i].pViewportState; |
| 1138 | |
| 1139 | if (viewport_state.sType != VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO) { |
| 1140 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1141 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-sType-sType", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1142 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1143 | "].pViewportState->sType is not VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO.", |
| 1144 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1145 | } |
| 1146 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1147 | const VkStructureType allowed_structs_VkPipelineViewportStateCreateInfo[] = { |
| 1148 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV, |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1149 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV, |
| 1150 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV, |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1151 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV, |
| 1152 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV, |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1153 | }; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1154 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1155 | "vkCreateGraphicsPipelines", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1156 | ParameterName("pCreateInfos[%i].pViewportState->pNext", ParameterName::IndexVector{i}), |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1157 | "VkPipelineViewportSwizzleStateCreateInfoNV, VkPipelineViewportWScalingStateCreateInfoNV, " |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 1158 | "VkPipelineViewportExclusiveScissorStateCreateInfoNV, VkPipelineViewportShadingRateImageStateCreateInfoNV, " |
| 1159 | "VkPipelineViewportCoarseSampleOrderStateCreateInfoNV", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1160 | viewport_state.pNext, ARRAY_SIZE(allowed_structs_VkPipelineViewportStateCreateInfo), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1161 | allowed_structs_VkPipelineViewportStateCreateInfo, 65, |
| 1162 | "VUID-VkPipelineViewportStateCreateInfo-pNext-pNext"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1163 | |
| 1164 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1165 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1166 | ParameterName("pCreateInfos[%i].pViewportState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1167 | viewport_state.flags, "VUID-VkPipelineViewportStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1168 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1169 | auto exclusive_scissor_struct = lvl_find_in_chain<VkPipelineViewportExclusiveScissorStateCreateInfoNV>( |
| 1170 | pCreateInfos[i].pViewportState->pNext); |
| 1171 | auto shading_rate_image_struct = lvl_find_in_chain<VkPipelineViewportShadingRateImageStateCreateInfoNV>( |
| 1172 | pCreateInfos[i].pViewportState->pNext); |
| 1173 | auto coarse_sample_order_struct = lvl_find_in_chain<VkPipelineViewportCoarseSampleOrderStateCreateInfoNV>( |
| 1174 | pCreateInfos[i].pViewportState->pNext); |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 1175 | const auto vp_swizzle_struct = |
| 1176 | lvl_find_in_chain<VkPipelineViewportSwizzleStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1177 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1178 | if (!physical_device_features.multiViewport) { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1179 | if (viewport_state.viewportCount != 1) { |
| 1180 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1181 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-01216", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1182 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 1183 | "disabled, but pCreateInfos[%" PRIu32 "].pViewportState->viewportCount (=%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1184 | ") is not 1.", |
| 1185 | i, viewport_state.viewportCount); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1186 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1187 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1188 | if (viewport_state.scissorCount != 1) { |
| 1189 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1190 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01217", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1191 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 1192 | "disabled, but pCreateInfos[%" PRIu32 "].pViewportState->scissorCount (=%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1193 | ") is not 1.", |
| 1194 | i, viewport_state.scissorCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1195 | } |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1196 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1197 | if (exclusive_scissor_struct && (exclusive_scissor_struct->exclusiveScissorCount != 0 && |
| 1198 | exclusive_scissor_struct->exclusiveScissorCount != 1)) { |
| 1199 | skip |= |
| 1200 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1201 | VK_NULL_HANDLE, |
| 1202 | "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02027", |
| 1203 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 1204 | "disabled, but pCreateInfos[%" PRIu32 |
| 1205 | "] VkPipelineViewportExclusiveScissorStateCreateInfoNV::exclusiveScissorCount (=%" PRIu32 |
| 1206 | ") is not 1.", |
| 1207 | i, exclusive_scissor_struct->exclusiveScissorCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1208 | } |
| 1209 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1210 | if (shading_rate_image_struct && |
| 1211 | (shading_rate_image_struct->viewportCount != 0 && shading_rate_image_struct->viewportCount != 1)) { |
| 1212 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1213 | VK_NULL_HANDLE, |
| 1214 | "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-viewportCount-02054", |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1215 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1216 | "disabled, but pCreateInfos[%" PRIu32 |
| 1217 | "] VkPipelineViewportShadingRateImageStateCreateInfoNV::viewportCount (=%" PRIu32 |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 1218 | ") is neither 0 nor 1.", |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1219 | i, shading_rate_image_struct->viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1220 | } |
| 1221 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1222 | } else { // multiViewport enabled |
| 1223 | if (viewport_state.viewportCount == 0) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1224 | skip |= log_msg( |
| 1225 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1226 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-arraylength", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1227 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "].pViewportState->viewportCount is 0.", i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1228 | } else if (viewport_state.viewportCount > device_limits.maxViewports) { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1229 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1230 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-01218", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1231 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1232 | "].pViewportState->viewportCount (=%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1233 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1234 | i, viewport_state.viewportCount, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1235 | } |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1236 | |
| 1237 | if (viewport_state.scissorCount == 0) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1238 | skip |= log_msg( |
| 1239 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1240 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-arraylength", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1241 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "].pViewportState->scissorCount is 0.", i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1242 | } else if (viewport_state.scissorCount > device_limits.maxViewports) { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1243 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1244 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01219", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1245 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1246 | "].pViewportState->scissorCount (=%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1247 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1248 | i, viewport_state.scissorCount, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1249 | } |
| 1250 | } |
| 1251 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1252 | if (exclusive_scissor_struct && exclusive_scissor_struct->exclusiveScissorCount > device_limits.maxViewports) { |
| 1253 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1254 | VK_NULL_HANDLE, |
| 1255 | "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02028", |
| 1256 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "] exclusiveScissorCount (=%" PRIu32 |
| 1257 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 1258 | i, exclusive_scissor_struct->exclusiveScissorCount, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1259 | } |
| 1260 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1261 | if (shading_rate_image_struct && shading_rate_image_struct->viewportCount > device_limits.maxViewports) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1262 | skip |= |
| 1263 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1264 | VK_NULL_HANDLE, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-viewportCount-02055", |
| 1265 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1266 | "] VkPipelineViewportShadingRateImageStateCreateInfoNV viewportCount (=%" PRIu32 |
| 1267 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1268 | i, shading_rate_image_struct->viewportCount, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1269 | } |
| 1270 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1271 | if (viewport_state.scissorCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1272 | skip |= |
| 1273 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1274 | VK_NULL_HANDLE, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01220", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1275 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "].pViewportState->scissorCount (=%" PRIu32 |
| 1276 | ") is not identical to pCreateInfos[%" PRIu32 "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 1277 | i, viewport_state.scissorCount, i, viewport_state.viewportCount); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1278 | } |
| 1279 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1280 | if (exclusive_scissor_struct && exclusive_scissor_struct->exclusiveScissorCount != 0 && |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1281 | exclusive_scissor_struct->exclusiveScissorCount != viewport_state.viewportCount) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1282 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1283 | VK_NULL_HANDLE, |
| 1284 | "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02029", |
| 1285 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "] exclusiveScissorCount (=%" PRIu32 |
| 1286 | ") must be zero or identical to pCreateInfos[%" PRIu32 |
| 1287 | "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 1288 | i, exclusive_scissor_struct->exclusiveScissorCount, i, viewport_state.viewportCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1289 | } |
| 1290 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1291 | if (shading_rate_image_struct && shading_rate_image_struct->shadingRateImageEnable && |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1292 | shading_rate_image_struct->viewportCount != viewport_state.viewportCount) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1293 | skip |= log_msg( |
| 1294 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, |
| 1295 | "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-shadingRateImageEnable-02056", |
| 1296 | "vkCreateGraphicsPipelines: If shadingRateImageEnable is enabled, pCreateInfos[%" PRIu32 |
| 1297 | "] " |
| 1298 | "VkPipelineViewportShadingRateImageStateCreateInfoNV viewportCount (=%" PRIu32 |
| 1299 | ") must identical to pCreateInfos[%" PRIu32 "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 1300 | i, shading_rate_image_struct->viewportCount, i, viewport_state.viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1301 | } |
| 1302 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1303 | if (!has_dynamic_viewport && viewport_state.viewportCount > 0 && viewport_state.pViewports == nullptr) { |
| 1304 | skip |= log_msg( |
| 1305 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1306 | "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00747", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1307 | "vkCreateGraphicsPipelines: The viewport state is static (pCreateInfos[%" PRIu32 |
| 1308 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_VIEWPORT), but pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1309 | "].pViewportState->pViewports (=NULL) is an invalid pointer.", |
| 1310 | i, i); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1311 | } |
| 1312 | |
| 1313 | if (!has_dynamic_scissor && viewport_state.scissorCount > 0 && viewport_state.pScissors == nullptr) { |
| 1314 | skip |= log_msg( |
| 1315 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1316 | "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00748", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1317 | "vkCreateGraphicsPipelines: The scissor state is static (pCreateInfos[%" PRIu32 |
| 1318 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_SCISSOR), but pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1319 | "].pViewportState->pScissors (=NULL) is an invalid pointer.", |
| 1320 | i, i); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1321 | } |
| 1322 | |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1323 | if (!has_dynamic_exclusive_scissor_nv && exclusive_scissor_struct && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1324 | exclusive_scissor_struct->exclusiveScissorCount > 0 && |
| 1325 | exclusive_scissor_struct->pExclusiveScissors == nullptr) { |
| 1326 | skip |= |
| 1327 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1328 | VK_NULL_HANDLE, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-pDynamicStates-02030", |
| 1329 | "vkCreateGraphicsPipelines: The exclusive scissor state is static (pCreateInfos[%" PRIu32 |
| 1330 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV), but " |
| 1331 | "pCreateInfos[%" PRIu32 "] pExclusiveScissors (=NULL) is an invalid pointer.", |
| 1332 | i, i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1333 | } |
| 1334 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1335 | if (!has_dynamic_shading_rate_palette_nv && shading_rate_image_struct && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1336 | shading_rate_image_struct->viewportCount > 0 && |
| 1337 | shading_rate_image_struct->pShadingRatePalettes == nullptr) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1338 | skip |= log_msg( |
| 1339 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, |
| 1340 | "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-pDynamicStates-02057", |
| 1341 | "vkCreateGraphicsPipelines: The shading rate palette state is static (pCreateInfos[%" PRIu32 |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1342 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV), " |
| 1343 | "but pCreateInfos[%" PRIu32 "] pShadingRatePalettes (=NULL) is an invalid pointer.", |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1344 | i, i); |
| 1345 | } |
| 1346 | |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 1347 | if (vp_swizzle_struct) { |
| 1348 | if (vp_swizzle_struct->viewportCount != viewport_state.viewportCount) { |
| 1349 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1350 | VK_NULL_HANDLE, "VUID-VkPipelineViewportSwizzleStateCreateInfoNV-viewportCount-01215", |
| 1351 | "vkCreateGraphicsPipelines: The viewport swizzle state vieport count of %" PRIu32 |
| 1352 | " does " |
| 1353 | "not match the viewport count of %" PRIu32 " in VkPipelineViewportStateCreateInfo.", |
| 1354 | vp_swizzle_struct->viewportCount, viewport_state.viewportCount); |
| 1355 | } |
| 1356 | } |
| 1357 | |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1358 | // validate the VkViewports |
| 1359 | if (!has_dynamic_viewport && viewport_state.pViewports) { |
| 1360 | for (uint32_t viewport_i = 0; viewport_i < viewport_state.viewportCount; ++viewport_i) { |
| 1361 | const auto &viewport = viewport_state.pViewports[viewport_i]; // will crash on invalid ptr |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 1362 | const char *fn_name = "vkCreateGraphicsPipelines"; |
| 1363 | skip |= manual_PreCallValidateViewport(viewport, fn_name, |
| 1364 | ParameterName("pCreateInfos[%i].pViewportState->pViewports[%i]", |
| 1365 | ParameterName::IndexVector{i, viewport_i}), |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1366 | VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1367 | } |
| 1368 | } |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1369 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1370 | if (has_dynamic_viewport_w_scaling_nv && !device_extensions.vk_nv_clip_space_w_scaling) { |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1371 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1372 | VK_NULL_HANDLE, kVUID_PVError_ExtensionNotEnabled, |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1373 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1374 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV, but " |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1375 | "VK_NV_clip_space_w_scaling extension is not enabled.", |
| 1376 | i); |
| 1377 | } |
| 1378 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1379 | if (has_dynamic_discard_rectangle_ext && !device_extensions.vk_ext_discard_rectangles) { |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1380 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1381 | VK_NULL_HANDLE, kVUID_PVError_ExtensionNotEnabled, |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1382 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1383 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT, but " |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1384 | "VK_EXT_discard_rectangles extension is not enabled.", |
| 1385 | i); |
| 1386 | } |
| 1387 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1388 | if (has_dynamic_sample_locations_ext && !device_extensions.vk_ext_sample_locations) { |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1389 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1390 | VK_NULL_HANDLE, kVUID_PVError_ExtensionNotEnabled, |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1391 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1392 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT, but " |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1393 | "VK_EXT_sample_locations extension is not enabled.", |
| 1394 | i); |
| 1395 | } |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1396 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1397 | if (has_dynamic_exclusive_scissor_nv && !device_extensions.vk_nv_scissor_exclusive) { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1398 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1399 | VK_NULL_HANDLE, kVUID_PVError_ExtensionNotEnabled, |
| 1400 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1401 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV, but " |
| 1402 | "VK_NV_scissor_exclusive extension is not enabled.", |
| 1403 | i); |
| 1404 | } |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1405 | |
| 1406 | if (coarse_sample_order_struct && |
| 1407 | coarse_sample_order_struct->sampleOrderType != VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV && |
| 1408 | coarse_sample_order_struct->customSampleOrderCount != 0) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1409 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, |
| 1410 | VK_NULL_HANDLE, |
| 1411 | "VUID-VkPipelineViewportCoarseSampleOrderStateCreateInfoNV-sampleOrderType-02072", |
| 1412 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1413 | "] " |
| 1414 | "VkPipelineViewportCoarseSampleOrderStateCreateInfoNV sampleOrderType is not " |
| 1415 | "VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV and customSampleOrderCount is not 0.", |
| 1416 | i); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1417 | } |
| 1418 | |
| 1419 | if (coarse_sample_order_struct) { |
| 1420 | for (uint32_t order_i = 0; order_i < coarse_sample_order_struct->customSampleOrderCount; ++order_i) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1421 | skip |= ValidateCoarseSampleOrderCustomNV(&coarse_sample_order_struct->pCustomSampleOrders[order_i]); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1422 | } |
| 1423 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1424 | } |
| 1425 | |
| 1426 | if (pCreateInfos[i].pMultisampleState == nullptr) { |
| 1427 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1428 | "VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00751", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1429 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1430 | "is VK_FALSE, pCreateInfos[%d].pMultisampleState must not be NULL.", |
| 1431 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1432 | } else { |
Dave Houlton | b3bbec7 | 2018-01-17 10:13:33 -0700 | [diff] [blame] | 1433 | const VkStructureType valid_next_stypes[] = {LvlTypeMap<VkPipelineCoverageModulationStateCreateInfoNV>::kSType, |
| 1434 | LvlTypeMap<VkPipelineCoverageToColorStateCreateInfoNV>::kSType, |
| 1435 | LvlTypeMap<VkPipelineSampleLocationsStateCreateInfoEXT>::kSType}; |
Mike Schuchardt | 97662b0 | 2017-12-06 13:31:29 -0700 | [diff] [blame] | 1436 | const char *valid_struct_names = |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1437 | "VkPipelineCoverageModulationStateCreateInfoNV, VkPipelineCoverageToColorStateCreateInfoNV, " |
John Zulauf | 96b0e42 | 2017-11-14 11:43:19 -0700 | [diff] [blame] | 1438 | "VkPipelineSampleLocationsStateCreateInfoEXT"; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1439 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1440 | "vkCreateGraphicsPipelines", |
John Zulauf | 96b0e42 | 2017-11-14 11:43:19 -0700 | [diff] [blame] | 1441 | ParameterName("pCreateInfos[%i].pMultisampleState->pNext", ParameterName::IndexVector{i}), |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1442 | valid_struct_names, pCreateInfos[i].pMultisampleState->pNext, 3, valid_next_stypes, |
| 1443 | GeneratedVulkanHeaderVersion, "VUID-VkPipelineMultisampleStateCreateInfo-pNext-pNext"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1444 | |
| 1445 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1446 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1447 | ParameterName("pCreateInfos[%i].pMultisampleState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1448 | pCreateInfos[i].pMultisampleState->flags, "VUID-VkPipelineMultisampleStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1449 | |
| 1450 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1451 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1452 | ParameterName("pCreateInfos[%i].pMultisampleState->sampleShadingEnable", ParameterName::IndexVector{i}), |
| 1453 | pCreateInfos[i].pMultisampleState->sampleShadingEnable); |
| 1454 | |
| 1455 | skip |= validate_array( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1456 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1457 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 1458 | ParameterName("pCreateInfos[%i].pMultisampleState->pSampleMask", ParameterName::IndexVector{i}), |
GabrÃel Arthúr Pétursson | 092b29b | 2018-03-21 22:44:11 +0000 | [diff] [blame] | 1459 | pCreateInfos[i].pMultisampleState->rasterizationSamples, &pCreateInfos[i].pMultisampleState->pSampleMask, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1460 | true, false, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1461 | |
| 1462 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1463 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1464 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToCoverageEnable", ParameterName::IndexVector{i}), |
| 1465 | pCreateInfos[i].pMultisampleState->alphaToCoverageEnable); |
| 1466 | |
| 1467 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1468 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1469 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToOneEnable", ParameterName::IndexVector{i}), |
| 1470 | pCreateInfos[i].pMultisampleState->alphaToOneEnable); |
| 1471 | |
| 1472 | if (pCreateInfos[i].pMultisampleState->sType != VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO) { |
| 1473 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1474 | kVUID_PVError_InvalidStructSType, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1475 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pMultisampleState->sType must be " |
| 1476 | "VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO", |
| 1477 | i); |
| 1478 | } |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1479 | if (pCreateInfos[i].pMultisampleState->sampleShadingEnable == VK_TRUE) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1480 | if (!physical_device_features.sampleRateShading) { |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1481 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1482 | "VUID-VkPipelineMultisampleStateCreateInfo-sampleShadingEnable-00784", |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1483 | "vkCreateGraphicsPipelines(): parameter " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1484 | "pCreateInfos[%d].pMultisampleState->sampleShadingEnable.", |
| 1485 | i); |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1486 | } |
| 1487 | // TODO Add documentation issue about when minSampleShading must be in range and when it is ignored |
| 1488 | // For now a "least noise" test *only* when sampleShadingEnable is VK_TRUE. |
| 1489 | if (!in_inclusive_range(pCreateInfos[i].pMultisampleState->minSampleShading, 0.F, 1.0F)) { |
| 1490 | skip |= log_msg( |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 1491 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1492 | "VUID-VkPipelineMultisampleStateCreateInfo-minSampleShading-00786", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 1493 | "vkCreateGraphicsPipelines(): parameter pCreateInfos[%d].pMultisampleState->minSampleShading.", i); |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1494 | } |
| 1495 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1496 | } |
| 1497 | |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 1498 | bool uses_color_attachment = false; |
| 1499 | bool uses_depthstencil_attachment = false; |
| 1500 | { |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1501 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1502 | const auto subpasses_uses_it = renderpasses_states.find(pCreateInfos[i].renderPass); |
| 1503 | if (subpasses_uses_it != renderpasses_states.end()) { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 1504 | const auto &subpasses_uses = subpasses_uses_it->second; |
| 1505 | if (subpasses_uses.subpasses_using_color_attachment.count(pCreateInfos[i].subpass)) |
| 1506 | uses_color_attachment = true; |
| 1507 | if (subpasses_uses.subpasses_using_depthstencil_attachment.count(pCreateInfos[i].subpass)) |
| 1508 | uses_depthstencil_attachment = true; |
| 1509 | } |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1510 | lock.unlock(); |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 1511 | } |
| 1512 | |
| 1513 | if (pCreateInfos[i].pDepthStencilState != nullptr && uses_depthstencil_attachment) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1514 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1515 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1516 | ParameterName("pCreateInfos[%i].pDepthStencilState->pNext", ParameterName::IndexVector{i}), NULL, |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1517 | pCreateInfos[i].pDepthStencilState->pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1518 | "VUID-VkPipelineDepthStencilStateCreateInfo-pNext-pNext"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1519 | |
| 1520 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1521 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1522 | ParameterName("pCreateInfos[%i].pDepthStencilState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1523 | pCreateInfos[i].pDepthStencilState->flags, "VUID-VkPipelineDepthStencilStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1524 | |
| 1525 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1526 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1527 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthTestEnable", ParameterName::IndexVector{i}), |
| 1528 | pCreateInfos[i].pDepthStencilState->depthTestEnable); |
| 1529 | |
| 1530 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1531 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1532 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthWriteEnable", ParameterName::IndexVector{i}), |
| 1533 | pCreateInfos[i].pDepthStencilState->depthWriteEnable); |
| 1534 | |
| 1535 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1536 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1537 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthCompareOp", ParameterName::IndexVector{i}), |
| 1538 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->depthCompareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1539 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1540 | |
| 1541 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1542 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1543 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthBoundsTestEnable", ParameterName::IndexVector{i}), |
| 1544 | pCreateInfos[i].pDepthStencilState->depthBoundsTestEnable); |
| 1545 | |
| 1546 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1547 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1548 | ParameterName("pCreateInfos[%i].pDepthStencilState->stencilTestEnable", ParameterName::IndexVector{i}), |
| 1549 | pCreateInfos[i].pDepthStencilState->stencilTestEnable); |
| 1550 | |
| 1551 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1552 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1553 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.failOp", ParameterName::IndexVector{i}), |
| 1554 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.failOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1555 | "VUID-VkStencilOpState-failOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1556 | |
| 1557 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1558 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1559 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.passOp", ParameterName::IndexVector{i}), |
| 1560 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.passOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1561 | "VUID-VkStencilOpState-passOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1562 | |
| 1563 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1564 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1565 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.depthFailOp", ParameterName::IndexVector{i}), |
| 1566 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.depthFailOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1567 | "VUID-VkStencilOpState-depthFailOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1568 | |
| 1569 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1570 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1571 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.compareOp", ParameterName::IndexVector{i}), |
| 1572 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->front.compareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1573 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1574 | |
| 1575 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1576 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1577 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.failOp", ParameterName::IndexVector{i}), |
| 1578 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.failOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1579 | "VUID-VkStencilOpState-failOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1580 | |
| 1581 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1582 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1583 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.passOp", ParameterName::IndexVector{i}), |
| 1584 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.passOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1585 | "VUID-VkStencilOpState-passOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1586 | |
| 1587 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1588 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1589 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.depthFailOp", ParameterName::IndexVector{i}), |
| 1590 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.depthFailOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1591 | "VUID-VkStencilOpState-depthFailOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1592 | |
| 1593 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1594 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1595 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.compareOp", ParameterName::IndexVector{i}), |
| 1596 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->back.compareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1597 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1598 | |
| 1599 | if (pCreateInfos[i].pDepthStencilState->sType != VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO) { |
| 1600 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1601 | kVUID_PVError_InvalidStructSType, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1602 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pDepthStencilState->sType must be " |
| 1603 | "VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO", |
| 1604 | i); |
| 1605 | } |
| 1606 | } |
| 1607 | |
Shannon McPherson | 9b9532b | 2018-10-24 12:00:09 -0600 | [diff] [blame] | 1608 | const VkStructureType allowed_structs_VkPipelineColorBlendStateCreateInfo[] = { |
| 1609 | VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT}; |
| 1610 | |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 1611 | if (pCreateInfos[i].pColorBlendState != nullptr && uses_color_attachment) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1612 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1613 | "vkCreateGraphicsPipelines", |
Shannon McPherson | 9b9532b | 2018-10-24 12:00:09 -0600 | [diff] [blame] | 1614 | ParameterName("pCreateInfos[%i].pColorBlendState->pNext", ParameterName::IndexVector{i}), |
| 1615 | "VkPipelineColorBlendAdvancedStateCreateInfoEXT", pCreateInfos[i].pColorBlendState->pNext, |
| 1616 | ARRAY_SIZE(allowed_structs_VkPipelineColorBlendStateCreateInfo), |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1617 | allowed_structs_VkPipelineColorBlendStateCreateInfo, GeneratedVulkanHeaderVersion, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1618 | "VUID-VkPipelineColorBlendStateCreateInfo-pNext-pNext"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1619 | |
| 1620 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1621 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1622 | ParameterName("pCreateInfos[%i].pColorBlendState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1623 | pCreateInfos[i].pColorBlendState->flags, "VUID-VkPipelineColorBlendStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1624 | |
| 1625 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1626 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1627 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOpEnable", ParameterName::IndexVector{i}), |
| 1628 | pCreateInfos[i].pColorBlendState->logicOpEnable); |
| 1629 | |
| 1630 | skip |= validate_array( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1631 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1632 | ParameterName("pCreateInfos[%i].pColorBlendState->attachmentCount", ParameterName::IndexVector{i}), |
| 1633 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments", ParameterName::IndexVector{i}), |
GabrÃel Arthúr Pétursson | 092b29b | 2018-03-21 22:44:11 +0000 | [diff] [blame] | 1634 | pCreateInfos[i].pColorBlendState->attachmentCount, &pCreateInfos[i].pColorBlendState->pAttachments, false, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1635 | true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1636 | |
| 1637 | if (pCreateInfos[i].pColorBlendState->pAttachments != NULL) { |
| 1638 | for (uint32_t attachmentIndex = 0; attachmentIndex < pCreateInfos[i].pColorBlendState->attachmentCount; |
| 1639 | ++attachmentIndex) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1640 | skip |= validate_bool32("vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1641 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].blendEnable", |
| 1642 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1643 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].blendEnable); |
| 1644 | |
| 1645 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1646 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1647 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcColorBlendFactor", |
| 1648 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1649 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 1650 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcColorBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1651 | "VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1652 | |
| 1653 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1654 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1655 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstColorBlendFactor", |
| 1656 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1657 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 1658 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstColorBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1659 | "VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1660 | |
| 1661 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1662 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1663 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorBlendOp", |
| 1664 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1665 | "VkBlendOp", AllVkBlendOpEnums, |
| 1666 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorBlendOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1667 | "VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1668 | |
| 1669 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1670 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1671 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcAlphaBlendFactor", |
| 1672 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1673 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 1674 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcAlphaBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1675 | "VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1676 | |
| 1677 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1678 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1679 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstAlphaBlendFactor", |
| 1680 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1681 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 1682 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstAlphaBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1683 | "VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1684 | |
| 1685 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1686 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1687 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].alphaBlendOp", |
| 1688 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1689 | "VkBlendOp", AllVkBlendOpEnums, |
| 1690 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].alphaBlendOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1691 | "VUID-VkPipelineColorBlendAttachmentState-alphaBlendOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1692 | |
| 1693 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1694 | validate_flags("vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1695 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorWriteMask", |
| 1696 | ParameterName::IndexVector{i, attachmentIndex}), |
| 1697 | "VkColorComponentFlagBits", AllVkColorComponentFlagBits, |
| 1698 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorWriteMask, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1699 | false, false, "VUID-VkPipelineColorBlendAttachmentState-colorWriteMask-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1700 | } |
| 1701 | } |
| 1702 | |
| 1703 | if (pCreateInfos[i].pColorBlendState->sType != VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO) { |
| 1704 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1705 | kVUID_PVError_InvalidStructSType, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1706 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pColorBlendState->sType must be " |
| 1707 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 1708 | i); |
| 1709 | } |
| 1710 | |
| 1711 | // If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value |
| 1712 | if (pCreateInfos[i].pColorBlendState->logicOpEnable == VK_TRUE) { |
| 1713 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1714 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1715 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOp", ParameterName::IndexVector{i}), "VkLogicOp", |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1716 | AllVkLogicOpEnums, pCreateInfos[i].pColorBlendState->logicOp, |
| 1717 | "VUID-VkPipelineColorBlendStateCreateInfo-logicOpEnable-00607"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1718 | } |
| 1719 | } |
| 1720 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1721 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 1722 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 1723 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 1724 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1725 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1726 | "VUID-VkGraphicsPipelineCreateInfo-flags-00724", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1727 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be " |
| 1728 | "VK_NULL_HANDLE if pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1729 | "and pCreateInfos->basePipelineIndex is not -1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1730 | } |
| 1731 | } |
| 1732 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 1733 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
| 1734 | if (pCreateInfos[i].basePipelineIndex != -1) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1735 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1736 | "VUID-VkGraphicsPipelineCreateInfo-flags-00725", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1737 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if " |
| 1738 | "pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1739 | "pCreateInfos->basePipelineHandle is not VK_NULL_HANDLE."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1740 | } |
| 1741 | } |
| 1742 | } |
| 1743 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 1744 | if (pCreateInfos[i].pRasterizationState) { |
| 1745 | if ((pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1746 | (physical_device_features.fillModeNonSolid == false)) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1747 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1748 | kVUID_PVError_DeviceFeature, |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1749 | "vkCreateGraphicsPipelines parameter, VkPolygonMode " |
| 1750 | "pCreateInfos->pRasterizationState->polygonMode cannot be VK_POLYGON_MODE_POINT or " |
| 1751 | "VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1752 | } |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1753 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1754 | if (!has_dynamic_line_width && !physical_device_features.wideLines && |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1755 | (pCreateInfos[i].pRasterizationState->lineWidth != 1.0f)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1756 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, 0, |
| 1757 | "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00749", |
| 1758 | "The line width state is static (pCreateInfos[%" PRIu32 |
| 1759 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_LINE_WIDTH) and " |
| 1760 | "VkPhysicalDeviceFeatures::wideLines is disabled, but pCreateInfos[%" PRIu32 |
| 1761 | "].pRasterizationState->lineWidth (=%f) is not 1.0.", |
| 1762 | i, i, pCreateInfos[i].pRasterizationState->lineWidth); |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1763 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1764 | } |
| 1765 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1766 | for (size_t j = 0; j < pCreateInfos[i].stageCount; j++) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1767 | skip |= validate_string("vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1768 | ParameterName("pCreateInfos[%i].pStages[%i].pName", ParameterName::IndexVector{i, j}), |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 1769 | "VUID-VkGraphicsPipelineCreateInfo-pStages-parameter", pCreateInfos[i].pStages[j].pName); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1770 | } |
| 1771 | } |
| 1772 | } |
| 1773 | |
| 1774 | return skip; |
| 1775 | } |
| 1776 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1777 | bool StatelessValidation::manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, |
| 1778 | uint32_t createInfoCount, |
| 1779 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 1780 | const VkAllocationCallbacks *pAllocator, |
| 1781 | VkPipeline *pPipelines) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1782 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1783 | for (uint32_t i = 0; i < createInfoCount; i++) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1784 | skip |= validate_string("vkCreateComputePipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1785 | ParameterName("pCreateInfos[%i].stage.pName", ParameterName::IndexVector{i}), |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 1786 | "VUID-VkPipelineShaderStageCreateInfo-pName-parameter", pCreateInfos[i].stage.pName); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 1787 | auto feedback_struct = lvl_find_in_chain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
| 1788 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != 1)) { |
| 1789 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, |
| 1790 | "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02669", |
| 1791 | "vkCreateComputePipelines(): in pCreateInfo[%" PRIu32 |
| 1792 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount must equal 1, found %" PRIu32 ".", |
| 1793 | i, feedback_struct->pipelineStageCreationFeedbackCount); |
| 1794 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1795 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1796 | return skip; |
| 1797 | } |
| 1798 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1799 | bool StatelessValidation::manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1800 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1801 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1802 | |
| 1803 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1804 | const auto &features = physical_device_features; |
| 1805 | const auto &limits = device_limits; |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 1806 | |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 1807 | if (pCreateInfo->anisotropyEnable == VK_TRUE) { |
| 1808 | if (!in_inclusive_range(pCreateInfo->maxAnisotropy, 1.0F, limits.maxSamplerAnisotropy)) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 1809 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1810 | "VUID-VkSamplerCreateInfo-anisotropyEnable-01071", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1811 | "vkCreateSampler(): value of %s must be in range [1.0, %f] %s, but %f found.", |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 1812 | "pCreateInfo->maxAnisotropy", limits.maxSamplerAnisotropy, |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1813 | "VkPhysicalDeviceLimits::maxSamplerAnistropy", pCreateInfo->maxAnisotropy); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 1814 | } |
| 1815 | |
| 1816 | // Anistropy cannot be enabled in sampler unless enabled as a feature |
| 1817 | if (features.samplerAnisotropy == VK_FALSE) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 1818 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1819 | "VUID-VkSamplerCreateInfo-anisotropyEnable-01070", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1820 | "vkCreateSampler(): Anisotropic sampling feature is not enabled, %s must be VK_FALSE.", |
| 1821 | "pCreateInfo->anisotropyEnable"); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 1822 | } |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 1823 | } |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 1824 | |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 1825 | if (pCreateInfo->unnormalizedCoordinates == VK_TRUE) { |
| 1826 | if (pCreateInfo->minFilter != pCreateInfo->magFilter) { |
| 1827 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1828 | "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01072", |
| 1829 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 1830 | "pCreateInfo->minFilter (%s) and pCreateInfo->magFilter (%s) must be equal.", |
| 1831 | string_VkFilter(pCreateInfo->minFilter), string_VkFilter(pCreateInfo->magFilter)); |
| 1832 | } |
| 1833 | if (pCreateInfo->mipmapMode != VK_SAMPLER_MIPMAP_MODE_NEAREST) { |
| 1834 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1835 | "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01073", |
| 1836 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 1837 | "pCreateInfo->mipmapMode (%s) must be VK_SAMPLER_MIPMAP_MODE_NEAREST.", |
| 1838 | string_VkSamplerMipmapMode(pCreateInfo->mipmapMode)); |
| 1839 | } |
| 1840 | if (pCreateInfo->minLod != 0.0f || pCreateInfo->maxLod != 0.0f) { |
| 1841 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1842 | "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01074", |
| 1843 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 1844 | "pCreateInfo->minLod (%f) and pCreateInfo->maxLod (%f) must both be zero.", |
| 1845 | pCreateInfo->minLod, pCreateInfo->maxLod); |
| 1846 | } |
| 1847 | if ((pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE && |
| 1848 | pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 1849 | (pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE && |
| 1850 | pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
| 1851 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1852 | "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01075", |
| 1853 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 1854 | "pCreateInfo->addressModeU (%s) and pCreateInfo->addressModeV (%s) must both be " |
| 1855 | "VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER.", |
| 1856 | string_VkSamplerAddressMode(pCreateInfo->addressModeU), |
| 1857 | string_VkSamplerAddressMode(pCreateInfo->addressModeV)); |
| 1858 | } |
| 1859 | if (pCreateInfo->anisotropyEnable == VK_TRUE) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 1860 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1861 | "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01076", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1862 | "vkCreateSampler(): pCreateInfo->anisotropyEnable and pCreateInfo->unnormalizedCoordinates must " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1863 | "not both be VK_TRUE."); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 1864 | } |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 1865 | if (pCreateInfo->compareEnable == VK_TRUE) { |
| 1866 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1867 | "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01077", |
| 1868 | "vkCreateSampler(): pCreateInfo->compareEnable and pCreateInfo->unnormalizedCoordinates must " |
| 1869 | "not both be VK_TRUE."); |
| 1870 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1871 | } |
| 1872 | |
| 1873 | // If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value |
| 1874 | if (pCreateInfo->compareEnable == VK_TRUE) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1875 | skip |= validate_ranged_enum("vkCreateSampler", "pCreateInfo->compareOp", "VkCompareOp", AllVkCompareOpEnums, |
| 1876 | pCreateInfo->compareOp, "VUID-VkSamplerCreateInfo-compareEnable-01080"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1877 | } |
| 1878 | |
| 1879 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a |
| 1880 | // valid VkBorderColor value |
| 1881 | if ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 1882 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 1883 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1884 | skip |= validate_ranged_enum("vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor", AllVkBorderColorEnums, |
| 1885 | pCreateInfo->borderColor, "VUID-VkSamplerCreateInfo-addressModeU-01078"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1886 | } |
| 1887 | |
| 1888 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, the |
| 1889 | // VK_KHR_sampler_mirror_clamp_to_edge extension must be enabled |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1890 | if (!device_extensions.vk_khr_sampler_mirror_clamp_to_edge && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1891 | ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) || |
| 1892 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) || |
| 1893 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE))) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1894 | skip |= |
| 1895 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 1896 | "VUID-VkSamplerCreateInfo-addressModeU-01079", |
| 1897 | "vkCreateSampler(): A VkSamplerAddressMode value is set to VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE " |
| 1898 | "but the VK_KHR_sampler_mirror_clamp_to_edge extension has not been enabled."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1899 | } |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 1900 | |
| 1901 | // Checks for the IMG cubic filtering extension |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1902 | if (device_extensions.vk_img_filter_cubic) { |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 1903 | if ((pCreateInfo->anisotropyEnable == VK_TRUE) && |
| 1904 | ((pCreateInfo->minFilter == VK_FILTER_CUBIC_IMG) || (pCreateInfo->magFilter == VK_FILTER_CUBIC_IMG))) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 1905 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1906 | "VUID-VkSamplerCreateInfo-magFilter-01081", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1907 | "vkCreateSampler(): Anisotropic sampling must not be VK_TRUE when either minFilter or magFilter " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1908 | "are VK_FILTER_CUBIC_IMG."); |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 1909 | } |
| 1910 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1911 | } |
| 1912 | |
| 1913 | return skip; |
| 1914 | } |
| 1915 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1916 | bool StatelessValidation::manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, |
| 1917 | const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 1918 | const VkAllocationCallbacks *pAllocator, |
| 1919 | VkDescriptorSetLayout *pSetLayout) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1920 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1921 | |
| 1922 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 1923 | if ((pCreateInfo != nullptr) && (pCreateInfo->pBindings != nullptr)) { |
| 1924 | for (uint32_t i = 0; i < pCreateInfo->bindingCount; ++i) { |
| 1925 | if (pCreateInfo->pBindings[i].descriptorCount != 0) { |
| 1926 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, and descriptorCount |
| 1927 | // is not 0 and pImmutableSamplers is not NULL, pImmutableSamplers must be a pointer to an array of descriptorCount |
| 1928 | // valid VkSampler handles |
| 1929 | if (((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 1930 | (pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) && |
| 1931 | (pCreateInfo->pBindings[i].pImmutableSamplers != nullptr)) { |
| 1932 | for (uint32_t descriptor_index = 0; descriptor_index < pCreateInfo->pBindings[i].descriptorCount; |
| 1933 | ++descriptor_index) { |
| 1934 | if (pCreateInfo->pBindings[i].pImmutableSamplers[descriptor_index] == VK_NULL_HANDLE) { |
| 1935 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1936 | kVUID_PVError_RequiredParameter, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1937 | "vkCreateDescriptorSetLayout: required parameter " |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1938 | "pCreateInfo->pBindings[%d].pImmutableSamplers[%d] specified as VK_NULL_HANDLE", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1939 | i, descriptor_index); |
| 1940 | } |
| 1941 | } |
| 1942 | } |
| 1943 | |
| 1944 | // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values |
| 1945 | if ((pCreateInfo->pBindings[i].stageFlags != 0) && |
| 1946 | ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1947 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1948 | "VUID-VkDescriptorSetLayoutBinding-descriptorCount-00283", |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1949 | "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%d].descriptorCount is not 0, " |
| 1950 | "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1951 | "values.", |
| 1952 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1953 | } |
| 1954 | } |
| 1955 | } |
| 1956 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1957 | return skip; |
| 1958 | } |
| 1959 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1960 | bool StatelessValidation::manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, |
| 1961 | uint32_t descriptorSetCount, |
| 1962 | const VkDescriptorSet *pDescriptorSets) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1963 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 1964 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 1965 | // validate_array() |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1966 | return validate_array("vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, &pDescriptorSets, |
| 1967 | true, true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1968 | } |
| 1969 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1970 | bool StatelessValidation::manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1971 | const VkWriteDescriptorSet *pDescriptorWrites, |
| 1972 | uint32_t descriptorCopyCount, |
| 1973 | const VkCopyDescriptorSet *pDescriptorCopies) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1974 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1975 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 1976 | if (pDescriptorWrites != NULL) { |
| 1977 | for (uint32_t i = 0; i < descriptorWriteCount; ++i) { |
| 1978 | // descriptorCount must be greater than 0 |
| 1979 | if (pDescriptorWrites[i].descriptorCount == 0) { |
| 1980 | skip |= |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 1981 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1982 | "VUID-VkWriteDescriptorSet-descriptorCount-arraylength", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1983 | "vkUpdateDescriptorSets(): parameter pDescriptorWrites[%d].descriptorCount must be greater than 0.", i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1984 | } |
| 1985 | |
| 1986 | // dstSet must be a valid VkDescriptorSet handle |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1987 | skip |= validate_required_handle("vkUpdateDescriptorSets", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1988 | ParameterName("pDescriptorWrites[%i].dstSet", ParameterName::IndexVector{i}), |
| 1989 | pDescriptorWrites[i].dstSet); |
| 1990 | |
| 1991 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 1992 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 1993 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 1994 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 1995 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 1996 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 1997 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
| 1998 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures |
| 1999 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
| 2000 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2001 | "VUID-VkWriteDescriptorSet-descriptorType-00322", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2002 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 2003 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 2004 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2005 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%d].pImageInfo must not be NULL.", |
| 2006 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2007 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 2008 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
| 2009 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView and imageLayout |
| 2010 | // members of any given element of pImageInfo must be a valid VkImageView and VkImageLayout, respectively |
| 2011 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 2012 | ++descriptor_index) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2013 | skip |= validate_required_handle("vkUpdateDescriptorSets", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2014 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageView", |
| 2015 | ParameterName::IndexVector{i, descriptor_index}), |
| 2016 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageView); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2017 | skip |= validate_ranged_enum("vkUpdateDescriptorSets", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2018 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageLayout", |
| 2019 | ParameterName::IndexVector{i, descriptor_index}), |
| 2020 | "VkImageLayout", AllVkImageLayoutEnums, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2021 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2022 | } |
| 2023 | } |
| 2024 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 2025 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 2026 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 2027 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 2028 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 2029 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 2030 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
| 2031 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
| 2032 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2033 | "VUID-VkWriteDescriptorSet-descriptorType-00324", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2034 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 2035 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 2036 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2037 | "pDescriptorWrites[%d].pBufferInfo must not be NULL.", |
| 2038 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2039 | } else { |
| 2040 | for (uint32_t descriptorIndex = 0; descriptorIndex < pDescriptorWrites[i].descriptorCount; ++descriptorIndex) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2041 | skip |= validate_required_handle("vkUpdateDescriptorSets", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2042 | ParameterName("pDescriptorWrites[%i].pBufferInfo[%i].buffer", |
| 2043 | ParameterName::IndexVector{i, descriptorIndex}), |
| 2044 | pDescriptorWrites[i].pBufferInfo[descriptorIndex].buffer); |
| 2045 | } |
| 2046 | } |
| 2047 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 2048 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 2049 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, |
| 2050 | // pTexelBufferView must be a pointer to an array of descriptorCount valid VkBufferView handles |
| 2051 | if (pDescriptorWrites[i].pTexelBufferView == nullptr) { |
| 2052 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2053 | "VUID-VkWriteDescriptorSet-descriptorType-00323", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2054 | "vkUpdateDescriptorSets(): if pDescriptorWrites[%d].descriptorType is " |
| 2055 | "VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2056 | "pDescriptorWrites[%d].pTexelBufferView must not be NULL.", |
| 2057 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2058 | } else { |
| 2059 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 2060 | ++descriptor_index) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2061 | skip |= validate_required_handle("vkUpdateDescriptorSets", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2062 | ParameterName("pDescriptorWrites[%i].pTexelBufferView[%i]", |
| 2063 | ParameterName::IndexVector{i, descriptor_index}), |
| 2064 | pDescriptorWrites[i].pTexelBufferView[descriptor_index]); |
| 2065 | } |
| 2066 | } |
| 2067 | } |
| 2068 | |
| 2069 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 2070 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2071 | VkDeviceSize uniformAlignment = device_limits.minUniformBufferOffsetAlignment; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2072 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 2073 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 2074 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 2075 | skip |= |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2076 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 2077 | 0, "VUID-VkWriteDescriptorSet-descriptorType-00327", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 2078 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 2079 | ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64 ".", |
| 2080 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2081 | } |
| 2082 | } |
| 2083 | } |
| 2084 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 2085 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2086 | VkDeviceSize storageAlignment = device_limits.minStorageBufferOffsetAlignment; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2087 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 2088 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 2089 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 2090 | skip |= |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2091 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, |
| 2092 | 0, "VUID-VkWriteDescriptorSet-descriptorType-00328", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 2093 | "vkUpdateDescriptorSets(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 2094 | ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64 ".", |
| 2095 | i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2096 | } |
| 2097 | } |
| 2098 | } |
| 2099 | } |
| 2100 | } |
| 2101 | } |
| 2102 | return skip; |
| 2103 | } |
| 2104 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2105 | bool StatelessValidation::manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2106 | const VkAllocationCallbacks *pAllocator, |
| 2107 | VkRenderPass *pRenderPass) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2108 | return CreateRenderPassGeneric(device, pCreateInfo, pAllocator, pRenderPass, RENDER_PASS_VERSION_1); |
| 2109 | } |
| 2110 | |
| 2111 | bool StatelessValidation::manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2112 | const VkAllocationCallbacks *pAllocator, |
| 2113 | VkRenderPass *pRenderPass) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2114 | return CreateRenderPassGeneric(device, pCreateInfo, pAllocator, pRenderPass, RENDER_PASS_VERSION_2); |
| 2115 | } |
| 2116 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2117 | bool StatelessValidation::manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, |
| 2118 | uint32_t commandBufferCount, |
| 2119 | const VkCommandBuffer *pCommandBuffers) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2120 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2121 | |
| 2122 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2123 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 2124 | // validate_array() |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2125 | skip |= validate_array("vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, &pCommandBuffers, |
| 2126 | true, true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2127 | return skip; |
| 2128 | } |
| 2129 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2130 | bool StatelessValidation::manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, |
| 2131 | const VkCommandBufferBeginInfo *pBeginInfo) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2132 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2133 | const VkCommandBufferInheritanceInfo *pInfo = pBeginInfo->pInheritanceInfo; |
| 2134 | |
| 2135 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2136 | // TODO: pBeginInfo->pInheritanceInfo must not be NULL if commandBuffer is a secondary command buffer |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2137 | skip |= validate_struct_type("vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2138 | "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", pBeginInfo->pInheritanceInfo, |
Mark Lobodzinski | a16ebc7 | 2018-06-15 14:47:39 -0600 | [diff] [blame] | 2139 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, false, |
| 2140 | "VUID_vkBeginCommandBuffer-pBeginInfo-parameter", "VUID_VkCommandBufferBeginInfo-sType-sType"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2141 | |
| 2142 | if (pBeginInfo->pInheritanceInfo != NULL) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2143 | skip |= validate_struct_pnext("vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pNext", NULL, |
| 2144 | pBeginInfo->pInheritanceInfo->pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2145 | "VUID-VkCommandBufferBeginInfo-pNext-pNext"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2146 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2147 | skip |= validate_bool32("vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->occlusionQueryEnable", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2148 | pBeginInfo->pInheritanceInfo->occlusionQueryEnable); |
| 2149 | |
| 2150 | // TODO: This only needs to be validated when the inherited queries feature is enabled |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2151 | // skip |= validate_flags("vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2152 | // "VkQueryControlFlagBits", AllVkQueryControlFlagBits, pBeginInfo->pInheritanceInfo->queryFlags, false); |
| 2153 | |
| 2154 | // TODO: This must be 0 if the pipeline statistics queries feature is not enabled |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2155 | skip |= validate_flags("vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->pipelineStatistics", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2156 | "VkQueryPipelineStatisticFlagBits", AllVkQueryPipelineStatisticFlagBits, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2157 | pBeginInfo->pInheritanceInfo->pipelineStatistics, false, false, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2158 | } |
| 2159 | |
| 2160 | if (pInfo != NULL) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2161 | if ((physical_device_features.inheritedQueries == VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE)) { |
| 2162 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2163 | HandleToUint64(commandBuffer), "VUID-VkCommandBufferInheritanceInfo-occlusionQueryEnable-00056", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2164 | "Cannot set inherited occlusionQueryEnable in vkBeginCommandBuffer() when device does not support " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2165 | "inheritedQueries."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2166 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2167 | if ((physical_device_features.inheritedQueries != VK_FALSE) && (pInfo->occlusionQueryEnable != VK_FALSE)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2168 | skip |= validate_flags("vkBeginCommandBuffer", "pBeginInfo->pInheritanceInfo->queryFlags", "VkQueryControlFlagBits", |
| 2169 | AllVkQueryControlFlagBits, pInfo->queryFlags, false, false, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2170 | "VUID-VkCommandBufferInheritanceInfo-queryFlags-00057"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2171 | } |
| 2172 | } |
| 2173 | |
| 2174 | return skip; |
| 2175 | } |
| 2176 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2177 | bool StatelessValidation::manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
| 2178 | uint32_t viewportCount, const VkViewport *pViewports) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2179 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2180 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2181 | if (!physical_device_features.multiViewport) { |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 2182 | if (firstViewport != 0) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2183 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2184 | HandleToUint64(commandBuffer), "VUID-vkCmdSetViewport-firstViewport-01224", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2185 | "vkCmdSetViewport: The multiViewport feature is disabled, but firstViewport (=%" PRIu32 ") is not 0.", |
| 2186 | firstViewport); |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 2187 | } |
| 2188 | if (viewportCount > 1) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2189 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2190 | HandleToUint64(commandBuffer), "VUID-vkCmdSetViewport-viewportCount-01225", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2191 | "vkCmdSetViewport: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 ") is not 1.", |
| 2192 | viewportCount); |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 2193 | } |
| 2194 | } else { // multiViewport enabled |
Petr Kraus | 7dfeed1 | 2018-02-27 20:51:20 +0100 | [diff] [blame] | 2195 | const uint64_t sum = static_cast<uint64_t>(firstViewport) + static_cast<uint64_t>(viewportCount); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2196 | if (sum > device_limits.maxViewports) { |
| 2197 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2198 | HandleToUint64(commandBuffer), "VUID-vkCmdSetViewport-firstViewport-01223", |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 2199 | "vkCmdSetViewport: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2200 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2201 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2202 | } |
| 2203 | } |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 2204 | |
| 2205 | if (pViewports) { |
| 2206 | for (uint32_t viewport_i = 0; viewport_i < viewportCount; ++viewport_i) { |
| 2207 | const auto &viewport = pViewports[viewport_i]; // will crash on invalid ptr |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 2208 | const char *fn_name = "vkCmdSetViewport"; |
| 2209 | skip |= manual_PreCallValidateViewport(viewport, fn_name, |
| 2210 | ParameterName("pViewports[%i]", ParameterName::IndexVector{viewport_i}), |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2211 | VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer)); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 2212 | } |
| 2213 | } |
| 2214 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2215 | return skip; |
| 2216 | } |
| 2217 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2218 | bool StatelessValidation::manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, |
| 2219 | uint32_t scissorCount, const VkRect2D *pScissors) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2220 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2221 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2222 | if (!physical_device_features.multiViewport) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2223 | if (firstScissor != 0) { |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2224 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2225 | HandleToUint64(commandBuffer), "VUID-vkCmdSetScissor-firstScissor-00593", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2226 | "vkCmdSetScissor: The multiViewport feature is disabled, but firstScissor (=%" PRIu32 ") is not 0.", |
| 2227 | firstScissor); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2228 | } |
| 2229 | if (scissorCount > 1) { |
| 2230 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2231 | HandleToUint64(commandBuffer), "VUID-vkCmdSetScissor-scissorCount-00594", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2232 | "vkCmdSetScissor: The multiViewport feature is disabled, but scissorCount (=%" PRIu32 ") is not 1.", |
| 2233 | scissorCount); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2234 | } |
| 2235 | } else { // multiViewport enabled |
| 2236 | const uint64_t sum = static_cast<uint64_t>(firstScissor) + static_cast<uint64_t>(scissorCount); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2237 | if (sum > device_limits.maxViewports) { |
| 2238 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2239 | HandleToUint64(commandBuffer), "VUID-vkCmdSetScissor-firstScissor-00592", |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2240 | "vkCmdSetScissor: firstScissor + scissorCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2241 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2242 | firstScissor, scissorCount, sum, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2243 | } |
| 2244 | } |
| 2245 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2246 | if (pScissors) { |
| 2247 | for (uint32_t scissor_i = 0; scissor_i < scissorCount; ++scissor_i) { |
| 2248 | const auto &scissor = pScissors[scissor_i]; // will crash on invalid ptr |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2249 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2250 | if (scissor.offset.x < 0) { |
| 2251 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2252 | HandleToUint64(commandBuffer), "VUID-vkCmdSetScissor-x-00595", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2253 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.x (=%" PRIi32 ") is negative.", scissor_i, |
| 2254 | scissor.offset.x); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2255 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2256 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2257 | if (scissor.offset.y < 0) { |
| 2258 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2259 | HandleToUint64(commandBuffer), "VUID-vkCmdSetScissor-x-00595", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2260 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.y (=%" PRIi32 ") is negative.", scissor_i, |
| 2261 | scissor.offset.y); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2262 | } |
| 2263 | |
| 2264 | const int64_t x_sum = static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 2265 | if (x_sum > INT32_MAX) { |
| 2266 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2267 | HandleToUint64(commandBuffer), "VUID-vkCmdSetScissor-offset-00596", |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2268 | "vkCmdSetScissor: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2269 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 2270 | scissor.offset.x, scissor.extent.width, x_sum, scissor_i); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2271 | } |
| 2272 | |
| 2273 | const int64_t y_sum = static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 2274 | if (y_sum > INT32_MAX) { |
| 2275 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2276 | HandleToUint64(commandBuffer), "VUID-vkCmdSetScissor-offset-00597", |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2277 | "vkCmdSetScissor: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2278 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 2279 | scissor.offset.y, scissor.extent.height, y_sum, scissor_i); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2280 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2281 | } |
| 2282 | } |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2283 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2284 | return skip; |
| 2285 | } |
| 2286 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2287 | bool StatelessValidation::manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2288 | bool skip = false; |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2289 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2290 | if (!physical_device_features.wideLines && (lineWidth != 1.0f)) { |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2291 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2292 | HandleToUint64(commandBuffer), "VUID-vkCmdSetLineWidth-lineWidth-00788", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2293 | "VkPhysicalDeviceFeatures::wideLines is disabled, but lineWidth (=%f) is not 1.0.", lineWidth); |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2294 | } |
| 2295 | |
| 2296 | return skip; |
| 2297 | } |
| 2298 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2299 | bool StatelessValidation::manual_PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2300 | uint32_t firstVertex, uint32_t firstInstance) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2301 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2302 | if (vertexCount == 0) { |
| 2303 | // TODO: Verify against Valid Usage section. I don't see a non-zero vertexCount listed, may need to add that and make |
| 2304 | // this an error or leave as is. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2305 | skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2306 | kVUID_PVError_RequiredParameter, "vkCmdDraw parameter, uint32_t vertexCount, is 0"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2307 | } |
| 2308 | |
| 2309 | if (instanceCount == 0) { |
| 2310 | // TODO: Verify against Valid Usage section. I don't see a non-zero instanceCount listed, may need to add that and make |
| 2311 | // this an error or leave as is. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2312 | skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2313 | kVUID_PVError_RequiredParameter, "vkCmdDraw parameter, uint32_t instanceCount, is 0"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2314 | } |
| 2315 | return skip; |
| 2316 | } |
| 2317 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2318 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 2319 | uint32_t count, uint32_t stride) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2320 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2321 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2322 | if (!physical_device_features.multiDrawIndirect && ((count > 1))) { |
| 2323 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2324 | kVUID_PVError_DeviceFeature, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2325 | "CmdDrawIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", count); |
| 2326 | } |
| 2327 | return skip; |
| 2328 | } |
| 2329 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2330 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 2331 | VkDeviceSize offset, uint32_t count, uint32_t stride) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2332 | bool skip = false; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2333 | if (!physical_device_features.multiDrawIndirect && ((count > 1))) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2334 | skip |= log_msg( |
| 2335 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, kVUID_PVError_DeviceFeature, |
| 2336 | "CmdDrawIndexedIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", count); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2337 | } |
| 2338 | return skip; |
| 2339 | } |
| 2340 | |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 2341 | bool StatelessValidation::manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 2342 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 2343 | const VkClearRect *pRects) { |
| 2344 | bool skip = false; |
| 2345 | for (uint32_t rect = 0; rect < rectCount; rect++) { |
| 2346 | if (pRects[rect].layerCount == 0) { |
| 2347 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2348 | HandleToUint64(commandBuffer), "VUID-vkCmdClearAttachments-layerCount-01934", |
| 2349 | "CmdClearAttachments(): pRects[%d].layerCount is zero.", rect); |
| 2350 | } |
| 2351 | } |
| 2352 | return skip; |
| 2353 | } |
| 2354 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2355 | bool StatelessValidation::manual_PreCallValidateCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, |
| 2356 | VkImageLayout srcImageLayout, VkImage dstImage, |
| 2357 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2358 | const VkImageCopy *pRegions) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2359 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2360 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2361 | VkImageAspectFlags legal_aspect_flags = |
| 2362 | VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2363 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2364 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2365 | } |
| 2366 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2367 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2368 | if ((pRegions->srcSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2369 | skip |= log_msg( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2370 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2371 | "VUID-VkImageSubresourceLayers-aspectMask-parameter", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2372 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2373 | } |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2374 | if ((pRegions->dstSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2375 | skip |= log_msg( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2376 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2377 | "VUID-VkImageSubresourceLayers-aspectMask-parameter", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2378 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2379 | } |
| 2380 | } |
| 2381 | return skip; |
| 2382 | } |
| 2383 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2384 | bool StatelessValidation::manual_PreCallValidateCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, |
| 2385 | VkImageLayout srcImageLayout, VkImage dstImage, |
| 2386 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2387 | const VkImageBlit *pRegions, VkFilter filter) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2388 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2389 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2390 | VkImageAspectFlags legal_aspect_flags = |
| 2391 | VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2392 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2393 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2394 | } |
| 2395 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2396 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2397 | if ((pRegions->srcSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2398 | skip |= log_msg( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2399 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2400 | kVUID_PVError_UnrecognizedValue, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2401 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 2402 | } |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2403 | if ((pRegions->dstSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2404 | skip |= log_msg( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2405 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2406 | kVUID_PVError_UnrecognizedValue, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2407 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 2408 | } |
| 2409 | } |
| 2410 | return skip; |
| 2411 | } |
| 2412 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2413 | bool StatelessValidation::manual_PreCallValidateCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, |
| 2414 | VkImage dstImage, VkImageLayout dstImageLayout, |
| 2415 | uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2416 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2417 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2418 | VkImageAspectFlags legal_aspect_flags = |
| 2419 | VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2420 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2421 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2422 | } |
| 2423 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2424 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2425 | if ((pRegions->imageSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2426 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2427 | kVUID_PVError_UnrecognizedValue, |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 2428 | "vkCmdCopyBufferToImage() parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an " |
| 2429 | "unrecognized enumerator"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2430 | } |
| 2431 | } |
| 2432 | return skip; |
| 2433 | } |
| 2434 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2435 | bool StatelessValidation::manual_PreCallValidateCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, |
| 2436 | VkImageLayout srcImageLayout, VkBuffer dstBuffer, |
| 2437 | uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2438 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2439 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2440 | VkImageAspectFlags legal_aspect_flags = |
| 2441 | VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2442 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2443 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2444 | } |
| 2445 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2446 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2447 | if ((pRegions->imageSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2448 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2449 | kVUID_PVError_UnrecognizedValue, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2450 | "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 2451 | "enumerator"); |
| 2452 | } |
| 2453 | } |
| 2454 | return skip; |
| 2455 | } |
| 2456 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2457 | bool StatelessValidation::manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, |
| 2458 | VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2459 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2460 | |
| 2461 | if (dstOffset & 3) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2462 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2463 | "VUID-vkCmdUpdateBuffer-dstOffset-00036", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2464 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", |
| 2465 | dstOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2466 | } |
| 2467 | |
| 2468 | if ((dataSize <= 0) || (dataSize > 65536)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2469 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2470 | "VUID-vkCmdUpdateBuffer-dataSize-00037", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2471 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2472 | "), must be greater than zero and less than or equal to 65536.", |
| 2473 | dataSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2474 | } else if (dataSize & 3) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2475 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2476 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2477 | "VUID-vkCmdUpdateBuffer-dataSize-00038", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2478 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 "), is not a multiple of 4.", dataSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2479 | } |
| 2480 | return skip; |
| 2481 | } |
| 2482 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2483 | bool StatelessValidation::manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, |
| 2484 | VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2485 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2486 | |
| 2487 | if (dstOffset & 3) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2488 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2489 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2490 | "VUID-vkCmdFillBuffer-dstOffset-00025", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2491 | "vkCmdFillBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", dstOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2492 | } |
| 2493 | |
| 2494 | if (size != VK_WHOLE_SIZE) { |
| 2495 | if (size <= 0) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2496 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2497 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2498 | "VUID-vkCmdFillBuffer-size-00026", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2499 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), must be greater than zero.", size); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2500 | } else if (size & 3) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2501 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2502 | "VUID-vkCmdFillBuffer-size-00028", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2503 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), is not a multiple of 4.", size); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2504 | } |
| 2505 | } |
| 2506 | return skip; |
| 2507 | } |
| 2508 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2509 | bool StatelessValidation::manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2510 | const VkAllocationCallbacks *pAllocator, |
| 2511 | VkSwapchainKHR *pSwapchain) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2512 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2513 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2514 | const LogMiscParams log_misc{VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, VK_NULL_HANDLE, "vkCreateSwapchainKHR"}; |
Petr Kraus | e5c3765 | 2018-01-05 04:05:12 +0100 | [diff] [blame] | 2515 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2516 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2517 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2518 | if (pCreateInfo->imageSharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 2519 | // If imageSharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 2520 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 2521 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2522 | "VUID-VkSwapchainCreateInfoKHR-imageSharingMode-01278", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2523 | "vkCreateSwapchainKHR(): if pCreateInfo->imageSharingMode is VK_SHARING_MODE_CONCURRENT, " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2524 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2525 | } |
| 2526 | |
| 2527 | // If imageSharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 2528 | // queueFamilyIndexCount uint32_t values |
| 2529 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | b1fd9d1 | 2018-03-30 14:26:00 -0600 | [diff] [blame] | 2530 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2531 | "VUID-VkSwapchainCreateInfoKHR-imageSharingMode-01277", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2532 | "vkCreateSwapchainKHR(): if pCreateInfo->imageSharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 2533 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2534 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2535 | } |
| 2536 | } |
| 2537 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2538 | skip |= ValidateGreaterThanZero(pCreateInfo->imageArrayLayers, "pCreateInfo->imageArrayLayers", |
| 2539 | "VUID-VkSwapchainCreateInfoKHR-imageArrayLayers-01275", log_misc); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2540 | } |
| 2541 | |
| 2542 | return skip; |
| 2543 | } |
| 2544 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2545 | bool StatelessValidation::manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2546 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2547 | |
| 2548 | if (pPresentInfo && pPresentInfo->pNext) { |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 2549 | const auto *present_regions = lvl_find_in_chain<VkPresentRegionsKHR>(pPresentInfo->pNext); |
| 2550 | if (present_regions) { |
| 2551 | // TODO: This and all other pNext extension dependencies should be added to code-generation |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2552 | skip |= require_device_extension(device_extensions.vk_khr_incremental_present, "vkQueuePresentKHR", |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 2553 | VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME); |
| 2554 | if (present_regions->swapchainCount != pPresentInfo->swapchainCount) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2555 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2556 | kVUID_PVError_InvalidUsage, |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 2557 | "QueuePresentKHR(): pPresentInfo->swapchainCount has a value of %i but VkPresentRegionsKHR " |
| 2558 | "extension swapchainCount is %i. These values must be equal.", |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 2559 | pPresentInfo->swapchainCount, present_regions->swapchainCount); |
| 2560 | } |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2561 | skip |= validate_struct_pnext("QueuePresentKHR", "pCreateInfo->pNext->pNext", NULL, present_regions->pNext, 0, NULL, |
| 2562 | GeneratedVulkanHeaderVersion, "VUID-VkPresentInfoKHR-pNext-pNext"); |
| 2563 | skip |= validate_array("QueuePresentKHR", "pCreateInfo->pNext->swapchainCount", "pCreateInfo->pNext->pRegions", |
| 2564 | present_regions->swapchainCount, &present_regions->pRegions, true, false, kVUIDUndefined, |
| 2565 | kVUIDUndefined); |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 2566 | for (uint32_t i = 0; i < present_regions->swapchainCount; ++i) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2567 | skip |= validate_array("QueuePresentKHR", "pCreateInfo->pNext->pRegions[].rectangleCount", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2568 | "pCreateInfo->pNext->pRegions[].pRectangles", present_regions->pRegions[i].rectangleCount, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2569 | &present_regions->pRegions[i].pRectangles, true, false, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2570 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2571 | } |
| 2572 | } |
| 2573 | |
| 2574 | return skip; |
| 2575 | } |
| 2576 | |
| 2577 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2578 | bool StatelessValidation::manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, |
| 2579 | const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 2580 | const VkAllocationCallbacks *pAllocator, |
| 2581 | VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2582 | bool skip = false; |
| 2583 | |
| 2584 | if (pCreateInfo->hwnd == nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2585 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2586 | "VUID-VkWin32SurfaceCreateInfoKHR-hwnd-01308", |
| 2587 | "vkCreateWin32SurfaceKHR(): hwnd must be a valid Win32 HWND but hwnd is NULL."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2588 | } |
| 2589 | |
| 2590 | return skip; |
| 2591 | } |
| 2592 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 2593 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2594 | bool StatelessValidation::manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2595 | const VkAllocationCallbacks *pAllocator, |
| 2596 | VkDescriptorPool *pDescriptorPool) { |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 2597 | bool skip = false; |
| 2598 | |
| 2599 | if (pCreateInfo) { |
| 2600 | if (pCreateInfo->maxSets <= 0) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2601 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, |
| 2602 | VK_NULL_HANDLE, "VUID-VkDescriptorPoolCreateInfo-maxSets-00301", |
| 2603 | "vkCreateDescriptorPool(): pCreateInfo->maxSets is not greater than 0."); |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 2604 | } |
| 2605 | |
| 2606 | if (pCreateInfo->pPoolSizes) { |
| 2607 | for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; ++i) { |
| 2608 | if (pCreateInfo->pPoolSizes[i].descriptorCount <= 0) { |
| 2609 | skip |= log_msg( |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2610 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, VK_NULL_HANDLE, |
| 2611 | "VUID-VkDescriptorPoolSize-descriptorCount-00302", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2612 | "vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[%" PRIu32 "].descriptorCount is not greater than 0.", i); |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 2613 | } |
Jeff Bolz | e54ae89 | 2018-09-08 12:16:29 -0500 | [diff] [blame] | 2614 | if (pCreateInfo->pPoolSizes[i].type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT && |
| 2615 | (pCreateInfo->pPoolSizes[i].descriptorCount % 4) != 0) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2616 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, |
| 2617 | VK_NULL_HANDLE, "VUID-VkDescriptorPoolSize-type-02218", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2618 | "vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[%" PRIu32 |
| 2619 | "].type is VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT " |
| 2620 | " and pCreateInfo->pPoolSizes[%" PRIu32 "].descriptorCount is not a multiple of 4.", |
| 2621 | i, i); |
Jeff Bolz | e54ae89 | 2018-09-08 12:16:29 -0500 | [diff] [blame] | 2622 | } |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 2623 | } |
| 2624 | } |
| 2625 | } |
| 2626 | |
| 2627 | return skip; |
| 2628 | } |
| 2629 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2630 | bool StatelessValidation::manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, |
| 2631 | uint32_t groupCountY, uint32_t groupCountZ) { |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2632 | bool skip = false; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2633 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2634 | if (groupCountX > device_limits.maxComputeWorkGroupCount[0]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2635 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2636 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2637 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatch-groupCountX-00386", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2638 | "vkCmdDispatch(): groupCountX (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2639 | groupCountX, device_limits.maxComputeWorkGroupCount[0]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2640 | } |
| 2641 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2642 | if (groupCountY > device_limits.maxComputeWorkGroupCount[1]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2643 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2644 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2645 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatch-groupCountY-00387", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2646 | "vkCmdDispatch(): groupCountY (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2647 | groupCountY, device_limits.maxComputeWorkGroupCount[1]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2648 | } |
| 2649 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2650 | if (groupCountZ > device_limits.maxComputeWorkGroupCount[2]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2651 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2652 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2653 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatch-groupCountZ-00388", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2654 | "vkCmdDispatch(): groupCountZ (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2655 | groupCountZ, device_limits.maxComputeWorkGroupCount[2]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2656 | } |
| 2657 | |
| 2658 | return skip; |
| 2659 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2660 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2661 | bool StatelessValidation::manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 2662 | VkDeviceSize offset) { |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 2663 | bool skip = false; |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 2664 | |
| 2665 | if ((offset % 4) != 0) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2666 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Shannon McPherson | de3eeba | 2019-04-30 16:53:59 -0600 | [diff] [blame] | 2667 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatchIndirect-offset-02710", |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 2668 | "vkCmdDispatchIndirect(): offset (%" PRIu64 ") must be a multiple of 4.", offset); |
| 2669 | } |
| 2670 | return skip; |
| 2671 | } |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2672 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2673 | bool StatelessValidation::manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, |
| 2674 | uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, |
| 2675 | uint32_t groupCountY, uint32_t groupCountZ) { |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2676 | bool skip = false; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2677 | |
| 2678 | // Paired if {} else if {} tests used to avoid any possible uint underflow |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2679 | uint32_t limit = device_limits.maxComputeWorkGroupCount[0]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2680 | if (baseGroupX >= limit) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2681 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2682 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatchBase-baseGroupX-00421", |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2683 | "vkCmdDispatch(): baseGroupX (%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2684 | ") equals or exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 2685 | baseGroupX, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2686 | } else if (groupCountX > (limit - baseGroupX)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2687 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2688 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatchBase-groupCountX-00424", |
Mark Lobodzinski | bf973a1 | 2018-03-01 08:50:21 -0700 | [diff] [blame] | 2689 | "vkCmdDispatchBaseKHR(): baseGroupX (%" PRIu32 ") + groupCountX (%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2690 | ") exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 2691 | baseGroupX, groupCountX, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2692 | } |
| 2693 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2694 | limit = device_limits.maxComputeWorkGroupCount[1]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2695 | if (baseGroupY >= limit) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2696 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2697 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatchBase-baseGroupX-00422", |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2698 | "vkCmdDispatch(): baseGroupY (%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2699 | ") equals or exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 2700 | baseGroupY, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2701 | } else if (groupCountY > (limit - baseGroupY)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2702 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2703 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatchBase-groupCountY-00425", |
Mark Lobodzinski | bf973a1 | 2018-03-01 08:50:21 -0700 | [diff] [blame] | 2704 | "vkCmdDispatchBaseKHR(): baseGroupY (%" PRIu32 ") + groupCountY (%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2705 | ") exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 2706 | baseGroupY, groupCountY, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2707 | } |
| 2708 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2709 | limit = device_limits.maxComputeWorkGroupCount[2]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2710 | if (baseGroupZ >= limit) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2711 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2712 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatchBase-baseGroupZ-00423", |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2713 | "vkCmdDispatch(): baseGroupZ (%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2714 | ") equals or exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 2715 | baseGroupZ, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2716 | } else if (groupCountZ > (limit - baseGroupZ)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2717 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2718 | HandleToUint64(commandBuffer), "VUID-vkCmdDispatchBase-groupCountZ-00426", |
Mark Lobodzinski | bf973a1 | 2018-03-01 08:50:21 -0700 | [diff] [blame] | 2719 | "vkCmdDispatchBaseKHR(): baseGroupZ (%" PRIu32 ") + groupCountZ (%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2720 | ") exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 2721 | baseGroupZ, groupCountZ, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 2722 | } |
| 2723 | |
| 2724 | return skip; |
| 2725 | } |
| 2726 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2727 | bool StatelessValidation::manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, |
| 2728 | uint32_t firstExclusiveScissor, |
| 2729 | uint32_t exclusiveScissorCount, |
| 2730 | const VkRect2D *pExclusiveScissors) { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2731 | bool skip = false; |
| 2732 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2733 | if (!physical_device_features.multiViewport) { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2734 | if (firstExclusiveScissor != 0) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2735 | skip |= |
| 2736 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2737 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02035", |
| 2738 | "vkCmdSetExclusiveScissorNV: The multiViewport feature is disabled, but firstExclusiveScissor (=%" PRIu32 |
| 2739 | ") is not 0.", |
| 2740 | firstExclusiveScissor); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2741 | } |
| 2742 | if (exclusiveScissorCount > 1) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2743 | skip |= |
| 2744 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2745 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-exclusiveScissorCount-02036", |
| 2746 | "vkCmdSetExclusiveScissorNV: The multiViewport feature is disabled, but exclusiveScissorCount (=%" PRIu32 |
| 2747 | ") is not 1.", |
| 2748 | exclusiveScissorCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2749 | } |
| 2750 | } else { // multiViewport enabled |
| 2751 | const uint64_t sum = static_cast<uint64_t>(firstExclusiveScissor) + static_cast<uint64_t>(exclusiveScissorCount); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2752 | if (sum > device_limits.maxViewports) { |
| 2753 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2754 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02034", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2755 | "vkCmdSetExclusiveScissorNV: firstExclusiveScissor + exclusiveScissorCount (=%" PRIu32 " + %" PRIu32 |
| 2756 | " = %" PRIu64 ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2757 | firstExclusiveScissor, exclusiveScissorCount, sum, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2758 | } |
| 2759 | } |
| 2760 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2761 | if (firstExclusiveScissor >= device_limits.maxViewports) { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2762 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2763 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02033", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2764 | "vkCmdSetExclusiveScissorNV: firstExclusiveScissor (=%" PRIu32 ") must be less than maxViewports (=%" PRIu32 |
| 2765 | ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2766 | firstExclusiveScissor, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2767 | } |
| 2768 | |
| 2769 | if (pExclusiveScissors) { |
| 2770 | for (uint32_t scissor_i = 0; scissor_i < exclusiveScissorCount; ++scissor_i) { |
| 2771 | const auto &scissor = pExclusiveScissors[scissor_i]; // will crash on invalid ptr |
| 2772 | |
| 2773 | if (scissor.offset.x < 0) { |
| 2774 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2775 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-x-02037", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2776 | "vkCmdSetExclusiveScissorNV: pScissors[%" PRIu32 "].offset.x (=%" PRIi32 ") is negative.", |
| 2777 | scissor_i, scissor.offset.x); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2778 | } |
| 2779 | |
| 2780 | if (scissor.offset.y < 0) { |
| 2781 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2782 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-x-02037", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2783 | "vkCmdSetExclusiveScissorNV: pScissors[%" PRIu32 "].offset.y (=%" PRIi32 ") is negative.", |
| 2784 | scissor_i, scissor.offset.y); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2785 | } |
| 2786 | |
| 2787 | const int64_t x_sum = static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 2788 | if (x_sum > INT32_MAX) { |
| 2789 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2790 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-offset-02038", |
| 2791 | "vkCmdSetExclusiveScissorNV: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 2792 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 2793 | scissor.offset.x, scissor.extent.width, x_sum, scissor_i); |
| 2794 | } |
| 2795 | |
| 2796 | const int64_t y_sum = static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 2797 | if (y_sum > INT32_MAX) { |
| 2798 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2799 | HandleToUint64(commandBuffer), "VUID-vkCmdSetExclusiveScissorNV-offset-02039", |
| 2800 | "vkCmdSetExclusiveScissorNV: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 2801 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 2802 | scissor.offset.y, scissor.extent.height, y_sum, scissor_i); |
| 2803 | } |
| 2804 | } |
| 2805 | } |
| 2806 | |
| 2807 | return skip; |
| 2808 | } |
| 2809 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2810 | bool StatelessValidation::manual_PreCallValidateCmdSetViewportShadingRatePaletteNV( |
| 2811 | VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 2812 | const VkShadingRatePaletteNV *pShadingRatePalettes) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2813 | bool skip = false; |
| 2814 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2815 | if (!physical_device_features.multiViewport) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2816 | if (firstViewport != 0) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2817 | skip |= |
| 2818 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2819 | HandleToUint64(commandBuffer), "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02068", |
| 2820 | "vkCmdSetViewportShadingRatePaletteNV: The multiViewport feature is disabled, but firstViewport (=%" PRIu32 |
| 2821 | ") is not 0.", |
| 2822 | firstViewport); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2823 | } |
| 2824 | if (viewportCount > 1) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2825 | skip |= |
| 2826 | log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2827 | HandleToUint64(commandBuffer), "VUID-vkCmdSetViewportShadingRatePaletteNV-viewportCount-02069", |
| 2828 | "vkCmdSetViewportShadingRatePaletteNV: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 |
| 2829 | ") is not 1.", |
| 2830 | viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2831 | } |
| 2832 | } |
| 2833 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2834 | if (firstViewport >= device_limits.maxViewports) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2835 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2836 | HandleToUint64(commandBuffer), "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02066", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2837 | "vkCmdSetViewportShadingRatePaletteNV: firstViewport (=%" PRIu32 |
| 2838 | ") must be less than maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2839 | firstViewport, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2840 | } |
| 2841 | |
| 2842 | const uint64_t sum = static_cast<uint64_t>(firstViewport) + static_cast<uint64_t>(viewportCount); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2843 | if (sum > device_limits.maxViewports) { |
| 2844 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2845 | HandleToUint64(commandBuffer), "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02067", |
| 2846 | "vkCmdSetViewportShadingRatePaletteNV: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
| 2847 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2848 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2849 | } |
| 2850 | |
| 2851 | return skip; |
| 2852 | } |
| 2853 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2854 | bool StatelessValidation::manual_PreCallValidateCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, |
| 2855 | VkCoarseSampleOrderTypeNV sampleOrderType, |
| 2856 | uint32_t customSampleOrderCount, |
| 2857 | const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2858 | bool skip = false; |
| 2859 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2860 | if (sampleOrderType != VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV && customSampleOrderCount != 0) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2861 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2862 | HandleToUint64(commandBuffer), "VUID-vkCmdSetCoarseSampleOrderNV-sampleOrderType-02081", |
| 2863 | "vkCmdSetCoarseSampleOrderNV: If sampleOrderType is not VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV, " |
| 2864 | "customSampleOrderCount must be 0."); |
| 2865 | } |
| 2866 | |
| 2867 | for (uint32_t order_i = 0; order_i < customSampleOrderCount; ++order_i) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2868 | skip |= ValidateCoarseSampleOrderCustomNV(&pCustomSampleOrders[order_i]); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2869 | } |
| 2870 | |
| 2871 | return skip; |
| 2872 | } |
| 2873 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2874 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, |
| 2875 | uint32_t firstTask) { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2876 | bool skip = false; |
| 2877 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2878 | if (taskCount > phys_dev_ext_props.mesh_shader_props.maxDrawMeshTasksCount) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2879 | skip |= log_msg( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2880 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2881 | HandleToUint64(commandBuffer), "VUID-vkCmdDrawMeshTasksNV-taskCount-02119", |
| 2882 | "vkCmdDrawMeshTasksNV() parameter, uint32_t taskCount (0x%" PRIxLEAST32 |
| 2883 | "), must be less than or equal to VkPhysicalDeviceMeshShaderPropertiesNV::maxDrawMeshTasksCount (0x%" PRIxLEAST32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2884 | taskCount, phys_dev_ext_props.mesh_shader_props.maxDrawMeshTasksCount); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2885 | } |
| 2886 | |
| 2887 | return skip; |
| 2888 | } |
| 2889 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2890 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 2891 | VkDeviceSize offset, uint32_t drawCount, |
| 2892 | uint32_t stride) { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2893 | bool skip = false; |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 2894 | static const int condition_multiples = 0b0011; |
| 2895 | if (offset & condition_multiples) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2896 | skip |= log_msg( |
| 2897 | report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Shannon McPherson | de3eeba | 2019-04-30 16:53:59 -0600 | [diff] [blame] | 2898 | HandleToUint64(commandBuffer), "VUID-vkCmdDrawMeshTasksIndirectNV-offset-02710", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2899 | "vkCmdDrawMeshTasksIndirectNV() parameter, VkDeviceSize offset (0x%" PRIxLEAST64 "), is not a multiple of 4.", offset); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2900 | } |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 2901 | if (drawCount > 1 && ((stride & condition_multiples) || stride < sizeof(VkDrawMeshTasksIndirectCommandNV))) { |
| 2902 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
| 2903 | HandleToUint64(commandBuffer), "VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02146", |
| 2904 | "vkCmdDrawMeshTasksIndirectNV() parameter, uint32_t stride (0x%" PRIxLEAST32 |
| 2905 | "), is not a multiple of 4 or smaller than sizeof (VkDrawMeshTasksIndirectCommandNV).", |
| 2906 | stride); |
| 2907 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2908 | if (!physical_device_features.multiDrawIndirect && ((drawCount > 1))) { |
Jeff Bolz | b574c34 | 2018-11-08 15:36:57 -0600 | [diff] [blame] | 2909 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Shannon McPherson | de3eeba | 2019-04-30 16:53:59 -0600 | [diff] [blame] | 2910 | HandleToUint64(commandBuffer), "VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02718", |
Jeff Bolz | b574c34 | 2018-11-08 15:36:57 -0600 | [diff] [blame] | 2911 | "vkCmdDrawMeshTasksIndirectNV(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", |
| 2912 | drawCount); |
| 2913 | } |
| 2914 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2915 | return skip; |
| 2916 | } |
| 2917 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2918 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 2919 | VkDeviceSize offset, VkBuffer countBuffer, |
| 2920 | VkDeviceSize countBufferOffset, |
| 2921 | uint32_t maxDrawCount, uint32_t stride) { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2922 | bool skip = false; |
| 2923 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2924 | if (offset & 3) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2925 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Shannon McPherson | de3eeba | 2019-04-30 16:53:59 -0600 | [diff] [blame] | 2926 | HandleToUint64(commandBuffer), "VUID-vkCmdDrawMeshTasksIndirectCountNV-offset-02710", |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2927 | "vkCmdDrawMeshTasksIndirectCountNV() parameter, VkDeviceSize offset (0x%" PRIxLEAST64 |
| 2928 | "), is not a multiple of 4.", |
| 2929 | offset); |
| 2930 | } |
| 2931 | |
| 2932 | if (countBufferOffset & 3) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2933 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, |
Shannon McPherson | de3eeba | 2019-04-30 16:53:59 -0600 | [diff] [blame] | 2934 | HandleToUint64(commandBuffer), "VUID-vkCmdDrawMeshTasksIndirectCountNV-countBufferOffset-02716", |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2935 | "vkCmdDrawMeshTasksIndirectCountNV() parameter, VkDeviceSize countBufferOffset (0x%" PRIxLEAST64 |
| 2936 | "), is not a multiple of 4.", |
| 2937 | countBufferOffset); |
| 2938 | } |
| 2939 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 2940 | return skip; |
| 2941 | } |
| 2942 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2943 | bool StatelessValidation::manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2944 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2945 | bool skip = false; |
| 2946 | |
| 2947 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2948 | if (pCreateInfo != nullptr) { |
| 2949 | // If queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, pipelineStatistics must be a valid combination of |
| 2950 | // VkQueryPipelineStatisticFlagBits values |
| 2951 | if ((pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) && (pCreateInfo->pipelineStatistics != 0) && |
| 2952 | ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { |
| 2953 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 2954 | "VUID-VkQueryPoolCreateInfo-queryType-00792", |
| 2955 | "vkCreateQueryPool(): if pCreateInfo->queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, " |
| 2956 | "pCreateInfo->pipelineStatistics must be a valid combination of VkQueryPipelineStatisticFlagBits " |
| 2957 | "values."); |
| 2958 | } |
Mark Lobodzinski | b7a2638 | 2018-07-02 13:14:26 -0600 | [diff] [blame] | 2959 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2960 | return skip; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2961 | } |
| 2962 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2963 | bool StatelessValidation::manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 2964 | const char *pLayerName, uint32_t *pPropertyCount, |
| 2965 | VkExtensionProperties *pProperties) { |
| 2966 | return validate_array("vkEnumerateDeviceExtensionProperties", "pPropertyCount", "pProperties", pPropertyCount, &pProperties, |
| 2967 | true, false, false, kVUIDUndefined, "VUID-vkEnumerateDeviceExtensionProperties-pProperties-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2968 | } |
| 2969 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2970 | void StatelessValidation::PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 2971 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 2972 | VkResult result) { |
| 2973 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2974 | RecordRenderPass(*pRenderPass, pCreateInfo); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2975 | } |
| 2976 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2977 | void StatelessValidation::PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 2978 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 2979 | VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2980 | // Track the state necessary for checking vkCreateGraphicsPipeline (subpass usage of depth and color attachments) |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 2981 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2982 | RecordRenderPass(*pRenderPass, pCreateInfo); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2983 | } |
| 2984 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2985 | void StatelessValidation::PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, |
| 2986 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2987 | // Track the state necessary for checking vkCreateGraphicsPipeline (subpass usage of depth and color attachments) |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 2988 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2989 | renderpasses_states.erase(renderPass); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2990 | } |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 2991 | |
| 2992 | bool StatelessValidation::manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
| 2993 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { |
| 2994 | bool skip = false; |
| 2995 | |
| 2996 | if (pAllocateInfo) { |
| 2997 | auto chained_prio_struct = lvl_find_in_chain<VkMemoryPriorityAllocateInfoEXT>(pAllocateInfo->pNext); |
| 2998 | if (chained_prio_struct && (chained_prio_struct->priority < 0.0f || chained_prio_struct->priority > 1.0f)) { |
| 2999 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3000 | "VUID-VkMemoryPriorityAllocateInfoEXT-priority-02602", |
| 3001 | "priority (=%f) must be between `0` and `1`, inclusive.", chained_prio_struct->priority); |
| 3002 | } |
| 3003 | } |
| 3004 | return skip; |
| 3005 | } |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3006 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame^] | 3007 | bool StatelessValidation::ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info) { |
| 3008 | bool skip = false; |
| 3009 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV && info.geometryCount != 0) { |
| 3010 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, 0, |
| 3011 | "VUID-VkAccelerationStructureInfoNV-type-02425", |
| 3012 | "VkAccelerationStructureInfoNV: If type is VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV then " |
| 3013 | "geometryCount must be 0."); |
| 3014 | } |
| 3015 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV && info.instanceCount != 0) { |
| 3016 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, 0, |
| 3017 | "VUID-VkAccelerationStructureInfoNV-type-02426", |
| 3018 | "VkAccelerationStructureInfoNV: If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV then " |
| 3019 | "instanceCount must be 0."); |
| 3020 | } |
| 3021 | if (info.flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV && |
| 3022 | info.flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV) { |
| 3023 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, 0, |
| 3024 | "VUID-VkAccelerationStructureInfoNV-flags-02592", |
| 3025 | "VkAccelerationStructureInfoNV: If flags has the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV" |
| 3026 | "bit set, then it must not have the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV bit set."); |
| 3027 | } |
| 3028 | if (info.geometryCount > phys_dev_ext_props.ray_tracing_props.maxGeometryCount) { |
| 3029 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, 0, |
| 3030 | "VUID-VkAccelerationStructureInfoNV-geometryCount-02422", |
| 3031 | "VkAccelerationStructureInfoNV: geometryCount must be less than or equal to " |
| 3032 | "VkPhysicalDeviceRayTracingPropertiesNV::maxGeometryCount."); |
| 3033 | } |
| 3034 | if (info.instanceCount > phys_dev_ext_props.ray_tracing_props.maxInstanceCount) { |
| 3035 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, 0, |
| 3036 | "VUID-VkAccelerationStructureInfoNV-instanceCount-02423", |
| 3037 | "VkAccelerationStructureInfoNV: instanceCount must be less than or equal to " |
| 3038 | "VkPhysicalDeviceRayTracingPropertiesNV::maxInstanceCount."); |
| 3039 | } |
| 3040 | if (info.geometryCount > 0) { |
| 3041 | uint64_t total_triangle_count = 0; |
| 3042 | for (uint32_t i = 0; i < info.geometryCount; i++) { |
| 3043 | const VkGeometryNV &geometry = info.pGeometries[i]; |
| 3044 | if (geometry.geometryType != VK_GEOMETRY_TYPE_TRIANGLES_NV) { |
| 3045 | continue; |
| 3046 | } |
| 3047 | total_triangle_count += geometry.geometry.triangles.indexCount / 3; |
| 3048 | } |
| 3049 | if (total_triangle_count > phys_dev_ext_props.ray_tracing_props.maxTriangleCount) { |
| 3050 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, |
| 3051 | 0, "VUID-VkAccelerationStructureInfoNV-maxTriangleCount-02424", |
| 3052 | "VkAccelerationStructureInfoNV: The total number of triangles in all geometries must be less than " |
| 3053 | "or equal to VkPhysicalDeviceRayTracingPropertiesNV::maxTriangleCount."); |
| 3054 | } |
| 3055 | } |
| 3056 | return skip; |
| 3057 | } |
| 3058 | |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3059 | bool StatelessValidation::manual_PreCallValidateCreateAccelerationStructureNV( |
| 3060 | VkDevice device, const VkAccelerationStructureCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 3061 | VkAccelerationStructureNV *pAccelerationStructure) { |
| 3062 | bool skip = false; |
| 3063 | |
| 3064 | if (pCreateInfo) { |
| 3065 | if ((pCreateInfo->compactedSize != 0) && |
| 3066 | ((pCreateInfo->info.geometryCount != 0) || (pCreateInfo->info.instanceCount != 0))) { |
| 3067 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, |
| 3068 | "VUID-VkAccelerationStructureCreateInfoNV-compactedSize-02421", |
| 3069 | "vkCreateAccelerationStructureNV(): pCreateInfo->compactedSize nonzero (%" PRIu64 |
| 3070 | ") with info.geometryCount (%" PRIu32 ") or info.instanceCount (%" PRIu32 ") nonzero.", |
| 3071 | pCreateInfo->compactedSize, pCreateInfo->info.geometryCount, pCreateInfo->info.instanceCount); |
| 3072 | } |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame^] | 3073 | |
| 3074 | skip |= ValidateAccelerationStructureInfoNV(pCreateInfo->info); |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3075 | } |
| 3076 | |
| 3077 | return skip; |
| 3078 | } |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 3079 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame^] | 3080 | bool StatelessValidation::manual_PreCallValidateCmdBuildAccelerationStructureNV( |
| 3081 | VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData, VkDeviceSize instanceOffset, |
| 3082 | VkBool32 update, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkBuffer scratch, VkDeviceSize scratchOffset) { |
| 3083 | bool skip = false; |
| 3084 | |
| 3085 | if (pInfo != nullptr) { |
| 3086 | skip |= ValidateAccelerationStructureInfoNV(*pInfo); |
| 3087 | } |
| 3088 | |
| 3089 | return skip; |
| 3090 | } |
| 3091 | |
| 3092 | bool StatelessValidation::manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, |
| 3093 | VkAccelerationStructureNV accelerationStructure, |
| 3094 | size_t dataSize, void *pData) { |
| 3095 | bool skip = false; |
| 3096 | if (dataSize < 8) { |
| 3097 | skip = log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT, |
| 3098 | HandleToUint64(accelerationStructure), "VUID-vkGetAccelerationStructureHandleNV-dataSize-02240", |
| 3099 | "vkGetAccelerationStructureHandleNV(): dataSize must be greater than or equal to 8."); |
| 3100 | } |
| 3101 | return skip; |
| 3102 | } |
| 3103 | |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 3104 | bool StatelessValidation::manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, |
| 3105 | uint32_t createInfoCount, |
| 3106 | const VkRayTracingPipelineCreateInfoNV *pCreateInfos, |
| 3107 | const VkAllocationCallbacks *pAllocator, |
| 3108 | VkPipeline *pPipelines) { |
| 3109 | bool skip = false; |
| 3110 | |
| 3111 | for (uint32_t i = 0; i < createInfoCount; i++) { |
| 3112 | auto feedback_struct = lvl_find_in_chain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
| 3113 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
| 3114 | skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, VK_NULL_HANDLE, |
| 3115 | "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02670", |
| 3116 | "vkCreateRayTracingPipelinesNV(): in pCreateInfo[%" PRIu32 |
| 3117 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
| 3118 | "(=%" PRIu32 ") must equal VkRayTracingPipelineCreateInfoNV::stageCount(=%" PRIu32 ").", |
| 3119 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
| 3120 | } |
| 3121 | } |
| 3122 | |
| 3123 | return skip; |
| 3124 | } |
| 3125 | |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 3126 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3127 | bool StatelessValidation::PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, |
| 3128 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
| 3129 | VkDeviceGroupPresentModeFlagsKHR *pModes) { |
| 3130 | bool skip = false; |
| 3131 | if (!device_extensions.vk_khr_swapchain) |
| 3132 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
| 3133 | if (!device_extensions.vk_khr_get_surface_capabilities_2) |
| 3134 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME); |
| 3135 | if (!device_extensions.vk_khr_surface) |
| 3136 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_SURFACE_EXTENSION_NAME); |
| 3137 | if (!device_extensions.vk_khr_get_physical_device_properties_2) |
| 3138 | skip |= |
| 3139 | OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
| 3140 | if (!device_extensions.vk_ext_full_screen_exclusive) |
| 3141 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME); |
| 3142 | skip |= validate_struct_type( |
| 3143 | "vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo", "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR", |
| 3144 | pSurfaceInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, true, |
| 3145 | "VUID-vkGetDeviceGroupSurfacePresentModes2EXT-pSurfaceInfo-parameter", "VUID-VkPhysicalDeviceSurfaceInfo2KHR-sType-sType"); |
| 3146 | if (pSurfaceInfo != NULL) { |
| 3147 | const VkStructureType allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR[] = { |
| 3148 | VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT, |
| 3149 | VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT}; |
| 3150 | |
| 3151 | skip |= validate_struct_pnext("vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo->pNext", |
| 3152 | "VkSurfaceFullScreenExclusiveInfoEXT, VkSurfaceFullScreenExclusiveWin32InfoEXT", |
| 3153 | pSurfaceInfo->pNext, ARRAY_SIZE(allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR), |
| 3154 | allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR, GeneratedVulkanHeaderVersion, |
| 3155 | "VUID-VkPhysicalDeviceSurfaceInfo2KHR-pNext-pNext"); |
| 3156 | |
| 3157 | skip |= validate_required_handle("vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo->surface", pSurfaceInfo->surface); |
| 3158 | } |
| 3159 | return skip; |
| 3160 | } |
| 3161 | #endif |