sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2015-2020 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2020 Valve Corporation |
| 3 | * Copyright (c) 2015-2020 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2020 Google Inc. |
Mark 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 | |
orbea | 80ddc06 | 2019-09-10 10:33:19 -0700 | [diff] [blame] | 22 | #include <cmath> |
Shahbaz Youssefi | 6be1141 | 2019-01-10 15:29:30 -0500 | [diff] [blame] | 23 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 24 | #include "chassis.h" |
| 25 | #include "stateless_validation.h" |
Mark Lobodzinski | e514d1a | 2019-03-12 08:47:45 -0600 | [diff] [blame] | 26 | #include "layer_chassis_dispatch.h" |
Tobias Hector | d942eb9 | 2018-10-22 15:18:56 +0100 | [diff] [blame] | 27 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 28 | static const int MaxParamCheckerStringLength = 256; |
| 29 | |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 30 | template <typename T> |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 31 | 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] | 32 | // Using only < for generality and || for early abort |
| 33 | return !((value < min) || (max < value)); |
| 34 | } |
| 35 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 36 | bool StatelessValidation::validate_string(const char *apiName, const ParameterName &stringName, const std::string &vuid, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 37 | const char *validateString) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 38 | bool skip = false; |
| 39 | |
| 40 | VkStringErrorFlags result = vk_string_validate(MaxParamCheckerStringLength, validateString); |
| 41 | |
| 42 | if (result == VK_STRING_ERROR_NONE) { |
| 43 | return skip; |
| 44 | } else if (result & VK_STRING_ERROR_LENGTH) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 45 | skip = LogError(device, vuid, "%s: string %s exceeds max length %d", apiName, stringName.get_name().c_str(), |
| 46 | MaxParamCheckerStringLength); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 47 | } else if (result & VK_STRING_ERROR_BAD_DATA) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 48 | skip = LogError(device, vuid, "%s: string %s contains invalid characters or is badly formed", apiName, |
| 49 | stringName.get_name().c_str()); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 50 | } |
| 51 | return skip; |
| 52 | } |
| 53 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 54 | bool StatelessValidation::validate_api_version(uint32_t api_version, uint32_t effective_api_version) const { |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 55 | bool skip = false; |
| 56 | uint32_t api_version_nopatch = VK_MAKE_VERSION(VK_VERSION_MAJOR(api_version), VK_VERSION_MINOR(api_version), 0); |
| 57 | if (api_version_nopatch != effective_api_version) { |
| 58 | if (api_version_nopatch < VK_API_VERSION_1_0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 59 | skip |= LogError(instance, kVUIDUndefined, |
| 60 | "Invalid CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number (0x%08x). " |
| 61 | "Using VK_API_VERSION_%" PRIu32 "_%" PRIu32 ".", |
| 62 | api_version, VK_VERSION_MAJOR(effective_api_version), VK_VERSION_MINOR(effective_api_version)); |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 63 | } else { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 64 | skip |= LogWarning(instance, kVUIDUndefined, |
| 65 | "Unrecognized CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number (0x%08x). " |
| 66 | "Assuming VK_API_VERSION_%" PRIu32 "_%" PRIu32 ".", |
| 67 | api_version, VK_VERSION_MAJOR(effective_api_version), VK_VERSION_MINOR(effective_api_version)); |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 68 | } |
| 69 | } |
| 70 | return skip; |
| 71 | } |
| 72 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 73 | bool StatelessValidation::validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const { |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 74 | bool skip = false; |
Mark Lobodzinski | 05cce20 | 2019-08-27 10:28:37 -0600 | [diff] [blame] | 75 | // Create and use a local instance extension object, as an actual instance has not been created yet |
| 76 | uint32_t specified_version = (pCreateInfo->pApplicationInfo ? pCreateInfo->pApplicationInfo->apiVersion : VK_API_VERSION_1_0); |
| 77 | InstanceExtensions local_instance_extensions; |
| 78 | local_instance_extensions.InitFromInstanceCreateInfo(specified_version, pCreateInfo); |
| 79 | |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 80 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | 05cce20 | 2019-08-27 10:28:37 -0600 | [diff] [blame] | 81 | skip |= validate_extension_reqs(local_instance_extensions, "VUID-vkCreateInstance-ppEnabledExtensionNames-01388", |
| 82 | "instance", pCreateInfo->ppEnabledExtensionNames[i]); |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | return skip; |
| 86 | } |
| 87 | |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 88 | template <typename ExtensionState> |
Tony-LunarG | 2ec96bb | 2019-11-26 13:43:02 -0700 | [diff] [blame] | 89 | ExtEnabled extension_state_by_name(const ExtensionState &extensions, const char *extension_name) { |
| 90 | if (!extension_name) return kNotEnabled; // null strings specify nothing |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 91 | auto info = ExtensionState::get_info(extension_name); |
Tony-LunarG | 2ec96bb | 2019-11-26 13:43:02 -0700 | [diff] [blame] | 92 | ExtEnabled state = |
| 93 | info.state ? extensions.*(info.state) : kNotEnabled; // unknown extensions can't be enabled in extension struct |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 94 | return state; |
| 95 | } |
| 96 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 97 | bool StatelessValidation::manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 98 | const VkAllocationCallbacks *pAllocator, |
| 99 | VkInstance *pInstance) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 100 | bool skip = false; |
| 101 | // Note: From the spec-- |
| 102 | // Providing a NULL VkInstanceCreateInfo::pApplicationInfo or providing an apiVersion of 0 is equivalent to providing |
| 103 | // an apiVersion of VK_MAKE_VERSION(1, 0, 0). (a.k.a. VK_API_VERSION_1_0) |
| 104 | uint32_t local_api_version = (pCreateInfo->pApplicationInfo && pCreateInfo->pApplicationInfo->apiVersion) |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 105 | ? pCreateInfo->pApplicationInfo->apiVersion |
| 106 | : VK_API_VERSION_1_0; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 107 | skip |= validate_api_version(local_api_version, api_version); |
| 108 | skip |= validate_instance_extensions(pCreateInfo); |
| 109 | return skip; |
| 110 | } |
| 111 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 112 | void StatelessValidation::PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 113 | const VkAllocationCallbacks *pAllocator, VkInstance *pInstance, |
| 114 | VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 115 | auto instance_data = GetLayerDataPtr(get_dispatch_key(*pInstance), layer_data_map); |
| 116 | // Copy extension data into local object |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 117 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 118 | this->instance_extensions = instance_data->instance_extensions; |
| 119 | } |
| 120 | |
| 121 | void StatelessValidation::PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 122 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 123 | auto device_data = GetLayerDataPtr(get_dispatch_key(*pDevice), layer_data_map); |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 124 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 125 | ValidationObject *validation_data = GetValidationObject(device_data->object_dispatch, LayerObjectTypeParameterValidation); |
| 126 | StatelessValidation *stateless_validation = static_cast<StatelessValidation *>(validation_data); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 127 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 128 | // Parmeter validation also uses extension data |
| 129 | stateless_validation->device_extensions = this->device_extensions; |
| 130 | |
| 131 | VkPhysicalDeviceProperties device_properties = {}; |
| 132 | // Need to get instance and do a getlayerdata call... |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 133 | DispatchGetPhysicalDeviceProperties(physicalDevice, &device_properties); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 134 | memcpy(&stateless_validation->device_limits, &device_properties.limits, sizeof(VkPhysicalDeviceLimits)); |
| 135 | |
| 136 | if (device_extensions.vk_nv_shading_rate_image) { |
| 137 | // Get the needed shading rate image limits |
| 138 | auto shading_rate_image_props = lvl_init_struct<VkPhysicalDeviceShadingRateImagePropertiesNV>(); |
| 139 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&shading_rate_image_props); |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 140 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 141 | phys_dev_ext_props.shading_rate_image_props = shading_rate_image_props; |
| 142 | } |
| 143 | |
| 144 | if (device_extensions.vk_nv_mesh_shader) { |
| 145 | // Get the needed mesh shader limits |
| 146 | auto mesh_shader_props = lvl_init_struct<VkPhysicalDeviceMeshShaderPropertiesNV>(); |
| 147 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&mesh_shader_props); |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 148 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 149 | phys_dev_ext_props.mesh_shader_props = mesh_shader_props; |
| 150 | } |
| 151 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 152 | if (device_extensions.vk_nv_ray_tracing) { |
| 153 | // Get the needed ray tracing limits |
| 154 | auto ray_tracing_props = lvl_init_struct<VkPhysicalDeviceRayTracingPropertiesNV>(); |
| 155 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&ray_tracing_props); |
| 156 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame^] | 157 | phys_dev_ext_props.ray_tracing_propsNV = ray_tracing_props; |
| 158 | } |
| 159 | |
| 160 | if (device_extensions.vk_khr_ray_tracing) { |
| 161 | // Get the needed ray tracing limits |
| 162 | auto ray_tracing_props = lvl_init_struct<VkPhysicalDeviceRayTracingPropertiesKHR>(); |
| 163 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&ray_tracing_props); |
| 164 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 165 | phys_dev_ext_props.ray_tracing_propsKHR = ray_tracing_props; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 168 | if (device_extensions.vk_ext_transform_feedback) { |
| 169 | // Get the needed transform feedback limits |
| 170 | auto transform_feedback_props = lvl_init_struct<VkPhysicalDeviceTransformFeedbackPropertiesEXT>(); |
| 171 | auto prop2 = lvl_init_struct<VkPhysicalDeviceProperties2KHR>(&transform_feedback_props); |
| 172 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 173 | phys_dev_ext_props.transform_feedback_props = transform_feedback_props; |
| 174 | } |
| 175 | |
Jasper St. Pierre | a49b4be | 2019-02-05 17:48:57 -0800 | [diff] [blame] | 176 | stateless_validation->phys_dev_ext_props = this->phys_dev_ext_props; |
| 177 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 178 | // Save app-enabled features in this device's validation object |
| 179 | // The enabled features can come from either pEnabledFeatures, or from the pNext chain |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 180 | const auto *features2 = lvl_find_in_chain<VkPhysicalDeviceFeatures2>(pCreateInfo->pNext); |
| 181 | safe_VkPhysicalDeviceFeatures2 tmp_features2_state; |
| 182 | tmp_features2_state.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; |
| 183 | if (features2) { |
| 184 | tmp_features2_state.features = features2->features; |
| 185 | } else if (pCreateInfo->pEnabledFeatures) { |
| 186 | tmp_features2_state.features = *pCreateInfo->pEnabledFeatures; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 187 | } else { |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 188 | tmp_features2_state.features = {}; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 189 | } |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 190 | // Use pCreateInfo->pNext to get full chain |
Tony-LunarG | 6c3c545 | 2019-12-13 10:37:38 -0700 | [diff] [blame] | 191 | stateless_validation->device_createinfo_pnext = SafePnextCopy(pCreateInfo->pNext); |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 192 | stateless_validation->physical_device_features2 = tmp_features2_state; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 193 | } |
| 194 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 195 | bool StatelessValidation::manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 196 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 197 | bool skip = false; |
| 198 | |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 199 | for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) { |
| 200 | skip |= validate_string("vkCreateDevice", "pCreateInfo->ppEnabledLayerNames", |
| 201 | "VUID-VkDeviceCreateInfo-ppEnabledLayerNames-parameter", pCreateInfo->ppEnabledLayerNames[i]); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 202 | } |
| 203 | |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 204 | for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 205 | skip |= |
| 206 | validate_string("vkCreateDevice", "pCreateInfo->ppEnabledExtensionNames", |
| 207 | "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-parameter", pCreateInfo->ppEnabledExtensionNames[i]); |
| 208 | skip |= validate_extension_reqs(device_extensions, "VUID-vkCreateDevice-ppEnabledExtensionNames-01387", "device", |
| 209 | pCreateInfo->ppEnabledExtensionNames[i]); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 210 | } |
| 211 | |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 212 | { |
Tony-LunarG | 2ec96bb | 2019-11-26 13:43:02 -0700 | [diff] [blame] | 213 | bool maint1 = IsExtEnabled(extension_state_by_name(device_extensions, VK_KHR_MAINTENANCE1_EXTENSION_NAME)); |
| 214 | bool negative_viewport = |
| 215 | IsExtEnabled(extension_state_by_name(device_extensions, VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME)); |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 216 | if (maint1 && negative_viewport) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 217 | skip |= LogError(device, "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-00374", |
| 218 | "VkDeviceCreateInfo->ppEnabledExtensionNames must not simultaneously include VK_KHR_maintenance1 and " |
| 219 | "VK_AMD_negative_viewport_height."); |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 220 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 221 | } |
| 222 | |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 223 | { |
| 224 | bool khr_bda = IsExtEnabled(extension_state_by_name(device_extensions, VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME)); |
| 225 | bool ext_bda = IsExtEnabled(extension_state_by_name(device_extensions, VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME)); |
| 226 | if (khr_bda && ext_bda) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 227 | skip |= LogError(device, "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-03328", |
| 228 | "VkDeviceCreateInfo->ppEnabledExtensionNames must not contain both VK_KHR_buffer_device_address and " |
| 229 | "VK_EXT_buffer_device_address."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 233 | if (pCreateInfo->pNext != NULL && pCreateInfo->pEnabledFeatures) { |
| 234 | // Check for get_physical_device_properties2 struct |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 235 | const auto *features2 = lvl_find_in_chain<VkPhysicalDeviceFeatures2KHR>(pCreateInfo->pNext); |
| 236 | if (features2) { |
| 237 | // Cannot include VkPhysicalDeviceFeatures2KHR and have non-null pEnabledFeatures |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 238 | skip |= LogError(device, kVUID_PVError_InvalidUsage, |
| 239 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceFeatures2KHR struct when " |
| 240 | "pCreateInfo->pEnabledFeatures is non-NULL."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 241 | } |
| 242 | } |
| 243 | |
Locke | 77fad1c | 2019-04-16 13:09:03 -0600 | [diff] [blame] | 244 | auto features2 = lvl_find_in_chain<VkPhysicalDeviceFeatures2>(pCreateInfo->pNext); |
| 245 | if (features2) { |
| 246 | if (!instance_extensions.vk_khr_get_physical_device_properties_2) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 247 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 248 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceFeatures2 struct, " |
| 249 | "VK_KHR_get_physical_device_properties2 must be enabled when it creates an instance."); |
Locke | 77fad1c | 2019-04-16 13:09:03 -0600 | [diff] [blame] | 250 | } |
| 251 | } |
| 252 | |
| 253 | auto vertex_attribute_divisor_features = |
| 254 | lvl_find_in_chain<VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT>(pCreateInfo->pNext); |
| 255 | if (vertex_attribute_divisor_features) { |
| 256 | bool extension_found = false; |
| 257 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) { |
| 258 | if (0 == strncmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, |
| 259 | VK_MAX_EXTENSION_NAME_SIZE)) { |
| 260 | extension_found = true; |
| 261 | break; |
| 262 | } |
| 263 | } |
| 264 | if (!extension_found) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 265 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 266 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT " |
| 267 | "struct, VK_EXT_vertex_attribute_divisor must be enabled when it creates a device."); |
Locke | 77fad1c | 2019-04-16 13:09:03 -0600 | [diff] [blame] | 268 | } |
| 269 | } |
| 270 | |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 271 | const auto *vulkan_11_features = lvl_find_in_chain<VkPhysicalDeviceVulkan11Features>(pCreateInfo->pNext); |
| 272 | if (vulkan_11_features) { |
| 273 | const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(pCreateInfo->pNext); |
| 274 | while (current) { |
| 275 | if (current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES || |
| 276 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES || |
| 277 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES || |
| 278 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES || |
| 279 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES || |
| 280 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 281 | skip |= LogError( |
| 282 | instance, "VUID-VkDeviceCreateInfo-pNext-02829", |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 283 | "If the pNext chain includes a VkPhysicalDeviceVulkan11Features structure, then it must not include a " |
| 284 | "VkPhysicalDevice16BitStorageFeatures, VkPhysicalDeviceMultiviewFeatures, " |
| 285 | "VkPhysicalDeviceVariablePointersFeatures, VkPhysicalDeviceProtectedMemoryFeatures, " |
| 286 | "VkPhysicalDeviceSamplerYcbcrConversionFeatures, or VkPhysicalDeviceShaderDrawParametersFeatures structure"); |
| 287 | break; |
| 288 | } |
| 289 | current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | const auto *vulkan_12_features = lvl_find_in_chain<VkPhysicalDeviceVulkan12Features>(pCreateInfo->pNext); |
| 294 | if (vulkan_12_features) { |
| 295 | const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(pCreateInfo->pNext); |
| 296 | while (current) { |
| 297 | if (current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES || |
| 298 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES || |
| 299 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES || |
| 300 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES || |
| 301 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES || |
| 302 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES || |
| 303 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES || |
| 304 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES || |
| 305 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES || |
| 306 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES || |
| 307 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES || |
| 308 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES || |
| 309 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 310 | skip |= LogError( |
| 311 | instance, "VUID-VkDeviceCreateInfo-pNext-02830", |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 312 | "If the pNext chain includes a VkPhysicalDeviceVulkan12Features structure, then it must not include a " |
| 313 | "VkPhysicalDevice8BitStorageFeatures, VkPhysicalDeviceShaderAtomicInt64Features, " |
| 314 | "VkPhysicalDeviceShaderFloat16Int8Features, VkPhysicalDeviceDescriptorIndexingFeatures, " |
| 315 | "VkPhysicalDeviceScalarBlockLayoutFeatures, VkPhysicalDeviceImagelessFramebufferFeatures, " |
| 316 | "VkPhysicalDeviceUniformBufferStandardLayoutFeatures, VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures, " |
| 317 | "VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures, VkPhysicalDeviceHostQueryResetFeatures, " |
| 318 | "VkPhysicalDeviceTimelineSemaphoreFeatures, VkPhysicalDeviceBufferDeviceAddressFeatures, or " |
| 319 | "VkPhysicalDeviceVulkanMemoryModelFeatures structure"); |
| 320 | break; |
| 321 | } |
| 322 | current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext); |
| 323 | } |
| 324 | } |
| 325 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 326 | // Validate pCreateInfo->pQueueCreateInfos |
| 327 | if (pCreateInfo->pQueueCreateInfos) { |
| 328 | std::unordered_set<uint32_t> set; |
| 329 | |
| 330 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
| 331 | const uint32_t requested_queue_family = pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex; |
| 332 | if (requested_queue_family == VK_QUEUE_FAMILY_IGNORED) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 333 | skip |= |
| 334 | LogError(physicalDevice, "VUID-VkDeviceQueueCreateInfo-queueFamilyIndex-00381", |
| 335 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 |
| 336 | "].queueFamilyIndex is VK_QUEUE_FAMILY_IGNORED, but it is required to provide a valid queue family " |
| 337 | "index value.", |
| 338 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 339 | } else if (set.count(requested_queue_family)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 340 | skip |= LogError(physicalDevice, "VUID-VkDeviceCreateInfo-queueFamilyIndex-00372", |
| 341 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueFamilyIndex (=%" PRIu32 |
| 342 | ") is not unique within pCreateInfo->pQueueCreateInfos array.", |
| 343 | i, requested_queue_family); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 344 | } else { |
| 345 | set.insert(requested_queue_family); |
| 346 | } |
| 347 | |
| 348 | if (pCreateInfo->pQueueCreateInfos[i].pQueuePriorities != nullptr) { |
| 349 | for (uint32_t j = 0; j < pCreateInfo->pQueueCreateInfos[i].queueCount; ++j) { |
| 350 | const float queue_priority = pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j]; |
| 351 | if (!(queue_priority >= 0.f) || !(queue_priority <= 1.f)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 352 | skip |= LogError(physicalDevice, "VUID-VkDeviceQueueCreateInfo-pQueuePriorities-00383", |
| 353 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].pQueuePriorities[%" PRIu32 |
| 354 | "] (=%f) is not between 0 and 1 (inclusive).", |
| 355 | i, j, queue_priority); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 356 | } |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | return skip; |
| 363 | } |
| 364 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 365 | bool StatelessValidation::require_device_extension(bool flag, char const *function_name, char const *extension_name) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 366 | if (!flag) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 367 | return LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 368 | "%s() called even though the %s extension was not enabled for this VkDevice.", function_name, |
| 369 | extension_name); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 370 | } |
| 371 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 372 | return false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 373 | } |
| 374 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 375 | bool StatelessValidation::manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 376 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 377 | bool skip = false; |
| 378 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 379 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 380 | skip |= |
| 381 | ValidateGreaterThanZero(pCreateInfo->size, "pCreateInfo->size", "VUID-VkBufferCreateInfo-size-00912", "vkCreateBuffer"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 382 | |
| 383 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 384 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 385 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 386 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 387 | skip |= LogError(device, "VUID-VkBufferCreateInfo-sharingMode-00914", |
| 388 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 389 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 393 | // queueFamilyIndexCount uint32_t values |
| 394 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 395 | skip |= LogError(device, "VUID-VkBufferCreateInfo-sharingMode-00913", |
| 396 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 397 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 398 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 399 | } |
| 400 | } |
| 401 | |
| 402 | // If flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 403 | // VK_BUFFER_CREATE_SPARSE_BINDING_BIT |
| 404 | if (((pCreateInfo->flags & (VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 405 | ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) != VK_BUFFER_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 406 | skip |= LogError(device, "VUID-VkBufferCreateInfo-flags-00918", |
| 407 | "vkCreateBuffer: if pCreateInfo->flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or " |
| 408 | "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] | 409 | } |
| 410 | } |
| 411 | |
| 412 | return skip; |
| 413 | } |
| 414 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 415 | bool StatelessValidation::manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 416 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 417 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 418 | |
| 419 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 420 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 421 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 422 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 423 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 424 | skip |= LogError(device, "VUID-VkImageCreateInfo-sharingMode-00942", |
| 425 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 426 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 427 | } |
| 428 | |
| 429 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 430 | // queueFamilyIndexCount uint32_t values |
| 431 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 432 | skip |= LogError(device, "VUID-VkImageCreateInfo-sharingMode-00941", |
| 433 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 434 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 435 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 436 | } |
| 437 | } |
| 438 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 439 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.width, "pCreateInfo->extent.width", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 440 | "VUID-VkImageCreateInfo-extent-00944", "vkCreateImage"); |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 441 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.height, "pCreateInfo->extent.height", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 442 | "VUID-VkImageCreateInfo-extent-00945", "vkCreateImage"); |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 443 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.depth, "pCreateInfo->extent.depth", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 444 | "VUID-VkImageCreateInfo-extent-00946", "vkCreateImage"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 445 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 446 | skip |= ValidateGreaterThanZero(pCreateInfo->mipLevels, "pCreateInfo->mipLevels", "VUID-VkImageCreateInfo-mipLevels-00947", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 447 | "vkCreateImage"); |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 448 | skip |= ValidateGreaterThanZero(pCreateInfo->arrayLayers, "pCreateInfo->arrayLayers", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 449 | "VUID-VkImageCreateInfo-arrayLayers-00948", "vkCreateImage"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 450 | |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 451 | // InitialLayout must be PREINITIALIZED or UNDEFINED |
Dave Houlton | e19e20d | 2018-02-02 16:32:41 -0700 | [diff] [blame] | 452 | if ((pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_UNDEFINED) && |
| 453 | (pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_PREINITIALIZED)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 454 | skip |= LogError( |
| 455 | device, "VUID-VkImageCreateInfo-initialLayout-00993", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 456 | "vkCreateImage(): initialLayout is %s, must be VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED.", |
| 457 | string_VkImageLayout(pCreateInfo->initialLayout)); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 458 | } |
| 459 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 460 | // 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] | 461 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && |
| 462 | ((pCreateInfo->extent.height != 1) || (pCreateInfo->extent.depth != 1))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 463 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00956", |
| 464 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both pCreateInfo->extent.height and " |
| 465 | "pCreateInfo->extent.depth must be 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) { |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 469 | if (pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
| 470 | if (pCreateInfo->extent.width != pCreateInfo->extent.height) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 471 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00954", |
| 472 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but " |
| 473 | "pCreateInfo->extent.width (=%" PRIu32 ") and pCreateInfo->extent.height (=%" PRIu32 |
| 474 | ") are not equal.", |
| 475 | pCreateInfo->extent.width, pCreateInfo->extent.height); |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 476 | } |
| 477 | |
| 478 | if (pCreateInfo->arrayLayers < 6) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 479 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00954", |
| 480 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but " |
| 481 | "pCreateInfo->arrayLayers (=%" PRIu32 ") is not greater than or equal to 6.", |
| 482 | pCreateInfo->arrayLayers); |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 483 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | if (pCreateInfo->extent.depth != 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 487 | skip |= LogError( |
| 488 | device, "VUID-VkImageCreateInfo-imageType-00957", |
| 489 | "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] | 490 | } |
| 491 | } |
| 492 | |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 493 | // 3D image may have only 1 layer |
| 494 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_3D) && (pCreateInfo->arrayLayers != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 495 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00961", |
| 496 | "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] | 497 | } |
| 498 | |
| 499 | // If multi-sample, validate type, usage, tiling and mip levels. |
| 500 | if ((pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) && |
| 501 | ((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] | 502 | (pCreateInfo->mipLevels != 1) || (pCreateInfo->tiling != VK_IMAGE_TILING_OPTIMAL))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 503 | skip |= LogError(device, "VUID-VkImageCreateInfo-samples-02257", |
| 504 | "vkCreateImage(): Multi-sample image with incompatible type, usage, tiling, or mips."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 505 | } |
| 506 | |
| 507 | if (0 != (pCreateInfo->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT)) { |
| 508 | VkImageUsageFlags legal_flags = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | |
| 509 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); |
| 510 | // At least one of the legal attachment bits must be set |
| 511 | if (0 == (pCreateInfo->usage & legal_flags)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 512 | skip |= LogError(device, "VUID-VkImageCreateInfo-usage-00966", |
| 513 | "vkCreateImage(): Transient attachment image without a compatible attachment flag set."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 514 | } |
| 515 | // No flags other than the legal attachment bits may be set |
| 516 | legal_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 517 | if (0 != (pCreateInfo->usage & ~legal_flags)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 518 | skip |= LogError(device, "VUID-VkImageCreateInfo-usage-00963", |
| 519 | "vkCreateImage(): Transient attachment image with incompatible usage flags set."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 520 | } |
| 521 | } |
| 522 | |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 523 | // 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] | 524 | 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] | 525 | // Max mip levels is different for corner-sampled images vs normal images. |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 526 | uint32_t maxMipLevels = (pCreateInfo->flags & VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV) ? (uint32_t)(ceil(log2(maxDim))) |
| 527 | : (uint32_t)(floor(log2(maxDim)) + 1); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 528 | if (maxDim > 0 && pCreateInfo->mipLevels > maxMipLevels) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 529 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 530 | LogError(device, "VUID-VkImageCreateInfo-mipLevels-00958", |
| 531 | "vkCreateImage(): pCreateInfo->mipLevels must be less than or equal to " |
| 532 | "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] | 533 | } |
| 534 | |
Mark Lobodzinski | 69259c5 | 2018-09-18 15:14:58 -0600 | [diff] [blame] | 535 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) && (pCreateInfo->imageType != VK_IMAGE_TYPE_3D)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 536 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-00950", |
| 537 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT but " |
| 538 | "pCreateInfo->imageType is not VK_IMAGE_TYPE_3D."); |
Mark Lobodzinski | 69259c5 | 2018-09-18 15:14:58 -0600 | [diff] [blame] | 539 | } |
| 540 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 541 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) && (!physical_device_features.sparseBinding)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 542 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-00969", |
| 543 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_BINDING_BIT, but the " |
| 544 | "VkPhysicalDeviceFeatures::sparseBinding feature is disabled."); |
Petr Kraus | b6f9780 | 2018-03-13 12:31:39 +0100 | [diff] [blame] | 545 | } |
| 546 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 547 | // If flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 548 | // VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
| 549 | if (((pCreateInfo->flags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 550 | ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) != VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 551 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-00987", |
| 552 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or " |
| 553 | "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] | 554 | } |
| 555 | |
| 556 | // Check for combinations of attributes that are incompatible with having VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT set |
| 557 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) != 0) { |
| 558 | // Linear tiling is unsupported |
| 559 | if (VK_IMAGE_TILING_LINEAR == pCreateInfo->tiling) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 560 | skip |= LogError(device, kVUID_PVError_InvalidUsage, |
| 561 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT then image " |
| 562 | "tiling of VK_IMAGE_TILING_LINEAR is not supported"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | // Sparse 1D image isn't valid |
| 566 | if (VK_IMAGE_TYPE_1D == pCreateInfo->imageType) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 567 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00970", |
| 568 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 1D image."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 569 | } |
| 570 | |
| 571 | // Sparse 2D image when device doesn't support it |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 572 | if ((VK_FALSE == physical_device_features.sparseResidencyImage2D) && (VK_IMAGE_TYPE_2D == pCreateInfo->imageType)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 573 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00971", |
| 574 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2D image if corresponding " |
| 575 | "feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | // Sparse 3D image when device doesn't support it |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 579 | if ((VK_FALSE == physical_device_features.sparseResidencyImage3D) && (VK_IMAGE_TYPE_3D == pCreateInfo->imageType)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 580 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00972", |
| 581 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 3D image if corresponding " |
| 582 | "feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | // Multi-sample 2D image when device doesn't support it |
| 586 | if (VK_IMAGE_TYPE_2D == pCreateInfo->imageType) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 587 | if ((VK_FALSE == physical_device_features.sparseResidency2Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 588 | (VK_SAMPLE_COUNT_2_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 589 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00973", |
| 590 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2-sample image if " |
| 591 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 592 | } else if ((VK_FALSE == physical_device_features.sparseResidency4Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 593 | (VK_SAMPLE_COUNT_4_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 594 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00974", |
| 595 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 4-sample image if " |
| 596 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 597 | } else if ((VK_FALSE == physical_device_features.sparseResidency8Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 598 | (VK_SAMPLE_COUNT_8_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 599 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00975", |
| 600 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 8-sample image if " |
| 601 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 602 | } else if ((VK_FALSE == physical_device_features.sparseResidency16Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 603 | (VK_SAMPLE_COUNT_16_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 604 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00976", |
| 605 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 16-sample image if " |
| 606 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 607 | } |
| 608 | } |
| 609 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 610 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 611 | if (pCreateInfo->usage & VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV) { |
| 612 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 613 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-02082", |
| 614 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 615 | "imageType must be VK_IMAGE_TYPE_2D."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 616 | } |
| 617 | if (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 618 | skip |= LogError(device, "VUID-VkImageCreateInfo-samples-02083", |
| 619 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 620 | "samples must be VK_SAMPLE_COUNT_1_BIT."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 621 | } |
| 622 | if (pCreateInfo->tiling != VK_IMAGE_TILING_OPTIMAL) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 623 | skip |= LogError(device, "VUID-VkImageCreateInfo-tiling-02084", |
| 624 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 625 | "tiling must be VK_IMAGE_TILING_OPTIMAL."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 626 | } |
| 627 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 628 | |
| 629 | if (pCreateInfo->flags & VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 630 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D && pCreateInfo->imageType != VK_IMAGE_TYPE_3D) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 631 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02050", |
| 632 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV, " |
| 633 | "imageType must be VK_IMAGE_TYPE_2D or VK_IMAGE_TYPE_3D."); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 634 | } |
| 635 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 636 | if ((pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) || FormatIsDepthOrStencil(pCreateInfo->format)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 637 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02051", |
| 638 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV, " |
| 639 | "it must not also contain VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT and format must " |
| 640 | "not be a depth/stencil format."); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 641 | } |
| 642 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 643 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D && (pCreateInfo->extent.width == 1 || pCreateInfo->extent.height == 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 644 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02052", |
| 645 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV and " |
| 646 | "imageType is VK_IMAGE_TYPE_2D, extent.width and extent.height must be " |
| 647 | "greater than 1."); |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 648 | } else if (pCreateInfo->imageType == VK_IMAGE_TYPE_3D && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 649 | (pCreateInfo->extent.width == 1 || pCreateInfo->extent.height == 1 || pCreateInfo->extent.depth == 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 650 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02053", |
| 651 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV and " |
| 652 | "imageType is VK_IMAGE_TYPE_3D, extent.width, extent.height, and extent.depth " |
| 653 | "must be greater than 1."); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 654 | } |
| 655 | } |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 656 | |
| 657 | const auto image_stencil_struct = lvl_find_in_chain<VkImageStencilUsageCreateInfoEXT>(pCreateInfo->pNext); |
| 658 | if (image_stencil_struct != nullptr) { |
| 659 | if ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0) { |
| 660 | VkImageUsageFlags legal_flags = (VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); |
| 661 | // No flags other than the legal attachment bits may be set |
| 662 | legal_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 663 | if ((image_stencil_struct->stencilUsage & ~legal_flags) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 664 | skip |= LogError(device, "VUID-VkImageStencilUsageCreateInfo-stencilUsage-02539", |
| 665 | "vkCreateImage(): in pNext chain, VkImageStencilUsageCreateInfo::stencilUsage includes " |
| 666 | "VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, it must not include bits other than " |
| 667 | "VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT or VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT"); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 668 | } |
| 669 | } |
| 670 | |
| 671 | if (FormatIsDepthOrStencil(pCreateInfo->format)) { |
| 672 | if ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) != 0) { |
| 673 | if (pCreateInfo->extent.width > device_limits.maxFramebufferWidth) { |
| 674 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 675 | LogError(device, "VUID-VkImageCreateInfo-Format-02536", |
| 676 | "vkCreateImage(): Depth-stencil image contains VkImageStencilUsageCreateInfo structure with " |
| 677 | "stencilUsage including VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT and image width exceeds device " |
| 678 | "maxFramebufferWidth"); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | if (pCreateInfo->extent.height > device_limits.maxFramebufferHeight) { |
| 682 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 683 | LogError(device, "VUID-VkImageCreateInfo-format-02537", |
| 684 | "vkCreateImage(): Depth-stencil image contains VkImageStencilUsageCreateInfo structure with " |
| 685 | "stencilUsage including VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT and image height exceeds device " |
| 686 | "maxFramebufferHeight"); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 687 | } |
| 688 | } |
| 689 | |
| 690 | if (!physical_device_features.shaderStorageImageMultisample && |
| 691 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_STORAGE_BIT) != 0) && |
| 692 | (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT)) { |
| 693 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 694 | LogError(device, "VUID-VkImageCreateInfo-format-02538", |
| 695 | "vkCreateImage(): Depth-stencil image contains VkImageStencilUsageCreateInfo structure with " |
| 696 | "stencilUsage including VK_IMAGE_USAGE_STORAGE_BIT and the multisampled storage images feature is " |
| 697 | "not enabled, image samples must be VK_SAMPLE_COUNT_1_BIT"); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | if (((pCreateInfo->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0) && |
| 701 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) == 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 702 | skip |= LogError( |
| 703 | device, "VUID-VkImageCreateInfo-format-02795", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 704 | "vkCreateImage(): Depth-stencil image in which usage includes VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT " |
| 705 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 706 | "also include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 707 | } else if (((pCreateInfo->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) == 0) && |
| 708 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 709 | skip |= LogError( |
| 710 | device, "VUID-VkImageCreateInfo-format-02796", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 711 | "vkCreateImage(): Depth-stencil image in which usage does not include " |
| 712 | "VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT " |
| 713 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 714 | "also not include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 715 | } |
| 716 | |
| 717 | if (((pCreateInfo->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0) && |
| 718 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 719 | skip |= LogError( |
| 720 | device, "VUID-VkImageCreateInfo-format-02797", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 721 | "vkCreateImage(): Depth-stencil image in which usage includes VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT " |
| 722 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 723 | "also include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 724 | } else if (((pCreateInfo->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0) && |
| 725 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 726 | skip |= LogError( |
| 727 | device, "VUID-VkImageCreateInfo-format-02798", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 728 | "vkCreateImage(): Depth-stencil image in which usage does not include " |
| 729 | "VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT " |
| 730 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 731 | "also not include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 732 | } |
| 733 | } |
| 734 | } |
Spencer Fricke | ca52b5c | 2020-03-16 17:34:00 -0700 | [diff] [blame] | 735 | |
| 736 | if ((!physical_device_features.shaderStorageImageMultisample) && ((pCreateInfo->usage & VK_IMAGE_USAGE_STORAGE_BIT) != 0) && |
| 737 | (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT)) { |
| 738 | skip |= LogError(device, "VUID-VkImageCreateInfo-usage-00968", |
| 739 | "vkCreateImage(): usage contains VK_IMAGE_USAGE_STORAGE_BIT and the multisampled storage images " |
| 740 | "feature is not enabled, image samples must be VK_SAMPLE_COUNT_1_BIT"); |
| 741 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 742 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 743 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 744 | return skip; |
| 745 | } |
| 746 | |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 747 | bool StatelessValidation::manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 748 | const ParameterName ¶meter_name, VkCommandBuffer object) const { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 749 | bool skip = false; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 750 | |
| 751 | // Note: for numerical correctness |
| 752 | // - float comparisons should expect NaN (comparison always false). |
| 753 | // - VkPhysicalDeviceLimits::maxViewportDimensions is uint32_t, not float -> careful. |
| 754 | |
| 755 | 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] | 756 | if (std::isnan(v1_f)) return false; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 757 | if (v1_f <= 0.0f) return true; |
| 758 | |
| 759 | float intpart; |
| 760 | const float fract = modff(v1_f, &intpart); |
| 761 | |
| 762 | assert(std::numeric_limits<float>::radix == 2); |
| 763 | const float u32_max_plus1 = ldexpf(1.0f, 32); // hopefully exact |
| 764 | if (intpart >= u32_max_plus1) return false; |
| 765 | |
| 766 | uint32_t v1_u32 = static_cast<uint32_t>(intpart); |
| 767 | if (v1_u32 < v2_u32) |
| 768 | return true; |
| 769 | else if (v1_u32 == v2_u32 && fract == 0.0f) |
| 770 | return true; |
| 771 | else |
| 772 | return false; |
| 773 | }; |
| 774 | |
| 775 | const auto f_lte_u32_direct = [](const float v1_f, const uint32_t v2_u32) { |
| 776 | const float v2_f = static_cast<float>(v2_u32); // not accurate for > radix^digits; and undefined rounding mode |
| 777 | return (v1_f <= v2_f); |
| 778 | }; |
| 779 | |
| 780 | // width |
| 781 | bool width_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 782 | const auto max_w = device_limits.maxViewportDimensions[0]; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 783 | |
| 784 | if (!(viewport.width > 0.0f)) { |
| 785 | width_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 786 | skip |= LogError(object, "VUID-VkViewport-width-01770", "%s: %s.width (=%f) is not greater than 0.0.", fn_name, |
| 787 | parameter_name.get_name().c_str(), viewport.width); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 788 | } else if (!(f_lte_u32_exact(viewport.width, max_w) || f_lte_u32_direct(viewport.width, max_w))) { |
| 789 | width_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 790 | skip |= LogError(object, "VUID-VkViewport-width-01771", |
| 791 | "%s: %s.width (=%f) exceeds VkPhysicalDeviceLimits::maxViewportDimensions[0] (=%" PRIu32 ").", fn_name, |
| 792 | parameter_name.get_name().c_str(), viewport.width, max_w); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 793 | } else if (!f_lte_u32_exact(viewport.width, max_w) && f_lte_u32_direct(viewport.width, max_w)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 794 | skip |= LogWarning(object, kVUID_PVError_NONE, |
| 795 | "%s: %s.width (=%f) technically exceeds VkPhysicalDeviceLimits::maxViewportDimensions[0] (=%" PRIu32 |
| 796 | "), but it is within the static_cast<float>(maxViewportDimensions[0]) limit.", |
| 797 | fn_name, parameter_name.get_name().c_str(), viewport.width, max_w); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | // height |
| 801 | bool height_healthy = true; |
Mark Lobodzinski | a09ab94 | 2020-02-20 11:01:59 -0700 | [diff] [blame] | 802 | const bool negative_height_enabled = device_extensions.vk_khr_maintenance1 || device_extensions.vk_amd_negative_viewport_height; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 803 | const auto max_h = device_limits.maxViewportDimensions[1]; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 804 | |
| 805 | if (!negative_height_enabled && !(viewport.height > 0.0f)) { |
| 806 | height_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 807 | skip |= LogError(object, "VUID-VkViewport-height-01772", "%s: %s.height (=%f) is not greater 0.0.", fn_name, |
| 808 | parameter_name.get_name().c_str(), viewport.height); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 809 | } else if (!(f_lte_u32_exact(fabsf(viewport.height), max_h) || f_lte_u32_direct(fabsf(viewport.height), max_h))) { |
| 810 | height_healthy = false; |
| 811 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 812 | skip |= LogError(object, "VUID-VkViewport-height-01773", |
| 813 | "%s: Absolute value of %s.height (=%f) exceeds VkPhysicalDeviceLimits::maxViewportDimensions[1] (=%" PRIu32 |
| 814 | ").", |
| 815 | fn_name, parameter_name.get_name().c_str(), viewport.height, max_h); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 816 | } else if (!f_lte_u32_exact(fabsf(viewport.height), max_h) && f_lte_u32_direct(fabsf(viewport.height), max_h)) { |
| 817 | height_healthy = false; |
| 818 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 819 | skip |= LogWarning( |
| 820 | object, kVUID_PVError_NONE, |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 821 | "%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] | 822 | "), but it is within the static_cast<float>(maxViewportDimensions[1]) limit.", |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 823 | fn_name, parameter_name.get_name().c_str(), viewport.height, max_h); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 824 | } |
| 825 | |
| 826 | // x |
| 827 | bool x_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 828 | if (!(viewport.x >= device_limits.viewportBoundsRange[0])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 829 | x_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 830 | skip |= LogError(object, "VUID-VkViewport-x-01774", |
| 831 | "%s: %s.x (=%f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", fn_name, |
| 832 | parameter_name.get_name().c_str(), viewport.x, device_limits.viewportBoundsRange[0]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | // x + width |
| 836 | if (x_healthy && width_healthy) { |
| 837 | const float right_bound = viewport.x + viewport.width; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 838 | if (!(right_bound <= device_limits.viewportBoundsRange[1])) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 839 | skip |= LogError( |
| 840 | object, "VUID-VkViewport-x-01232", |
| 841 | "%s: %s.x + %s.width (=%f + %f = %f) is greater than VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", |
| 842 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.x, viewport.width, |
| 843 | right_bound, device_limits.viewportBoundsRange[1]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 844 | } |
| 845 | } |
| 846 | |
| 847 | // y |
| 848 | bool y_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 849 | if (!(viewport.y >= device_limits.viewportBoundsRange[0])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 850 | y_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 851 | skip |= LogError(object, "VUID-VkViewport-y-01775", |
| 852 | "%s: %s.y (=%f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", fn_name, |
| 853 | parameter_name.get_name().c_str(), viewport.y, device_limits.viewportBoundsRange[0]); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 854 | } else if (negative_height_enabled && !(viewport.y <= device_limits.viewportBoundsRange[1])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 855 | y_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 856 | skip |= LogError(object, "VUID-VkViewport-y-01776", |
| 857 | "%s: %s.y (=%f) exceeds VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", fn_name, |
| 858 | parameter_name.get_name().c_str(), viewport.y, device_limits.viewportBoundsRange[1]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 859 | } |
| 860 | |
| 861 | // y + height |
| 862 | if (y_healthy && height_healthy) { |
| 863 | const float boundary = viewport.y + viewport.height; |
| 864 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 865 | if (!(boundary <= device_limits.viewportBoundsRange[1])) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 866 | skip |= LogError(object, "VUID-VkViewport-y-01233", |
| 867 | "%s: %s.y + %s.height (=%f + %f = %f) exceeds VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", |
| 868 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.y, |
| 869 | viewport.height, boundary, device_limits.viewportBoundsRange[1]); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 870 | } else if (negative_height_enabled && !(boundary >= device_limits.viewportBoundsRange[0])) { |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 871 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 872 | LogError(object, "VUID-VkViewport-y-01777", |
| 873 | "%s: %s.y + %s.height (=%f + %f = %f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", |
| 874 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.y, viewport.height, |
| 875 | boundary, device_limits.viewportBoundsRange[0]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 876 | } |
| 877 | } |
| 878 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 879 | if (!device_extensions.vk_ext_depth_range_unrestricted) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 880 | // minDepth |
| 881 | if (!(viewport.minDepth >= 0.0) || !(viewport.minDepth <= 1.0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 882 | skip |= LogError(object, "VUID-VkViewport-minDepth-01234", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 883 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 884 | "%s: VK_EXT_depth_range_unrestricted extension is not enabled and %s.minDepth (=%f) is not within the " |
| 885 | "[0.0, 1.0] range.", |
| 886 | fn_name, parameter_name.get_name().c_str(), viewport.minDepth); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 887 | } |
| 888 | |
| 889 | // maxDepth |
| 890 | if (!(viewport.maxDepth >= 0.0) || !(viewport.maxDepth <= 1.0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 891 | skip |= LogError(object, "VUID-VkViewport-maxDepth-01235", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 892 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 893 | "%s: VK_EXT_depth_range_unrestricted extension is not enabled and %s.maxDepth (=%f) is not within the " |
| 894 | "[0.0, 1.0] range.", |
| 895 | fn_name, parameter_name.get_name().c_str(), viewport.maxDepth); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 896 | } |
| 897 | } |
| 898 | |
| 899 | return skip; |
| 900 | } |
| 901 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 902 | struct SampleOrderInfo { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 903 | VkShadingRatePaletteEntryNV shadingRate; |
| 904 | uint32_t width; |
| 905 | uint32_t height; |
| 906 | }; |
| 907 | |
| 908 | // All palette entries with more than one pixel per fragment |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 909 | static SampleOrderInfo sampleOrderInfos[] = { |
| 910 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV, 1, 2}, |
| 911 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV, 2, 1}, |
| 912 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV, 2, 2}, |
| 913 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV, 4, 2}, |
| 914 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV, 2, 4}, |
| 915 | {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] | 916 | }; |
| 917 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 918 | bool StatelessValidation::ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 919 | bool skip = false; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 920 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 921 | SampleOrderInfo *sampleOrderInfo; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 922 | uint32_t infoIdx = 0; |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 923 | for (sampleOrderInfo = nullptr; infoIdx < ARRAY_SIZE(sampleOrderInfos); ++infoIdx) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 924 | if (sampleOrderInfos[infoIdx].shadingRate == order->shadingRate) { |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 925 | sampleOrderInfo = &sampleOrderInfos[infoIdx]; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 926 | break; |
| 927 | } |
| 928 | } |
| 929 | |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 930 | if (sampleOrderInfo == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 931 | skip |= LogError(device, "VUID-VkCoarseSampleOrderCustomNV-shadingRate-02073", |
| 932 | "VkCoarseSampleOrderCustomNV shadingRate must be a shading rate " |
| 933 | "that generates fragments with more than one pixel."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 934 | return skip; |
| 935 | } |
| 936 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 937 | if (order->sampleCount == 0 || (order->sampleCount & (order->sampleCount - 1)) || |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 938 | !(order->sampleCount & device_limits.framebufferNoAttachmentsSampleCounts)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 939 | skip |= LogError(device, "VUID-VkCoarseSampleOrderCustomNV-sampleCount-02074", |
| 940 | "VkCoarseSampleOrderCustomNV sampleCount (=%" PRIu32 |
| 941 | ") must " |
| 942 | "correspond to a sample count enumerated in VkSampleCountFlags whose corresponding bit " |
| 943 | "is set in framebufferNoAttachmentsSampleCounts.", |
| 944 | order->sampleCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 945 | } |
| 946 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 947 | if (order->sampleLocationCount != order->sampleCount * sampleOrderInfo->width * sampleOrderInfo->height) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 948 | skip |= LogError(device, "VUID-VkCoarseSampleOrderCustomNV-sampleLocationCount-02075", |
| 949 | "VkCoarseSampleOrderCustomNV sampleLocationCount (=%" PRIu32 |
| 950 | ") must " |
| 951 | "be equal to the product of sampleCount (=%" PRIu32 |
| 952 | "), the fragment width for shadingRate " |
| 953 | "(=%" PRIu32 "), and the fragment height for shadingRate (=%" PRIu32 ").", |
| 954 | order->sampleLocationCount, order->sampleCount, sampleOrderInfo->width, sampleOrderInfo->height); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 955 | } |
| 956 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 957 | if (order->sampleLocationCount > phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 958 | skip |= LogError( |
| 959 | device, "VUID-VkCoarseSampleOrderCustomNV-sampleLocationCount-02076", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 960 | "VkCoarseSampleOrderCustomNV sampleLocationCount (=%" PRIu32 |
| 961 | ") must " |
| 962 | "be less than or equal to VkPhysicalDeviceShadingRateImagePropertiesNV shadingRateMaxCoarseSamples (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 963 | order->sampleLocationCount, phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 964 | } |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 965 | |
| 966 | // Accumulate a bitmask tracking which (x,y,sample) tuples are seen. Expect |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 967 | // the first width*height*sampleCount bits to all be set. Note: There is no |
| 968 | // guarantee that 64 bits is enough, but practically it's unlikely for an |
| 969 | // implementation to support more than 32 bits for samplemask. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 970 | assert(phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples <= 64); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 971 | uint64_t sampleLocationsMask = 0; |
| 972 | for (uint32_t i = 0; i < order->sampleLocationCount; ++i) { |
| 973 | const VkCoarseSampleLocationNV *sampleLoc = &order->pSampleLocations[i]; |
| 974 | if (sampleLoc->pixelX >= sampleOrderInfo->width) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 975 | skip |= LogError(device, "VUID-VkCoarseSampleLocationNV-pixelX-02078", |
| 976 | "pixelX must be less than the width (in pixels) of the fragment."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 977 | } |
| 978 | if (sampleLoc->pixelY >= sampleOrderInfo->height) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 979 | skip |= LogError(device, "VUID-VkCoarseSampleLocationNV-pixelY-02079", |
| 980 | "pixelY must be less than the height (in pixels) of the fragment."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 981 | } |
| 982 | if (sampleLoc->sample >= order->sampleCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 983 | skip |= LogError(device, "VUID-VkCoarseSampleLocationNV-sample-02080", |
| 984 | "sample must be less than the number of coverage samples in each pixel belonging to the fragment."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 985 | } |
| 986 | uint32_t idx = sampleLoc->sample + order->sampleCount * (sampleLoc->pixelX + sampleOrderInfo->width * sampleLoc->pixelY); |
| 987 | sampleLocationsMask |= 1ULL << idx; |
| 988 | } |
| 989 | |
| 990 | uint64_t expectedMask = (order->sampleLocationCount == 64) ? ~0ULL : ((1ULL << order->sampleLocationCount) - 1); |
| 991 | if (sampleLocationsMask != expectedMask) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 992 | skip |= LogError( |
| 993 | device, "VUID-VkCoarseSampleOrderCustomNV-pSampleLocations-02077", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 994 | "The array pSampleLocations must contain exactly one entry for " |
| 995 | "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] | 996 | } |
| 997 | |
| 998 | return skip; |
| 999 | } |
| 1000 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1001 | bool StatelessValidation::manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, |
| 1002 | uint32_t createInfoCount, |
| 1003 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 1004 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1005 | VkPipeline *pPipelines) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1006 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1007 | |
| 1008 | if (pCreateInfos != nullptr) { |
| 1009 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1010 | bool has_dynamic_viewport = false; |
| 1011 | bool has_dynamic_scissor = false; |
| 1012 | bool has_dynamic_line_width = false; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1013 | bool has_dynamic_depth_bias = false; |
| 1014 | bool has_dynamic_blend_constant = false; |
| 1015 | bool has_dynamic_depth_bounds = false; |
| 1016 | bool has_dynamic_stencil_compare = false; |
| 1017 | bool has_dynamic_stencil_write = false; |
| 1018 | bool has_dynamic_stencil_reference = false; |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1019 | bool has_dynamic_viewport_w_scaling_nv = false; |
| 1020 | bool has_dynamic_discard_rectangle_ext = false; |
| 1021 | bool has_dynamic_sample_locations_ext = false; |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1022 | bool has_dynamic_exclusive_scissor_nv = false; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1023 | bool has_dynamic_shading_rate_palette_nv = false; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1024 | bool has_dynamic_viewport_course_sample_order_nv = false; |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1025 | bool has_dynamic_line_stipple = false; |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1026 | if (pCreateInfos[i].pDynamicState != nullptr) { |
| 1027 | const auto &dynamic_state_info = *pCreateInfos[i].pDynamicState; |
| 1028 | for (uint32_t state_index = 0; state_index < dynamic_state_info.dynamicStateCount; ++state_index) { |
| 1029 | const auto &dynamic_state = dynamic_state_info.pDynamicStates[state_index]; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1030 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT) { |
| 1031 | if (has_dynamic_viewport == true) { |
| 1032 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1033 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT was listed twice in the " |
| 1034 | "pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1035 | i); |
| 1036 | } |
| 1037 | has_dynamic_viewport = true; |
| 1038 | } |
| 1039 | if (dynamic_state == VK_DYNAMIC_STATE_SCISSOR) { |
| 1040 | if (has_dynamic_scissor == true) { |
| 1041 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1042 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_SCISSOR was listed twice in the " |
| 1043 | "pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1044 | i); |
| 1045 | } |
| 1046 | has_dynamic_scissor = true; |
| 1047 | } |
| 1048 | if (dynamic_state == VK_DYNAMIC_STATE_LINE_WIDTH) { |
| 1049 | if (has_dynamic_line_width == true) { |
| 1050 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1051 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_LINE_WIDTH was listed twice in the " |
| 1052 | "pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1053 | i); |
| 1054 | } |
| 1055 | has_dynamic_line_width = true; |
| 1056 | } |
| 1057 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_BIAS) { |
| 1058 | if (has_dynamic_depth_bias == true) { |
| 1059 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1060 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_BIAS was listed twice in the " |
| 1061 | "pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1062 | i); |
| 1063 | } |
| 1064 | has_dynamic_depth_bias = true; |
| 1065 | } |
| 1066 | if (dynamic_state == VK_DYNAMIC_STATE_BLEND_CONSTANTS) { |
| 1067 | if (has_dynamic_blend_constant == true) { |
| 1068 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1069 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_BLEND_CONSTANTS was listed twice in the " |
| 1070 | "pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1071 | i); |
| 1072 | } |
| 1073 | has_dynamic_blend_constant = true; |
| 1074 | } |
| 1075 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_BOUNDS) { |
| 1076 | if (has_dynamic_depth_bounds == true) { |
| 1077 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1078 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_BOUNDS was listed twice in the " |
| 1079 | "pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1080 | i); |
| 1081 | } |
| 1082 | has_dynamic_depth_bounds = true; |
| 1083 | } |
| 1084 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK) { |
| 1085 | if (has_dynamic_stencil_compare == true) { |
| 1086 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1087 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK was listed twice in " |
| 1088 | "the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1089 | i); |
| 1090 | } |
| 1091 | has_dynamic_stencil_compare = true; |
| 1092 | } |
| 1093 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_WRITE_MASK) { |
| 1094 | if (has_dynamic_stencil_write == true) { |
| 1095 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1096 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_WRITE_MASK was listed twice in " |
| 1097 | "the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1098 | i); |
| 1099 | } |
| 1100 | has_dynamic_stencil_write = true; |
| 1101 | } |
| 1102 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_REFERENCE) { |
| 1103 | if (has_dynamic_stencil_reference == true) { |
| 1104 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1105 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_REFERENCE was listed twice in " |
| 1106 | "the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1107 | i); |
| 1108 | } |
| 1109 | has_dynamic_stencil_reference = true; |
| 1110 | } |
| 1111 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV) { |
| 1112 | if (has_dynamic_viewport_w_scaling_nv == true) { |
| 1113 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1114 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV was listed twice " |
| 1115 | "in the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1116 | i); |
| 1117 | } |
| 1118 | has_dynamic_viewport_w_scaling_nv = true; |
| 1119 | } |
| 1120 | if (dynamic_state == VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT) { |
| 1121 | if (has_dynamic_discard_rectangle_ext == true) { |
| 1122 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1123 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT was listed twice " |
| 1124 | "in the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1125 | i); |
| 1126 | } |
| 1127 | has_dynamic_discard_rectangle_ext = true; |
| 1128 | } |
| 1129 | if (dynamic_state == VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT) { |
| 1130 | if (has_dynamic_sample_locations_ext == true) { |
| 1131 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1132 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT was listed twice in " |
| 1133 | "the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1134 | i); |
| 1135 | } |
| 1136 | has_dynamic_sample_locations_ext = true; |
| 1137 | } |
| 1138 | if (dynamic_state == VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV) { |
| 1139 | if (has_dynamic_exclusive_scissor_nv == true) { |
| 1140 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1141 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV was listed twice in " |
| 1142 | "the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1143 | i); |
| 1144 | } |
| 1145 | has_dynamic_exclusive_scissor_nv = true; |
| 1146 | } |
| 1147 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV) { |
| 1148 | if (has_dynamic_shading_rate_palette_nv == true) { |
| 1149 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1150 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV was " |
| 1151 | "listed twice in the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1152 | i); |
| 1153 | } |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1154 | has_dynamic_shading_rate_palette_nv = true; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1155 | } |
| 1156 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV) { |
| 1157 | if (has_dynamic_viewport_course_sample_order_nv == true) { |
| 1158 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1159 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV was " |
| 1160 | "listed twice in the pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1161 | i); |
| 1162 | } |
| 1163 | has_dynamic_viewport_course_sample_order_nv = true; |
| 1164 | } |
| 1165 | if (dynamic_state == VK_DYNAMIC_STATE_LINE_STIPPLE_EXT) { |
| 1166 | if (has_dynamic_line_stipple == true) { |
| 1167 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1168 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_LINE_STIPPLE_EXT was listed twice in the " |
| 1169 | "pCreateInfos[%d].pDynamicState->pDynamicStates array", |
| 1170 | i); |
| 1171 | } |
| 1172 | has_dynamic_line_stipple = true; |
| 1173 | } |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1174 | } |
| 1175 | } |
| 1176 | |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 1177 | auto feedback_struct = lvl_find_in_chain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
| 1178 | if ((feedback_struct != nullptr) && |
| 1179 | (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1180 | skip |= LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02668", |
| 1181 | "vkCreateGraphicsPipelines(): in pCreateInfo[%" PRIu32 |
| 1182 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
| 1183 | "(=%" PRIu32 ") must equal VkGraphicsPipelineCreateInfo::stageCount(=%" PRIu32 ").", |
| 1184 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 1185 | } |
| 1186 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1187 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1188 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 1189 | // Collect active stages and other information |
| 1190 | // Only want to loop through pStages once |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1191 | uint32_t active_shaders = 0; |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 1192 | bool has_eval = false; |
| 1193 | bool has_control = false; |
| 1194 | if (pCreateInfos[i].pStages != nullptr) { |
| 1195 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 1196 | active_shaders |= pCreateInfos[i].pStages[stage_index].stage; |
| 1197 | |
| 1198 | if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
| 1199 | has_control = true; |
| 1200 | } else if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
| 1201 | has_eval = true; |
| 1202 | } |
| 1203 | |
| 1204 | skip |= validate_string( |
| 1205 | "vkCreateGraphicsPipelines", |
| 1206 | ParameterName("pCreateInfos[%i].pStages[%i].pName", ParameterName::IndexVector{i, stage_index}), |
| 1207 | "VUID-VkGraphicsPipelineCreateInfo-pStages-parameter", pCreateInfos[i].pStages[stage_index].pName); |
| 1208 | } |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1209 | } |
| 1210 | |
| 1211 | if ((active_shaders & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) && |
| 1212 | (active_shaders & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) && (pCreateInfos[i].pTessellationState != nullptr)) { |
| 1213 | skip |= validate_struct_type("vkCreateGraphicsPipelines", "pCreateInfos[i].pTessellationState", |
| 1214 | "VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO", |
| 1215 | pCreateInfos[i].pTessellationState, |
| 1216 | VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO, false, kVUIDUndefined, |
| 1217 | "VUID-VkPipelineTessellationStateCreateInfo-sType-sType"); |
| 1218 | |
| 1219 | const VkStructureType allowed_structs_VkPipelineTessellationStateCreateInfo[] = { |
| 1220 | VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO}; |
| 1221 | |
| 1222 | skip |= validate_struct_pnext("vkCreateGraphicsPipelines", "pCreateInfos[i].pTessellationState->pNext", |
| 1223 | "VkPipelineTessellationDomainOriginStateCreateInfo", |
| 1224 | pCreateInfos[i].pTessellationState->pNext, |
| 1225 | ARRAY_SIZE(allowed_structs_VkPipelineTessellationStateCreateInfo), |
| 1226 | allowed_structs_VkPipelineTessellationStateCreateInfo, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 1227 | "VUID-VkPipelineTessellationStateCreateInfo-pNext-pNext", |
| 1228 | "VUID-VkPipelineTessellationStateCreateInfo-sType-unique"); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1229 | |
| 1230 | skip |= validate_reserved_flags("vkCreateGraphicsPipelines", "pCreateInfos[i].pTessellationState->flags", |
| 1231 | pCreateInfos[i].pTessellationState->flags, |
| 1232 | "VUID-VkPipelineTessellationStateCreateInfo-flags-zerobitmask"); |
| 1233 | } |
| 1234 | |
| 1235 | if (!(active_shaders & VK_SHADER_STAGE_MESH_BIT_NV) && (pCreateInfos[i].pInputAssemblyState != nullptr)) { |
| 1236 | skip |= validate_struct_type("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState", |
| 1237 | "VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO", |
| 1238 | pCreateInfos[i].pInputAssemblyState, |
| 1239 | VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, false, kVUIDUndefined, |
| 1240 | "VUID-VkPipelineInputAssemblyStateCreateInfo-sType-sType"); |
| 1241 | |
| 1242 | skip |= validate_struct_pnext("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->pNext", NULL, |
| 1243 | pCreateInfos[i].pInputAssemblyState->pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 1244 | "VUID-VkPipelineInputAssemblyStateCreateInfo-pNext-pNext", nullptr); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1245 | |
| 1246 | skip |= validate_reserved_flags("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->flags", |
| 1247 | pCreateInfos[i].pInputAssemblyState->flags, |
| 1248 | "VUID-VkPipelineInputAssemblyStateCreateInfo-flags-zerobitmask"); |
| 1249 | |
| 1250 | skip |= validate_ranged_enum("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->topology", |
| 1251 | "VkPrimitiveTopology", AllVkPrimitiveTopologyEnums, |
| 1252 | pCreateInfos[i].pInputAssemblyState->topology, |
| 1253 | "VUID-VkPipelineInputAssemblyStateCreateInfo-topology-parameter"); |
| 1254 | |
| 1255 | skip |= validate_bool32("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->primitiveRestartEnable", |
| 1256 | pCreateInfos[i].pInputAssemblyState->primitiveRestartEnable); |
| 1257 | } |
| 1258 | |
| 1259 | if (!(active_shaders & VK_SHADER_STAGE_MESH_BIT_NV) && (pCreateInfos[i].pVertexInputState != nullptr)) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1260 | auto const &vertex_input_state = pCreateInfos[i].pVertexInputState; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1261 | |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1262 | if (pCreateInfos[i].pVertexInputState->flags != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1263 | skip |= LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-flags-zerobitmask", |
| 1264 | "vkCreateGraphicsPipelines: pararameter " |
| 1265 | "pCreateInfos[%d].pVertexInputState->flags (%u) is reserved and must be zero.", |
| 1266 | i, vertex_input_state->flags); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1267 | } |
| 1268 | |
| 1269 | const VkStructureType allowed_structs_VkPipelineVertexInputStateCreateInfo[] = { |
| 1270 | VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT}; |
| 1271 | skip |= validate_struct_pnext("vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState->pNext", |
| 1272 | "VkPipelineVertexInputDivisorStateCreateInfoEXT", |
| 1273 | pCreateInfos[i].pVertexInputState->pNext, 1, |
| 1274 | allowed_structs_VkPipelineVertexInputStateCreateInfo, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 1275 | "VUID-VkPipelineVertexInputStateCreateInfo-pNext-pNext", |
| 1276 | "VUID-VkPipelineVertexInputStateCreateInfo-sType-unique"); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1277 | skip |= validate_struct_type("vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState", |
| 1278 | "VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO", vertex_input_state, |
Shannon McPherson | 3cc90bc | 2019-08-13 11:28:22 -0600 | [diff] [blame] | 1279 | VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, false, kVUIDUndefined, |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1280 | "VUID-VkPipelineVertexInputStateCreateInfo-sType-sType"); |
| 1281 | skip |= |
| 1282 | validate_array("vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState->vertexBindingDescriptionCount", |
| 1283 | "pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions", |
| 1284 | pCreateInfos[i].pVertexInputState->vertexBindingDescriptionCount, |
| 1285 | &pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions, false, true, kVUIDUndefined, |
| 1286 | "VUID-VkPipelineVertexInputStateCreateInfo-pVertexBindingDescriptions-parameter"); |
| 1287 | |
| 1288 | skip |= validate_array( |
| 1289 | "vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState->vertexAttributeDescriptionCount", |
| 1290 | "pCreateInfos[i]->pVertexAttributeDescriptions", vertex_input_state->vertexAttributeDescriptionCount, |
| 1291 | &vertex_input_state->pVertexAttributeDescriptions, false, true, kVUIDUndefined, |
| 1292 | "VUID-VkPipelineVertexInputStateCreateInfo-pVertexAttributeDescriptions-parameter"); |
| 1293 | |
| 1294 | if (pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions != NULL) { |
| 1295 | for (uint32_t vertexBindingDescriptionIndex = 0; |
| 1296 | vertexBindingDescriptionIndex < pCreateInfos[i].pVertexInputState->vertexBindingDescriptionCount; |
| 1297 | ++vertexBindingDescriptionIndex) { |
| 1298 | skip |= validate_ranged_enum( |
| 1299 | "vkCreateGraphicsPipelines", |
| 1300 | "pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions[j].inputRate", "VkVertexInputRate", |
| 1301 | AllVkVertexInputRateEnums, |
| 1302 | pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions[vertexBindingDescriptionIndex].inputRate, |
| 1303 | "VUID-VkVertexInputBindingDescription-inputRate-parameter"); |
| 1304 | } |
| 1305 | } |
| 1306 | |
| 1307 | if (pCreateInfos[i].pVertexInputState->pVertexAttributeDescriptions != NULL) { |
| 1308 | for (uint32_t vertexAttributeDescriptionIndex = 0; |
| 1309 | vertexAttributeDescriptionIndex < pCreateInfos[i].pVertexInputState->vertexAttributeDescriptionCount; |
| 1310 | ++vertexAttributeDescriptionIndex) { |
| 1311 | skip |= validate_ranged_enum( |
| 1312 | "vkCreateGraphicsPipelines", |
| 1313 | "pCreateInfos[i].pVertexInputState->pVertexAttributeDescriptions[i].format", "VkFormat", |
| 1314 | AllVkFormatEnums, |
| 1315 | pCreateInfos[i].pVertexInputState->pVertexAttributeDescriptions[vertexAttributeDescriptionIndex].format, |
| 1316 | "VUID-VkVertexInputAttributeDescription-format-parameter"); |
| 1317 | } |
| 1318 | } |
| 1319 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1320 | if (vertex_input_state->vertexBindingDescriptionCount > device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1321 | skip |= LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-vertexBindingDescriptionCount-00613", |
| 1322 | "vkCreateGraphicsPipelines: pararameter " |
| 1323 | "pCreateInfo[%d].pVertexInputState->vertexBindingDescriptionCount (%u) is " |
| 1324 | "greater than VkPhysicalDeviceLimits::maxVertexInputBindings (%u).", |
| 1325 | i, vertex_input_state->vertexBindingDescriptionCount, device_limits.maxVertexInputBindings); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1326 | } |
| 1327 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1328 | if (vertex_input_state->vertexAttributeDescriptionCount > device_limits.maxVertexInputAttributes) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1329 | skip |= |
| 1330 | LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-vertexAttributeDescriptionCount-00614", |
| 1331 | "vkCreateGraphicsPipelines: pararameter " |
| 1332 | "pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptionCount (%u) is " |
| 1333 | "greater than VkPhysicalDeviceLimits::maxVertexInputAttributes (%u).", |
| 1334 | i, vertex_input_state->vertexAttributeDescriptionCount, device_limits.maxVertexInputAttributes); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1335 | } |
| 1336 | |
| 1337 | std::unordered_set<uint32_t> vertex_bindings(vertex_input_state->vertexBindingDescriptionCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1338 | for (uint32_t d = 0; d < vertex_input_state->vertexBindingDescriptionCount; ++d) { |
| 1339 | auto const &vertex_bind_desc = vertex_input_state->pVertexBindingDescriptions[d]; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1340 | auto const &binding_it = vertex_bindings.find(vertex_bind_desc.binding); |
| 1341 | if (binding_it != vertex_bindings.cend()) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1342 | skip |= LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-pVertexBindingDescriptions-00616", |
| 1343 | "vkCreateGraphicsPipelines: parameter " |
| 1344 | "pCreateInfo[%d].pVertexInputState->pVertexBindingDescription[%d].binding " |
| 1345 | "(%" PRIu32 ") is not distinct.", |
| 1346 | i, d, vertex_bind_desc.binding); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1347 | } |
| 1348 | vertex_bindings.insert(vertex_bind_desc.binding); |
| 1349 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1350 | if (vertex_bind_desc.binding >= device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1351 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription-binding-00618", |
| 1352 | "vkCreateGraphicsPipelines: parameter " |
| 1353 | "pCreateInfos[%u].pVertexInputState->pVertexBindingDescriptions[%u].binding (%u) is " |
| 1354 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings (%u).", |
| 1355 | i, d, vertex_bind_desc.binding, device_limits.maxVertexInputBindings); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1356 | } |
| 1357 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1358 | if (vertex_bind_desc.stride > device_limits.maxVertexInputBindingStride) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1359 | skip |= |
| 1360 | LogError(device, "VUID-VkVertexInputBindingDescription-stride-00619", |
| 1361 | "vkCreateGraphicsPipelines: parameter " |
| 1362 | "pCreateInfos[%u].pVertexInputState->pVertexBindingDescriptions[%u].stride (%u) is greater " |
| 1363 | "than VkPhysicalDeviceLimits::maxVertexInputBindingStride (%u).", |
| 1364 | i, d, vertex_bind_desc.stride, device_limits.maxVertexInputBindingStride); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1365 | } |
| 1366 | } |
| 1367 | |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1368 | std::unordered_set<uint32_t> attribute_locations(vertex_input_state->vertexAttributeDescriptionCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1369 | for (uint32_t d = 0; d < vertex_input_state->vertexAttributeDescriptionCount; ++d) { |
| 1370 | auto const &vertex_attrib_desc = vertex_input_state->pVertexAttributeDescriptions[d]; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1371 | auto const &location_it = attribute_locations.find(vertex_attrib_desc.location); |
| 1372 | if (location_it != attribute_locations.cend()) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1373 | skip |= LogError( |
| 1374 | device, "VUID-VkPipelineVertexInputStateCreateInfo-pVertexAttributeDescriptions-00617", |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1375 | "vkCreateGraphicsPipelines: parameter " |
| 1376 | "pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptions[%d].location (%u) is not distinct.", |
| 1377 | i, d, vertex_attrib_desc.location); |
| 1378 | } |
| 1379 | attribute_locations.insert(vertex_attrib_desc.location); |
| 1380 | |
| 1381 | auto const &binding_it = vertex_bindings.find(vertex_attrib_desc.binding); |
| 1382 | if (binding_it == vertex_bindings.cend()) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1383 | skip |= LogError( |
| 1384 | device, "VUID-VkPipelineVertexInputStateCreateInfo-binding-00615", |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 1385 | "vkCreateGraphicsPipelines: parameter " |
| 1386 | " pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptions[%d].binding (%u) does not exist " |
| 1387 | "in any pCreateInfo[%d].pVertexInputState->pVertexBindingDescription.", |
| 1388 | i, d, vertex_attrib_desc.binding, i); |
| 1389 | } |
| 1390 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1391 | if (vertex_attrib_desc.location >= device_limits.maxVertexInputAttributes) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1392 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription-location-00620", |
| 1393 | "vkCreateGraphicsPipelines: parameter " |
| 1394 | "pCreateInfos[%u].pVertexInputState->pVertexAttributeDescriptions[%u].location (%u) is " |
| 1395 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputAttributes (%u).", |
| 1396 | i, d, vertex_attrib_desc.location, device_limits.maxVertexInputAttributes); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1397 | } |
| 1398 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1399 | if (vertex_attrib_desc.binding >= device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1400 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription-binding-00621", |
| 1401 | "vkCreateGraphicsPipelines: parameter " |
| 1402 | "pCreateInfos[%u].pVertexInputState->pVertexAttributeDescriptions[%u].binding (%u) is " |
| 1403 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings (%u).", |
| 1404 | i, d, vertex_attrib_desc.binding, device_limits.maxVertexInputBindings); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1405 | } |
| 1406 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1407 | if (vertex_attrib_desc.offset > device_limits.maxVertexInputAttributeOffset) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1408 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription-offset-00622", |
| 1409 | "vkCreateGraphicsPipelines: parameter " |
| 1410 | "pCreateInfos[%u].pVertexInputState->pVertexAttributeDescriptions[%u].offset (%u) is " |
| 1411 | "greater than VkPhysicalDeviceLimits::maxVertexInputAttributeOffset (%u).", |
| 1412 | i, d, vertex_attrib_desc.offset, device_limits.maxVertexInputAttributeOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1413 | } |
| 1414 | } |
| 1415 | } |
| 1416 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 1417 | // pTessellationState is ignored without both tessellation control and tessellation evaluation shaders stages |
| 1418 | if (has_control && has_eval) { |
| 1419 | if (pCreateInfos[i].pTessellationState == nullptr) { |
| 1420 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pStages-00731", |
| 1421 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pStages includes a tessellation control " |
| 1422 | "shader stage and a tessellation evaluation shader stage, " |
| 1423 | "pCreateInfos[%d].pTessellationState must not be NULL.", |
| 1424 | i, i); |
| 1425 | } else { |
| 1426 | const VkStructureType allowed_type = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO; |
| 1427 | skip |= validate_struct_pnext( |
| 1428 | "vkCreateGraphicsPipelines", |
| 1429 | ParameterName("pCreateInfos[%i].pTessellationState->pNext", ParameterName::IndexVector{i}), |
| 1430 | "VkPipelineTessellationDomainOriginStateCreateInfo", pCreateInfos[i].pTessellationState->pNext, 1, |
| 1431 | &allowed_type, GeneratedVulkanHeaderVersion, "VUID-VkGraphicsPipelineCreateInfo-pNext-pNext", |
| 1432 | "VUID-VkGraphicsPipelineCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1433 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 1434 | skip |= validate_reserved_flags( |
| 1435 | "vkCreateGraphicsPipelines", |
| 1436 | ParameterName("pCreateInfos[%i].pTessellationState->flags", ParameterName::IndexVector{i}), |
| 1437 | pCreateInfos[i].pTessellationState->flags, "VUID-VkPipelineTessellationStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1438 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 1439 | if (pCreateInfos[i].pTessellationState->patchControlPoints == 0 || |
| 1440 | pCreateInfos[i].pTessellationState->patchControlPoints > device_limits.maxTessellationPatchSize) { |
| 1441 | skip |= LogError(device, "VUID-VkPipelineTessellationStateCreateInfo-patchControlPoints-01214", |
| 1442 | "vkCreateGraphicsPipelines: invalid parameter " |
| 1443 | "pCreateInfos[%d].pTessellationState->patchControlPoints value %u. patchControlPoints " |
| 1444 | "should be >0 and <=%u.", |
| 1445 | i, pCreateInfos[i].pTessellationState->patchControlPoints, |
| 1446 | device_limits.maxTessellationPatchSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1447 | } |
| 1448 | } |
| 1449 | } |
| 1450 | |
| 1451 | // pViewportState, pMultisampleState, pDepthStencilState, and pColorBlendState ignored when rasterization is disabled |
| 1452 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 1453 | (pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) { |
| 1454 | if (pCreateInfos[i].pViewportState == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1455 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00750", |
| 1456 | "vkCreateGraphicsPipelines: Rasterization is enabled (pCreateInfos[%" PRIu32 |
| 1457 | "].pRasterizationState->rasterizerDiscardEnable is VK_FALSE), but pCreateInfos[%" PRIu32 |
| 1458 | "].pViewportState (=NULL) is not a valid pointer.", |
| 1459 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1460 | } else { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1461 | const auto &viewport_state = *pCreateInfos[i].pViewportState; |
| 1462 | |
| 1463 | if (viewport_state.sType != VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1464 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-sType-sType", |
| 1465 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1466 | "].pViewportState->sType is not VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO.", |
| 1467 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1468 | } |
| 1469 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1470 | const VkStructureType allowed_structs_VkPipelineViewportStateCreateInfo[] = { |
| 1471 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV, |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1472 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV, |
| 1473 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV, |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1474 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV, |
| 1475 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV, |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1476 | }; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1477 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1478 | "vkCreateGraphicsPipelines", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1479 | ParameterName("pCreateInfos[%i].pViewportState->pNext", ParameterName::IndexVector{i}), |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1480 | "VkPipelineViewportSwizzleStateCreateInfoNV, VkPipelineViewportWScalingStateCreateInfoNV, " |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 1481 | "VkPipelineViewportExclusiveScissorStateCreateInfoNV, VkPipelineViewportShadingRateImageStateCreateInfoNV, " |
| 1482 | "VkPipelineViewportCoarseSampleOrderStateCreateInfoNV", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1483 | viewport_state.pNext, ARRAY_SIZE(allowed_structs_VkPipelineViewportStateCreateInfo), |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 1484 | allowed_structs_VkPipelineViewportStateCreateInfo, 65, "VUID-VkPipelineViewportStateCreateInfo-pNext-pNext", |
| 1485 | "VUID-VkPipelineViewportStateCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1486 | |
| 1487 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1488 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1489 | ParameterName("pCreateInfos[%i].pViewportState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1490 | viewport_state.flags, "VUID-VkPipelineViewportStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1491 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1492 | auto exclusive_scissor_struct = lvl_find_in_chain<VkPipelineViewportExclusiveScissorStateCreateInfoNV>( |
| 1493 | pCreateInfos[i].pViewportState->pNext); |
| 1494 | auto shading_rate_image_struct = lvl_find_in_chain<VkPipelineViewportShadingRateImageStateCreateInfoNV>( |
| 1495 | pCreateInfos[i].pViewportState->pNext); |
| 1496 | auto coarse_sample_order_struct = lvl_find_in_chain<VkPipelineViewportCoarseSampleOrderStateCreateInfoNV>( |
| 1497 | pCreateInfos[i].pViewportState->pNext); |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 1498 | const auto vp_swizzle_struct = |
| 1499 | lvl_find_in_chain<VkPipelineViewportSwizzleStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 1500 | const auto vp_w_scaling_struct = |
| 1501 | lvl_find_in_chain<VkPipelineViewportWScalingStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1502 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1503 | if (!physical_device_features.multiViewport) { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1504 | if (viewport_state.viewportCount != 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1505 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-01216", |
| 1506 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 1507 | "disabled, but pCreateInfos[%" PRIu32 "].pViewportState->viewportCount (=%" PRIu32 |
| 1508 | ") is not 1.", |
| 1509 | i, viewport_state.viewportCount); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1510 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1511 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1512 | if (viewport_state.scissorCount != 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1513 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01217", |
| 1514 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 1515 | "disabled, but pCreateInfos[%" PRIu32 "].pViewportState->scissorCount (=%" PRIu32 |
| 1516 | ") is not 1.", |
| 1517 | i, viewport_state.scissorCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1518 | } |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1519 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1520 | if (exclusive_scissor_struct && (exclusive_scissor_struct->exclusiveScissorCount != 0 && |
| 1521 | exclusive_scissor_struct->exclusiveScissorCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1522 | skip |= LogError( |
| 1523 | device, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02027", |
| 1524 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 1525 | "disabled, but pCreateInfos[%" PRIu32 |
| 1526 | "] VkPipelineViewportExclusiveScissorStateCreateInfoNV::exclusiveScissorCount (=%" PRIu32 |
| 1527 | ") is not 1.", |
| 1528 | i, exclusive_scissor_struct->exclusiveScissorCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1529 | } |
| 1530 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1531 | if (shading_rate_image_struct && |
| 1532 | (shading_rate_image_struct->viewportCount != 0 && shading_rate_image_struct->viewportCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1533 | skip |= LogError(device, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-viewportCount-02054", |
| 1534 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 1535 | "disabled, but pCreateInfos[%" PRIu32 |
| 1536 | "] VkPipelineViewportShadingRateImageStateCreateInfoNV::viewportCount (=%" PRIu32 |
| 1537 | ") is neither 0 nor 1.", |
| 1538 | i, shading_rate_image_struct->viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1539 | } |
| 1540 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1541 | } else { // multiViewport enabled |
| 1542 | if (viewport_state.viewportCount == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1543 | skip |= LogError( |
| 1544 | device, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-arraylength", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1545 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "].pViewportState->viewportCount is 0.", i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1546 | } else if (viewport_state.viewportCount > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1547 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-01218", |
| 1548 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1549 | "].pViewportState->viewportCount (=%" PRIu32 |
| 1550 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 1551 | i, viewport_state.viewportCount, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1552 | } |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1553 | |
| 1554 | if (viewport_state.scissorCount == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1555 | skip |= LogError( |
| 1556 | device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-arraylength", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1557 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "].pViewportState->scissorCount is 0.", i); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1558 | } else if (viewport_state.scissorCount > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1559 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01219", |
| 1560 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1561 | "].pViewportState->scissorCount (=%" PRIu32 |
| 1562 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 1563 | i, viewport_state.scissorCount, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1564 | } |
| 1565 | } |
| 1566 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1567 | if (exclusive_scissor_struct && exclusive_scissor_struct->exclusiveScissorCount > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1568 | skip |= |
| 1569 | LogError(device, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02028", |
| 1570 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "] exclusiveScissorCount (=%" PRIu32 |
| 1571 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 1572 | i, exclusive_scissor_struct->exclusiveScissorCount, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1573 | } |
| 1574 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1575 | if (shading_rate_image_struct && shading_rate_image_struct->viewportCount > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1576 | skip |= LogError(device, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-viewportCount-02055", |
| 1577 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1578 | "] VkPipelineViewportShadingRateImageStateCreateInfoNV viewportCount (=%" PRIu32 |
| 1579 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 1580 | i, shading_rate_image_struct->viewportCount, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1581 | } |
| 1582 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1583 | if (viewport_state.scissorCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1584 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01220", |
| 1585 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1586 | "].pViewportState->scissorCount (=%" PRIu32 ") is not identical to pCreateInfos[%" PRIu32 |
| 1587 | "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 1588 | i, viewport_state.scissorCount, i, viewport_state.viewportCount); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1589 | } |
| 1590 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1591 | if (exclusive_scissor_struct && exclusive_scissor_struct->exclusiveScissorCount != 0 && |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1592 | exclusive_scissor_struct->exclusiveScissorCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1593 | skip |= |
| 1594 | LogError(device, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02029", |
| 1595 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "] exclusiveScissorCount (=%" PRIu32 |
| 1596 | ") must be zero or identical to pCreateInfos[%" PRIu32 |
| 1597 | "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 1598 | i, exclusive_scissor_struct->exclusiveScissorCount, i, viewport_state.viewportCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1599 | } |
| 1600 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1601 | if (shading_rate_image_struct && shading_rate_image_struct->shadingRateImageEnable && |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1602 | shading_rate_image_struct->viewportCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1603 | skip |= LogError( |
| 1604 | device, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-shadingRateImageEnable-02056", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1605 | "vkCreateGraphicsPipelines: If shadingRateImageEnable is enabled, pCreateInfos[%" PRIu32 |
| 1606 | "] " |
| 1607 | "VkPipelineViewportShadingRateImageStateCreateInfoNV viewportCount (=%" PRIu32 |
| 1608 | ") must identical to pCreateInfos[%" PRIu32 "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 1609 | i, shading_rate_image_struct->viewportCount, i, viewport_state.viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1610 | } |
| 1611 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1612 | if (!has_dynamic_viewport && viewport_state.viewportCount > 0 && viewport_state.pViewports == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1613 | skip |= LogError( |
| 1614 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00747", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1615 | "vkCreateGraphicsPipelines: The viewport state is static (pCreateInfos[%" PRIu32 |
| 1616 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_VIEWPORT), but pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1617 | "].pViewportState->pViewports (=NULL) is an invalid pointer.", |
| 1618 | i, i); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1619 | } |
| 1620 | |
| 1621 | if (!has_dynamic_scissor && viewport_state.scissorCount > 0 && viewport_state.pScissors == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1622 | skip |= LogError( |
| 1623 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00748", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1624 | "vkCreateGraphicsPipelines: The scissor state is static (pCreateInfos[%" PRIu32 |
| 1625 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_SCISSOR), but pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 1626 | "].pViewportState->pScissors (=NULL) is an invalid pointer.", |
| 1627 | i, i); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 1628 | } |
| 1629 | |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1630 | if (!has_dynamic_exclusive_scissor_nv && exclusive_scissor_struct && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1631 | exclusive_scissor_struct->exclusiveScissorCount > 0 && |
| 1632 | exclusive_scissor_struct->pExclusiveScissors == nullptr) { |
| 1633 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1634 | LogError(device, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-pDynamicStates-02030", |
| 1635 | "vkCreateGraphicsPipelines: The exclusive scissor state is static (pCreateInfos[%" PRIu32 |
| 1636 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV), but " |
| 1637 | "pCreateInfos[%" PRIu32 "] pExclusiveScissors (=NULL) is an invalid pointer.", |
| 1638 | i, i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1639 | } |
| 1640 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1641 | if (!has_dynamic_shading_rate_palette_nv && shading_rate_image_struct && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1642 | shading_rate_image_struct->viewportCount > 0 && |
| 1643 | shading_rate_image_struct->pShadingRatePalettes == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1644 | skip |= LogError( |
| 1645 | device, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-pDynamicStates-02057", |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1646 | "vkCreateGraphicsPipelines: The shading rate palette state is static (pCreateInfos[%" PRIu32 |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1647 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV), " |
| 1648 | "but pCreateInfos[%" PRIu32 "] pShadingRatePalettes (=NULL) is an invalid pointer.", |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1649 | i, i); |
| 1650 | } |
| 1651 | |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 1652 | if (vp_swizzle_struct) { |
| 1653 | if (vp_swizzle_struct->viewportCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1654 | skip |= LogError(device, "VUID-VkPipelineViewportSwizzleStateCreateInfoNV-viewportCount-01215", |
| 1655 | "vkCreateGraphicsPipelines: The viewport swizzle state vieport count of %" PRIu32 |
| 1656 | " does " |
| 1657 | "not match the viewport count of %" PRIu32 " in VkPipelineViewportStateCreateInfo.", |
| 1658 | vp_swizzle_struct->viewportCount, viewport_state.viewportCount); |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 1659 | } |
| 1660 | } |
| 1661 | |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1662 | // validate the VkViewports |
| 1663 | if (!has_dynamic_viewport && viewport_state.pViewports) { |
| 1664 | for (uint32_t viewport_i = 0; viewport_i < viewport_state.viewportCount; ++viewport_i) { |
| 1665 | 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] | 1666 | const char *fn_name = "vkCreateGraphicsPipelines"; |
| 1667 | skip |= manual_PreCallValidateViewport(viewport, fn_name, |
| 1668 | ParameterName("pCreateInfos[%i].pViewportState->pViewports[%i]", |
| 1669 | ParameterName::IndexVector{i, viewport_i}), |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1670 | VkCommandBuffer(0)); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1671 | } |
| 1672 | } |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1673 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1674 | if (has_dynamic_viewport_w_scaling_nv && !device_extensions.vk_nv_clip_space_w_scaling) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1675 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 1676 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1677 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV, but " |
| 1678 | "VK_NV_clip_space_w_scaling extension is not enabled.", |
| 1679 | i); |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1680 | } |
| 1681 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1682 | if (has_dynamic_discard_rectangle_ext && !device_extensions.vk_ext_discard_rectangles) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1683 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 1684 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1685 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT, but " |
| 1686 | "VK_EXT_discard_rectangles extension is not enabled.", |
| 1687 | i); |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1688 | } |
| 1689 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1690 | if (has_dynamic_sample_locations_ext && !device_extensions.vk_ext_sample_locations) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1691 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 1692 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1693 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT, but " |
| 1694 | "VK_EXT_sample_locations extension is not enabled.", |
| 1695 | i); |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1696 | } |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1697 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1698 | if (has_dynamic_exclusive_scissor_nv && !device_extensions.vk_nv_scissor_exclusive) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1699 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 1700 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1701 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV, but " |
| 1702 | "VK_NV_scissor_exclusive extension is not enabled.", |
| 1703 | i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1704 | } |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1705 | |
| 1706 | if (coarse_sample_order_struct && |
| 1707 | coarse_sample_order_struct->sampleOrderType != VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV && |
| 1708 | coarse_sample_order_struct->customSampleOrderCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1709 | skip |= LogError(device, "VUID-VkPipelineViewportCoarseSampleOrderStateCreateInfoNV-sampleOrderType-02072", |
| 1710 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1711 | "] " |
| 1712 | "VkPipelineViewportCoarseSampleOrderStateCreateInfoNV sampleOrderType is not " |
| 1713 | "VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV and customSampleOrderCount is not 0.", |
| 1714 | i); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1715 | } |
| 1716 | |
| 1717 | if (coarse_sample_order_struct) { |
| 1718 | 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] | 1719 | skip |= ValidateCoarseSampleOrderCustomNV(&coarse_sample_order_struct->pCustomSampleOrders[order_i]); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1720 | } |
| 1721 | } |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 1722 | |
| 1723 | if (vp_w_scaling_struct && (vp_w_scaling_struct->viewportWScalingEnable == VK_TRUE)) { |
| 1724 | if (vp_w_scaling_struct->viewportCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1725 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-viewportWScalingEnable-01726", |
| 1726 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1727 | "] " |
| 1728 | "VkPipelineViewportWScalingStateCreateInfoNV.viewportCount (=%" PRIu32 |
| 1729 | ") " |
| 1730 | "is not equal to VkPipelineViewportStateCreateInfo.viewportCount (=%" PRIu32 ").", |
| 1731 | i, vp_w_scaling_struct->viewportCount, viewport_state.viewportCount); |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 1732 | } |
| 1733 | if (!has_dynamic_viewport_w_scaling_nv && !vp_w_scaling_struct->pViewportWScalings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1734 | skip |= LogError( |
| 1735 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-01715", |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 1736 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 1737 | "] " |
| 1738 | "VkPipelineViewportWScalingStateCreateInfoNV.pViewportWScalings (=NULL) is not a valid array.", |
| 1739 | i); |
| 1740 | } |
| 1741 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1742 | } |
| 1743 | |
| 1744 | if (pCreateInfos[i].pMultisampleState == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1745 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00751", |
| 1746 | "vkCreateGraphicsPipelines: if pCreateInfos[%d].pRasterizationState->rasterizerDiscardEnable " |
| 1747 | "is VK_FALSE, pCreateInfos[%d].pMultisampleState must not be NULL.", |
| 1748 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1749 | } else { |
Dave Houlton | b3bbec7 | 2018-01-17 10:13:33 -0700 | [diff] [blame] | 1750 | const VkStructureType valid_next_stypes[] = {LvlTypeMap<VkPipelineCoverageModulationStateCreateInfoNV>::kSType, |
| 1751 | LvlTypeMap<VkPipelineCoverageToColorStateCreateInfoNV>::kSType, |
| 1752 | LvlTypeMap<VkPipelineSampleLocationsStateCreateInfoEXT>::kSType}; |
Mike Schuchardt | 97662b0 | 2017-12-06 13:31:29 -0700 | [diff] [blame] | 1753 | const char *valid_struct_names = |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 1754 | "VkPipelineCoverageModulationStateCreateInfoNV, VkPipelineCoverageToColorStateCreateInfoNV, " |
John Zulauf | 96b0e42 | 2017-11-14 11:43:19 -0700 | [diff] [blame] | 1755 | "VkPipelineSampleLocationsStateCreateInfoEXT"; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1756 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1757 | "vkCreateGraphicsPipelines", |
John Zulauf | 96b0e42 | 2017-11-14 11:43:19 -0700 | [diff] [blame] | 1758 | ParameterName("pCreateInfos[%i].pMultisampleState->pNext", ParameterName::IndexVector{i}), |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1759 | valid_struct_names, pCreateInfos[i].pMultisampleState->pNext, 3, valid_next_stypes, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 1760 | GeneratedVulkanHeaderVersion, "VUID-VkPipelineMultisampleStateCreateInfo-pNext-pNext", |
| 1761 | "VUID-VkPipelineMultisampleStateCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1762 | |
| 1763 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1764 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1765 | ParameterName("pCreateInfos[%i].pMultisampleState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1766 | pCreateInfos[i].pMultisampleState->flags, "VUID-VkPipelineMultisampleStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1767 | |
| 1768 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1769 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1770 | ParameterName("pCreateInfos[%i].pMultisampleState->sampleShadingEnable", ParameterName::IndexVector{i}), |
| 1771 | pCreateInfos[i].pMultisampleState->sampleShadingEnable); |
| 1772 | |
| 1773 | skip |= validate_array( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1774 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1775 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 1776 | ParameterName("pCreateInfos[%i].pMultisampleState->pSampleMask", ParameterName::IndexVector{i}), |
GabrÃel Arthúr Pétursson | 092b29b | 2018-03-21 22:44:11 +0000 | [diff] [blame] | 1777 | pCreateInfos[i].pMultisampleState->rasterizationSamples, &pCreateInfos[i].pMultisampleState->pSampleMask, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1778 | true, false, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1779 | |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1780 | skip |= validate_flags( |
| 1781 | "vkCreateGraphicsPipelines", |
| 1782 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 1783 | "VkSampleCountFlagBits", AllVkSampleCountFlagBits, pCreateInfos[i].pMultisampleState->rasterizationSamples, |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 1784 | kRequiredSingleBit, "VUID-VkPipelineMultisampleStateCreateInfo-rasterizationSamples-parameter"); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 1785 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1786 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1787 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1788 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToCoverageEnable", ParameterName::IndexVector{i}), |
| 1789 | pCreateInfos[i].pMultisampleState->alphaToCoverageEnable); |
| 1790 | |
| 1791 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1792 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1793 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToOneEnable", ParameterName::IndexVector{i}), |
| 1794 | pCreateInfos[i].pMultisampleState->alphaToOneEnable); |
| 1795 | |
| 1796 | if (pCreateInfos[i].pMultisampleState->sType != VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1797 | skip |= LogError(device, kVUID_PVError_InvalidStructSType, |
| 1798 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pMultisampleState->sType must be " |
| 1799 | "VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO", |
| 1800 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1801 | } |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1802 | if (pCreateInfos[i].pMultisampleState->sampleShadingEnable == VK_TRUE) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1803 | if (!physical_device_features.sampleRateShading) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1804 | skip |= LogError(device, "VUID-VkPipelineMultisampleStateCreateInfo-sampleShadingEnable-00784", |
| 1805 | "vkCreateGraphicsPipelines(): parameter " |
| 1806 | "pCreateInfos[%d].pMultisampleState->sampleShadingEnable.", |
| 1807 | i); |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1808 | } |
| 1809 | // TODO Add documentation issue about when minSampleShading must be in range and when it is ignored |
| 1810 | // For now a "least noise" test *only* when sampleShadingEnable is VK_TRUE. |
| 1811 | if (!in_inclusive_range(pCreateInfos[i].pMultisampleState->minSampleShading, 0.F, 1.0F)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1812 | skip |= LogError( |
| 1813 | device, |
| 1814 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1815 | "VUID-VkPipelineMultisampleStateCreateInfo-minSampleShading-00786", |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 1816 | "vkCreateGraphicsPipelines(): parameter pCreateInfos[%d].pMultisampleState->minSampleShading.", i); |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 1817 | } |
| 1818 | } |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1819 | |
| 1820 | const auto *line_state = lvl_find_in_chain<VkPipelineRasterizationLineStateCreateInfoEXT>( |
| 1821 | pCreateInfos[i].pRasterizationState->pNext); |
| 1822 | |
| 1823 | if (line_state) { |
| 1824 | if ((line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT || |
| 1825 | line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT)) { |
| 1826 | if (pCreateInfos[i].pMultisampleState->alphaToCoverageEnable) { |
| 1827 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1828 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766", |
| 1829 | "vkCreateGraphicsPipelines(): Bresenham/Smooth line rasterization not supported with " |
| 1830 | "pCreateInfos[%d].pMultisampleState->alphaToCoverageEnable == VK_TRUE.", |
| 1831 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1832 | } |
| 1833 | if (pCreateInfos[i].pMultisampleState->alphaToOneEnable) { |
| 1834 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1835 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766", |
| 1836 | "vkCreateGraphicsPipelines(): Bresenham/Smooth line rasterization not supported with " |
| 1837 | "pCreateInfos[%d].pMultisampleState->alphaToOneEnable == VK_TRUE.", |
| 1838 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1839 | } |
| 1840 | if (pCreateInfos[i].pMultisampleState->sampleShadingEnable) { |
| 1841 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1842 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766", |
| 1843 | "vkCreateGraphicsPipelines(): Bresenham/Smooth line rasterization not supported with " |
| 1844 | "pCreateInfos[%d].pMultisampleState->sampleShadingEnable == VK_TRUE.", |
| 1845 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1846 | } |
| 1847 | } |
| 1848 | if (line_state->stippledLineEnable && !has_dynamic_line_stipple) { |
| 1849 | if (line_state->lineStippleFactor < 1 || line_state->lineStippleFactor > 256) { |
| 1850 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1851 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-stippledLineEnable-02767", |
| 1852 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineStippleFactor = %d must be in the " |
| 1853 | "range [1,256].", |
| 1854 | i, line_state->lineStippleFactor); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1855 | } |
| 1856 | } |
| 1857 | const auto *line_features = |
Tony-LunarG | 6c3c545 | 2019-12-13 10:37:38 -0700 | [diff] [blame] | 1858 | lvl_find_in_chain<VkPhysicalDeviceLineRasterizationFeaturesEXT>(device_createinfo_pnext); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1859 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT && |
| 1860 | (!line_features || !line_features->rectangularLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1861 | skip |= |
| 1862 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-lineRasterizationMode-02768", |
| 1863 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineRasterizationMode = " |
| 1864 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT requires the rectangularLines feature.", |
| 1865 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1866 | } |
| 1867 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT && |
| 1868 | (!line_features || !line_features->bresenhamLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1869 | skip |= |
| 1870 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-lineRasterizationMode-02769", |
| 1871 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineRasterizationMode = " |
| 1872 | "VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT requires the bresenhamLines feature.", |
| 1873 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1874 | } |
| 1875 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT && |
| 1876 | (!line_features || !line_features->smoothLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1877 | skip |= |
| 1878 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-lineRasterizationMode-02770", |
| 1879 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineRasterizationMode = " |
| 1880 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT requires the smoothLines feature.", |
| 1881 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1882 | } |
| 1883 | if (line_state->stippledLineEnable) { |
| 1884 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT && |
| 1885 | (!line_features || !line_features->stippledRectangularLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1886 | skip |= |
| 1887 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02771", |
| 1888 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineRasterizationMode = " |
| 1889 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT with stipple requires the " |
| 1890 | "stippledRectangularLines feature.", |
| 1891 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1892 | } |
| 1893 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT && |
| 1894 | (!line_features || !line_features->stippledBresenhamLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1895 | skip |= |
| 1896 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02772", |
| 1897 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineRasterizationMode = " |
| 1898 | "VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT with stipple requires the " |
| 1899 | "stippledBresenhamLines feature.", |
| 1900 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1901 | } |
| 1902 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT && |
| 1903 | (!line_features || !line_features->stippledSmoothLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1904 | skip |= |
| 1905 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02773", |
| 1906 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineRasterizationMode = " |
| 1907 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT with stipple requires the " |
| 1908 | "stippledSmoothLines feature.", |
| 1909 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1910 | } |
| 1911 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT && |
| 1912 | (!line_features || !line_features->stippledSmoothLines || !device_limits.strictLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1913 | skip |= |
| 1914 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02774", |
| 1915 | "vkCreateGraphicsPipelines(): pCreateInfos[%d] lineRasterizationMode = " |
| 1916 | "VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT with stipple requires the " |
| 1917 | "stippledRectangularLines and strictLines features.", |
| 1918 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1919 | } |
| 1920 | } |
| 1921 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1922 | } |
| 1923 | |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 1924 | bool uses_color_attachment = false; |
| 1925 | bool uses_depthstencil_attachment = false; |
| 1926 | { |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1927 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1928 | const auto subpasses_uses_it = renderpasses_states.find(pCreateInfos[i].renderPass); |
| 1929 | if (subpasses_uses_it != renderpasses_states.end()) { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 1930 | const auto &subpasses_uses = subpasses_uses_it->second; |
| 1931 | if (subpasses_uses.subpasses_using_color_attachment.count(pCreateInfos[i].subpass)) |
| 1932 | uses_color_attachment = true; |
| 1933 | if (subpasses_uses.subpasses_using_depthstencil_attachment.count(pCreateInfos[i].subpass)) |
| 1934 | uses_depthstencil_attachment = true; |
| 1935 | } |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 1936 | lock.unlock(); |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 1937 | } |
| 1938 | |
| 1939 | if (pCreateInfos[i].pDepthStencilState != nullptr && uses_depthstencil_attachment) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1940 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1941 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1942 | ParameterName("pCreateInfos[%i].pDepthStencilState->pNext", ParameterName::IndexVector{i}), NULL, |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1943 | pCreateInfos[i].pDepthStencilState->pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 1944 | "VUID-VkPipelineDepthStencilStateCreateInfo-pNext-pNext", nullptr); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1945 | |
| 1946 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1947 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1948 | ParameterName("pCreateInfos[%i].pDepthStencilState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1949 | pCreateInfos[i].pDepthStencilState->flags, "VUID-VkPipelineDepthStencilStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1950 | |
| 1951 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1952 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1953 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthTestEnable", ParameterName::IndexVector{i}), |
| 1954 | pCreateInfos[i].pDepthStencilState->depthTestEnable); |
| 1955 | |
| 1956 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1957 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1958 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthWriteEnable", ParameterName::IndexVector{i}), |
| 1959 | pCreateInfos[i].pDepthStencilState->depthWriteEnable); |
| 1960 | |
| 1961 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1962 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1963 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthCompareOp", ParameterName::IndexVector{i}), |
| 1964 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->depthCompareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1965 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1966 | |
| 1967 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1968 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1969 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthBoundsTestEnable", ParameterName::IndexVector{i}), |
| 1970 | pCreateInfos[i].pDepthStencilState->depthBoundsTestEnable); |
| 1971 | |
| 1972 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1973 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1974 | ParameterName("pCreateInfos[%i].pDepthStencilState->stencilTestEnable", ParameterName::IndexVector{i}), |
| 1975 | pCreateInfos[i].pDepthStencilState->stencilTestEnable); |
| 1976 | |
| 1977 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1978 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1979 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.failOp", ParameterName::IndexVector{i}), |
| 1980 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.failOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1981 | "VUID-VkStencilOpState-failOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1982 | |
| 1983 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1984 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1985 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.passOp", ParameterName::IndexVector{i}), |
| 1986 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.passOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1987 | "VUID-VkStencilOpState-passOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1988 | |
| 1989 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1990 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1991 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.depthFailOp", ParameterName::IndexVector{i}), |
| 1992 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.depthFailOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1993 | "VUID-VkStencilOpState-depthFailOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1994 | |
| 1995 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1996 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1997 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.compareOp", ParameterName::IndexVector{i}), |
| 1998 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->front.compareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 1999 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2000 | |
| 2001 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2002 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2003 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.failOp", ParameterName::IndexVector{i}), |
| 2004 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.failOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2005 | "VUID-VkStencilOpState-failOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2006 | |
| 2007 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2008 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2009 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.passOp", ParameterName::IndexVector{i}), |
| 2010 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.passOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2011 | "VUID-VkStencilOpState-passOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2012 | |
| 2013 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2014 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2015 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.depthFailOp", ParameterName::IndexVector{i}), |
| 2016 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.depthFailOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2017 | "VUID-VkStencilOpState-depthFailOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2018 | |
| 2019 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2020 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2021 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.compareOp", ParameterName::IndexVector{i}), |
| 2022 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->back.compareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2023 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2024 | |
| 2025 | if (pCreateInfos[i].pDepthStencilState->sType != VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2026 | skip |= LogError(device, kVUID_PVError_InvalidStructSType, |
| 2027 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pDepthStencilState->sType must be " |
| 2028 | "VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO", |
| 2029 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2030 | } |
| 2031 | } |
| 2032 | |
Shannon McPherson | 9b9532b | 2018-10-24 12:00:09 -0600 | [diff] [blame] | 2033 | const VkStructureType allowed_structs_VkPipelineColorBlendStateCreateInfo[] = { |
| 2034 | VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT}; |
| 2035 | |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2036 | if (pCreateInfos[i].pColorBlendState != nullptr && uses_color_attachment) { |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2037 | skip |= validate_struct_type("vkCreateGraphicsPipelines", |
| 2038 | ParameterName("pCreateInfos[%i].pColorBlendState", ParameterName::IndexVector{i}), |
| 2039 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 2040 | pCreateInfos[i].pColorBlendState, |
| 2041 | VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, false, kVUIDUndefined, |
| 2042 | "VUID-VkPipelineColorBlendStateCreateInfo-sType-sType"); |
| 2043 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2044 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2045 | "vkCreateGraphicsPipelines", |
Shannon McPherson | 9b9532b | 2018-10-24 12:00:09 -0600 | [diff] [blame] | 2046 | ParameterName("pCreateInfos[%i].pColorBlendState->pNext", ParameterName::IndexVector{i}), |
| 2047 | "VkPipelineColorBlendAdvancedStateCreateInfoEXT", pCreateInfos[i].pColorBlendState->pNext, |
| 2048 | ARRAY_SIZE(allowed_structs_VkPipelineColorBlendStateCreateInfo), |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2049 | allowed_structs_VkPipelineColorBlendStateCreateInfo, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2050 | "VUID-VkPipelineColorBlendStateCreateInfo-pNext-pNext", |
| 2051 | "VUID-VkPipelineColorBlendStateCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2052 | |
| 2053 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2054 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2055 | ParameterName("pCreateInfos[%i].pColorBlendState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2056 | pCreateInfos[i].pColorBlendState->flags, "VUID-VkPipelineColorBlendStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2057 | |
| 2058 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2059 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2060 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOpEnable", ParameterName::IndexVector{i}), |
| 2061 | pCreateInfos[i].pColorBlendState->logicOpEnable); |
| 2062 | |
| 2063 | skip |= validate_array( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2064 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2065 | ParameterName("pCreateInfos[%i].pColorBlendState->attachmentCount", ParameterName::IndexVector{i}), |
| 2066 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments", ParameterName::IndexVector{i}), |
GabrÃel Arthúr Pétursson | 092b29b | 2018-03-21 22:44:11 +0000 | [diff] [blame] | 2067 | pCreateInfos[i].pColorBlendState->attachmentCount, &pCreateInfos[i].pColorBlendState->pAttachments, false, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2068 | true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2069 | |
| 2070 | if (pCreateInfos[i].pColorBlendState->pAttachments != NULL) { |
| 2071 | for (uint32_t attachmentIndex = 0; attachmentIndex < pCreateInfos[i].pColorBlendState->attachmentCount; |
| 2072 | ++attachmentIndex) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2073 | skip |= validate_bool32("vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2074 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].blendEnable", |
| 2075 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2076 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].blendEnable); |
| 2077 | |
| 2078 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2079 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2080 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcColorBlendFactor", |
| 2081 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2082 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 2083 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcColorBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2084 | "VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2085 | |
| 2086 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2087 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2088 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstColorBlendFactor", |
| 2089 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2090 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 2091 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstColorBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2092 | "VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2093 | |
| 2094 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2095 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2096 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorBlendOp", |
| 2097 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2098 | "VkBlendOp", AllVkBlendOpEnums, |
| 2099 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorBlendOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2100 | "VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2101 | |
| 2102 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2103 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2104 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcAlphaBlendFactor", |
| 2105 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2106 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 2107 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].srcAlphaBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2108 | "VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2109 | |
| 2110 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2111 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2112 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstAlphaBlendFactor", |
| 2113 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2114 | "VkBlendFactor", AllVkBlendFactorEnums, |
| 2115 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].dstAlphaBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2116 | "VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2117 | |
| 2118 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2119 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2120 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].alphaBlendOp", |
| 2121 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2122 | "VkBlendOp", AllVkBlendOpEnums, |
| 2123 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].alphaBlendOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2124 | "VUID-VkPipelineColorBlendAttachmentState-alphaBlendOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2125 | |
| 2126 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2127 | validate_flags("vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2128 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorWriteMask", |
| 2129 | ParameterName::IndexVector{i, attachmentIndex}), |
| 2130 | "VkColorComponentFlagBits", AllVkColorComponentFlagBits, |
| 2131 | pCreateInfos[i].pColorBlendState->pAttachments[attachmentIndex].colorWriteMask, |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 2132 | kOptionalFlags, "VUID-VkPipelineColorBlendAttachmentState-colorWriteMask-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2133 | } |
| 2134 | } |
| 2135 | |
| 2136 | if (pCreateInfos[i].pColorBlendState->sType != VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2137 | skip |= LogError(device, kVUID_PVError_InvalidStructSType, |
| 2138 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%d].pColorBlendState->sType must be " |
| 2139 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 2140 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2141 | } |
| 2142 | |
| 2143 | // If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value |
| 2144 | if (pCreateInfos[i].pColorBlendState->logicOpEnable == VK_TRUE) { |
| 2145 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2146 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2147 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOp", ParameterName::IndexVector{i}), "VkLogicOp", |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2148 | AllVkLogicOpEnums, pCreateInfos[i].pColorBlendState->logicOp, |
| 2149 | "VUID-VkPipelineColorBlendStateCreateInfo-logicOpEnable-00607"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2150 | } |
| 2151 | } |
| 2152 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2153 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 2154 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 2155 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 2156 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2157 | skip |= |
| 2158 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-00724", |
| 2159 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineHandle, must be " |
| 2160 | "VK_NULL_HANDLE if pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag " |
| 2161 | "and pCreateInfos->basePipelineIndex is not -1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2162 | } |
| 2163 | } |
| 2164 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 2165 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
| 2166 | if (pCreateInfos[i].basePipelineIndex != -1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2167 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-00725", |
| 2168 | "vkCreateGraphicsPipelines parameter, pCreateInfos->basePipelineIndex, must be -1 if " |
| 2169 | "pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and " |
| 2170 | "pCreateInfos->basePipelineHandle is not VK_NULL_HANDLE."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2171 | } |
Mark Lobodzinski | 4dfeb94 | 2019-09-13 12:11:13 -0600 | [diff] [blame] | 2172 | } else { |
| 2173 | if (static_cast<const uint32_t>(pCreateInfos[i].basePipelineIndex) >= createInfoCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2174 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-00723", |
| 2175 | "vkCreateGraphicsPipelines parameter pCreateInfos->basePipelineIndex (%d) must be a valid" |
| 2176 | "index into the pCreateInfos array, of size %d.", |
| 2177 | pCreateInfos[i].basePipelineIndex, createInfoCount); |
Mark Lobodzinski | 4dfeb94 | 2019-09-13 12:11:13 -0600 | [diff] [blame] | 2178 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2179 | } |
| 2180 | } |
| 2181 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 2182 | if (pCreateInfos[i].pRasterizationState) { |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 2183 | if (!device_extensions.vk_nv_fill_rectangle) { |
| 2184 | if (pCreateInfos[i].pRasterizationState->polygonMode == VK_POLYGON_MODE_FILL_RECTANGLE_NV) { |
| 2185 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2186 | LogError(device, "VUID-VkPipelineRasterizationStateCreateInfo-polygonMode-01414", |
| 2187 | "vkCreateGraphicsPipelines parameter, VkPolygonMode " |
| 2188 | "pCreateInfos->pRasterizationState->polygonMode cannot be VK_POLYGON_MODE_FILL_RECTANGLE_NV " |
| 2189 | "if the extension VK_NV_fill_rectangle is not enabled."); |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 2190 | } else if ((pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
| 2191 | (physical_device_features.fillModeNonSolid == false)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2192 | skip |= LogError(device, kVUID_PVError_DeviceFeature, |
| 2193 | "vkCreateGraphicsPipelines parameter, VkPolygonMode " |
| 2194 | "pCreateInfos->pRasterizationState->polygonMode cannot be VK_POLYGON_MODE_POINT or " |
| 2195 | "VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 2196 | } |
| 2197 | } else { |
| 2198 | if ((pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
| 2199 | (pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL_RECTANGLE_NV) && |
| 2200 | (physical_device_features.fillModeNonSolid == false)) { |
| 2201 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2202 | LogError(device, "VUID-VkPipelineRasterizationStateCreateInfo-polygonMode-01507", |
| 2203 | "vkCreateGraphicsPipelines parameter, VkPolygonMode " |
| 2204 | "pCreateInfos->pRasterizationState->polygonMode must be VK_POLYGON_MODE_FILL or " |
| 2205 | "VK_POLYGON_MODE_FILL_RECTANGLE_NV if VkPhysicalDeviceFeatures->fillModeNonSolid is false."); |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 2206 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2207 | } |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2208 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2209 | if (!has_dynamic_line_width && !physical_device_features.wideLines && |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2210 | (pCreateInfos[i].pRasterizationState->lineWidth != 1.0f)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2211 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00749", |
| 2212 | "The line width state is static (pCreateInfos[%" PRIu32 |
| 2213 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_LINE_WIDTH) and " |
| 2214 | "VkPhysicalDeviceFeatures::wideLines is disabled, but pCreateInfos[%" PRIu32 |
| 2215 | "].pRasterizationState->lineWidth (=%f) is not 1.0.", |
| 2216 | i, i, pCreateInfos[i].pRasterizationState->lineWidth); |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2217 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2218 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2219 | } |
| 2220 | } |
| 2221 | |
| 2222 | return skip; |
| 2223 | } |
| 2224 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2225 | bool StatelessValidation::manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, |
| 2226 | uint32_t createInfoCount, |
| 2227 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 2228 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2229 | VkPipeline *pPipelines) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2230 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2231 | for (uint32_t i = 0; i < createInfoCount; i++) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2232 | skip |= validate_string("vkCreateComputePipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2233 | ParameterName("pCreateInfos[%i].stage.pName", ParameterName::IndexVector{i}), |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 2234 | "VUID-VkPipelineShaderStageCreateInfo-pName-parameter", pCreateInfos[i].stage.pName); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 2235 | auto feedback_struct = lvl_find_in_chain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
| 2236 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2237 | skip |= |
| 2238 | LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02669", |
| 2239 | "vkCreateComputePipelines(): in pCreateInfo[%" PRIu32 |
| 2240 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount must equal 1, found %" PRIu32 ".", |
| 2241 | i, feedback_struct->pipelineStageCreationFeedbackCount); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 2242 | } |
sfricke-samsung | c522715 | 2020-02-09 17:36:31 -0800 | [diff] [blame] | 2243 | |
| 2244 | // Make sure compute stage is selected |
| 2245 | if (pCreateInfos[i].stage.stage != VK_SHADER_STAGE_COMPUTE_BIT) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2246 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-stage-00701", |
| 2247 | "vkCreateComputePipelines(): the pCreateInfo[%u].stage.stage (%s) is not VK_SHADER_STAGE_COMPUTE_BIT", |
| 2248 | i, string_VkShaderStageFlagBits(pCreateInfos[i].stage.stage)); |
sfricke-samsung | c522715 | 2020-02-09 17:36:31 -0800 | [diff] [blame] | 2249 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2250 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2251 | return skip; |
| 2252 | } |
| 2253 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2254 | bool StatelessValidation::manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2255 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2256 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2257 | |
| 2258 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2259 | const auto &features = physical_device_features; |
| 2260 | const auto &limits = device_limits; |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2261 | |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 2262 | if (pCreateInfo->anisotropyEnable == VK_TRUE) { |
| 2263 | if (!in_inclusive_range(pCreateInfo->maxAnisotropy, 1.0F, limits.maxSamplerAnisotropy)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2264 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-anisotropyEnable-01071", |
| 2265 | "vkCreateSampler(): value of %s must be in range [1.0, %f] %s, but %f found.", |
| 2266 | "pCreateInfo->maxAnisotropy", limits.maxSamplerAnisotropy, |
| 2267 | "VkPhysicalDeviceLimits::maxSamplerAnistropy", pCreateInfo->maxAnisotropy); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 2268 | } |
| 2269 | |
| 2270 | // Anistropy cannot be enabled in sampler unless enabled as a feature |
| 2271 | if (features.samplerAnisotropy == VK_FALSE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2272 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-anisotropyEnable-01070", |
| 2273 | "vkCreateSampler(): Anisotropic sampling feature is not enabled, %s must be VK_FALSE.", |
| 2274 | "pCreateInfo->anisotropyEnable"); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 2275 | } |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2276 | } |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 2277 | |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2278 | if (pCreateInfo->unnormalizedCoordinates == VK_TRUE) { |
| 2279 | if (pCreateInfo->minFilter != pCreateInfo->magFilter) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2280 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01072", |
| 2281 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 2282 | "pCreateInfo->minFilter (%s) and pCreateInfo->magFilter (%s) must be equal.", |
| 2283 | string_VkFilter(pCreateInfo->minFilter), string_VkFilter(pCreateInfo->magFilter)); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2284 | } |
| 2285 | if (pCreateInfo->mipmapMode != VK_SAMPLER_MIPMAP_MODE_NEAREST) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2286 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01073", |
| 2287 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 2288 | "pCreateInfo->mipmapMode (%s) must be VK_SAMPLER_MIPMAP_MODE_NEAREST.", |
| 2289 | string_VkSamplerMipmapMode(pCreateInfo->mipmapMode)); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2290 | } |
| 2291 | if (pCreateInfo->minLod != 0.0f || pCreateInfo->maxLod != 0.0f) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2292 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01074", |
| 2293 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 2294 | "pCreateInfo->minLod (%f) and pCreateInfo->maxLod (%f) must both be zero.", |
| 2295 | pCreateInfo->minLod, pCreateInfo->maxLod); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2296 | } |
| 2297 | if ((pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE && |
| 2298 | pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 2299 | (pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE && |
| 2300 | pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2301 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01075", |
| 2302 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 2303 | "pCreateInfo->addressModeU (%s) and pCreateInfo->addressModeV (%s) must both be " |
| 2304 | "VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER.", |
| 2305 | string_VkSamplerAddressMode(pCreateInfo->addressModeU), |
| 2306 | string_VkSamplerAddressMode(pCreateInfo->addressModeV)); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2307 | } |
| 2308 | if (pCreateInfo->anisotropyEnable == VK_TRUE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2309 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01076", |
| 2310 | "vkCreateSampler(): pCreateInfo->anisotropyEnable and pCreateInfo->unnormalizedCoordinates must " |
| 2311 | "not both be VK_TRUE."); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 2312 | } |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2313 | if (pCreateInfo->compareEnable == VK_TRUE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2314 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01077", |
| 2315 | "vkCreateSampler(): pCreateInfo->compareEnable and pCreateInfo->unnormalizedCoordinates must " |
| 2316 | "not both be VK_TRUE."); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 2317 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2318 | } |
| 2319 | |
| 2320 | // If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value |
| 2321 | if (pCreateInfo->compareEnable == VK_TRUE) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2322 | skip |= validate_ranged_enum("vkCreateSampler", "pCreateInfo->compareOp", "VkCompareOp", AllVkCompareOpEnums, |
| 2323 | pCreateInfo->compareOp, "VUID-VkSamplerCreateInfo-compareEnable-01080"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2324 | } |
| 2325 | |
| 2326 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a |
| 2327 | // valid VkBorderColor value |
| 2328 | if ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 2329 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 2330 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2331 | skip |= validate_ranged_enum("vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor", AllVkBorderColorEnums, |
| 2332 | pCreateInfo->borderColor, "VUID-VkSamplerCreateInfo-addressModeU-01078"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2333 | } |
| 2334 | |
| 2335 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, the |
| 2336 | // VK_KHR_sampler_mirror_clamp_to_edge extension must be enabled |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2337 | if (!device_extensions.vk_khr_sampler_mirror_clamp_to_edge && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2338 | ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) || |
| 2339 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) || |
| 2340 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE))) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2341 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2342 | LogError(device, "VUID-VkSamplerCreateInfo-addressModeU-01079", |
| 2343 | "vkCreateSampler(): A VkSamplerAddressMode value is set to VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE " |
| 2344 | "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] | 2345 | } |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 2346 | |
| 2347 | // Checks for the IMG cubic filtering extension |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2348 | if (device_extensions.vk_img_filter_cubic) { |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 2349 | if ((pCreateInfo->anisotropyEnable == VK_TRUE) && |
| 2350 | ((pCreateInfo->minFilter == VK_FILTER_CUBIC_IMG) || (pCreateInfo->magFilter == VK_FILTER_CUBIC_IMG))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2351 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-magFilter-01081", |
| 2352 | "vkCreateSampler(): Anisotropic sampling must not be VK_TRUE when either minFilter or magFilter " |
| 2353 | "are VK_FILTER_CUBIC_IMG."); |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 2354 | } |
| 2355 | } |
Mark Lobodzinski | 61992fc | 2020-01-14 14:00:08 -0700 | [diff] [blame] | 2356 | |
sfricke-samsung | d91da4a | 2020-02-09 17:19:04 -0800 | [diff] [blame] | 2357 | // Check for valid Lod range |
| 2358 | if (pCreateInfo->minLod > pCreateInfo->maxLod) { |
Mark Lobodzinski | 728ab48 | 2020-02-12 13:46:47 -0700 | [diff] [blame] | 2359 | skip |= |
| 2360 | LogError(device, "VUID-VkSamplerCreateInfo-maxLod-01973", |
| 2361 | "vkCreateSampler(): minLod (%f) is greater than maxLod (%f)", pCreateInfo->minLod, pCreateInfo->maxLod); |
sfricke-samsung | d91da4a | 2020-02-09 17:19:04 -0800 | [diff] [blame] | 2362 | } |
| 2363 | |
| 2364 | // Check mipLodBias to device limit |
| 2365 | if (pCreateInfo->mipLodBias > limits.maxSamplerLodBias) { |
Mark Lobodzinski | 728ab48 | 2020-02-12 13:46:47 -0700 | [diff] [blame] | 2366 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-mipLodBias-01069", |
| 2367 | "vkCreateSampler(): mipLodBias (%f) is greater than VkPhysicalDeviceLimits::maxSamplerLodBias (%f)", |
| 2368 | pCreateInfo->mipLodBias, limits.maxSamplerLodBias); |
sfricke-samsung | d91da4a | 2020-02-09 17:19:04 -0800 | [diff] [blame] | 2369 | } |
| 2370 | |
Mark Lobodzinski | 61992fc | 2020-01-14 14:00:08 -0700 | [diff] [blame] | 2371 | const auto *sampler_conversion = lvl_find_in_chain<VkSamplerYcbcrConversionInfo>(pCreateInfo->pNext); |
| 2372 | if (sampler_conversion != nullptr) { |
| 2373 | if ((pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) || |
| 2374 | (pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) || |
| 2375 | (pCreateInfo->addressModeW != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) || |
| 2376 | (pCreateInfo->anisotropyEnable != VK_FALSE) || (pCreateInfo->unnormalizedCoordinates != VK_FALSE)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2377 | skip |= LogError( |
Mark Lobodzinski | 728ab48 | 2020-02-12 13:46:47 -0700 | [diff] [blame] | 2378 | device, "VUID-VkSamplerCreateInfo-addressModeU-01646", |
Mark Lobodzinski | 61992fc | 2020-01-14 14:00:08 -0700 | [diff] [blame] | 2379 | "vkCreateSampler(): SamplerYCbCrConversion is enabled: " |
| 2380 | "addressModeU (%s), addressModeV (%s), addressModeW (%s) must be CLAMP_TO_EDGE, and anisotropyEnable (%s) " |
| 2381 | "and unnormalizedCoordinates (%s) must be VK_FALSE.", |
| 2382 | string_VkSamplerAddressMode(pCreateInfo->addressModeU), string_VkSamplerAddressMode(pCreateInfo->addressModeV), |
| 2383 | string_VkSamplerAddressMode(pCreateInfo->addressModeW), pCreateInfo->anisotropyEnable ? "VK_TRUE" : "VK_FALSE", |
| 2384 | pCreateInfo->unnormalizedCoordinates ? "VK_TRUE" : "VK_FALSE"); |
| 2385 | } |
| 2386 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2387 | } |
| 2388 | |
| 2389 | return skip; |
| 2390 | } |
| 2391 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2392 | bool StatelessValidation::manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, |
| 2393 | const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 2394 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2395 | VkDescriptorSetLayout *pSetLayout) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2396 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2397 | |
| 2398 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2399 | if ((pCreateInfo != nullptr) && (pCreateInfo->pBindings != nullptr)) { |
| 2400 | for (uint32_t i = 0; i < pCreateInfo->bindingCount; ++i) { |
| 2401 | if (pCreateInfo->pBindings[i].descriptorCount != 0) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2402 | if (((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 2403 | (pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) && |
| 2404 | (pCreateInfo->pBindings[i].pImmutableSamplers != nullptr)) { |
| 2405 | for (uint32_t descriptor_index = 0; descriptor_index < pCreateInfo->pBindings[i].descriptorCount; |
| 2406 | ++descriptor_index) { |
| 2407 | if (pCreateInfo->pBindings[i].pImmutableSamplers[descriptor_index] == VK_NULL_HANDLE) { |
Spencer Fricke | b0e3082 | 2020-03-23 10:32:30 -0700 | [diff] [blame] | 2408 | skip |= LogError(device, "VUID-VkDescriptorSetLayoutBinding-descriptorType-00282", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2409 | "vkCreateDescriptorSetLayout: required parameter " |
| 2410 | "pCreateInfo->pBindings[%d].pImmutableSamplers[%d] specified as VK_NULL_HANDLE", |
| 2411 | i, descriptor_index); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2412 | } |
| 2413 | } |
| 2414 | } |
| 2415 | |
| 2416 | // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values |
| 2417 | if ((pCreateInfo->pBindings[i].stageFlags != 0) && |
| 2418 | ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2419 | skip |= LogError(device, "VUID-VkDescriptorSetLayoutBinding-descriptorCount-00283", |
| 2420 | "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%d].descriptorCount is not 0, " |
| 2421 | "pCreateInfo->pBindings[%d].stageFlags must be a valid combination of VkShaderStageFlagBits " |
| 2422 | "values.", |
| 2423 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2424 | } |
Spencer Fricke | 84d0cc0 | 2020-03-16 17:21:59 -0700 | [diff] [blame] | 2425 | |
| 2426 | if ((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT) && |
| 2427 | (pCreateInfo->pBindings[i].stageFlags != 0) && |
| 2428 | (pCreateInfo->pBindings[i].stageFlags != VK_SHADER_STAGE_FRAGMENT_BIT)) { |
| 2429 | skip |= |
| 2430 | LogError(device, "VUID-VkDescriptorSetLayoutBinding-descriptorType-01510", |
| 2431 | "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%d].descriptorCount is not 0 and " |
| 2432 | "descriptorType is VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT then pCreateInfo->pBindings[%d].stageFlags " |
| 2433 | "must be 0 or VK_SHADER_STAGE_FRAGMENT_BIT but is currently %s", |
| 2434 | i, i, string_VkShaderStageFlags(pCreateInfo->pBindings[i].stageFlags).c_str()); |
| 2435 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2436 | } |
| 2437 | } |
| 2438 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2439 | return skip; |
| 2440 | } |
| 2441 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2442 | bool StatelessValidation::manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, |
| 2443 | uint32_t descriptorSetCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2444 | const VkDescriptorSet *pDescriptorSets) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2445 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2446 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 2447 | // validate_array() |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2448 | return validate_array("vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, &pDescriptorSets, |
| 2449 | true, true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2450 | } |
| 2451 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2452 | bool StatelessValidation::validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount, |
| 2453 | const VkWriteDescriptorSet *pDescriptorWrites, |
| 2454 | const bool validateDstSet) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2455 | bool skip = false; |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2456 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2457 | if (pDescriptorWrites != NULL) { |
| 2458 | for (uint32_t i = 0; i < descriptorWriteCount; ++i) { |
| 2459 | // descriptorCount must be greater than 0 |
| 2460 | if (pDescriptorWrites[i].descriptorCount == 0) { |
| 2461 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2462 | LogError(device, "VUID-VkWriteDescriptorSet-descriptorCount-arraylength", |
| 2463 | "%s(): parameter pDescriptorWrites[%d].descriptorCount must be greater than 0.", vkCallingFunction, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2464 | } |
| 2465 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2466 | // If called from vkCmdPushDescriptorSetKHR, the dstSet member is ignored. |
| 2467 | if (validateDstSet) { |
| 2468 | // dstSet must be a valid VkDescriptorSet handle |
| 2469 | skip |= validate_required_handle(vkCallingFunction, |
| 2470 | ParameterName("pDescriptorWrites[%i].dstSet", ParameterName::IndexVector{i}), |
| 2471 | pDescriptorWrites[i].dstSet); |
| 2472 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2473 | |
| 2474 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 2475 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 2476 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 2477 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 2478 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 2479 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 2480 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
| 2481 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures |
| 2482 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2483 | skip |= LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00322", |
| 2484 | "%s(): if pDescriptorWrites[%d].descriptorType is " |
| 2485 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 2486 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
| 2487 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%d].pImageInfo must not be NULL.", |
| 2488 | vkCallingFunction, i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2489 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 2490 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
| 2491 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageView and imageLayout |
| 2492 | // members of any given element of pImageInfo must be a valid VkImageView and VkImageLayout, respectively |
| 2493 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 2494 | ++descriptor_index) { |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2495 | skip |= validate_required_handle(vkCallingFunction, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2496 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageView", |
| 2497 | ParameterName::IndexVector{i, descriptor_index}), |
| 2498 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageView); |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2499 | skip |= validate_ranged_enum(vkCallingFunction, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2500 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageLayout", |
| 2501 | ParameterName::IndexVector{i, descriptor_index}), |
| 2502 | "VkImageLayout", AllVkImageLayoutEnums, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2503 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2504 | } |
| 2505 | } |
| 2506 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 2507 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 2508 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 2509 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 2510 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 2511 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 2512 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
| 2513 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2514 | skip |= LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00324", |
| 2515 | "%s(): if pDescriptorWrites[%d].descriptorType is " |
| 2516 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 2517 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
| 2518 | "pDescriptorWrites[%d].pBufferInfo must not be NULL.", |
| 2519 | vkCallingFunction, i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2520 | } else { |
| 2521 | for (uint32_t descriptorIndex = 0; descriptorIndex < pDescriptorWrites[i].descriptorCount; ++descriptorIndex) { |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2522 | skip |= validate_required_handle(vkCallingFunction, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2523 | ParameterName("pDescriptorWrites[%i].pBufferInfo[%i].buffer", |
| 2524 | ParameterName::IndexVector{i, descriptorIndex}), |
| 2525 | pDescriptorWrites[i].pBufferInfo[descriptorIndex].buffer); |
| 2526 | } |
| 2527 | } |
| 2528 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 2529 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 2530 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, |
| 2531 | // pTexelBufferView must be a pointer to an array of descriptorCount valid VkBufferView handles |
| 2532 | if (pDescriptorWrites[i].pTexelBufferView == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2533 | skip |= LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00323", |
| 2534 | "%s(): if pDescriptorWrites[%d].descriptorType is " |
| 2535 | "VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, " |
| 2536 | "pDescriptorWrites[%d].pTexelBufferView must not be NULL.", |
| 2537 | vkCallingFunction, i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2538 | } else { |
| 2539 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 2540 | ++descriptor_index) { |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2541 | skip |= validate_required_handle(vkCallingFunction, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2542 | ParameterName("pDescriptorWrites[%i].pTexelBufferView[%i]", |
| 2543 | ParameterName::IndexVector{i, descriptor_index}), |
| 2544 | pDescriptorWrites[i].pTexelBufferView[descriptor_index]); |
| 2545 | } |
| 2546 | } |
| 2547 | } |
| 2548 | |
| 2549 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 2550 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2551 | VkDeviceSize uniformAlignment = device_limits.minUniformBufferOffsetAlignment; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2552 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 2553 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 2554 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 2555 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2556 | LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00327", |
| 2557 | "%s(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 2558 | ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64 ".", |
| 2559 | vkCallingFunction, i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2560 | } |
| 2561 | } |
| 2562 | } |
| 2563 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 2564 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2565 | VkDeviceSize storageAlignment = device_limits.minStorageBufferOffsetAlignment; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2566 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 2567 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
| 2568 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 2569 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2570 | LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00328", |
| 2571 | "%s(): pDescriptorWrites[%d].pBufferInfo[%d].offset (0x%" PRIxLEAST64 |
| 2572 | ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64 ".", |
| 2573 | vkCallingFunction, i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2574 | } |
| 2575 | } |
| 2576 | } |
| 2577 | } |
| 2578 | } |
| 2579 | } |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2580 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2581 | return skip; |
| 2582 | } |
| 2583 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 2584 | bool StatelessValidation::manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 2585 | const VkWriteDescriptorSet *pDescriptorWrites, |
| 2586 | uint32_t descriptorCopyCount, |
| 2587 | const VkCopyDescriptorSet *pDescriptorCopies) const { |
| 2588 | return validate_WriteDescriptorSet("vkUpdateDescriptorSets", descriptorWriteCount, pDescriptorWrites); |
| 2589 | } |
| 2590 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2591 | bool StatelessValidation::manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2592 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2593 | VkRenderPass *pRenderPass) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2594 | return CreateRenderPassGeneric(device, pCreateInfo, pAllocator, pRenderPass, RENDER_PASS_VERSION_1); |
| 2595 | } |
| 2596 | |
| 2597 | bool StatelessValidation::manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2598 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2599 | VkRenderPass *pRenderPass) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2600 | return CreateRenderPassGeneric(device, pCreateInfo, pAllocator, pRenderPass, RENDER_PASS_VERSION_2); |
| 2601 | } |
| 2602 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2603 | bool StatelessValidation::manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, |
| 2604 | uint32_t commandBufferCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2605 | const VkCommandBuffer *pCommandBuffers) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2606 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2607 | |
| 2608 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 2609 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 2610 | // validate_array() |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2611 | skip |= validate_array("vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, &pCommandBuffers, |
| 2612 | true, true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2613 | return skip; |
| 2614 | } |
| 2615 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2616 | bool StatelessValidation::manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2617 | const VkCommandBufferBeginInfo *pBeginInfo) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2618 | bool skip = false; |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2619 | |
| 2620 | // VkCommandBufferInheritanceInfo validation, due to a 'noautovalidity' of pBeginInfo->pInheritanceInfo in vkBeginCommandBuffer |
| 2621 | const char *cmd_name = "vkBeginCommandBuffer"; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2622 | const VkCommandBufferInheritanceInfo *pInfo = pBeginInfo->pInheritanceInfo; |
| 2623 | |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2624 | // Implicit VUs |
| 2625 | // validate only sType here; pointer has to be validated in core_validation |
| 2626 | const bool kNotRequired = false; |
| 2627 | const char *kNoVUID = nullptr; |
| 2628 | skip |= validate_struct_type(cmd_name, "pBeginInfo->pInheritanceInfo", "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", |
| 2629 | pInfo, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, kNotRequired, kNoVUID, |
| 2630 | "VUID-VkCommandBufferInheritanceInfo-sType-sType"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2631 | |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2632 | if (pInfo) { |
| 2633 | const VkStructureType allowed_structs_VkCommandBufferInheritanceInfo[] = { |
| 2634 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT}; |
| 2635 | skip |= validate_struct_pnext( |
| 2636 | cmd_name, "pBeginInfo->pInheritanceInfo->pNext", "VkCommandBufferInheritanceConditionalRenderingInfoEXT", pInfo->pNext, |
| 2637 | ARRAY_SIZE(allowed_structs_VkCommandBufferInheritanceInfo), allowed_structs_VkCommandBufferInheritanceInfo, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2638 | GeneratedVulkanHeaderVersion, "VUID-VkCommandBufferInheritanceInfo-pNext-pNext", |
| 2639 | "VUID-VkCommandBufferInheritanceInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2640 | |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2641 | skip |= validate_bool32(cmd_name, "pBeginInfo->pInheritanceInfo->occlusionQueryEnable", pInfo->occlusionQueryEnable); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2642 | |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2643 | // Explicit VUs |
| 2644 | if (!physical_device_features.inheritedQueries && pInfo->occlusionQueryEnable == VK_TRUE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2645 | skip |= LogError( |
| 2646 | commandBuffer, "VUID-VkCommandBufferInheritanceInfo-occlusionQueryEnable-00056", |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2647 | "%s: Inherited queries feature is disabled, but pBeginInfo->pInheritanceInfo->occlusionQueryEnable is VK_TRUE.", |
| 2648 | cmd_name); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2649 | } |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2650 | |
| 2651 | if (physical_device_features.inheritedQueries) { |
| 2652 | skip |= validate_flags(cmd_name, "pBeginInfo->pInheritanceInfo->queryFlags", "VkQueryControlFlagBits", |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 2653 | AllVkQueryControlFlagBits, pInfo->queryFlags, kOptionalFlags, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2654 | "VUID-VkCommandBufferInheritanceInfo-queryFlags-00057"); |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2655 | } else { // !inheritedQueries |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2656 | skip |= validate_reserved_flags(cmd_name, "pBeginInfo->pInheritanceInfo->queryFlags", pInfo->queryFlags, |
Petr Kraus | 43aed2c | 2019-08-18 13:59:16 +0200 | [diff] [blame] | 2657 | "VUID-VkCommandBufferInheritanceInfo-queryFlags-02788"); |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2658 | } |
| 2659 | |
| 2660 | if (physical_device_features.pipelineStatisticsQuery) { |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2661 | skip |= validate_flags(cmd_name, "pBeginInfo->pInheritanceInfo->pipelineStatistics", "VkQueryPipelineStatisticFlagBits", |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 2662 | AllVkQueryPipelineStatisticFlagBits, pInfo->pipelineStatistics, kOptionalFlags, |
Petr Kraus | 43aed2c | 2019-08-18 13:59:16 +0200 | [diff] [blame] | 2663 | "VUID-VkCommandBufferInheritanceInfo-pipelineStatistics-02789"); |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 2664 | } else { // !pipelineStatisticsQuery |
| 2665 | skip |= validate_reserved_flags(cmd_name, "pBeginInfo->pInheritanceInfo->pipelineStatistics", pInfo->pipelineStatistics, |
| 2666 | "VUID-VkCommandBufferInheritanceInfo-pipelineStatistics-00058"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2667 | } |
Petr Kraus | 139757b | 2019-08-15 17:19:33 +0200 | [diff] [blame] | 2668 | |
| 2669 | const auto *conditional_rendering = lvl_find_in_chain<VkCommandBufferInheritanceConditionalRenderingInfoEXT>(pInfo->pNext); |
| 2670 | if (conditional_rendering) { |
Tony-LunarG | 6c3c545 | 2019-12-13 10:37:38 -0700 | [diff] [blame] | 2671 | const auto *cr_features = lvl_find_in_chain<VkPhysicalDeviceConditionalRenderingFeaturesEXT>(device_createinfo_pnext); |
Petr Kraus | 139757b | 2019-08-15 17:19:33 +0200 | [diff] [blame] | 2672 | const auto inherited_conditional_rendering = cr_features && cr_features->inheritedConditionalRendering; |
| 2673 | if (!inherited_conditional_rendering && conditional_rendering->conditionalRenderingEnable == VK_TRUE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2674 | skip |= LogError( |
| 2675 | commandBuffer, "VUID-VkCommandBufferInheritanceConditionalRenderingInfoEXT-conditionalRenderingEnable-01977", |
Petr Kraus | 139757b | 2019-08-15 17:19:33 +0200 | [diff] [blame] | 2676 | "vkBeginCommandBuffer: Inherited conditional rendering is disabled, but " |
| 2677 | "pBeginInfo->pInheritanceInfo->pNext<VkCommandBufferInheritanceConditionalRenderingInfoEXT> is VK_TRUE."); |
| 2678 | } |
| 2679 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2680 | } |
| 2681 | |
| 2682 | return skip; |
| 2683 | } |
| 2684 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2685 | bool StatelessValidation::manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2686 | uint32_t viewportCount, const VkViewport *pViewports) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2687 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2688 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2689 | if (!physical_device_features.multiViewport) { |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 2690 | if (firstViewport != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2691 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewport-firstViewport-01224", |
| 2692 | "vkCmdSetViewport: The multiViewport feature is disabled, but firstViewport (=%" PRIu32 ") is not 0.", |
| 2693 | firstViewport); |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 2694 | } |
| 2695 | if (viewportCount > 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2696 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewport-viewportCount-01225", |
| 2697 | "vkCmdSetViewport: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 ") is not 1.", |
| 2698 | viewportCount); |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 2699 | } |
| 2700 | } else { // multiViewport enabled |
Petr Kraus | 7dfeed1 | 2018-02-27 20:51:20 +0100 | [diff] [blame] | 2701 | 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] | 2702 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2703 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewport-firstViewport-01223", |
| 2704 | "vkCmdSetViewport: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
| 2705 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 2706 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2707 | } |
| 2708 | } |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 2709 | |
| 2710 | if (pViewports) { |
| 2711 | for (uint32_t viewport_i = 0; viewport_i < viewportCount; ++viewport_i) { |
| 2712 | const auto &viewport = pViewports[viewport_i]; // will crash on invalid ptr |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 2713 | const char *fn_name = "vkCmdSetViewport"; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2714 | skip |= manual_PreCallValidateViewport( |
| 2715 | viewport, fn_name, ParameterName("pViewports[%i]", ParameterName::IndexVector{viewport_i}), commandBuffer); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 2716 | } |
| 2717 | } |
| 2718 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2719 | return skip; |
| 2720 | } |
| 2721 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2722 | bool StatelessValidation::manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2723 | uint32_t scissorCount, const VkRect2D *pScissors) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2724 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2725 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2726 | if (!physical_device_features.multiViewport) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2727 | if (firstScissor != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2728 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-firstScissor-00593", |
| 2729 | "vkCmdSetScissor: The multiViewport feature is disabled, but firstScissor (=%" PRIu32 ") is not 0.", |
| 2730 | firstScissor); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2731 | } |
| 2732 | if (scissorCount > 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2733 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-scissorCount-00594", |
| 2734 | "vkCmdSetScissor: The multiViewport feature is disabled, but scissorCount (=%" PRIu32 ") is not 1.", |
| 2735 | scissorCount); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2736 | } |
| 2737 | } else { // multiViewport enabled |
| 2738 | 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] | 2739 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2740 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-firstScissor-00592", |
| 2741 | "vkCmdSetScissor: firstScissor + scissorCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
| 2742 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 2743 | firstScissor, scissorCount, sum, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2744 | } |
| 2745 | } |
| 2746 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2747 | if (pScissors) { |
| 2748 | for (uint32_t scissor_i = 0; scissor_i < scissorCount; ++scissor_i) { |
| 2749 | const auto &scissor = pScissors[scissor_i]; // will crash on invalid ptr |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2750 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2751 | if (scissor.offset.x < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2752 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-x-00595", |
| 2753 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.x (=%" PRIi32 ") is negative.", scissor_i, |
| 2754 | scissor.offset.x); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2755 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2756 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2757 | if (scissor.offset.y < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2758 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-x-00595", |
| 2759 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.y (=%" PRIi32 ") is negative.", scissor_i, |
| 2760 | scissor.offset.y); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2761 | } |
| 2762 | |
| 2763 | const int64_t x_sum = static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 2764 | if (x_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2765 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-offset-00596", |
| 2766 | "vkCmdSetScissor: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 2767 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 2768 | scissor.offset.x, scissor.extent.width, x_sum, scissor_i); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2769 | } |
| 2770 | |
| 2771 | const int64_t y_sum = static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 2772 | if (y_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2773 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-offset-00597", |
| 2774 | "vkCmdSetScissor: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 2775 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 2776 | scissor.offset.y, scissor.extent.height, y_sum, scissor_i); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2777 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2778 | } |
| 2779 | } |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 2780 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2781 | return skip; |
| 2782 | } |
| 2783 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2784 | bool StatelessValidation::manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const { |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2785 | bool skip = false; |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2786 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2787 | if (!physical_device_features.wideLines && (lineWidth != 1.0f)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2788 | skip |= LogError(commandBuffer, "VUID-vkCmdSetLineWidth-lineWidth-00788", |
| 2789 | "VkPhysicalDeviceFeatures::wideLines is disabled, but lineWidth (=%f) is not 1.0.", lineWidth); |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 2790 | } |
| 2791 | |
| 2792 | return skip; |
| 2793 | } |
| 2794 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2795 | bool StatelessValidation::manual_PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2796 | uint32_t firstVertex, uint32_t firstInstance) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2797 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2798 | if (vertexCount == 0) { |
| 2799 | // TODO: Verify against Valid Usage section. I don't see a non-zero vertexCount listed, may need to add that and make |
| 2800 | // this an error or leave as is. |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2801 | skip |= LogWarning(device, kVUID_PVError_RequiredParameter, "vkCmdDraw parameter, uint32_t vertexCount, is 0"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2802 | } |
| 2803 | |
| 2804 | if (instanceCount == 0) { |
| 2805 | // TODO: Verify against Valid Usage section. I don't see a non-zero instanceCount listed, may need to add that and make |
| 2806 | // this an error or leave as is. |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2807 | skip |= LogWarning(device, kVUID_PVError_RequiredParameter, "vkCmdDraw parameter, uint32_t instanceCount, is 0"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2808 | } |
| 2809 | return skip; |
| 2810 | } |
| 2811 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2812 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2813 | uint32_t count, uint32_t stride) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2814 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2815 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2816 | if (!physical_device_features.multiDrawIndirect && ((count > 1))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2817 | skip |= LogError(device, kVUID_PVError_DeviceFeature, |
| 2818 | "CmdDrawIndirect(): 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] | 2819 | } |
| 2820 | return skip; |
| 2821 | } |
| 2822 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2823 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2824 | VkDeviceSize offset, uint32_t count, uint32_t stride) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2825 | bool skip = false; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2826 | if (!physical_device_features.multiDrawIndirect && ((count > 1))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2827 | skip |= |
| 2828 | LogError(device, kVUID_PVError_DeviceFeature, |
| 2829 | "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] | 2830 | } |
| 2831 | return skip; |
| 2832 | } |
| 2833 | |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 2834 | bool StatelessValidation::manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 2835 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2836 | const VkClearRect *pRects) const { |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 2837 | bool skip = false; |
| 2838 | for (uint32_t rect = 0; rect < rectCount; rect++) { |
| 2839 | if (pRects[rect].layerCount == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2840 | skip |= LogError(commandBuffer, "VUID-vkCmdClearAttachments-layerCount-01934", |
| 2841 | "CmdClearAttachments(): pRects[%d].layerCount is zero.", rect); |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 2842 | } |
| 2843 | } |
| 2844 | return skip; |
| 2845 | } |
| 2846 | |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 2847 | bool StatelessValidation::ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, |
| 2848 | const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 2849 | VkImageFormatProperties2 *pImageFormatProperties, |
| 2850 | const char *apiName) const { |
| 2851 | bool skip = false; |
| 2852 | |
| 2853 | if (pImageFormatInfo != nullptr) { |
| 2854 | const auto image_stencil_struct = lvl_find_in_chain<VkImageStencilUsageCreateInfoEXT>(pImageFormatInfo->pNext); |
| 2855 | if (image_stencil_struct != nullptr) { |
| 2856 | if ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0) { |
| 2857 | VkImageUsageFlags legal_flags = (VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); |
| 2858 | // No flags other than the legal attachment bits may be set |
| 2859 | legal_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 2860 | if ((image_stencil_struct->stencilUsage & ~legal_flags) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2861 | skip |= LogError(physicalDevice, "VUID-VkImageStencilUsageCreateInfo-stencilUsage-02539", |
| 2862 | "%s(): in pNext chain, VkImageStencilUsageCreateInfo::stencilUsage " |
| 2863 | "includes VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, it must not include bits other than " |
| 2864 | "VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT or VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT", |
| 2865 | apiName); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 2866 | } |
| 2867 | } |
| 2868 | } |
| 2869 | } |
| 2870 | |
| 2871 | return skip; |
| 2872 | } |
| 2873 | |
| 2874 | bool StatelessValidation::manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2( |
| 2875 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 2876 | VkImageFormatProperties2 *pImageFormatProperties) const { |
| 2877 | return ValidateGetPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties, |
| 2878 | "vkGetPhysicalDeviceImageFormatProperties2"); |
| 2879 | } |
| 2880 | |
| 2881 | bool StatelessValidation::manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR( |
| 2882 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 2883 | VkImageFormatProperties2 *pImageFormatProperties) const { |
| 2884 | return ValidateGetPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties, |
| 2885 | "vkGetPhysicalDeviceImageFormatProperties2KHR"); |
| 2886 | } |
| 2887 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2888 | bool StatelessValidation::manual_PreCallValidateCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, |
| 2889 | VkImageLayout srcImageLayout, VkImage dstImage, |
| 2890 | VkImageLayout dstImageLayout, uint32_t regionCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2891 | const VkImageCopy *pRegions) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2892 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2893 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2894 | VkImageAspectFlags legal_aspect_flags = |
| 2895 | 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] | 2896 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2897 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2898 | } |
| 2899 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2900 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2901 | if ((pRegions->srcSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2902 | skip |= LogError( |
| 2903 | device, "VUID-VkImageSubresourceLayers-aspectMask-parameter", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2904 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2905 | } |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2906 | if ((pRegions->dstSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2907 | skip |= LogError( |
| 2908 | device, "VUID-VkImageSubresourceLayers-aspectMask-parameter", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2909 | "vkCmdCopyImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2910 | } |
| 2911 | } |
| 2912 | return skip; |
| 2913 | } |
| 2914 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2915 | bool StatelessValidation::manual_PreCallValidateCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, |
| 2916 | VkImageLayout srcImageLayout, VkImage dstImage, |
| 2917 | VkImageLayout dstImageLayout, uint32_t regionCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2918 | const VkImageBlit *pRegions, VkFilter filter) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2919 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2920 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2921 | VkImageAspectFlags legal_aspect_flags = |
| 2922 | 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] | 2923 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2924 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2925 | } |
| 2926 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2927 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2928 | if ((pRegions->srcSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2929 | skip |= LogError( |
| 2930 | device, kVUID_PVError_UnrecognizedValue, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2931 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->srcSubresource.aspectMask, is an unrecognized enumerator"); |
| 2932 | } |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2933 | if ((pRegions->dstSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2934 | skip |= LogError( |
| 2935 | device, kVUID_PVError_UnrecognizedValue, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2936 | "vkCmdBlitImage() parameter, VkImageAspect pRegions->dstSubresource.aspectMask, is an unrecognized enumerator"); |
| 2937 | } |
| 2938 | } |
| 2939 | return skip; |
| 2940 | } |
| 2941 | |
sfricke-samsung | 3999ef6 | 2020-02-09 17:05:59 -0800 | [diff] [blame] | 2942 | bool StatelessValidation::manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 2943 | uint32_t regionCount, const VkBufferCopy *pRegions) const { |
| 2944 | bool skip = false; |
| 2945 | |
| 2946 | if (pRegions != nullptr) { |
| 2947 | for (uint32_t i = 0; i < regionCount; i++) { |
| 2948 | if (pRegions[i].size == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2949 | skip |= LogError(device, "VUID-VkBufferCopy-size-01988", |
| 2950 | "vkCmdCopyBuffer() pRegions[%u].size must be greater than zero", i); |
sfricke-samsung | 3999ef6 | 2020-02-09 17:05:59 -0800 | [diff] [blame] | 2951 | } |
| 2952 | } |
| 2953 | } |
| 2954 | return skip; |
| 2955 | } |
| 2956 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2957 | bool StatelessValidation::manual_PreCallValidateCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, |
| 2958 | VkImage dstImage, VkImageLayout dstImageLayout, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2959 | uint32_t regionCount, |
| 2960 | const VkBufferImageCopy *pRegions) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2961 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2962 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2963 | VkImageAspectFlags legal_aspect_flags = |
| 2964 | 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] | 2965 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2966 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2967 | } |
| 2968 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2969 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2970 | if ((pRegions->imageSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2971 | skip |= LogError(device, kVUID_PVError_UnrecognizedValue, |
| 2972 | "vkCmdCopyBufferToImage() parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an " |
| 2973 | "unrecognized enumerator"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2974 | } |
| 2975 | } |
| 2976 | return skip; |
| 2977 | } |
| 2978 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2979 | bool StatelessValidation::manual_PreCallValidateCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, |
| 2980 | VkImageLayout srcImageLayout, VkBuffer dstBuffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 2981 | uint32_t regionCount, |
| 2982 | const VkBufferImageCopy *pRegions) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2983 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2984 | |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2985 | VkImageAspectFlags legal_aspect_flags = |
| 2986 | 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] | 2987 | if (device_extensions.vk_khr_sampler_ycbcr_conversion) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2988 | legal_aspect_flags |= (VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | VK_IMAGE_ASPECT_PLANE_2_BIT_KHR); |
| 2989 | } |
| 2990 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2991 | if (pRegions != nullptr) { |
Dave Houlton | f521761 | 2018-02-02 16:18:52 -0700 | [diff] [blame] | 2992 | if ((pRegions->imageSubresource.aspectMask & legal_aspect_flags) == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2993 | LogError(device, kVUID_PVError_UnrecognizedValue, |
| 2994 | "vkCmdCopyImageToBuffer parameter, VkImageAspect pRegions->imageSubresource.aspectMask, is an unrecognized " |
| 2995 | "enumerator"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2996 | } |
| 2997 | } |
| 2998 | return skip; |
| 2999 | } |
| 3000 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3001 | bool StatelessValidation::manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3002 | VkDeviceSize dstOffset, VkDeviceSize dataSize, |
| 3003 | const void *pData) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3004 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3005 | |
| 3006 | if (dstOffset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3007 | skip |= LogError(device, "VUID-vkCmdUpdateBuffer-dstOffset-00036", |
| 3008 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", |
| 3009 | dstOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3010 | } |
| 3011 | |
| 3012 | if ((dataSize <= 0) || (dataSize > 65536)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3013 | skip |= LogError(device, "VUID-vkCmdUpdateBuffer-dataSize-00037", |
| 3014 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 |
| 3015 | "), must be greater than zero and less than or equal to 65536.", |
| 3016 | dataSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3017 | } else if (dataSize & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3018 | skip |= LogError(device, "VUID-vkCmdUpdateBuffer-dataSize-00038", |
| 3019 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 "), is not a multiple of 4.", |
| 3020 | dataSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3021 | } |
| 3022 | return skip; |
| 3023 | } |
| 3024 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3025 | bool StatelessValidation::manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3026 | VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3027 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3028 | |
| 3029 | if (dstOffset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3030 | skip |= LogError(device, "VUID-vkCmdFillBuffer-dstOffset-00025", |
| 3031 | "vkCmdFillBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", |
| 3032 | dstOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3033 | } |
| 3034 | |
| 3035 | if (size != VK_WHOLE_SIZE) { |
| 3036 | if (size <= 0) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 3037 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3038 | LogError(device, "VUID-vkCmdFillBuffer-size-00026", |
| 3039 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), must be greater than zero.", size); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3040 | } else if (size & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3041 | skip |= LogError(device, "VUID-vkCmdFillBuffer-size-00028", |
| 3042 | "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] | 3043 | } |
| 3044 | } |
| 3045 | return skip; |
| 3046 | } |
| 3047 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3048 | bool StatelessValidation::manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3049 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3050 | VkSwapchainKHR *pSwapchain) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3051 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3052 | |
| 3053 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3054 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3055 | if (pCreateInfo->imageSharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 3056 | // If imageSharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 3057 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3058 | skip |= LogError(device, "VUID-VkSwapchainCreateInfoKHR-imageSharingMode-01278", |
| 3059 | "vkCreateSwapchainKHR(): if pCreateInfo->imageSharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 3060 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3061 | } |
| 3062 | |
| 3063 | // If imageSharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 3064 | // queueFamilyIndexCount uint32_t values |
| 3065 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3066 | skip |= LogError(device, "VUID-VkSwapchainCreateInfoKHR-imageSharingMode-01277", |
| 3067 | "vkCreateSwapchainKHR(): if pCreateInfo->imageSharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 3068 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 3069 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3070 | } |
| 3071 | } |
| 3072 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3073 | skip |= ValidateGreaterThanZero(pCreateInfo->imageArrayLayers, "pCreateInfo->imageArrayLayers", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3074 | "VUID-VkSwapchainCreateInfoKHR-imageArrayLayers-01275", "vkCreateSwapchainKHR"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3075 | } |
| 3076 | |
| 3077 | return skip; |
| 3078 | } |
| 3079 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3080 | bool StatelessValidation::manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3081 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3082 | |
| 3083 | if (pPresentInfo && pPresentInfo->pNext) { |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 3084 | const auto *present_regions = lvl_find_in_chain<VkPresentRegionsKHR>(pPresentInfo->pNext); |
| 3085 | if (present_regions) { |
| 3086 | // TODO: This and all other pNext extension dependencies should be added to code-generation |
Tony-LunarG | 2ec96bb | 2019-11-26 13:43:02 -0700 | [diff] [blame] | 3087 | skip |= require_device_extension(IsExtEnabled(device_extensions.vk_khr_incremental_present), "vkQueuePresentKHR", |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 3088 | VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME); |
| 3089 | if (present_regions->swapchainCount != pPresentInfo->swapchainCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3090 | skip |= LogError(device, kVUID_PVError_InvalidUsage, |
| 3091 | "QueuePresentKHR(): pPresentInfo->swapchainCount has a value of %i but VkPresentRegionsKHR " |
| 3092 | "extension swapchainCount is %i. These values must be equal.", |
| 3093 | pPresentInfo->swapchainCount, present_regions->swapchainCount); |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 3094 | } |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3095 | skip |= validate_struct_pnext("QueuePresentKHR", "pCreateInfo->pNext->pNext", NULL, present_regions->pNext, 0, NULL, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 3096 | GeneratedVulkanHeaderVersion, "VUID-VkPresentInfoKHR-pNext-pNext", |
| 3097 | "VUID-VkPresentInfoKHR-sType-unique"); |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3098 | skip |= validate_array("QueuePresentKHR", "pCreateInfo->pNext->swapchainCount", "pCreateInfo->pNext->pRegions", |
| 3099 | present_regions->swapchainCount, &present_regions->pRegions, true, false, kVUIDUndefined, |
| 3100 | kVUIDUndefined); |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 3101 | for (uint32_t i = 0; i < present_regions->swapchainCount; ++i) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3102 | skip |= validate_array("QueuePresentKHR", "pCreateInfo->pNext->pRegions[].rectangleCount", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3103 | "pCreateInfo->pNext->pRegions[].pRectangles", present_regions->pRegions[i].rectangleCount, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3104 | &present_regions->pRegions[i].pRectangles, true, false, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3105 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3106 | } |
| 3107 | } |
| 3108 | |
| 3109 | return skip; |
| 3110 | } |
| 3111 | |
| 3112 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3113 | bool StatelessValidation::manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, |
| 3114 | const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 3115 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3116 | VkSurfaceKHR *pSurface) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3117 | bool skip = false; |
| 3118 | |
| 3119 | if (pCreateInfo->hwnd == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3120 | skip |= LogError(device, "VUID-VkWin32SurfaceCreateInfoKHR-hwnd-01308", |
| 3121 | "vkCreateWin32SurfaceKHR(): hwnd must be a valid Win32 HWND but hwnd is NULL."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3122 | } |
| 3123 | |
| 3124 | return skip; |
| 3125 | } |
| 3126 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 3127 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3128 | bool StatelessValidation::manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3129 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3130 | VkDescriptorPool *pDescriptorPool) const { |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 3131 | bool skip = false; |
| 3132 | |
| 3133 | if (pCreateInfo) { |
| 3134 | if (pCreateInfo->maxSets <= 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3135 | skip |= LogError(device, "VUID-VkDescriptorPoolCreateInfo-maxSets-00301", |
| 3136 | "vkCreateDescriptorPool(): pCreateInfo->maxSets is not greater than 0."); |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 3137 | } |
| 3138 | |
| 3139 | if (pCreateInfo->pPoolSizes) { |
| 3140 | for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; ++i) { |
| 3141 | if (pCreateInfo->pPoolSizes[i].descriptorCount <= 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3142 | skip |= LogError( |
| 3143 | device, "VUID-VkDescriptorPoolSize-descriptorCount-00302", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 3144 | "vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[%" PRIu32 "].descriptorCount is not greater than 0.", i); |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 3145 | } |
Jeff Bolz | e54ae89 | 2018-09-08 12:16:29 -0500 | [diff] [blame] | 3146 | if (pCreateInfo->pPoolSizes[i].type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT && |
| 3147 | (pCreateInfo->pPoolSizes[i].descriptorCount % 4) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3148 | skip |= LogError(device, "VUID-VkDescriptorPoolSize-type-02218", |
| 3149 | "vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[%" PRIu32 |
| 3150 | "].type is VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT " |
| 3151 | " and pCreateInfo->pPoolSizes[%" PRIu32 "].descriptorCount is not a multiple of 4.", |
| 3152 | i, i); |
Jeff Bolz | e54ae89 | 2018-09-08 12:16:29 -0500 | [diff] [blame] | 3153 | } |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 3154 | } |
| 3155 | } |
| 3156 | } |
| 3157 | |
| 3158 | return skip; |
| 3159 | } |
| 3160 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3161 | bool StatelessValidation::manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3162 | uint32_t groupCountY, uint32_t groupCountZ) const { |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3163 | bool skip = false; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3164 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3165 | if (groupCountX > device_limits.maxComputeWorkGroupCount[0]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 3166 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3167 | LogError(commandBuffer, "VUID-vkCmdDispatch-groupCountX-00386", |
| 3168 | "vkCmdDispatch(): groupCountX (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 3169 | groupCountX, device_limits.maxComputeWorkGroupCount[0]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3170 | } |
| 3171 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3172 | if (groupCountY > device_limits.maxComputeWorkGroupCount[1]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 3173 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3174 | LogError(commandBuffer, "VUID-vkCmdDispatch-groupCountY-00387", |
| 3175 | "vkCmdDispatch(): groupCountY (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 3176 | groupCountY, device_limits.maxComputeWorkGroupCount[1]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3177 | } |
| 3178 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3179 | if (groupCountZ > device_limits.maxComputeWorkGroupCount[2]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 3180 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3181 | LogError(commandBuffer, "VUID-vkCmdDispatch-groupCountZ-00388", |
| 3182 | "vkCmdDispatch(): groupCountZ (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 3183 | groupCountZ, device_limits.maxComputeWorkGroupCount[2]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3184 | } |
| 3185 | |
| 3186 | return skip; |
| 3187 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3188 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3189 | bool StatelessValidation::manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3190 | VkDeviceSize offset) const { |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 3191 | bool skip = false; |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 3192 | |
| 3193 | if ((offset % 4) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3194 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchIndirect-offset-02710", |
| 3195 | "vkCmdDispatchIndirect(): offset (%" PRIu64 ") must be a multiple of 4.", offset); |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 3196 | } |
| 3197 | return skip; |
| 3198 | } |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3199 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3200 | bool StatelessValidation::manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, |
| 3201 | uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3202 | uint32_t groupCountY, uint32_t groupCountZ) const { |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3203 | bool skip = false; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3204 | |
| 3205 | // Paired if {} else if {} tests used to avoid any possible uint underflow |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3206 | uint32_t limit = device_limits.maxComputeWorkGroupCount[0]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3207 | if (baseGroupX >= limit) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3208 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-baseGroupX-00421", |
| 3209 | "vkCmdDispatch(): baseGroupX (%" PRIu32 |
| 3210 | ") equals or exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 3211 | baseGroupX, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3212 | } else if (groupCountX > (limit - baseGroupX)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3213 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-groupCountX-00424", |
| 3214 | "vkCmdDispatchBaseKHR(): baseGroupX (%" PRIu32 ") + groupCountX (%" PRIu32 |
| 3215 | ") exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 3216 | baseGroupX, groupCountX, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3217 | } |
| 3218 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3219 | limit = device_limits.maxComputeWorkGroupCount[1]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3220 | if (baseGroupY >= limit) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3221 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-baseGroupX-00422", |
| 3222 | "vkCmdDispatch(): baseGroupY (%" PRIu32 |
| 3223 | ") equals or exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 3224 | baseGroupY, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3225 | } else if (groupCountY > (limit - baseGroupY)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3226 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-groupCountY-00425", |
| 3227 | "vkCmdDispatchBaseKHR(): baseGroupY (%" PRIu32 ") + groupCountY (%" PRIu32 |
| 3228 | ") exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 3229 | baseGroupY, groupCountY, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3230 | } |
| 3231 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3232 | limit = device_limits.maxComputeWorkGroupCount[2]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3233 | if (baseGroupZ >= limit) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3234 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-baseGroupZ-00423", |
| 3235 | "vkCmdDispatch(): baseGroupZ (%" PRIu32 |
| 3236 | ") equals or exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 3237 | baseGroupZ, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3238 | } else if (groupCountZ > (limit - baseGroupZ)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3239 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-groupCountZ-00426", |
| 3240 | "vkCmdDispatchBaseKHR(): baseGroupZ (%" PRIu32 ") + groupCountZ (%" PRIu32 |
| 3241 | ") exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 3242 | baseGroupZ, groupCountZ, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 3243 | } |
| 3244 | |
| 3245 | return skip; |
| 3246 | } |
| 3247 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 3248 | bool StatelessValidation::manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, |
| 3249 | VkPipelineBindPoint pipelineBindPoint, |
| 3250 | VkPipelineLayout layout, uint32_t set, |
| 3251 | uint32_t descriptorWriteCount, |
| 3252 | const VkWriteDescriptorSet *pDescriptorWrites) const { |
| 3253 | return validate_WriteDescriptorSet("vkCmdPushDescriptorSetKHR", descriptorWriteCount, pDescriptorWrites, false); |
| 3254 | } |
| 3255 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3256 | bool StatelessValidation::manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, |
| 3257 | uint32_t firstExclusiveScissor, |
| 3258 | uint32_t exclusiveScissorCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3259 | const VkRect2D *pExclusiveScissors) const { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3260 | bool skip = false; |
| 3261 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3262 | if (!physical_device_features.multiViewport) { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3263 | if (firstExclusiveScissor != 0) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 3264 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3265 | LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02035", |
| 3266 | "vkCmdSetExclusiveScissorNV: The multiViewport feature is disabled, but firstExclusiveScissor (=%" PRIu32 |
| 3267 | ") is not 0.", |
| 3268 | firstExclusiveScissor); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3269 | } |
| 3270 | if (exclusiveScissorCount > 1) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 3271 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3272 | LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-exclusiveScissorCount-02036", |
| 3273 | "vkCmdSetExclusiveScissorNV: The multiViewport feature is disabled, but exclusiveScissorCount (=%" PRIu32 |
| 3274 | ") is not 1.", |
| 3275 | exclusiveScissorCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3276 | } |
| 3277 | } else { // multiViewport enabled |
| 3278 | 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] | 3279 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3280 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02034", |
| 3281 | "vkCmdSetExclusiveScissorNV: firstExclusiveScissor + exclusiveScissorCount (=%" PRIu32 " + %" PRIu32 |
| 3282 | " = %" PRIu64 ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 3283 | firstExclusiveScissor, exclusiveScissorCount, sum, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3284 | } |
| 3285 | } |
| 3286 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3287 | if (firstExclusiveScissor >= device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3288 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02033", |
| 3289 | "vkCmdSetExclusiveScissorNV: firstExclusiveScissor (=%" PRIu32 |
| 3290 | ") must be less than maxViewports (=%" PRIu32 ").", |
| 3291 | firstExclusiveScissor, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3292 | } |
| 3293 | |
| 3294 | if (pExclusiveScissors) { |
| 3295 | for (uint32_t scissor_i = 0; scissor_i < exclusiveScissorCount; ++scissor_i) { |
| 3296 | const auto &scissor = pExclusiveScissors[scissor_i]; // will crash on invalid ptr |
| 3297 | |
| 3298 | if (scissor.offset.x < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3299 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-x-02037", |
| 3300 | "vkCmdSetExclusiveScissorNV: pScissors[%" PRIu32 "].offset.x (=%" PRIi32 ") is negative.", |
| 3301 | scissor_i, scissor.offset.x); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3302 | } |
| 3303 | |
| 3304 | if (scissor.offset.y < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3305 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-x-02037", |
| 3306 | "vkCmdSetExclusiveScissorNV: pScissors[%" PRIu32 "].offset.y (=%" PRIi32 ") is negative.", |
| 3307 | scissor_i, scissor.offset.y); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3308 | } |
| 3309 | |
| 3310 | const int64_t x_sum = static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 3311 | if (x_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3312 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-offset-02038", |
| 3313 | "vkCmdSetExclusiveScissorNV: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 3314 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 3315 | scissor.offset.x, scissor.extent.width, x_sum, scissor_i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3316 | } |
| 3317 | |
| 3318 | const int64_t y_sum = static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 3319 | if (y_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3320 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-offset-02039", |
| 3321 | "vkCmdSetExclusiveScissorNV: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 3322 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 3323 | scissor.offset.y, scissor.extent.height, y_sum, scissor_i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 3324 | } |
| 3325 | } |
| 3326 | } |
| 3327 | |
| 3328 | return skip; |
| 3329 | } |
| 3330 | |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 3331 | bool StatelessValidation::manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
| 3332 | uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3333 | const VkViewportWScalingNV *pViewportWScalings) const { |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 3334 | bool skip = false; |
| 3335 | if (firstViewport >= device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3336 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportWScalingNV-firstViewport-01323", |
| 3337 | "vkCmdSetViewportWScalingNV: firstViewport (=%" PRIu32 ") must be less than maxViewports (=%" PRIu32 ").", |
| 3338 | firstViewport, device_limits.maxViewports); |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 3339 | } else { |
| 3340 | const uint64_t sum = static_cast<uint64_t>(firstViewport) + static_cast<uint64_t>(viewportCount); |
| 3341 | if ((sum < 1) || (sum > device_limits.maxViewports)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3342 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportWScalingNV-firstViewport-01324", |
| 3343 | "vkCmdSetViewportWScalingNV: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
| 3344 | ") must be between 1 and VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 "), inculsive.", |
| 3345 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 3346 | } |
| 3347 | } |
| 3348 | |
| 3349 | return skip; |
| 3350 | } |
| 3351 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3352 | bool StatelessValidation::manual_PreCallValidateCmdSetViewportShadingRatePaletteNV( |
| 3353 | VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3354 | const VkShadingRatePaletteNV *pShadingRatePalettes) const { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3355 | bool skip = false; |
| 3356 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3357 | if (!physical_device_features.multiViewport) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3358 | if (firstViewport != 0) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 3359 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3360 | LogError(commandBuffer, "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02068", |
| 3361 | "vkCmdSetViewportShadingRatePaletteNV: The multiViewport feature is disabled, but firstViewport (=%" PRIu32 |
| 3362 | ") is not 0.", |
| 3363 | firstViewport); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3364 | } |
| 3365 | if (viewportCount > 1) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 3366 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3367 | LogError(commandBuffer, "VUID-vkCmdSetViewportShadingRatePaletteNV-viewportCount-02069", |
| 3368 | "vkCmdSetViewportShadingRatePaletteNV: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 |
| 3369 | ") is not 1.", |
| 3370 | viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3371 | } |
| 3372 | } |
| 3373 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3374 | if (firstViewport >= device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3375 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02066", |
| 3376 | "vkCmdSetViewportShadingRatePaletteNV: firstViewport (=%" PRIu32 |
| 3377 | ") must be less than maxViewports (=%" PRIu32 ").", |
| 3378 | firstViewport, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3379 | } |
| 3380 | |
| 3381 | 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] | 3382 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3383 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02067", |
| 3384 | "vkCmdSetViewportShadingRatePaletteNV: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 |
| 3385 | " = %" PRIu64 ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 3386 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3387 | } |
| 3388 | |
| 3389 | return skip; |
| 3390 | } |
| 3391 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3392 | bool StatelessValidation::manual_PreCallValidateCmdSetCoarseSampleOrderNV( |
| 3393 | VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, |
| 3394 | const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3395 | bool skip = false; |
| 3396 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 3397 | if (sampleOrderType != VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV && customSampleOrderCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3398 | skip |= LogError(commandBuffer, "VUID-vkCmdSetCoarseSampleOrderNV-sampleOrderType-02081", |
| 3399 | "vkCmdSetCoarseSampleOrderNV: If sampleOrderType is not VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV, " |
| 3400 | "customSampleOrderCount must be 0."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3401 | } |
| 3402 | |
| 3403 | for (uint32_t order_i = 0; order_i < customSampleOrderCount; ++order_i) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3404 | skip |= ValidateCoarseSampleOrderCustomNV(&pCustomSampleOrders[order_i]); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 3405 | } |
| 3406 | |
| 3407 | return skip; |
| 3408 | } |
| 3409 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3410 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3411 | uint32_t firstTask) const { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3412 | bool skip = false; |
| 3413 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3414 | if (taskCount > phys_dev_ext_props.mesh_shader_props.maxDrawMeshTasksCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3415 | skip |= LogError( |
| 3416 | commandBuffer, "VUID-vkCmdDrawMeshTasksNV-taskCount-02119", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 3417 | "vkCmdDrawMeshTasksNV() parameter, uint32_t taskCount (0x%" PRIxLEAST32 |
| 3418 | "), must be less than or equal to VkPhysicalDeviceMeshShaderPropertiesNV::maxDrawMeshTasksCount (0x%" PRIxLEAST32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3419 | taskCount, phys_dev_ext_props.mesh_shader_props.maxDrawMeshTasksCount); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3420 | } |
| 3421 | |
| 3422 | return skip; |
| 3423 | } |
| 3424 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3425 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 3426 | VkDeviceSize offset, uint32_t drawCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3427 | uint32_t stride) const { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3428 | bool skip = false; |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 3429 | static const int condition_multiples = 0b0011; |
| 3430 | if (offset & condition_multiples) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3431 | skip |= LogError( |
| 3432 | commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectNV-offset-02710", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 3433 | "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] | 3434 | } |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 3435 | if (drawCount > 1 && ((stride & condition_multiples) || stride < sizeof(VkDrawMeshTasksIndirectCommandNV))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3436 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02146", |
| 3437 | "vkCmdDrawMeshTasksIndirectNV() parameter, uint32_t stride (0x%" PRIxLEAST32 |
| 3438 | "), is not a multiple of 4 or smaller than sizeof (VkDrawMeshTasksIndirectCommandNV).", |
| 3439 | stride); |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 3440 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3441 | if (!physical_device_features.multiDrawIndirect && ((drawCount > 1))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3442 | skip |= LogError( |
| 3443 | commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02718", |
| 3444 | "vkCmdDrawMeshTasksIndirectNV(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %d", drawCount); |
Jeff Bolz | b574c34 | 2018-11-08 15:36:57 -0600 | [diff] [blame] | 3445 | } |
| 3446 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3447 | return skip; |
| 3448 | } |
| 3449 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3450 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 3451 | VkDeviceSize offset, VkBuffer countBuffer, |
| 3452 | VkDeviceSize countBufferOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3453 | uint32_t maxDrawCount, uint32_t stride) const { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3454 | bool skip = false; |
| 3455 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3456 | if (offset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3457 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectCountNV-offset-02710", |
| 3458 | "vkCmdDrawMeshTasksIndirectCountNV() parameter, VkDeviceSize offset (0x%" PRIxLEAST64 |
| 3459 | "), is not a multiple of 4.", |
| 3460 | offset); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3461 | } |
| 3462 | |
| 3463 | if (countBufferOffset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3464 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectCountNV-countBufferOffset-02716", |
| 3465 | "vkCmdDrawMeshTasksIndirectCountNV() parameter, VkDeviceSize countBufferOffset (0x%" PRIxLEAST64 |
| 3466 | "), is not a multiple of 4.", |
| 3467 | countBufferOffset); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3468 | } |
| 3469 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 3470 | return skip; |
| 3471 | } |
| 3472 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3473 | bool StatelessValidation::manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3474 | const VkAllocationCallbacks *pAllocator, |
| 3475 | VkQueryPool *pQueryPool) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3476 | bool skip = false; |
| 3477 | |
| 3478 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3479 | if (pCreateInfo != nullptr) { |
| 3480 | // If queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, pipelineStatistics must be a valid combination of |
| 3481 | // VkQueryPipelineStatisticFlagBits values |
| 3482 | if ((pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) && (pCreateInfo->pipelineStatistics != 0) && |
| 3483 | ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3484 | skip |= LogError(device, "VUID-VkQueryPoolCreateInfo-queryType-00792", |
| 3485 | "vkCreateQueryPool(): if pCreateInfo->queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, " |
| 3486 | "pCreateInfo->pipelineStatistics must be a valid combination of VkQueryPipelineStatisticFlagBits " |
| 3487 | "values."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3488 | } |
Mark Lobodzinski | b7a2638 | 2018-07-02 13:14:26 -0600 | [diff] [blame] | 3489 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3490 | return skip; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3491 | } |
| 3492 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3493 | bool StatelessValidation::manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 3494 | const char *pLayerName, uint32_t *pPropertyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3495 | VkExtensionProperties *pProperties) const { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3496 | return validate_array("vkEnumerateDeviceExtensionProperties", "pPropertyCount", "pProperties", pPropertyCount, &pProperties, |
| 3497 | true, false, false, kVUIDUndefined, "VUID-vkEnumerateDeviceExtensionProperties-pProperties-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3498 | } |
| 3499 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3500 | void StatelessValidation::PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 3501 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 3502 | VkResult result) { |
| 3503 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3504 | RecordRenderPass(*pRenderPass, pCreateInfo); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3505 | } |
| 3506 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3507 | void StatelessValidation::PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 3508 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 3509 | VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3510 | // 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] | 3511 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3512 | RecordRenderPass(*pRenderPass, pCreateInfo); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3513 | } |
| 3514 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3515 | void StatelessValidation::PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, |
| 3516 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3517 | // 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] | 3518 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3519 | renderpasses_states.erase(renderPass); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3520 | } |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 3521 | |
| 3522 | bool StatelessValidation::manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3523 | const VkAllocationCallbacks *pAllocator, |
| 3524 | VkDeviceMemory *pMemory) const { |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 3525 | bool skip = false; |
| 3526 | |
| 3527 | if (pAllocateInfo) { |
| 3528 | auto chained_prio_struct = lvl_find_in_chain<VkMemoryPriorityAllocateInfoEXT>(pAllocateInfo->pNext); |
| 3529 | if (chained_prio_struct && (chained_prio_struct->priority < 0.0f || chained_prio_struct->priority > 1.0f)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3530 | skip |= LogError(device, "VUID-VkMemoryPriorityAllocateInfoEXT-priority-02602", |
| 3531 | "priority (=%f) must be between `0` and `1`, inclusive.", chained_prio_struct->priority); |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 3532 | } |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 3533 | |
| 3534 | VkMemoryAllocateFlags flags = 0; |
| 3535 | auto flags_info = lvl_find_in_chain<VkMemoryAllocateFlagsInfo>(pAllocateInfo->pNext); |
| 3536 | if (flags_info) { |
| 3537 | flags = flags_info->flags; |
| 3538 | } |
| 3539 | |
| 3540 | auto opaque_alloc_info = lvl_find_in_chain<VkMemoryOpaqueCaptureAddressAllocateInfoKHR>(pAllocateInfo->pNext); |
| 3541 | if (opaque_alloc_info && opaque_alloc_info->opaqueCaptureAddress != 0) { |
| 3542 | if (!(flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3543 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-opaqueCaptureAddress-03329", |
| 3544 | "If opaqueCaptureAddress is non-zero, VkMemoryAllocateFlagsInfo::flags must include " |
| 3545 | "VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 3546 | } |
| 3547 | |
| 3548 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3549 | auto import_memory_win32_handle = lvl_find_in_chain<VkImportMemoryWin32HandleInfoKHR>(pAllocateInfo->pNext); |
| 3550 | #endif |
| 3551 | auto import_memory_fd = lvl_find_in_chain<VkImportMemoryFdInfoKHR>(pAllocateInfo->pNext); |
| 3552 | auto import_memory_host_pointer = lvl_find_in_chain<VkImportMemoryHostPointerInfoEXT>(pAllocateInfo->pNext); |
| 3553 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 3554 | auto import_memory_ahb = lvl_find_in_chain<VkImportAndroidHardwareBufferInfoANDROID>(pAllocateInfo->pNext); |
| 3555 | #endif |
| 3556 | |
| 3557 | if (import_memory_host_pointer) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3558 | skip |= LogError( |
| 3559 | device, "VUID-VkMemoryAllocateInfo-pNext-03332", |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 3560 | "If the pNext chain includes a VkImportMemoryHostPointerInfoEXT structure, opaqueCaptureAddress must be zero."); |
| 3561 | } |
| 3562 | if ( |
| 3563 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3564 | (import_memory_win32_handle && import_memory_win32_handle->handleType) || |
| 3565 | #endif |
| 3566 | (import_memory_fd && import_memory_fd->handleType) || |
| 3567 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 3568 | (import_memory_ahb && import_memory_ahb->buffer) || |
| 3569 | #endif |
| 3570 | (import_memory_host_pointer && import_memory_host_pointer->handleType)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3571 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-opaqueCaptureAddress-03333", |
| 3572 | "If the parameters define an import operation, opaqueCaptureAddress must be zero."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 3573 | } |
| 3574 | } |
| 3575 | |
| 3576 | if (flags) { |
Tony-LunarG | a74d3fe | 2019-11-22 15:43:20 -0700 | [diff] [blame] | 3577 | VkBool32 capture_replay = false; |
| 3578 | VkBool32 buffer_device_address = false; |
| 3579 | const auto *vulkan_12_features = lvl_find_in_chain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext); |
| 3580 | if (vulkan_12_features) { |
| 3581 | capture_replay = vulkan_12_features->bufferDeviceAddressCaptureReplay; |
| 3582 | buffer_device_address = vulkan_12_features->bufferDeviceAddress; |
| 3583 | } else { |
| 3584 | const auto *bda_features = |
| 3585 | lvl_find_in_chain<VkPhysicalDeviceBufferDeviceAddressFeaturesKHR>(device_createinfo_pnext); |
| 3586 | if (bda_features) { |
| 3587 | capture_replay = bda_features->bufferDeviceAddressCaptureReplay; |
| 3588 | buffer_device_address = bda_features->bufferDeviceAddress; |
| 3589 | } |
| 3590 | } |
| 3591 | if ((flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR) && !capture_replay) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3592 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-flags-03330", |
| 3593 | "If VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR is set, " |
| 3594 | "bufferDeviceAddressCaptureReplay must be enabled."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 3595 | } |
Tony-LunarG | a74d3fe | 2019-11-22 15:43:20 -0700 | [diff] [blame] | 3596 | if ((flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR) && !buffer_device_address) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3597 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-flags-03331", |
| 3598 | "If VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR is set, bufferDeviceAddress must be enabled."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 3599 | } |
| 3600 | } |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 3601 | } |
| 3602 | return skip; |
| 3603 | } |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3604 | |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3605 | bool StatelessValidation::ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3606 | VkAccelerationStructureNV object_handle, const char *func_name) const { |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3607 | bool skip = false; |
| 3608 | |
| 3609 | if (triangles.vertexFormat != VK_FORMAT_R32G32B32_SFLOAT && triangles.vertexFormat != VK_FORMAT_R16G16B16_SFLOAT && |
| 3610 | triangles.vertexFormat != VK_FORMAT_R16G16B16_SNORM && triangles.vertexFormat != VK_FORMAT_R32G32_SFLOAT && |
| 3611 | triangles.vertexFormat != VK_FORMAT_R16G16_SFLOAT && triangles.vertexFormat != VK_FORMAT_R16G16_SNORM) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3612 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-vertexFormat-02430", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3613 | } else { |
| 3614 | uint32_t vertex_component_size = 0; |
| 3615 | if (triangles.vertexFormat == VK_FORMAT_R32G32B32_SFLOAT || triangles.vertexFormat == VK_FORMAT_R32G32_SFLOAT) { |
| 3616 | vertex_component_size = 4; |
| 3617 | } else if (triangles.vertexFormat == VK_FORMAT_R16G16B16_SFLOAT || triangles.vertexFormat == VK_FORMAT_R16G16B16_SNORM || |
| 3618 | triangles.vertexFormat == VK_FORMAT_R16G16_SFLOAT || triangles.vertexFormat == VK_FORMAT_R16G16_SNORM) { |
| 3619 | vertex_component_size = 2; |
| 3620 | } |
| 3621 | if (vertex_component_size > 0 && SafeModulo(triangles.vertexOffset, vertex_component_size) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3622 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-vertexOffset-02429", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3623 | } |
| 3624 | } |
| 3625 | |
| 3626 | if (triangles.indexType != VK_INDEX_TYPE_UINT32 && triangles.indexType != VK_INDEX_TYPE_UINT16 && |
| 3627 | triangles.indexType != VK_INDEX_TYPE_NONE_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3628 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexType-02433", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3629 | } else { |
| 3630 | uint32_t index_element_size = 0; |
| 3631 | if (triangles.indexType == VK_INDEX_TYPE_UINT32) { |
| 3632 | index_element_size = 4; |
| 3633 | } else if (triangles.indexType == VK_INDEX_TYPE_UINT16) { |
| 3634 | index_element_size = 2; |
| 3635 | } |
| 3636 | if (index_element_size > 0 && SafeModulo(triangles.indexOffset, index_element_size) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3637 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexOffset-02432", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3638 | } |
| 3639 | } |
| 3640 | if (triangles.indexType == VK_INDEX_TYPE_NONE_NV) { |
| 3641 | if (triangles.indexCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3642 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexCount-02436", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3643 | } |
| 3644 | if (triangles.indexData != VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3645 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexData-02434", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3646 | } |
| 3647 | } |
| 3648 | |
| 3649 | if (SafeModulo(triangles.transformOffset, 16) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3650 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-transformOffset-02438", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3651 | } |
| 3652 | |
| 3653 | return skip; |
| 3654 | } |
| 3655 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3656 | bool StatelessValidation::ValidateGeometryAABBNV(const VkGeometryAABBNV &aabbs, VkAccelerationStructureNV object_handle, |
| 3657 | const char *func_name) const { |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3658 | bool skip = false; |
| 3659 | |
| 3660 | if (SafeModulo(aabbs.offset, 8) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3661 | skip |= LogError(object_handle, "VUID-VkGeometryAABBNV-offset-02440", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3662 | } |
| 3663 | if (SafeModulo(aabbs.stride, 8) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3664 | skip |= LogError(object_handle, "VUID-VkGeometryAABBNV-stride-02441", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3665 | } |
| 3666 | |
| 3667 | return skip; |
| 3668 | } |
| 3669 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3670 | bool StatelessValidation::ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, |
| 3671 | const char *func_name) const { |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3672 | bool skip = false; |
| 3673 | if (geometry.geometryType == VK_GEOMETRY_TYPE_TRIANGLES_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3674 | skip = ValidateGeometryTrianglesNV(geometry.geometry.triangles, object_handle, func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3675 | } else if (geometry.geometryType == VK_GEOMETRY_TYPE_AABBS_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3676 | skip = ValidateGeometryAABBNV(geometry.geometry.aabbs, object_handle, func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3677 | } |
| 3678 | return skip; |
| 3679 | } |
| 3680 | |
| 3681 | bool StatelessValidation::ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3682 | VkAccelerationStructureNV object_handle, |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3683 | const char *func_name) const { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3684 | bool skip = false; |
| 3685 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV && info.geometryCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3686 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-type-02425", |
| 3687 | "VkAccelerationStructureInfoNV: If type is VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV then " |
| 3688 | "geometryCount must be 0."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3689 | } |
| 3690 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV && info.instanceCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3691 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-type-02426", |
| 3692 | "VkAccelerationStructureInfoNV: If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV then " |
| 3693 | "instanceCount must be 0."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3694 | } |
| 3695 | if (info.flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV && |
| 3696 | info.flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3697 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-flags-02592", |
| 3698 | "VkAccelerationStructureInfoNV: If flags has the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV" |
| 3699 | "bit set, then it must not have the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV bit set."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3700 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame^] | 3701 | if (info.geometryCount > phys_dev_ext_props.ray_tracing_propsNV.maxGeometryCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3702 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-geometryCount-02422", |
| 3703 | "VkAccelerationStructureInfoNV: geometryCount must be less than or equal to " |
| 3704 | "VkPhysicalDeviceRayTracingPropertiesNV::maxGeometryCount."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3705 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame^] | 3706 | if (info.instanceCount > phys_dev_ext_props.ray_tracing_propsNV.maxInstanceCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3707 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-instanceCount-02423", |
| 3708 | "VkAccelerationStructureInfoNV: instanceCount must be less than or equal to " |
| 3709 | "VkPhysicalDeviceRayTracingPropertiesNV::maxInstanceCount."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3710 | } |
Jason Macnak | 21ba97e | 2019-08-09 12:57:44 -0700 | [diff] [blame] | 3711 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV && info.geometryCount > 0) { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3712 | uint64_t total_triangle_count = 0; |
| 3713 | for (uint32_t i = 0; i < info.geometryCount; i++) { |
| 3714 | const VkGeometryNV &geometry = info.pGeometries[i]; |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3715 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3716 | skip |= ValidateGeometryNV(geometry, object_handle, func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3717 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3718 | if (geometry.geometryType != VK_GEOMETRY_TYPE_TRIANGLES_NV) { |
| 3719 | continue; |
| 3720 | } |
| 3721 | total_triangle_count += geometry.geometry.triangles.indexCount / 3; |
| 3722 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame^] | 3723 | if (total_triangle_count > phys_dev_ext_props.ray_tracing_propsNV.maxTriangleCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3724 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-maxTriangleCount-02424", |
| 3725 | "VkAccelerationStructureInfoNV: The total number of triangles in all geometries must be less than " |
| 3726 | "or equal to VkPhysicalDeviceRayTracingPropertiesNV::maxTriangleCount."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3727 | } |
| 3728 | } |
Jason Macnak | 21ba97e | 2019-08-09 12:57:44 -0700 | [diff] [blame] | 3729 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV && info.geometryCount > 1) { |
| 3730 | const VkGeometryTypeNV first_geometry_type = info.pGeometries[0].geometryType; |
| 3731 | for (uint32_t i = 1; i < info.geometryCount; i++) { |
| 3732 | const VkGeometryNV &geometry = info.pGeometries[i]; |
| 3733 | if (geometry.geometryType != first_geometry_type) { |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame^] | 3734 | skip |= LogError(device, "VUID-VkAccelerationStructureInfoNV-type-02786", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3735 | "VkAccelerationStructureInfoNV: info.pGeometries[%d].geometryType does not match " |
| 3736 | "info.pGeometries[0].geometryType.", |
| 3737 | i); |
Jason Macnak | 21ba97e | 2019-08-09 12:57:44 -0700 | [diff] [blame] | 3738 | } |
| 3739 | } |
| 3740 | } |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3741 | return skip; |
| 3742 | } |
| 3743 | |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3744 | bool StatelessValidation::manual_PreCallValidateCreateAccelerationStructureNV( |
| 3745 | VkDevice device, const VkAccelerationStructureCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3746 | VkAccelerationStructureNV *pAccelerationStructure) const { |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3747 | bool skip = false; |
| 3748 | |
| 3749 | if (pCreateInfo) { |
| 3750 | if ((pCreateInfo->compactedSize != 0) && |
| 3751 | ((pCreateInfo->info.geometryCount != 0) || (pCreateInfo->info.instanceCount != 0))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3752 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoNV-compactedSize-02421", |
| 3753 | "vkCreateAccelerationStructureNV(): pCreateInfo->compactedSize nonzero (%" PRIu64 |
| 3754 | ") with info.geometryCount (%" PRIu32 ") or info.instanceCount (%" PRIu32 ") nonzero.", |
| 3755 | pCreateInfo->compactedSize, pCreateInfo->info.geometryCount, pCreateInfo->info.instanceCount); |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3756 | } |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3757 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3758 | skip |= ValidateAccelerationStructureInfoNV(pCreateInfo->info, VkAccelerationStructureNV(0), |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 3759 | "vkCreateAccelerationStructureNV()"); |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 3760 | } |
| 3761 | |
| 3762 | return skip; |
| 3763 | } |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 3764 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3765 | bool StatelessValidation::manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, |
| 3766 | const VkAccelerationStructureInfoNV *pInfo, |
| 3767 | VkBuffer instanceData, VkDeviceSize instanceOffset, |
| 3768 | VkBool32 update, VkAccelerationStructureNV dst, |
| 3769 | VkAccelerationStructureNV src, VkBuffer scratch, |
| 3770 | VkDeviceSize scratchOffset) const { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3771 | bool skip = false; |
| 3772 | |
| 3773 | if (pInfo != nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3774 | skip |= ValidateAccelerationStructureInfoNV(*pInfo, dst, "vkCmdBuildAccelerationStructureNV()"); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3775 | } |
| 3776 | |
| 3777 | return skip; |
| 3778 | } |
| 3779 | |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame^] | 3780 | bool StatelessValidation::manual_PreCallValidateCreateAccelerationStructureKHR( |
| 3781 | VkDevice device, const VkAccelerationStructureCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 3782 | VkAccelerationStructureKHR *pAccelerationStructure) const { |
| 3783 | bool skip = false; |
| 3784 | |
| 3785 | if (pCreateInfo) { |
| 3786 | for (uint32_t i = 0; i < pCreateInfo->maxGeometryCount; ++i) { |
| 3787 | if (pCreateInfo->type == VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR && pCreateInfo->compactedSize == 0) { |
| 3788 | if (pCreateInfo->pGeometryInfos[i].geometryType != VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 3789 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoKHR-type-03496", |
| 3790 | "VkAccelerationStructureCreateInfoKHR: Top-level acceleration structure " |
| 3791 | "pGeometryInfos[%d].geometryType must be VK_GEOMETRY_TYPE_INSTANCES_KHR", |
| 3792 | i); |
| 3793 | } |
| 3794 | } |
| 3795 | |
| 3796 | if (pCreateInfo->type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR && pCreateInfo->compactedSize == 0) { |
| 3797 | if (pCreateInfo->pGeometryInfos[i].geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 3798 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoKHR-type-03497", |
| 3799 | "VkAccelerationStructureCreateInfoKHR: Bottom-level acceleration structure " |
| 3800 | "pGeometryInfos[%d].geometryType must not be VK_GEOMETRY_TYPE_INSTANCES_KHR", |
| 3801 | i); |
| 3802 | } |
| 3803 | } |
| 3804 | } |
| 3805 | |
| 3806 | if (pCreateInfo->flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR && |
| 3807 | pCreateInfo->flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR) { |
| 3808 | skip |= LogError( |
| 3809 | device, "VUID-VkAccelerationStructureCreateInfoKHR-flags-03499", |
| 3810 | "VkAccelerationStructureCreateInfoKHR: If flags has the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR" |
| 3811 | "bit set, then it must not have the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR bit set."); |
| 3812 | } |
| 3813 | |
| 3814 | if (pCreateInfo->compactedSize != 0 && pCreateInfo->maxGeometryCount != 0) { |
| 3815 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoKHR-compactedSize-03490", |
| 3816 | "VkAccelerationStructureCreateInfoKHR: pCreateInfo->compactedSize nonzero (%" PRIu64 |
| 3817 | ") with maxGeometryCount (%" PRIu32 ") nonzero.", |
| 3818 | pCreateInfo->compactedSize, pCreateInfo->maxGeometryCount); |
| 3819 | } |
| 3820 | |
| 3821 | if (pCreateInfo->type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV && pCreateInfo->maxGeometryCount > 1) { |
| 3822 | const VkGeometryTypeKHR first_geometry_type = pCreateInfo->pGeometryInfos[0].geometryType; |
| 3823 | for (uint32_t i = 1; i < pCreateInfo->maxGeometryCount; i++) { |
| 3824 | const VkGeometryTypeKHR geometry_type = pCreateInfo->pGeometryInfos[i].geometryType; |
| 3825 | if (geometry_type != first_geometry_type) { |
| 3826 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoKHR-type-03498", |
| 3827 | "VkAccelerationStructureCreateInfoKHR: pGeometryInfos[%d].geometryType does not match " |
| 3828 | "pGeometryInfos[0].geometryType.", |
| 3829 | i); |
| 3830 | } |
| 3831 | } |
| 3832 | } |
| 3833 | } |
| 3834 | |
| 3835 | return skip; |
| 3836 | } |
| 3837 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3838 | bool StatelessValidation::manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, |
| 3839 | VkAccelerationStructureNV accelerationStructure, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3840 | size_t dataSize, void *pData) const { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3841 | bool skip = false; |
| 3842 | if (dataSize < 8) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3843 | skip = LogError(accelerationStructure, "VUID-vkGetAccelerationStructureHandleNV-dataSize-02240", |
| 3844 | "vkGetAccelerationStructureHandleNV(): dataSize must be greater than or equal to 8."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 3845 | } |
| 3846 | return skip; |
| 3847 | } |
| 3848 | |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 3849 | bool StatelessValidation::manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, |
| 3850 | uint32_t createInfoCount, |
| 3851 | const VkRayTracingPipelineCreateInfoNV *pCreateInfos, |
| 3852 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3853 | VkPipeline *pPipelines) const { |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 3854 | bool skip = false; |
| 3855 | |
| 3856 | for (uint32_t i = 0; i < createInfoCount; i++) { |
| 3857 | auto feedback_struct = lvl_find_in_chain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
| 3858 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3859 | skip |= LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02670", |
| 3860 | "vkCreateRayTracingPipelinesNV(): in pCreateInfo[%" PRIu32 |
| 3861 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
| 3862 | "(=%" PRIu32 ") must equal VkRayTracingPipelineCreateInfoNV::stageCount(=%" PRIu32 ").", |
| 3863 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 3864 | } |
| 3865 | } |
| 3866 | |
| 3867 | return skip; |
| 3868 | } |
| 3869 | |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame^] | 3870 | bool StatelessValidation::manual_PreCallValidateCreateRayTracingPipelinesKHR(VkDevice device, VkPipelineCache pipelineCache, |
| 3871 | uint32_t createInfoCount, |
| 3872 | const VkRayTracingPipelineCreateInfoKHR *pCreateInfos, |
| 3873 | const VkAllocationCallbacks *pAllocator, |
| 3874 | VkPipeline *pPipelines) const { |
| 3875 | bool skip = false; |
| 3876 | |
| 3877 | for (uint32_t i = 0; i < createInfoCount; i++) { |
| 3878 | auto feedback_struct = lvl_find_in_chain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
| 3879 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
| 3880 | skip |= LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02670", |
| 3881 | "vkCreateRayTracingPipelinesKHR(): in pCreateInfo[%" PRIu32 |
| 3882 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
| 3883 | "(=%" PRIu32 ") must equal VkRayTracingPipelineCreateInfoKHR::stageCount(=%" PRIu32 ").", |
| 3884 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
| 3885 | } |
| 3886 | } |
| 3887 | |
| 3888 | return skip; |
| 3889 | } |
| 3890 | |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 3891 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3892 | bool StatelessValidation::PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, |
| 3893 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3894 | VkDeviceGroupPresentModeFlagsKHR *pModes) const { |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 3895 | bool skip = false; |
| 3896 | if (!device_extensions.vk_khr_swapchain) |
| 3897 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
| 3898 | if (!device_extensions.vk_khr_get_surface_capabilities_2) |
| 3899 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME); |
| 3900 | if (!device_extensions.vk_khr_surface) |
| 3901 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_SURFACE_EXTENSION_NAME); |
| 3902 | if (!device_extensions.vk_khr_get_physical_device_properties_2) |
| 3903 | skip |= |
| 3904 | OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
| 3905 | if (!device_extensions.vk_ext_full_screen_exclusive) |
| 3906 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME); |
| 3907 | skip |= validate_struct_type( |
| 3908 | "vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo", "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR", |
| 3909 | pSurfaceInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, true, |
| 3910 | "VUID-vkGetDeviceGroupSurfacePresentModes2EXT-pSurfaceInfo-parameter", "VUID-VkPhysicalDeviceSurfaceInfo2KHR-sType-sType"); |
| 3911 | if (pSurfaceInfo != NULL) { |
| 3912 | const VkStructureType allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR[] = { |
| 3913 | VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT, |
| 3914 | VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT}; |
| 3915 | |
| 3916 | skip |= validate_struct_pnext("vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo->pNext", |
| 3917 | "VkSurfaceFullScreenExclusiveInfoEXT, VkSurfaceFullScreenExclusiveWin32InfoEXT", |
| 3918 | pSurfaceInfo->pNext, ARRAY_SIZE(allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR), |
| 3919 | allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 3920 | "VUID-VkPhysicalDeviceSurfaceInfo2KHR-pNext-pNext", |
| 3921 | "VUID-VkPhysicalDeviceSurfaceInfo2KHR-sType-unique"); |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 3922 | |
| 3923 | skip |= validate_required_handle("vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo->surface", pSurfaceInfo->surface); |
| 3924 | } |
| 3925 | return skip; |
| 3926 | } |
| 3927 | #endif |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 3928 | |
| 3929 | bool StatelessValidation::manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
| 3930 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3931 | VkFramebuffer *pFramebuffer) const { |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 3932 | // Validation for pAttachments which is excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3933 | bool skip = false; |
| 3934 | if ((pCreateInfo->flags & VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR) == 0) { |
| 3935 | skip |= validate_array("vkCreateFramebuffer", "attachmentCount", "pAttachments", pCreateInfo->attachmentCount, |
| 3936 | &pCreateInfo->pAttachments, false, true, kVUIDUndefined, kVUIDUndefined); |
| 3937 | } |
| 3938 | return skip; |
| 3939 | } |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 3940 | |
| 3941 | bool StatelessValidation::manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3942 | uint16_t lineStipplePattern) const { |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 3943 | bool skip = false; |
| 3944 | |
| 3945 | if (lineStippleFactor < 1 || lineStippleFactor > 256) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3946 | skip |= LogError(commandBuffer, "VUID-vkCmdSetLineStippleEXT-lineStippleFactor-02776", |
| 3947 | "vkCmdSetLineStippleEXT::lineStippleFactor=%d is not in [1,256].", lineStippleFactor); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 3948 | } |
| 3949 | |
| 3950 | return skip; |
| 3951 | } |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 3952 | |
| 3953 | bool StatelessValidation::manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3954 | VkDeviceSize offset, VkIndexType indexType) const { |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 3955 | bool skip = false; |
| 3956 | |
| 3957 | if (indexType == VK_INDEX_TYPE_NONE_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3958 | skip |= LogError(commandBuffer, "VUID-vkCmdBindIndexBuffer-indexType-02507", |
| 3959 | "vkCmdBindIndexBuffer() indexType must not be VK_INDEX_TYPE_NONE_NV."); |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 3960 | } |
| 3961 | |
Tony-LunarG | 6c3c545 | 2019-12-13 10:37:38 -0700 | [diff] [blame] | 3962 | const auto *index_type_uint8_features = lvl_find_in_chain<VkPhysicalDeviceIndexTypeUint8FeaturesEXT>(device_createinfo_pnext); |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 3963 | if (indexType == VK_INDEX_TYPE_UINT8_EXT && !index_type_uint8_features->indexTypeUint8) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3964 | skip |= LogError(commandBuffer, "VUID-vkCmdBindIndexBuffer-indexType-02765", |
| 3965 | "vkCmdBindIndexBuffer() indexType is VK_INDEX_TYPE_UINT8_EXT but indexTypeUint8 feature is not enabled."); |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 3966 | } |
| 3967 | |
| 3968 | return skip; |
| 3969 | } |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 3970 | |
sfricke-samsung | 4ada8d4 | 2020-02-09 17:43:11 -0800 | [diff] [blame] | 3971 | bool StatelessValidation::manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, |
| 3972 | uint32_t bindingCount, const VkBuffer *pBuffers, |
| 3973 | const VkDeviceSize *pOffsets) const { |
| 3974 | bool skip = false; |
| 3975 | if (firstBinding > device_limits.maxVertexInputBindings) { |
| 3976 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers-firstBinding-00624", |
| 3977 | "vkCmdBindVertexBuffers() firstBinding (%u) must be less than maxVertexInputBindings (%u)", firstBinding, |
| 3978 | device_limits.maxVertexInputBindings); |
| 3979 | } else if ((firstBinding + bindingCount) > device_limits.maxVertexInputBindings) { |
| 3980 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers-firstBinding-00625", |
| 3981 | "vkCmdBindVertexBuffers() sum of firstBinding (%u) and bindingCount (%u) must be less than " |
| 3982 | "maxVertexInputBindings (%u)", |
| 3983 | firstBinding, bindingCount, device_limits.maxVertexInputBindings); |
| 3984 | } |
| 3985 | |
| 3986 | return skip; |
| 3987 | } |
| 3988 | |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 3989 | bool StatelessValidation::manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3990 | const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const { |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 3991 | bool skip = false; |
| 3992 | if (pNameInfo->objectType == VK_OBJECT_TYPE_UNKNOWN) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3993 | skip |= LogError(device, "VUID-VkDebugUtilsObjectNameInfoEXT-objectType-02589", |
| 3994 | "vkSetDebugUtilsObjectNameEXT() pNameInfo->objectType cannot be VK_OBJECT_TYPE_UNKNOWN."); |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 3995 | } |
| 3996 | return skip; |
| 3997 | } |
| 3998 | |
| 3999 | bool StatelessValidation::manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4000 | const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const { |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 4001 | bool skip = false; |
| 4002 | if (pTagInfo->objectType == VK_OBJECT_TYPE_UNKNOWN) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4003 | skip |= LogError(device, "VUID-VkDebugUtilsObjectTagInfoEXT-objectType-01908", |
| 4004 | "vkSetDebugUtilsObjectTagEXT() pTagInfo->objectType cannot be VK_OBJECT_TYPE_UNKNOWN."); |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 4005 | } |
| 4006 | return skip; |
| 4007 | } |
Petr Kraus | 3d72039 | 2019-11-13 02:52:39 +0100 | [diff] [blame] | 4008 | |
| 4009 | bool StatelessValidation::manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
| 4010 | VkSemaphore semaphore, VkFence fence, |
| 4011 | uint32_t *pImageIndex) const { |
| 4012 | bool skip = false; |
| 4013 | |
| 4014 | if (semaphore == VK_NULL_HANDLE && fence == VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4015 | skip |= LogError(swapchain, "VUID-vkAcquireNextImageKHR-semaphore-01780", |
| 4016 | "vkAcquireNextImageKHR: semaphore and fence are both VK_NULL_HANDLE."); |
Petr Kraus | 3d72039 | 2019-11-13 02:52:39 +0100 | [diff] [blame] | 4017 | } |
| 4018 | |
| 4019 | return skip; |
| 4020 | } |
| 4021 | |
| 4022 | bool StatelessValidation::manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, |
| 4023 | uint32_t *pImageIndex) const { |
| 4024 | bool skip = false; |
| 4025 | |
| 4026 | if (pAcquireInfo->semaphore == VK_NULL_HANDLE && pAcquireInfo->fence == VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4027 | skip |= LogError(pAcquireInfo->swapchain, "VUID-VkAcquireNextImageInfoKHR-semaphore-01782", |
| 4028 | "vkAcquireNextImage2KHR: pAcquireInfo->semaphore and pAcquireInfo->fence are both VK_NULL_HANDLE."); |
Petr Kraus | 3d72039 | 2019-11-13 02:52:39 +0100 | [diff] [blame] | 4029 | } |
| 4030 | |
| 4031 | return skip; |
| 4032 | } |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 4033 | |
| 4034 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, |
| 4035 | uint32_t firstInstance, VkBuffer counterBuffer, |
| 4036 | VkDeviceSize counterBufferOffset, |
| 4037 | uint32_t counterOffset, uint32_t vertexStride) const { |
| 4038 | bool skip = false; |
| 4039 | |
| 4040 | if ((vertexStride <= 0) || (vertexStride > phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBufferDataStride)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4041 | skip |= LogError( |
| 4042 | counterBuffer, "VUID-vkCmdDrawIndirectByteCountEXT-vertexStride-02289", |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 4043 | "vkCmdDrawIndirectByteCountEXT: vertexStride (%d) must be between 0 and maxTransformFeedbackBufferDataStride (%d).", |
| 4044 | vertexStride, phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBufferDataStride); |
| 4045 | } |
| 4046 | |
| 4047 | return skip; |
| 4048 | } |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 4049 | |
| 4050 | bool StatelessValidation::ValidateCreateSamplerYcbcrConversion(VkDevice device, |
| 4051 | const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, |
| 4052 | const VkAllocationCallbacks *pAllocator, |
| 4053 | VkSamplerYcbcrConversion *pYcbcrConversion, |
| 4054 | const char *apiName) const { |
| 4055 | bool skip = false; |
| 4056 | |
| 4057 | // Check samplerYcbcrConversion feature is set |
Tony-LunarG | 6c3c545 | 2019-12-13 10:37:38 -0700 | [diff] [blame] | 4058 | const auto *ycbcr_features = lvl_find_in_chain<VkPhysicalDeviceSamplerYcbcrConversionFeatures>(device_createinfo_pnext); |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 4059 | if ((ycbcr_features == nullptr) || (ycbcr_features->samplerYcbcrConversion == VK_FALSE)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4060 | skip |= LogError(device, "VUID-vkCreateSamplerYcbcrConversion-None-01648", |
| 4061 | "samplerYcbcrConversion must be enabled to call %s.", apiName); |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 4062 | } |
| 4063 | return skip; |
| 4064 | } |
| 4065 | |
| 4066 | bool StatelessValidation::manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, |
| 4067 | const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, |
| 4068 | const VkAllocationCallbacks *pAllocator, |
| 4069 | VkSamplerYcbcrConversion *pYcbcrConversion) const { |
| 4070 | return ValidateCreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion, |
| 4071 | "vkCreateSamplerYcbcrConversion"); |
| 4072 | } |
| 4073 | |
| 4074 | bool StatelessValidation::manual_PreCallValidateCreateSamplerYcbcrConversionKHR( |
| 4075 | VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 4076 | VkSamplerYcbcrConversion *pYcbcrConversion) const { |
| 4077 | return ValidateCreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion, |
| 4078 | "vkCreateSamplerYcbcrConversionKHR"); |
| 4079 | } |
sfricke-samsung | 1708a8c | 2020-02-10 00:35:06 -0800 | [diff] [blame] | 4080 | |
| 4081 | bool StatelessValidation::manual_PreCallValidateImportSemaphoreFdKHR( |
| 4082 | VkDevice device, const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const { |
| 4083 | bool skip = false; |
| 4084 | VkExternalSemaphoreHandleTypeFlags supported_handle_types = |
| 4085 | VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT | VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT; |
| 4086 | |
| 4087 | if (0 == (pImportSemaphoreFdInfo->handleType & supported_handle_types)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4088 | skip |= LogError(device, "VUID-VkImportSemaphoreFdInfoKHR-handleType-01143", |
| 4089 | "vkImportSemaphoreFdKHR() to semaphore %s handleType %s is not one of the supported handleTypes (%s).", |
| 4090 | report_data->FormatHandle(pImportSemaphoreFdInfo->semaphore).c_str(), |
| 4091 | string_VkExternalSemaphoreHandleTypeFlagBits(pImportSemaphoreFdInfo->handleType), |
| 4092 | string_VkExternalSemaphoreHandleTypeFlags(supported_handle_types).c_str()); |
sfricke-samsung | 1708a8c | 2020-02-10 00:35:06 -0800 | [diff] [blame] | 4093 | } |
| 4094 | return skip; |
| 4095 | } |