Mark Lobodzinski | c0df6b6 | 2021-01-08 12:34:11 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2021 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2021 Valve Corporation |
| 3 | * Copyright (c) 2015-2021 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2021 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" |
sfricke-samsung | 2e82721 | 2021-09-28 07:52:08 -0700 | [diff] [blame] | 27 | #include "core_validation_error_enums.h" |
Tobias Hector | d942eb9 | 2018-10-22 15:18:56 +0100 | [diff] [blame] | 28 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 29 | static const int kMaxParamCheckerStringLength = 256; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 30 | |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 31 | template <typename T> |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 32 | 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] | 33 | // Using only < for generality and || for early abort |
| 34 | return !((value < min) || (max < value)); |
| 35 | } |
| 36 | |
Mark Lobodzinski | 21b91fe | 2020-12-03 15:44:24 -0700 | [diff] [blame] | 37 | read_lock_guard_t StatelessValidation::read_lock() { return read_lock_guard_t(validation_object_mutex, std::defer_lock); } |
| 38 | write_lock_guard_t StatelessValidation::write_lock() { return write_lock_guard_t(validation_object_mutex, std::defer_lock); } |
| 39 | |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 40 | static layer_data::unordered_map<VkCommandBuffer, VkCommandPool> secondary_cb_map{}; |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 41 | static ReadWriteLock secondary_cb_map_mutex; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 42 | static read_lock_guard_t cb_read_lock() { return read_lock_guard_t(secondary_cb_map_mutex); } |
| 43 | static write_lock_guard_t cb_write_lock() { return write_lock_guard_t(secondary_cb_map_mutex); } |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 44 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 45 | 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] | 46 | const char *validateString) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 47 | bool skip = false; |
| 48 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 49 | VkStringErrorFlags result = vk_string_validate(kMaxParamCheckerStringLength, validateString); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 50 | |
| 51 | if (result == VK_STRING_ERROR_NONE) { |
| 52 | return skip; |
| 53 | } else if (result & VK_STRING_ERROR_LENGTH) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 54 | skip = LogError(device, vuid, "%s: string %s exceeds max length %d", apiName, stringName.get_name().c_str(), |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 55 | kMaxParamCheckerStringLength); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 56 | } else if (result & VK_STRING_ERROR_BAD_DATA) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 57 | skip = LogError(device, vuid, "%s: string %s contains invalid characters or is badly formed", apiName, |
| 58 | stringName.get_name().c_str()); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 59 | } |
| 60 | return skip; |
| 61 | } |
| 62 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 63 | 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] | 64 | bool skip = false; |
| 65 | uint32_t api_version_nopatch = VK_MAKE_VERSION(VK_VERSION_MAJOR(api_version), VK_VERSION_MINOR(api_version), 0); |
| 66 | if (api_version_nopatch != effective_api_version) { |
sfricke-samsung | 6aec21b | 2020-11-01 07:49:43 -0800 | [diff] [blame] | 67 | if ((api_version_nopatch < VK_API_VERSION_1_0) && (api_version != 0)) { |
| 68 | skip |= LogError(instance, "VUID-VkApplicationInfo-apiVersion-04010", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 69 | "Invalid CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number (0x%08x). " |
| 70 | "Using VK_API_VERSION_%" PRIu32 "_%" PRIu32 ".", |
| 71 | 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] | 72 | } else { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 73 | skip |= LogWarning(instance, kVUIDUndefined, |
| 74 | "Unrecognized CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number (0x%08x). " |
| 75 | "Assuming VK_API_VERSION_%" PRIu32 "_%" PRIu32 ".", |
| 76 | 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] | 77 | } |
| 78 | } |
| 79 | return skip; |
| 80 | } |
| 81 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 82 | bool StatelessValidation::validate_instance_extensions(const VkInstanceCreateInfo *pCreateInfo) const { |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 83 | bool skip = false; |
Mark Lobodzinski | 05cce20 | 2019-08-27 10:28:37 -0600 | [diff] [blame] | 84 | // Create and use a local instance extension object, as an actual instance has not been created yet |
| 85 | uint32_t specified_version = (pCreateInfo->pApplicationInfo ? pCreateInfo->pApplicationInfo->apiVersion : VK_API_VERSION_1_0); |
| 86 | InstanceExtensions local_instance_extensions; |
| 87 | local_instance_extensions.InitFromInstanceCreateInfo(specified_version, pCreateInfo); |
| 88 | |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 89 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | 05cce20 | 2019-08-27 10:28:37 -0600 | [diff] [blame] | 90 | skip |= validate_extension_reqs(local_instance_extensions, "VUID-vkCreateInstance-ppEnabledExtensionNames-01388", |
| 91 | "instance", pCreateInfo->ppEnabledExtensionNames[i]); |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | return skip; |
| 95 | } |
| 96 | |
Mark Lobodzinski | bece6c1 | 2020-08-27 15:34:02 -0600 | [diff] [blame] | 97 | bool StatelessValidation::SupportedByPdev(const VkPhysicalDevice physical_device, const std::string ext_name) const { |
Mike Schuchardt | c57de4a | 2021-07-20 17:26:32 -0700 | [diff] [blame] | 98 | if (instance_extensions.vk_khr_get_physical_device_properties2) { |
Mark Lobodzinski | bece6c1 | 2020-08-27 15:34:02 -0600 | [diff] [blame] | 99 | // Struct is legal IF it's supported |
| 100 | const auto &dev_exts_enumerated = device_extensions_enumerated.find(physical_device); |
| 101 | if (dev_exts_enumerated == device_extensions_enumerated.end()) return true; |
| 102 | auto enum_iter = dev_exts_enumerated->second.find(ext_name); |
| 103 | if (enum_iter != dev_exts_enumerated->second.cend()) { |
| 104 | return true; |
| 105 | } |
| 106 | } |
| 107 | return false; |
| 108 | } |
| 109 | |
Tony-LunarG | 866843d | 2020-05-13 11:22:42 -0600 | [diff] [blame] | 110 | bool StatelessValidation::validate_validation_features(const VkInstanceCreateInfo *pCreateInfo, |
| 111 | const VkValidationFeaturesEXT *validation_features) const { |
| 112 | bool skip = false; |
| 113 | bool debug_printf = false; |
| 114 | bool gpu_assisted = false; |
| 115 | bool reserve_slot = false; |
| 116 | for (uint32_t i = 0; i < validation_features->enabledValidationFeatureCount; i++) { |
| 117 | switch (validation_features->pEnabledValidationFeatures[i]) { |
| 118 | case VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT: |
| 119 | gpu_assisted = true; |
| 120 | break; |
| 121 | |
| 122 | case VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT: |
| 123 | debug_printf = true; |
| 124 | break; |
| 125 | |
| 126 | case VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT: |
| 127 | reserve_slot = true; |
| 128 | break; |
| 129 | |
| 130 | default: |
| 131 | break; |
| 132 | } |
| 133 | } |
| 134 | if (reserve_slot && !gpu_assisted) { |
| 135 | skip |= LogError(instance, "VUID-VkValidationFeaturesEXT-pEnabledValidationFeatures-02967", |
| 136 | "If VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT is in pEnabledValidationFeatures, " |
| 137 | "VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT must also be in pEnabledValidationFeatures."); |
| 138 | } |
| 139 | if (gpu_assisted && debug_printf) { |
| 140 | skip |= LogError(instance, "VUID-VkValidationFeaturesEXT-pEnabledValidationFeatures-02968", |
| 141 | "If VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT is in pEnabledValidationFeatures, " |
| 142 | "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT must not also be in pEnabledValidationFeatures."); |
| 143 | } |
| 144 | |
| 145 | return skip; |
| 146 | } |
| 147 | |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 148 | template <typename ExtensionState> |
Tony-LunarG | 2ec96bb | 2019-11-26 13:43:02 -0700 | [diff] [blame] | 149 | ExtEnabled extension_state_by_name(const ExtensionState &extensions, const char *extension_name) { |
| 150 | if (!extension_name) return kNotEnabled; // null strings specify nothing |
John Zulauf | 620755c | 2018-04-16 11:00:43 -0600 | [diff] [blame] | 151 | auto info = ExtensionState::get_info(extension_name); |
Tony-LunarG | 2ec96bb | 2019-11-26 13:43:02 -0700 | [diff] [blame] | 152 | ExtEnabled state = |
| 153 | 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] | 154 | return state; |
| 155 | } |
| 156 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 157 | bool StatelessValidation::manual_PreCallValidateCreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 158 | const VkAllocationCallbacks *pAllocator, |
| 159 | VkInstance *pInstance) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 160 | bool skip = false; |
| 161 | // Note: From the spec-- |
| 162 | // Providing a NULL VkInstanceCreateInfo::pApplicationInfo or providing an apiVersion of 0 is equivalent to providing |
| 163 | // an apiVersion of VK_MAKE_VERSION(1, 0, 0). (a.k.a. VK_API_VERSION_1_0) |
| 164 | uint32_t local_api_version = (pCreateInfo->pApplicationInfo && pCreateInfo->pApplicationInfo->apiVersion) |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 165 | ? pCreateInfo->pApplicationInfo->apiVersion |
| 166 | : VK_API_VERSION_1_0; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 167 | skip |= validate_api_version(local_api_version, api_version); |
| 168 | skip |= validate_instance_extensions(pCreateInfo); |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 169 | const auto *validation_features = LvlFindInChain<VkValidationFeaturesEXT>(pCreateInfo->pNext); |
Tony-LunarG | 866843d | 2020-05-13 11:22:42 -0600 | [diff] [blame] | 170 | if (validation_features) skip |= validate_validation_features(pCreateInfo, validation_features); |
| 171 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 172 | return skip; |
| 173 | } |
| 174 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 175 | void StatelessValidation::PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 176 | const VkAllocationCallbacks *pAllocator, VkInstance *pInstance, |
| 177 | VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 178 | auto instance_data = GetLayerDataPtr(get_dispatch_key(*pInstance), layer_data_map); |
| 179 | // Copy extension data into local object |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 180 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 181 | this->instance_extensions = instance_data->instance_extensions; |
Nathaniel Cesario | 645a15b | 2021-01-08 22:40:21 -0700 | [diff] [blame] | 182 | } |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 183 | |
Nathaniel Cesario | 645a15b | 2021-01-08 22:40:21 -0700 | [diff] [blame] | 184 | void StatelessValidation::CommonPostCallRecordEnumeratePhysicalDevice(const VkPhysicalDevice *phys_devices, const int count) { |
| 185 | // Assume phys_devices is valid |
| 186 | assert(phys_devices); |
| 187 | for (int i = 0; i < count; ++i) { |
| 188 | const auto &phys_device = phys_devices[i]; |
| 189 | if (0 == physical_device_properties_map.count(phys_device)) { |
| 190 | auto phys_dev_props = new VkPhysicalDeviceProperties; |
| 191 | DispatchGetPhysicalDeviceProperties(phys_device, phys_dev_props); |
| 192 | physical_device_properties_map[phys_device] = phys_dev_props; |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 193 | |
Nathaniel Cesario | 645a15b | 2021-01-08 22:40:21 -0700 | [diff] [blame] | 194 | // Enumerate the Device Ext Properties to save the PhysicalDevice supported extension state |
| 195 | uint32_t ext_count = 0; |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 196 | layer_data::unordered_set<std::string> dev_exts_enumerated{}; |
Nathaniel Cesario | 645a15b | 2021-01-08 22:40:21 -0700 | [diff] [blame] | 197 | std::vector<VkExtensionProperties> ext_props{}; |
| 198 | instance_dispatch_table.EnumerateDeviceExtensionProperties(phys_device, nullptr, &ext_count, nullptr); |
| 199 | ext_props.resize(ext_count); |
| 200 | instance_dispatch_table.EnumerateDeviceExtensionProperties(phys_device, nullptr, &ext_count, ext_props.data()); |
| 201 | for (uint32_t j = 0; j < ext_count; j++) { |
| 202 | dev_exts_enumerated.insert(ext_props[j].extensionName); |
| 203 | } |
| 204 | device_extensions_enumerated[phys_device] = std::move(dev_exts_enumerated); |
Mark Lobodzinski | bece6c1 | 2020-08-27 15:34:02 -0600 | [diff] [blame] | 205 | } |
Nathaniel Cesario | 645a15b | 2021-01-08 22:40:21 -0700 | [diff] [blame] | 206 | } |
| 207 | } |
| 208 | |
| 209 | void StatelessValidation::PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
| 210 | VkPhysicalDevice *pPhysicalDevices, VkResult result) { |
| 211 | if ((VK_SUCCESS != result) && (VK_INCOMPLETE != result)) { |
| 212 | return; |
| 213 | } |
| 214 | |
| 215 | if (pPhysicalDeviceCount && pPhysicalDevices) { |
| 216 | CommonPostCallRecordEnumeratePhysicalDevice(pPhysicalDevices, *pPhysicalDeviceCount); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | void StatelessValidation::PostCallRecordEnumeratePhysicalDeviceGroups( |
| 221 | VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties, |
| 222 | VkResult result) { |
| 223 | if ((VK_SUCCESS != result) && (VK_INCOMPLETE != result)) { |
| 224 | return; |
| 225 | } |
| 226 | |
| 227 | if (pPhysicalDeviceGroupCount && pPhysicalDeviceGroupProperties) { |
| 228 | for (uint32_t i = 0; i < *pPhysicalDeviceGroupCount; i++) { |
| 229 | const auto &group = pPhysicalDeviceGroupProperties[i]; |
| 230 | CommonPostCallRecordEnumeratePhysicalDevice(group.physicalDevices, group.physicalDeviceCount); |
| 231 | } |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 232 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 233 | } |
| 234 | |
Mark Lobodzinski | 2e40a13 | 2020-08-10 14:51:41 -0600 | [diff] [blame] | 235 | void StatelessValidation::PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
| 236 | for (auto it = physical_device_properties_map.begin(); it != physical_device_properties_map.end();) { |
| 237 | delete (it->second); |
| 238 | it = physical_device_properties_map.erase(it); |
| 239 | } |
| 240 | }; |
| 241 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 242 | void StatelessValidation::PostCallRecordCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 243 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 244 | auto device_data = GetLayerDataPtr(get_dispatch_key(*pDevice), layer_data_map); |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 245 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 246 | ValidationObject *validation_data = GetValidationObject(device_data->object_dispatch, LayerObjectTypeParameterValidation); |
| 247 | StatelessValidation *stateless_validation = static_cast<StatelessValidation *>(validation_data); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 248 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 249 | // Parmeter validation also uses extension data |
| 250 | stateless_validation->device_extensions = this->device_extensions; |
| 251 | |
| 252 | VkPhysicalDeviceProperties device_properties = {}; |
| 253 | // Need to get instance and do a getlayerdata call... |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 254 | DispatchGetPhysicalDeviceProperties(physicalDevice, &device_properties); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 255 | memcpy(&stateless_validation->device_limits, &device_properties.limits, sizeof(VkPhysicalDeviceLimits)); |
| 256 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 257 | if (IsExtEnabled(device_extensions.vk_nv_shading_rate_image)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 258 | // Get the needed shading rate image limits |
Mark Lobodzinski | 6fe9e70 | 2020-12-30 15:36:39 -0700 | [diff] [blame] | 259 | auto shading_rate_image_props = LvlInitStruct<VkPhysicalDeviceShadingRateImagePropertiesNV>(); |
| 260 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&shading_rate_image_props); |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 261 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 262 | phys_dev_ext_props.shading_rate_image_props = shading_rate_image_props; |
| 263 | } |
| 264 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 265 | if (IsExtEnabled(device_extensions.vk_nv_mesh_shader)) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 266 | // Get the needed mesh shader limits |
Mark Lobodzinski | 6fe9e70 | 2020-12-30 15:36:39 -0700 | [diff] [blame] | 267 | auto mesh_shader_props = LvlInitStruct<VkPhysicalDeviceMeshShaderPropertiesNV>(); |
| 268 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&mesh_shader_props); |
Tony-LunarG | 152a88b | 2019-03-20 15:42:24 -0600 | [diff] [blame] | 269 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 270 | phys_dev_ext_props.mesh_shader_props = mesh_shader_props; |
| 271 | } |
| 272 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 273 | if (IsExtEnabled(device_extensions.vk_nv_ray_tracing)) { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 274 | // Get the needed ray tracing limits |
Mark Lobodzinski | 6fe9e70 | 2020-12-30 15:36:39 -0700 | [diff] [blame] | 275 | auto ray_tracing_props = LvlInitStruct<VkPhysicalDeviceRayTracingPropertiesNV>(); |
| 276 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&ray_tracing_props); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 277 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 278 | phys_dev_ext_props.ray_tracing_propsNV = ray_tracing_props; |
| 279 | } |
| 280 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 281 | if (IsExtEnabled(device_extensions.vk_khr_ray_tracing_pipeline)) { |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 282 | // Get the needed ray tracing limits |
Mark Lobodzinski | 6fe9e70 | 2020-12-30 15:36:39 -0700 | [diff] [blame] | 283 | auto ray_tracing_props = LvlInitStruct<VkPhysicalDeviceRayTracingPipelinePropertiesKHR>(); |
| 284 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&ray_tracing_props); |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 285 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 286 | phys_dev_ext_props.ray_tracing_propsKHR = ray_tracing_props; |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 287 | } |
| 288 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 289 | if (IsExtEnabled(device_extensions.vk_khr_acceleration_structure)) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 290 | // Get the needed ray tracing acc structure limits |
Mark Lobodzinski | 6fe9e70 | 2020-12-30 15:36:39 -0700 | [diff] [blame] | 291 | auto acc_structure_props = LvlInitStruct<VkPhysicalDeviceAccelerationStructurePropertiesKHR>(); |
| 292 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&acc_structure_props); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 293 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 294 | phys_dev_ext_props.acc_structure_props = acc_structure_props; |
| 295 | } |
| 296 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 297 | if (IsExtEnabled(device_extensions.vk_ext_transform_feedback)) { |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 298 | // Get the needed transform feedback limits |
Mark Lobodzinski | 6fe9e70 | 2020-12-30 15:36:39 -0700 | [diff] [blame] | 299 | auto transform_feedback_props = LvlInitStruct<VkPhysicalDeviceTransformFeedbackPropertiesEXT>(); |
| 300 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&transform_feedback_props); |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 301 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 302 | phys_dev_ext_props.transform_feedback_props = transform_feedback_props; |
| 303 | } |
| 304 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 305 | if (IsExtEnabled(device_extensions.vk_ext_vertex_attribute_divisor)) { |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 306 | // Get the needed vertex attribute divisor limits |
| 307 | auto vertex_attribute_divisor_props = LvlInitStruct<VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT>(); |
| 308 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&vertex_attribute_divisor_props); |
| 309 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 310 | phys_dev_ext_props.vertex_attribute_divisor_props = vertex_attribute_divisor_props; |
| 311 | } |
| 312 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 313 | if (IsExtEnabled(device_extensions.vk_ext_blend_operation_advanced)) { |
ziga-lunarg | a283d02 | 2021-08-04 18:35:23 +0200 | [diff] [blame] | 314 | // Get the needed vertex attribute divisor limits |
| 315 | auto blend_operation_advanced_props = LvlInitStruct<VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT>(); |
| 316 | auto prop2 = LvlInitStruct<VkPhysicalDeviceProperties2>(&blend_operation_advanced_props); |
| 317 | DispatchGetPhysicalDeviceProperties2KHR(physicalDevice, &prop2); |
| 318 | phys_dev_ext_props.blend_operation_advanced_props = blend_operation_advanced_props; |
| 319 | } |
| 320 | |
Jasper St. Pierre | a49b4be | 2019-02-05 17:48:57 -0800 | [diff] [blame] | 321 | stateless_validation->phys_dev_ext_props = this->phys_dev_ext_props; |
| 322 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 323 | // Save app-enabled features in this device's validation object |
| 324 | // The enabled features can come from either pEnabledFeatures, or from the pNext chain |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 325 | const auto *features2 = LvlFindInChain<VkPhysicalDeviceFeatures2>(pCreateInfo->pNext); |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 326 | safe_VkPhysicalDeviceFeatures2 tmp_features2_state; |
| 327 | tmp_features2_state.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; |
| 328 | if (features2) { |
| 329 | tmp_features2_state.features = features2->features; |
| 330 | } else if (pCreateInfo->pEnabledFeatures) { |
| 331 | tmp_features2_state.features = *pCreateInfo->pEnabledFeatures; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 332 | } else { |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 333 | tmp_features2_state.features = {}; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 334 | } |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 335 | // Use pCreateInfo->pNext to get full chain |
Tony-LunarG | 6c3c545 | 2019-12-13 10:37:38 -0700 | [diff] [blame] | 336 | stateless_validation->device_createinfo_pnext = SafePnextCopy(pCreateInfo->pNext); |
Petr Kraus | 715bcc7 | 2019-08-15 17:17:33 +0200 | [diff] [blame] | 337 | stateless_validation->physical_device_features2 = tmp_features2_state; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 338 | } |
| 339 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 340 | bool StatelessValidation::manual_PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 341 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 342 | bool skip = false; |
| 343 | |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 344 | for (size_t i = 0; i < pCreateInfo->enabledLayerCount; i++) { |
| 345 | skip |= validate_string("vkCreateDevice", "pCreateInfo->ppEnabledLayerNames", |
| 346 | "VUID-VkDeviceCreateInfo-ppEnabledLayerNames-parameter", pCreateInfo->ppEnabledLayerNames[i]); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 347 | } |
| 348 | |
Nathaniel Cesario | b3f2d70 | 2020-11-09 09:20:49 -0700 | [diff] [blame] | 349 | // If this device supports VK_KHR_portability_subset, it must be enabled |
| 350 | const std::string portability_extension_name("VK_KHR_portability_subset"); |
| 351 | const auto &dev_extensions = device_extensions_enumerated.at(physicalDevice); |
| 352 | const bool portability_supported = dev_extensions.count(portability_extension_name) != 0; |
| 353 | bool portability_requested = false; |
| 354 | |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 355 | for (size_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 356 | skip |= |
| 357 | validate_string("vkCreateDevice", "pCreateInfo->ppEnabledExtensionNames", |
| 358 | "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-parameter", pCreateInfo->ppEnabledExtensionNames[i]); |
| 359 | skip |= validate_extension_reqs(device_extensions, "VUID-vkCreateDevice-ppEnabledExtensionNames-01387", "device", |
| 360 | pCreateInfo->ppEnabledExtensionNames[i]); |
Nathaniel Cesario | b3f2d70 | 2020-11-09 09:20:49 -0700 | [diff] [blame] | 361 | if (portability_extension_name == pCreateInfo->ppEnabledExtensionNames[i]) { |
| 362 | portability_requested = true; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | if (portability_supported && !portability_requested) { |
| 367 | skip |= LogError(physicalDevice, "VUID-VkDeviceCreateInfo-pProperties-04451", |
| 368 | "vkCreateDevice: VK_KHR_portability_subset must be enabled because physical device %s supports it", |
| 369 | report_data->FormatHandle(physicalDevice).c_str()); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 370 | } |
| 371 | |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 372 | { |
Mike Schuchardt | 7cc5784 | 2021-09-15 10:49:59 -0700 | [diff] [blame] | 373 | bool maint1 = IsExtEnabled(extension_state_by_name(device_extensions, VK_KHR_MAINTENANCE_1_EXTENSION_NAME)); |
Tony-LunarG | 2ec96bb | 2019-11-26 13:43:02 -0700 | [diff] [blame] | 374 | bool negative_viewport = |
| 375 | 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] | 376 | if (maint1 && negative_viewport) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 377 | skip |= LogError(device, "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-00374", |
| 378 | "VkDeviceCreateInfo->ppEnabledExtensionNames must not simultaneously include VK_KHR_maintenance1 and " |
| 379 | "VK_AMD_negative_viewport_height."); |
Petr Kraus | 6c4bdce | 2019-08-27 17:35:01 +0200 | [diff] [blame] | 380 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 381 | } |
| 382 | |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 383 | { |
ziga-lunarg | 9271a7c | 2021-07-19 16:37:06 +0200 | [diff] [blame] | 384 | bool khr_bda = |
| 385 | IsExtEnabledByCreateinfo(extension_state_by_name(device_extensions, VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME)); |
| 386 | bool ext_bda = |
| 387 | IsExtEnabledByCreateinfo(extension_state_by_name(device_extensions, VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME)); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 388 | if (khr_bda && ext_bda) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 389 | skip |= LogError(device, "VUID-VkDeviceCreateInfo-ppEnabledExtensionNames-03328", |
| 390 | "VkDeviceCreateInfo->ppEnabledExtensionNames must not contain both VK_KHR_buffer_device_address and " |
| 391 | "VK_EXT_buffer_device_address."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 392 | } |
| 393 | } |
| 394 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 395 | if (pCreateInfo->pNext != NULL && pCreateInfo->pEnabledFeatures) { |
| 396 | // Check for get_physical_device_properties2 struct |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 397 | const auto *features2 = LvlFindInChain<VkPhysicalDeviceFeatures2>(pCreateInfo->pNext); |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 398 | if (features2) { |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 399 | // Cannot include VkPhysicalDeviceFeatures2 and have non-null pEnabledFeatures |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 400 | skip |= LogError(device, "VUID-VkDeviceCreateInfo-pNext-00373", |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 401 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceFeatures2 struct when " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 402 | "pCreateInfo->pEnabledFeatures is non-NULL."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 403 | } |
| 404 | } |
| 405 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 406 | auto features2 = LvlFindInChain<VkPhysicalDeviceFeatures2>(pCreateInfo->pNext); |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 407 | const VkPhysicalDeviceFeatures *features = features2 ? &features2->features : pCreateInfo->pEnabledFeatures; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 408 | const auto *robustness2_features = LvlFindInChain<VkPhysicalDeviceRobustness2FeaturesEXT>(pCreateInfo->pNext); |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 409 | if (features && robustness2_features && robustness2_features->robustBufferAccess2 && !features->robustBufferAccess) { |
| 410 | skip |= LogError(device, "VUID-VkPhysicalDeviceRobustness2FeaturesEXT-robustBufferAccess2-04000", |
| 411 | "If robustBufferAccess2 is enabled then robustBufferAccess must be enabled."); |
| 412 | } |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 413 | const auto *raytracing_features = LvlFindInChain<VkPhysicalDeviceRayTracingPipelineFeaturesKHR>(pCreateInfo->pNext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 414 | if (raytracing_features && raytracing_features->rayTracingPipelineShaderGroupHandleCaptureReplayMixed && |
| 415 | !raytracing_features->rayTracingPipelineShaderGroupHandleCaptureReplay) { |
| 416 | skip |= LogError( |
| 417 | device, |
| 418 | "VUID-VkPhysicalDeviceRayTracingPipelineFeaturesKHR-rayTracingPipelineShaderGroupHandleCaptureReplayMixed-03575", |
| 419 | "If rayTracingPipelineShaderGroupHandleCaptureReplayMixed is VK_TRUE, rayTracingPipelineShaderGroupHandleCaptureReplay " |
| 420 | "must also be VK_TRUE."); |
sourav parmar | a24fb7b | 2020-05-26 10:50:04 -0700 | [diff] [blame] | 421 | } |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 422 | auto vertex_attribute_divisor_features = LvlFindInChain<VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT>(pCreateInfo->pNext); |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 423 | if (vertex_attribute_divisor_features && (!IsExtEnabled(device_extensions.vk_ext_vertex_attribute_divisor))) { |
Mark Lobodzinski | 3e66ae8 | 2020-08-12 16:27:29 -0600 | [diff] [blame] | 424 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 425 | "VkDeviceCreateInfo->pNext includes a VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT " |
| 426 | "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] | 427 | } |
| 428 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 429 | const auto *vulkan_11_features = LvlFindInChain<VkPhysicalDeviceVulkan11Features>(pCreateInfo->pNext); |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 430 | if (vulkan_11_features) { |
| 431 | const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(pCreateInfo->pNext); |
| 432 | while (current) { |
| 433 | if (current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES || |
| 434 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES || |
| 435 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES || |
| 436 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES || |
| 437 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES || |
| 438 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 439 | skip |= LogError( |
| 440 | instance, "VUID-VkDeviceCreateInfo-pNext-02829", |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 441 | "If the pNext chain includes a VkPhysicalDeviceVulkan11Features structure, then it must not include a " |
| 442 | "VkPhysicalDevice16BitStorageFeatures, VkPhysicalDeviceMultiviewFeatures, " |
| 443 | "VkPhysicalDeviceVariablePointersFeatures, VkPhysicalDeviceProtectedMemoryFeatures, " |
| 444 | "VkPhysicalDeviceSamplerYcbcrConversionFeatures, or VkPhysicalDeviceShaderDrawParametersFeatures structure"); |
| 445 | break; |
| 446 | } |
| 447 | current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext); |
| 448 | } |
sfricke-samsung | ebda679 | 2021-01-16 08:57:52 -0800 | [diff] [blame] | 449 | |
| 450 | // Check features are enabled if matching extension is passed in as well |
| 451 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 452 | const char *extension = pCreateInfo->ppEnabledExtensionNames[i]; |
| 453 | if ((0 == strncmp(extension, VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) && |
| 454 | (vulkan_11_features->shaderDrawParameters == VK_FALSE)) { |
| 455 | skip |= LogError( |
| 456 | instance, "VUID-VkDeviceCreateInfo-ppEnabledExtensions-04476", |
| 457 | "vkCreateDevice(): %s is enabled but VkPhysicalDeviceVulkan11Features::shaderDrawParameters is not VK_TRUE.", |
| 458 | VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME); |
| 459 | } |
| 460 | } |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 461 | } |
| 462 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 463 | const auto *vulkan_12_features = LvlFindInChain<VkPhysicalDeviceVulkan12Features>(pCreateInfo->pNext); |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 464 | if (vulkan_12_features) { |
| 465 | const VkBaseOutStructure *current = reinterpret_cast<const VkBaseOutStructure *>(pCreateInfo->pNext); |
| 466 | while (current) { |
| 467 | if (current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES || |
| 468 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES || |
| 469 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES || |
| 470 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES || |
| 471 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES || |
| 472 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES || |
| 473 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES || |
| 474 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES || |
| 475 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES || |
| 476 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES || |
| 477 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES || |
| 478 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES || |
| 479 | current->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 480 | skip |= LogError( |
| 481 | instance, "VUID-VkDeviceCreateInfo-pNext-02830", |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 482 | "If the pNext chain includes a VkPhysicalDeviceVulkan12Features structure, then it must not include a " |
| 483 | "VkPhysicalDevice8BitStorageFeatures, VkPhysicalDeviceShaderAtomicInt64Features, " |
| 484 | "VkPhysicalDeviceShaderFloat16Int8Features, VkPhysicalDeviceDescriptorIndexingFeatures, " |
| 485 | "VkPhysicalDeviceScalarBlockLayoutFeatures, VkPhysicalDeviceImagelessFramebufferFeatures, " |
| 486 | "VkPhysicalDeviceUniformBufferStandardLayoutFeatures, VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures, " |
| 487 | "VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures, VkPhysicalDeviceHostQueryResetFeatures, " |
| 488 | "VkPhysicalDeviceTimelineSemaphoreFeatures, VkPhysicalDeviceBufferDeviceAddressFeatures, or " |
| 489 | "VkPhysicalDeviceVulkanMemoryModelFeatures structure"); |
| 490 | break; |
| 491 | } |
| 492 | current = reinterpret_cast<const VkBaseOutStructure *>(current->pNext); |
| 493 | } |
sfricke-samsung | abab463 | 2020-05-04 06:51:46 -0700 | [diff] [blame] | 494 | // Check features are enabled if matching extension is passed in as well |
| 495 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 496 | const char *extension = pCreateInfo->ppEnabledExtensionNames[i]; |
| 497 | if ((0 == strncmp(extension, VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) && |
| 498 | (vulkan_12_features->drawIndirectCount == VK_FALSE)) { |
| 499 | skip |= LogError( |
| 500 | instance, "VUID-VkDeviceCreateInfo-ppEnabledExtensions-02831", |
| 501 | "vkCreateDevice(): %s is enabled but VkPhysicalDeviceVulkan12Features::drawIndirectCount is not VK_TRUE.", |
| 502 | VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME); |
| 503 | } |
| 504 | if ((0 == strncmp(extension, VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) && |
| 505 | (vulkan_12_features->samplerMirrorClampToEdge == VK_FALSE)) { |
| 506 | skip |= LogError(instance, "VUID-VkDeviceCreateInfo-ppEnabledExtensions-02832", |
| 507 | "vkCreateDevice(): %s is enabled but VkPhysicalDeviceVulkan12Features::samplerMirrorClampToEdge " |
| 508 | "is not VK_TRUE.", |
| 509 | VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME); |
| 510 | } |
| 511 | if ((0 == strncmp(extension, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) && |
| 512 | (vulkan_12_features->descriptorIndexing == VK_FALSE)) { |
| 513 | skip |= LogError( |
| 514 | instance, "VUID-VkDeviceCreateInfo-ppEnabledExtensions-02833", |
| 515 | "vkCreateDevice(): %s is enabled but VkPhysicalDeviceVulkan12Features::descriptorIndexing is not VK_TRUE.", |
| 516 | VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME); |
| 517 | } |
| 518 | if ((0 == strncmp(extension, VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) && |
| 519 | (vulkan_12_features->samplerFilterMinmax == VK_FALSE)) { |
| 520 | skip |= LogError( |
| 521 | instance, "VUID-VkDeviceCreateInfo-ppEnabledExtensions-02834", |
| 522 | "vkCreateDevice(): %s is enabled but VkPhysicalDeviceVulkan12Features::samplerFilterMinmax is not VK_TRUE.", |
| 523 | VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME); |
| 524 | } |
| 525 | if ((0 == strncmp(extension, VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME, VK_MAX_EXTENSION_NAME_SIZE)) && |
| 526 | ((vulkan_12_features->shaderOutputViewportIndex == VK_FALSE) || |
| 527 | (vulkan_12_features->shaderOutputLayer == VK_FALSE))) { |
| 528 | skip |= |
| 529 | LogError(instance, "VUID-VkDeviceCreateInfo-ppEnabledExtensions-02835", |
| 530 | "vkCreateDevice(): %s is enabled but both VkPhysicalDeviceVulkan12Features::shaderOutputViewportIndex " |
| 531 | "and VkPhysicalDeviceVulkan12Features::shaderOutputLayer are not VK_TRUE.", |
| 532 | VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME); |
| 533 | } |
| 534 | } |
ziga-lunarg | 27f88fd | 2021-08-01 15:47:30 +0200 | [diff] [blame] | 535 | if (vulkan_12_features->bufferDeviceAddress == VK_TRUE) { |
| 536 | if (IsExtEnabledByCreateinfo(extension_state_by_name(device_extensions, VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME))) { |
| 537 | skip |= LogError(instance, "VUID-VkDeviceCreateInfo-pNext-04748", |
| 538 | "vkCreateDevice(): pNext chain includes VkPhysicalDeviceVulkan12Features with bufferDeviceAddress " |
| 539 | "set to VK_TRUE and ppEnabledExtensionNames contains VK_EXT_buffer_device_address"); |
| 540 | } |
| 541 | } |
Tony-LunarG | 28017bc | 2020-01-23 14:40:25 -0700 | [diff] [blame] | 542 | } |
| 543 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 544 | // Validate pCreateInfo->pQueueCreateInfos |
| 545 | if (pCreateInfo->pQueueCreateInfos) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 546 | |
| 547 | for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 548 | const VkDeviceQueueCreateInfo &queue_create_info = pCreateInfo->pQueueCreateInfos[i]; |
| 549 | const uint32_t requested_queue_family = queue_create_info.queueFamilyIndex; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 550 | if (requested_queue_family == VK_QUEUE_FAMILY_IGNORED) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 551 | skip |= |
| 552 | LogError(physicalDevice, "VUID-VkDeviceQueueCreateInfo-queueFamilyIndex-00381", |
| 553 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 |
| 554 | "].queueFamilyIndex is VK_QUEUE_FAMILY_IGNORED, but it is required to provide a valid queue family " |
| 555 | "index value.", |
| 556 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 557 | } |
| 558 | |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 559 | if (queue_create_info.pQueuePriorities != nullptr) { |
| 560 | for (uint32_t j = 0; j < queue_create_info.queueCount; ++j) { |
| 561 | const float queue_priority = queue_create_info.pQueuePriorities[j]; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 562 | if (!(queue_priority >= 0.f) || !(queue_priority <= 1.f)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 563 | skip |= LogError(physicalDevice, "VUID-VkDeviceQueueCreateInfo-pQueuePriorities-00383", |
| 564 | "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].pQueuePriorities[%" PRIu32 |
| 565 | "] (=%f) is not between 0 and 1 (inclusive).", |
| 566 | i, j, queue_priority); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 567 | } |
| 568 | } |
| 569 | } |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 570 | |
| 571 | // Need to know if protectedMemory feature is passed in preCall to creating the device |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 572 | VkBool32 protected_memory = VK_FALSE; |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 573 | const VkPhysicalDeviceProtectedMemoryFeatures *protected_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 574 | LvlFindInChain<VkPhysicalDeviceProtectedMemoryFeatures>(pCreateInfo->pNext); |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 575 | if (protected_features) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 576 | protected_memory = protected_features->protectedMemory; |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 577 | } else if (vulkan_11_features) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 578 | protected_memory = vulkan_11_features->protectedMemory; |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 579 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 580 | if ((queue_create_info.flags == VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT) && (protected_memory == VK_FALSE)) { |
sfricke-samsung | 590ae1e | 2020-04-25 01:18:05 -0700 | [diff] [blame] | 581 | skip |= LogError(physicalDevice, "VUID-VkDeviceQueueCreateInfo-flags-02861", |
| 582 | "vkCreateDevice: pCreateInfo->flags set to VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT without the " |
| 583 | "protectedMemory feature being set as well."); |
| 584 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 585 | } |
| 586 | } |
| 587 | |
sfricke-samsung | 30a5741 | 2020-05-15 21:14:54 -0700 | [diff] [blame] | 588 | // feature dependencies for VK_KHR_variable_pointers |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 589 | const auto *variable_pointers_features = LvlFindInChain<VkPhysicalDeviceVariablePointersFeatures>(pCreateInfo->pNext); |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 590 | VkBool32 variable_pointers = VK_FALSE; |
| 591 | VkBool32 variable_pointers_storage_buffer = VK_FALSE; |
sfricke-samsung | 30a5741 | 2020-05-15 21:14:54 -0700 | [diff] [blame] | 592 | if (vulkan_11_features) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 593 | variable_pointers = vulkan_11_features->variablePointers; |
| 594 | variable_pointers_storage_buffer = vulkan_11_features->variablePointersStorageBuffer; |
sfricke-samsung | 30a5741 | 2020-05-15 21:14:54 -0700 | [diff] [blame] | 595 | } else if (variable_pointers_features) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 596 | variable_pointers = variable_pointers_features->variablePointers; |
| 597 | variable_pointers_storage_buffer = variable_pointers_features->variablePointersStorageBuffer; |
sfricke-samsung | 30a5741 | 2020-05-15 21:14:54 -0700 | [diff] [blame] | 598 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 599 | if ((variable_pointers == VK_TRUE) && (variable_pointers_storage_buffer == VK_FALSE)) { |
sfricke-samsung | 30a5741 | 2020-05-15 21:14:54 -0700 | [diff] [blame] | 600 | skip |= LogError(instance, "VUID-VkPhysicalDeviceVariablePointersFeatures-variablePointers-01431", |
| 601 | "If variablePointers is VK_TRUE then variablePointersStorageBuffer also needs to be VK_TRUE"); |
| 602 | } |
| 603 | |
sfricke-samsung | fd76c34 | 2020-05-29 23:13:43 -0700 | [diff] [blame] | 604 | // feature dependencies for VK_KHR_multiview |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 605 | const auto *multiview_features = LvlFindInChain<VkPhysicalDeviceMultiviewFeatures>(pCreateInfo->pNext); |
sfricke-samsung | fd76c34 | 2020-05-29 23:13:43 -0700 | [diff] [blame] | 606 | VkBool32 multiview = VK_FALSE; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 607 | VkBool32 multiview_geometry_shader = VK_FALSE; |
| 608 | VkBool32 multiview_tessellation_shader = VK_FALSE; |
sfricke-samsung | fd76c34 | 2020-05-29 23:13:43 -0700 | [diff] [blame] | 609 | if (vulkan_11_features) { |
| 610 | multiview = vulkan_11_features->multiview; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 611 | multiview_geometry_shader = vulkan_11_features->multiviewGeometryShader; |
| 612 | multiview_tessellation_shader = vulkan_11_features->multiviewTessellationShader; |
sfricke-samsung | fd76c34 | 2020-05-29 23:13:43 -0700 | [diff] [blame] | 613 | } else if (multiview_features) { |
| 614 | multiview = multiview_features->multiview; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 615 | multiview_geometry_shader = multiview_features->multiviewGeometryShader; |
| 616 | multiview_tessellation_shader = multiview_features->multiviewTessellationShader; |
sfricke-samsung | fd76c34 | 2020-05-29 23:13:43 -0700 | [diff] [blame] | 617 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 618 | if ((multiview == VK_FALSE) && (multiview_geometry_shader == VK_TRUE)) { |
sfricke-samsung | fd76c34 | 2020-05-29 23:13:43 -0700 | [diff] [blame] | 619 | skip |= LogError(instance, "VUID-VkPhysicalDeviceMultiviewFeatures-multiviewGeometryShader-00580", |
| 620 | "If multiviewGeometryShader is VK_TRUE then multiview also needs to be VK_TRUE"); |
| 621 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 622 | if ((multiview == VK_FALSE) && (multiview_tessellation_shader == VK_TRUE)) { |
sfricke-samsung | fd76c34 | 2020-05-29 23:13:43 -0700 | [diff] [blame] | 623 | skip |= LogError(instance, "VUID-VkPhysicalDeviceMultiviewFeatures-multiviewTessellationShader-00581", |
| 624 | "If multiviewTessellationShader is VK_TRUE then multiview also needs to be VK_TRUE"); |
| 625 | } |
| 626 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 627 | return skip; |
| 628 | } |
| 629 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 630 | 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] | 631 | if (!flag) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 632 | return LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 633 | "%s() called even though the %s extension was not enabled for this VkDevice.", function_name, |
| 634 | extension_name); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 635 | } |
| 636 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 637 | return false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 638 | } |
| 639 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 640 | bool StatelessValidation::manual_PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 641 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) const { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 642 | bool skip = false; |
| 643 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 644 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 645 | skip |= |
| 646 | ValidateGreaterThanZero(pCreateInfo->size, "pCreateInfo->size", "VUID-VkBufferCreateInfo-size-00912", "vkCreateBuffer"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 647 | |
| 648 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 649 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 650 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 651 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 652 | skip |= LogError(device, "VUID-VkBufferCreateInfo-sharingMode-00914", |
| 653 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 654 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 658 | // queueFamilyIndexCount uint32_t values |
| 659 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 660 | skip |= LogError(device, "VUID-VkBufferCreateInfo-sharingMode-00913", |
| 661 | "vkCreateBuffer: if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 662 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 663 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 664 | } |
| 665 | } |
| 666 | |
sfricke-samsung | 8f8cf05 | 2020-07-03 22:44:29 -0700 | [diff] [blame] | 667 | if ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) && (!physical_device_features.sparseBinding)) { |
| 668 | skip |= LogError(device, "VUID-VkBufferCreateInfo-flags-00915", |
| 669 | "vkCreateBuffer(): the sparseBinding device feature is disabled: Buffers cannot be created with the " |
| 670 | "VK_BUFFER_CREATE_SPARSE_BINDING_BIT set."); |
| 671 | } |
| 672 | |
| 673 | if ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) && (!physical_device_features.sparseResidencyBuffer)) { |
| 674 | skip |= |
| 675 | LogError(device, "VUID-VkBufferCreateInfo-flags-00916", |
| 676 | "vkCreateBuffer(): the sparseResidencyBuffer device feature is disabled: Buffers cannot be created with " |
| 677 | "the VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT set."); |
| 678 | } |
| 679 | |
| 680 | if ((pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) && (!physical_device_features.sparseResidencyAliased)) { |
| 681 | skip |= |
| 682 | LogError(device, "VUID-VkBufferCreateInfo-flags-00917", |
| 683 | "vkCreateBuffer(): the sparseResidencyAliased device feature is disabled: Buffers cannot be created with " |
| 684 | "the VK_BUFFER_CREATE_SPARSE_ALIASED_BIT set."); |
| 685 | } |
| 686 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 687 | // If flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 688 | // VK_BUFFER_CREATE_SPARSE_BINDING_BIT |
| 689 | if (((pCreateInfo->flags & (VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 690 | ((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] | 691 | skip |= LogError(device, "VUID-VkBufferCreateInfo-flags-00918", |
| 692 | "vkCreateBuffer: if pCreateInfo->flags contains VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT or " |
| 693 | "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] | 694 | } |
| 695 | } |
| 696 | |
| 697 | return skip; |
| 698 | } |
| 699 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 700 | bool StatelessValidation::manual_PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 701 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 702 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 703 | |
| 704 | if (pCreateInfo != nullptr) { |
sfricke-samsung | 61a57c0 | 2021-01-10 21:35:12 -0800 | [diff] [blame] | 705 | const VkFormat image_format = pCreateInfo->format; |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 706 | const VkImageCreateFlags image_flags = pCreateInfo->flags; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 707 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 708 | if (pCreateInfo->sharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 709 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 710 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 711 | skip |= LogError(device, "VUID-VkImageCreateInfo-sharingMode-00942", |
| 712 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 713 | "pCreateInfo->queueFamilyIndexCount must be greater than 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 714 | } |
| 715 | |
| 716 | // If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 717 | // queueFamilyIndexCount uint32_t values |
| 718 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 719 | skip |= LogError(device, "VUID-VkImageCreateInfo-sharingMode-00941", |
| 720 | "vkCreateImage(): if pCreateInfo->sharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 721 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
| 722 | "pCreateInfo->queueFamilyIndexCount uint32_t values."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 723 | } |
| 724 | } |
| 725 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 726 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.width, "pCreateInfo->extent.width", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 727 | "VUID-VkImageCreateInfo-extent-00944", "vkCreateImage"); |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 728 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.height, "pCreateInfo->extent.height", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 729 | "VUID-VkImageCreateInfo-extent-00945", "vkCreateImage"); |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 730 | skip |= ValidateGreaterThanZero(pCreateInfo->extent.depth, "pCreateInfo->extent.depth", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 731 | "VUID-VkImageCreateInfo-extent-00946", "vkCreateImage"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 732 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 733 | skip |= ValidateGreaterThanZero(pCreateInfo->mipLevels, "pCreateInfo->mipLevels", "VUID-VkImageCreateInfo-mipLevels-00947", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 734 | "vkCreateImage"); |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 735 | skip |= ValidateGreaterThanZero(pCreateInfo->arrayLayers, "pCreateInfo->arrayLayers", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 736 | "VUID-VkImageCreateInfo-arrayLayers-00948", "vkCreateImage"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 737 | |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 738 | // InitialLayout must be PREINITIALIZED or UNDEFINED |
Dave Houlton | e19e20d | 2018-02-02 16:32:41 -0700 | [diff] [blame] | 739 | if ((pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_UNDEFINED) && |
| 740 | (pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_PREINITIALIZED)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 741 | skip |= LogError( |
| 742 | device, "VUID-VkImageCreateInfo-initialLayout-00993", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 743 | "vkCreateImage(): initialLayout is %s, must be VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED.", |
| 744 | string_VkImageLayout(pCreateInfo->initialLayout)); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 745 | } |
| 746 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 747 | // 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] | 748 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_1D) && |
| 749 | ((pCreateInfo->extent.height != 1) || (pCreateInfo->extent.depth != 1))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 750 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00956", |
| 751 | "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_1D, both pCreateInfo->extent.height and " |
| 752 | "pCreateInfo->extent.depth must be 1."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 753 | } |
| 754 | |
| 755 | if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) { |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 756 | if (image_flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 757 | if (pCreateInfo->extent.width != pCreateInfo->extent.height) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 758 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00954", |
| 759 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but " |
| 760 | "pCreateInfo->extent.width (=%" PRIu32 ") and pCreateInfo->extent.height (=%" PRIu32 |
| 761 | ") are not equal.", |
| 762 | pCreateInfo->extent.width, pCreateInfo->extent.height); |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | if (pCreateInfo->arrayLayers < 6) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 766 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00954", |
| 767 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but " |
| 768 | "pCreateInfo->arrayLayers (=%" PRIu32 ") is not greater than or equal to 6.", |
| 769 | pCreateInfo->arrayLayers); |
Petr Kraus | 3f43321 | 2018-03-13 12:31:27 +0100 | [diff] [blame] | 770 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | if (pCreateInfo->extent.depth != 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 774 | skip |= LogError( |
| 775 | device, "VUID-VkImageCreateInfo-imageType-00957", |
| 776 | "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] | 777 | } |
| 778 | } |
| 779 | |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 780 | // 3D image may have only 1 layer |
| 781 | if ((pCreateInfo->imageType == VK_IMAGE_TYPE_3D) && (pCreateInfo->arrayLayers != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 782 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00961", |
| 783 | "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] | 784 | } |
| 785 | |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 786 | if (0 != (pCreateInfo->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT)) { |
| 787 | VkImageUsageFlags legal_flags = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | |
| 788 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); |
| 789 | // At least one of the legal attachment bits must be set |
| 790 | if (0 == (pCreateInfo->usage & legal_flags)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 791 | skip |= LogError(device, "VUID-VkImageCreateInfo-usage-00966", |
| 792 | "vkCreateImage(): Transient attachment image without a compatible attachment flag set."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 793 | } |
| 794 | // No flags other than the legal attachment bits may be set |
| 795 | legal_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 796 | if (0 != (pCreateInfo->usage & ~legal_flags)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 797 | skip |= LogError(device, "VUID-VkImageCreateInfo-usage-00963", |
| 798 | "vkCreateImage(): Transient attachment image with incompatible usage flags set."); |
Dave Houlton | 130c021 | 2018-01-29 13:39:56 -0700 | [diff] [blame] | 799 | } |
| 800 | } |
| 801 | |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 802 | // mipLevels must be less than or equal to the number of levels in the complete mipmap chain |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 803 | uint32_t max_dim = 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] | 804 | // Max mip levels is different for corner-sampled images vs normal images. |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 805 | uint32_t max_mip_levels = (image_flags & VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV) |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 806 | ? static_cast<uint32_t>(ceil(log2(max_dim))) |
| 807 | : static_cast<uint32_t>(floor(log2(max_dim)) + 1); |
| 808 | if (max_dim > 0 && pCreateInfo->mipLevels > max_mip_levels) { |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 809 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 810 | LogError(device, "VUID-VkImageCreateInfo-mipLevels-00958", |
| 811 | "vkCreateImage(): pCreateInfo->mipLevels must be less than or equal to " |
| 812 | "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] | 813 | } |
| 814 | |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 815 | if ((image_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] | 816 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-00950", |
| 817 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT but " |
| 818 | "pCreateInfo->imageType is not VK_IMAGE_TYPE_3D."); |
Mark Lobodzinski | 69259c5 | 2018-09-18 15:14:58 -0600 | [diff] [blame] | 819 | } |
| 820 | |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 821 | if ((image_flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) && (!physical_device_features.sparseBinding)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 822 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-00969", |
| 823 | "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_BINDING_BIT, but the " |
| 824 | "VkPhysicalDeviceFeatures::sparseBinding feature is disabled."); |
Petr Kraus | b6f9780 | 2018-03-13 12:31:39 +0100 | [diff] [blame] | 825 | } |
| 826 | |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 827 | if ((image_flags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) && (!physical_device_features.sparseResidencyAliased)) { |
sfricke-samsung | 8f8cf05 | 2020-07-03 22:44:29 -0700 | [diff] [blame] | 828 | skip |= LogError( |
| 829 | device, "VUID-VkImageCreateInfo-flags-01924", |
| 830 | "vkCreateImage(): the sparseResidencyAliased device feature is disabled: Images cannot be created with the " |
| 831 | "VK_IMAGE_CREATE_SPARSE_ALIASED_BIT set."); |
| 832 | } |
| 833 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 834 | // If flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or VK_IMAGE_CREATE_SPARSE_ALIASED_BIT, it must also contain |
| 835 | // VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 836 | if (((image_flags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) && |
| 837 | ((image_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] | 838 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-00987", |
| 839 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT or " |
| 840 | "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] | 841 | } |
| 842 | |
| 843 | // Check for combinations of attributes that are incompatible with having VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT set |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 844 | if ((image_flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) != 0) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 845 | // Linear tiling is unsupported |
| 846 | if (VK_IMAGE_TILING_LINEAR == pCreateInfo->tiling) { |
sfricke-samsung | 9801d75 | 2020-08-23 22:00:16 -0700 | [diff] [blame] | 847 | skip |= LogError(device, "VUID-VkImageCreateInfo-tiling-04121", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 848 | "vkCreateImage: if pCreateInfo->flags contains VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT then image " |
| 849 | "tiling of VK_IMAGE_TILING_LINEAR is not supported"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 850 | } |
| 851 | |
| 852 | // Sparse 1D image isn't valid |
| 853 | if (VK_IMAGE_TYPE_1D == pCreateInfo->imageType) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 854 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00970", |
| 855 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 1D image."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 856 | } |
| 857 | |
| 858 | // Sparse 2D image when device doesn't support it |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 859 | 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] | 860 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00971", |
| 861 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2D image if corresponding " |
| 862 | "feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 863 | } |
| 864 | |
| 865 | // Sparse 3D image when device doesn't support it |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 866 | 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] | 867 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00972", |
| 868 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 3D image if corresponding " |
| 869 | "feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | // Multi-sample 2D image when device doesn't support it |
| 873 | if (VK_IMAGE_TYPE_2D == pCreateInfo->imageType) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 874 | if ((VK_FALSE == physical_device_features.sparseResidency2Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 875 | (VK_SAMPLE_COUNT_2_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 876 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00973", |
| 877 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 2-sample image if " |
| 878 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 879 | } else if ((VK_FALSE == physical_device_features.sparseResidency4Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 880 | (VK_SAMPLE_COUNT_4_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 881 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00974", |
| 882 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 4-sample image if " |
| 883 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 884 | } else if ((VK_FALSE == physical_device_features.sparseResidency8Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 885 | (VK_SAMPLE_COUNT_8_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 886 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00975", |
| 887 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 8-sample image if " |
| 888 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 889 | } else if ((VK_FALSE == physical_device_features.sparseResidency16Samples) && |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 890 | (VK_SAMPLE_COUNT_16_BIT == pCreateInfo->samples)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 891 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-00976", |
| 892 | "vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT for 16-sample image if " |
| 893 | "corresponding feature is not enabled on the device."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 894 | } |
| 895 | } |
| 896 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 897 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 898 | if (pCreateInfo->usage & VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV) { |
| 899 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 900 | skip |= LogError(device, "VUID-VkImageCreateInfo-imageType-02082", |
| 901 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 902 | "imageType must be VK_IMAGE_TYPE_2D."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 903 | } |
| 904 | if (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 905 | skip |= LogError(device, "VUID-VkImageCreateInfo-samples-02083", |
| 906 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 907 | "samples must be VK_SAMPLE_COUNT_1_BIT."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 908 | } |
| 909 | if (pCreateInfo->tiling != VK_IMAGE_TILING_OPTIMAL) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 910 | skip |= LogError(device, "VUID-VkImageCreateInfo-tiling-02084", |
| 911 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, " |
| 912 | "tiling must be VK_IMAGE_TILING_OPTIMAL."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 913 | } |
| 914 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 915 | |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 916 | if (image_flags & VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 917 | 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] | 918 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02050", |
| 919 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV, " |
| 920 | "imageType must be VK_IMAGE_TYPE_2D or VK_IMAGE_TYPE_3D."); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 921 | } |
| 922 | |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 923 | if ((image_flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) || FormatIsDepthOrStencil(image_format)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 924 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02051", |
| 925 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV, " |
sfricke-samsung | 61a57c0 | 2021-01-10 21:35:12 -0800 | [diff] [blame] | 926 | "it must not also contain VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT and format (%s) must not be a " |
| 927 | "depth/stencil format.", |
| 928 | string_VkFormat(image_format)); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 929 | } |
| 930 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 931 | 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] | 932 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02052", |
| 933 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV and " |
| 934 | "imageType is VK_IMAGE_TYPE_2D, extent.width and extent.height must be " |
| 935 | "greater than 1."); |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 936 | } else if (pCreateInfo->imageType == VK_IMAGE_TYPE_3D && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 937 | (pCreateInfo->extent.width == 1 || pCreateInfo->extent.height == 1 || pCreateInfo->extent.depth == 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 938 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02053", |
| 939 | "vkCreateImage: If flags contains VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV and " |
| 940 | "imageType is VK_IMAGE_TYPE_3D, extent.width, extent.height, and extent.depth " |
| 941 | "must be greater than 1."); |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 942 | } |
| 943 | } |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 944 | |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 945 | if (((image_flags & VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT) != 0) && |
sfricke-samsung | 61a57c0 | 2021-01-10 21:35:12 -0800 | [diff] [blame] | 946 | (FormatHasDepth(image_format) == false)) { |
sfricke-samsung | 8f658d4 | 2020-05-03 20:12:24 -0700 | [diff] [blame] | 947 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-01533", |
| 948 | "vkCreateImage(): if flags contain VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT the " |
sfricke-samsung | 61a57c0 | 2021-01-10 21:35:12 -0800 | [diff] [blame] | 949 | "format (%s) must be a depth or depth/stencil format.", |
| 950 | string_VkFormat(image_format)); |
sfricke-samsung | 8f658d4 | 2020-05-03 20:12:24 -0700 | [diff] [blame] | 951 | } |
| 952 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 953 | const auto image_stencil_struct = LvlFindInChain<VkImageStencilUsageCreateInfo>(pCreateInfo->pNext); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 954 | if (image_stencil_struct != nullptr) { |
| 955 | if ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0) { |
| 956 | VkImageUsageFlags legal_flags = (VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); |
| 957 | // No flags other than the legal attachment bits may be set |
| 958 | legal_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 959 | if ((image_stencil_struct->stencilUsage & ~legal_flags) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 960 | skip |= LogError(device, "VUID-VkImageStencilUsageCreateInfo-stencilUsage-02539", |
| 961 | "vkCreateImage(): in pNext chain, VkImageStencilUsageCreateInfo::stencilUsage includes " |
| 962 | "VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, it must not include bits other than " |
| 963 | "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] | 964 | } |
| 965 | } |
| 966 | |
sfricke-samsung | 61a57c0 | 2021-01-10 21:35:12 -0800 | [diff] [blame] | 967 | if (FormatIsDepthOrStencil(image_format)) { |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 968 | if ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) != 0) { |
| 969 | if (pCreateInfo->extent.width > device_limits.maxFramebufferWidth) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 970 | skip |= |
| 971 | LogError(device, "VUID-VkImageCreateInfo-Format-02536", |
| 972 | "vkCreateImage(): Depth-stencil image contains VkImageStencilUsageCreateInfo structure with " |
| 973 | "stencilUsage including VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT and image width (%" PRIu32 |
| 974 | ") exceeds device " |
| 975 | "maxFramebufferWidth (%" PRIu32 ")", |
| 976 | pCreateInfo->extent.width, device_limits.maxFramebufferWidth); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 977 | } |
| 978 | |
| 979 | if (pCreateInfo->extent.height > device_limits.maxFramebufferHeight) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 980 | skip |= |
| 981 | LogError(device, "VUID-VkImageCreateInfo-format-02537", |
| 982 | "vkCreateImage(): Depth-stencil image contains VkImageStencilUsageCreateInfo structure with " |
| 983 | "stencilUsage including VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT and image height (%" PRIu32 |
| 984 | ") exceeds device " |
| 985 | "maxFramebufferHeight (%" PRIu32 ")", |
| 986 | pCreateInfo->extent.height, device_limits.maxFramebufferHeight); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 987 | } |
| 988 | } |
| 989 | |
| 990 | if (!physical_device_features.shaderStorageImageMultisample && |
| 991 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_STORAGE_BIT) != 0) && |
| 992 | (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT)) { |
| 993 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 994 | LogError(device, "VUID-VkImageCreateInfo-format-02538", |
| 995 | "vkCreateImage(): Depth-stencil image contains VkImageStencilUsageCreateInfo structure with " |
| 996 | "stencilUsage including VK_IMAGE_USAGE_STORAGE_BIT and the multisampled storage images feature is " |
| 997 | "not enabled, image samples must be VK_SAMPLE_COUNT_1_BIT"); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 998 | } |
| 999 | |
| 1000 | if (((pCreateInfo->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0) && |
| 1001 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) == 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1002 | skip |= LogError( |
| 1003 | device, "VUID-VkImageCreateInfo-format-02795", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 1004 | "vkCreateImage(): Depth-stencil image in which usage includes VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT " |
| 1005 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 1006 | "also include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 1007 | } else if (((pCreateInfo->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) == 0) && |
| 1008 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1009 | skip |= LogError( |
| 1010 | device, "VUID-VkImageCreateInfo-format-02796", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 1011 | "vkCreateImage(): Depth-stencil image in which usage does not include " |
| 1012 | "VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT " |
| 1013 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 1014 | "also not include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT"); |
| 1015 | } |
| 1016 | |
| 1017 | if (((pCreateInfo->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0) && |
| 1018 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1019 | skip |= LogError( |
| 1020 | device, "VUID-VkImageCreateInfo-format-02797", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 1021 | "vkCreateImage(): Depth-stencil image in which usage includes VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT " |
| 1022 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 1023 | "also include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 1024 | } else if (((pCreateInfo->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0) && |
| 1025 | ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1026 | skip |= LogError( |
| 1027 | device, "VUID-VkImageCreateInfo-format-02798", |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 1028 | "vkCreateImage(): Depth-stencil image in which usage does not include " |
| 1029 | "VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT " |
| 1030 | "contains VkImageStencilUsageCreateInfo structure, VkImageStencilUsageCreateInfo::stencilUsage must " |
| 1031 | "also not include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT"); |
| 1032 | } |
| 1033 | } |
| 1034 | } |
Spencer Fricke | ca52b5c | 2020-03-16 17:34:00 -0700 | [diff] [blame] | 1035 | |
| 1036 | if ((!physical_device_features.shaderStorageImageMultisample) && ((pCreateInfo->usage & VK_IMAGE_USAGE_STORAGE_BIT) != 0) && |
| 1037 | (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT)) { |
| 1038 | skip |= LogError(device, "VUID-VkImageCreateInfo-usage-00968", |
| 1039 | "vkCreateImage(): usage contains VK_IMAGE_USAGE_STORAGE_BIT and the multisampled storage images " |
| 1040 | "feature is not enabled, image samples must be VK_SAMPLE_COUNT_1_BIT"); |
| 1041 | } |
Spencer Fricke | 6f8b8ac | 2020-04-06 07:36:50 -0700 | [diff] [blame] | 1042 | |
Mark Lobodzinski | 09b4caa | 2020-11-20 17:26:46 -0700 | [diff] [blame] | 1043 | std::vector<uint64_t> image_create_drm_format_modifiers; |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 1044 | if (IsExtEnabled(device_extensions.vk_ext_image_drm_format_modifier)) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 1045 | const auto drm_format_mod_list = LvlFindInChain<VkImageDrmFormatModifierListCreateInfoEXT>(pCreateInfo->pNext); |
| 1046 | const auto drm_format_mod_explict = LvlFindInChain<VkImageDrmFormatModifierExplicitCreateInfoEXT>(pCreateInfo->pNext); |
Spencer Fricke | 6f8b8ac | 2020-04-06 07:36:50 -0700 | [diff] [blame] | 1047 | if (pCreateInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) { |
| 1048 | if (((drm_format_mod_list != nullptr) && (drm_format_mod_explict != nullptr)) || |
| 1049 | ((drm_format_mod_list == nullptr) && (drm_format_mod_explict == nullptr))) { |
| 1050 | skip |= LogError(device, "VUID-VkImageCreateInfo-tiling-02261", |
| 1051 | "vkCreateImage(): Tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT but pNext must have " |
| 1052 | "either VkImageDrmFormatModifierListCreateInfoEXT or " |
| 1053 | "VkImageDrmFormatModifierExplicitCreateInfoEXT in the pNext chain"); |
Martin Freebody | 0ec2c7a | 2021-03-03 16:48:00 +0000 | [diff] [blame] | 1054 | } else if (drm_format_mod_explict != nullptr) { |
Mark Lobodzinski | 09b4caa | 2020-11-20 17:26:46 -0700 | [diff] [blame] | 1055 | image_create_drm_format_modifiers.push_back(drm_format_mod_explict->drmFormatModifier); |
| 1056 | } else if (drm_format_mod_list != nullptr) { |
| 1057 | for (uint32_t i = 0; i < drm_format_mod_list->drmFormatModifierCount; i++) { |
| 1058 | image_create_drm_format_modifiers.push_back(*drm_format_mod_list->pDrmFormatModifiers); |
| 1059 | } |
Spencer Fricke | 6f8b8ac | 2020-04-06 07:36:50 -0700 | [diff] [blame] | 1060 | } |
| 1061 | } else if ((drm_format_mod_list != nullptr) || (drm_format_mod_explict != nullptr)) { |
| 1062 | skip |= LogError(device, "VUID-VkImageCreateInfo-pNext-02262", |
| 1063 | "vkCreateImage(): Tiling is not VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT but there is a " |
| 1064 | "VkImageDrmFormatModifierListCreateInfoEXT or VkImageDrmFormatModifierExplicitCreateInfoEXT " |
| 1065 | "in the pNext chain"); |
| 1066 | } |
| 1067 | } |
janharaldfredriksen-arm | 3b79377 | 2020-05-12 18:55:53 +0200 | [diff] [blame] | 1068 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1069 | static const uint64_t drm_format_mod_linear = 0; |
Mark Lobodzinski | 09b4caa | 2020-11-20 17:26:46 -0700 | [diff] [blame] | 1070 | bool image_create_maybe_linear = false; |
| 1071 | if (pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR) { |
| 1072 | image_create_maybe_linear = true; |
| 1073 | } else if (pCreateInfo->tiling == VK_IMAGE_TILING_OPTIMAL) { |
| 1074 | image_create_maybe_linear = false; |
| 1075 | } else if (pCreateInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) { |
| 1076 | image_create_maybe_linear = |
| 1077 | (std::find(image_create_drm_format_modifiers.begin(), image_create_drm_format_modifiers.end(), |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1078 | drm_format_mod_linear) != image_create_drm_format_modifiers.end()); |
Mark Lobodzinski | 09b4caa | 2020-11-20 17:26:46 -0700 | [diff] [blame] | 1079 | } |
| 1080 | |
| 1081 | // If multi-sample, validate type, usage, tiling and mip levels. |
| 1082 | if ((pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) && |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1083 | ((pCreateInfo->imageType != VK_IMAGE_TYPE_2D) || (image_flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) || |
Mark Lobodzinski | 09b4caa | 2020-11-20 17:26:46 -0700 | [diff] [blame] | 1084 | (pCreateInfo->mipLevels != 1) || image_create_maybe_linear)) { |
| 1085 | skip |= LogError(device, "VUID-VkImageCreateInfo-samples-02257", |
| 1086 | "vkCreateImage(): Multi-sample image with incompatible type, usage, tiling, or mips."); |
| 1087 | } |
| 1088 | |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1089 | if ((image_flags & VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT) && |
Mark Lobodzinski | 09b4caa | 2020-11-20 17:26:46 -0700 | [diff] [blame] | 1090 | ((pCreateInfo->mipLevels != 1) || (pCreateInfo->arrayLayers != 1) || (pCreateInfo->imageType != VK_IMAGE_TYPE_2D) || |
| 1091 | image_create_maybe_linear)) { |
| 1092 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02259", |
| 1093 | "vkCreateImage(): Multi-device image with incompatible type, usage, tiling, or mips."); |
| 1094 | } |
| 1095 | |
janharaldfredriksen-arm | 3b79377 | 2020-05-12 18:55:53 +0200 | [diff] [blame] | 1096 | if (pCreateInfo->usage & VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT) { |
| 1097 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D) { |
| 1098 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02557", |
| 1099 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT, " |
| 1100 | "imageType must be VK_IMAGE_TYPE_2D."); |
| 1101 | } |
| 1102 | if (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) { |
| 1103 | skip |= LogError(device, "VUID-VkImageCreateInfo-samples-02558", |
| 1104 | "vkCreateImage: if usage includes VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT, " |
| 1105 | "samples must be VK_SAMPLE_COUNT_1_BIT."); |
| 1106 | } |
janharaldfredriksen-arm | 3b79377 | 2020-05-12 18:55:53 +0200 | [diff] [blame] | 1107 | } |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1108 | if (image_flags & VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT) { |
janharaldfredriksen-arm | 3b79377 | 2020-05-12 18:55:53 +0200 | [diff] [blame] | 1109 | if (pCreateInfo->tiling != VK_IMAGE_TILING_OPTIMAL) { |
| 1110 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02565", |
| 1111 | "vkCreateImage: if usage includes VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT, " |
| 1112 | "tiling must be VK_IMAGE_TILING_OPTIMAL."); |
| 1113 | } |
| 1114 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D) { |
| 1115 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02566", |
| 1116 | "vkCreateImage: if flags includes VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT, " |
| 1117 | "imageType must be VK_IMAGE_TYPE_2D."); |
| 1118 | } |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1119 | if (image_flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) { |
janharaldfredriksen-arm | 3b79377 | 2020-05-12 18:55:53 +0200 | [diff] [blame] | 1120 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02567", |
| 1121 | "vkCreateImage: if flags includes VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT, " |
| 1122 | "flags must not include VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT."); |
| 1123 | } |
| 1124 | if (pCreateInfo->mipLevels != 1) { |
| 1125 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-02568", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1126 | "vkCreateImage: if flags includes VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT, mipLevels (%" PRIu32 |
| 1127 | ") must be 1.", |
janharaldfredriksen-arm | 3b79377 | 2020-05-12 18:55:53 +0200 | [diff] [blame] | 1128 | pCreateInfo->mipLevels); |
| 1129 | } |
| 1130 | } |
sfricke-samsung | ddaf72b | 2020-06-23 21:39:28 -0700 | [diff] [blame] | 1131 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 1132 | const auto swapchain_create_info = LvlFindInChain<VkImageSwapchainCreateInfoKHR>(pCreateInfo->pNext); |
sfricke-samsung | ddaf72b | 2020-06-23 21:39:28 -0700 | [diff] [blame] | 1133 | if (swapchain_create_info != nullptr) { |
| 1134 | if (swapchain_create_info->swapchain != VK_NULL_HANDLE) { |
| 1135 | // All the following fall under the same VU that checks that the swapchain image uses parameters limited by the |
| 1136 | // table in #swapchain-wsi-image-create-info. Breaking up into multiple checks allows for more useful information |
| 1137 | // returned why this error occured. Check for matching Swapchain flags is done later in state tracking validation |
| 1138 | const char *vuid = "VUID-VkImageSwapchainCreateInfoKHR-swapchain-00995"; |
| 1139 | const char *base_message = "vkCreateImage(): The image used for creating a presentable swapchain image"; |
| 1140 | |
| 1141 | if (pCreateInfo->imageType != VK_IMAGE_TYPE_2D) { |
| 1142 | // also implicitly forces the check above that extent.depth is 1 |
| 1143 | skip |= LogError(device, vuid, "%s must have a imageType value VK_IMAGE_TYPE_2D instead of %s.", base_message, |
| 1144 | string_VkImageType(pCreateInfo->imageType)); |
| 1145 | } |
| 1146 | if (pCreateInfo->mipLevels != 1) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1147 | skip |= LogError(device, vuid, "%s must have a mipLevels value of 1 instead of %" PRIu32 ".", base_message, |
sfricke-samsung | ddaf72b | 2020-06-23 21:39:28 -0700 | [diff] [blame] | 1148 | pCreateInfo->mipLevels); |
| 1149 | } |
| 1150 | if (pCreateInfo->samples != VK_SAMPLE_COUNT_1_BIT) { |
| 1151 | skip |= LogError(device, vuid, "%s must have a samples value of VK_SAMPLE_COUNT_1_BIT instead of %s.", |
| 1152 | base_message, string_VkSampleCountFlagBits(pCreateInfo->samples)); |
| 1153 | } |
| 1154 | if (pCreateInfo->tiling != VK_IMAGE_TILING_OPTIMAL) { |
| 1155 | skip |= LogError(device, vuid, "%s must have a tiling value of VK_IMAGE_TILING_OPTIMAL instead of %s.", |
| 1156 | base_message, string_VkImageTiling(pCreateInfo->tiling)); |
| 1157 | } |
| 1158 | if (pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_UNDEFINED) { |
| 1159 | skip |= LogError(device, vuid, "%s must have a initialLayout value of VK_IMAGE_LAYOUT_UNDEFINED instead of %s.", |
| 1160 | base_message, string_VkImageLayout(pCreateInfo->initialLayout)); |
| 1161 | } |
| 1162 | const VkImageCreateFlags valid_flags = |
| 1163 | (VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT | VK_IMAGE_CREATE_PROTECTED_BIT | |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 1164 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT); |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1165 | if ((image_flags & ~valid_flags) != 0) { |
sfricke-samsung | ddaf72b | 2020-06-23 21:39:28 -0700 | [diff] [blame] | 1166 | skip |= LogError(device, vuid, "%s flags are %" PRIu32 "and must only have valid flags set.", base_message, |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1167 | image_flags); |
sfricke-samsung | ddaf72b | 2020-06-23 21:39:28 -0700 | [diff] [blame] | 1168 | } |
| 1169 | } |
| 1170 | } |
sfricke-samsung | 61a57c0 | 2021-01-10 21:35:12 -0800 | [diff] [blame] | 1171 | |
| 1172 | // If Chroma subsampled format ( _420_ or _422_ ) |
| 1173 | if (FormatIsXChromaSubsampled(image_format) && (SafeModulo(pCreateInfo->extent.width, 2) != 0)) { |
| 1174 | skip |= |
| 1175 | LogError(device, "VUID-VkImageCreateInfo-format-04712", |
| 1176 | "vkCreateImage(): The format (%s) is X Chroma Subsampled (has _422 or _420 suffix) so the width (=%" PRIu32 |
| 1177 | ") must be a multiple of 2.", |
| 1178 | string_VkFormat(image_format), pCreateInfo->extent.width); |
| 1179 | } |
| 1180 | if (FormatIsYChromaSubsampled(image_format) && (SafeModulo(pCreateInfo->extent.height, 2) != 0)) { |
| 1181 | skip |= LogError(device, "VUID-VkImageCreateInfo-format-04713", |
| 1182 | "vkCreateImage(): The format (%s) is Y Chroma Subsampled (has _420 suffix) so the height (=%" PRIu32 |
| 1183 | ") must be a multiple of 2.", |
| 1184 | string_VkFormat(image_format), pCreateInfo->extent.height); |
| 1185 | } |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1186 | |
| 1187 | const auto format_list_info = LvlFindInChain<VkImageFormatListCreateInfo>(pCreateInfo->pNext); |
| 1188 | if (format_list_info) { |
| 1189 | const uint32_t viewFormatCount = format_list_info->viewFormatCount; |
| 1190 | if (((image_flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) == 0) && (viewFormatCount > 1)) { |
| 1191 | skip |= LogError(device, "VUID-VkImageCreateInfo-flags-04738", |
| 1192 | "vkCreateImage(): If the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT is not set, then " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1193 | "VkImageFormatListCreateInfo::viewFormatCount (%" PRIu32 ") must be 0 or 1.", |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1194 | viewFormatCount); |
| 1195 | } |
| 1196 | // Check if viewFormatCount is not zero that it is all compatible |
| 1197 | for (uint32_t i = 0; i < viewFormatCount; i++) { |
| 1198 | if (FormatCompatibilityClass(format_list_info->pViewFormats[i]) != FormatCompatibilityClass(image_format)) { |
| 1199 | skip |= LogError(device, "VUID-VkImageCreateInfo-pNext-04737", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1200 | "vkCreateImage(): VkImageFormatListCreateInfo::pViewFormats[%" PRIu32 |
| 1201 | "] (%s) and " |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1202 | "VkImageCreateInfo::format (%s) are not compatible.", |
Esther O'Keefe | d37c24b | 2021-09-27 12:45:40 +1000 | [diff] [blame] | 1203 | i, string_VkFormat(format_list_info->pViewFormats[i]), string_VkFormat(image_format)); |
sfricke-samsung | f60b6c8 | 2021-04-05 22:59:20 -0700 | [diff] [blame] | 1204 | } |
| 1205 | } |
| 1206 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1207 | } |
Jeff Bolz | ef40fec | 2018-09-01 22:04:34 -0500 | [diff] [blame] | 1208 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1209 | return skip; |
| 1210 | } |
| 1211 | |
Jeff Bolz | 99e3f63 | 2020-03-24 22:59:22 -0500 | [diff] [blame] | 1212 | bool StatelessValidation::manual_PreCallValidateCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 1213 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) const { |
| 1214 | bool skip = false; |
| 1215 | |
| 1216 | if (pCreateInfo != nullptr) { |
Spencer Fricke | 528e098 | 2020-04-19 18:46:01 -0700 | [diff] [blame] | 1217 | // Validate feature set if using CUBE_ARRAY |
| 1218 | if ((pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) && (physical_device_features.imageCubeArray == false)) { |
| 1219 | skip |= LogError(pCreateInfo->image, "VUID-VkImageViewCreateInfo-viewType-01004", |
| 1220 | "vkCreateImageView(): pCreateInfo->viewType can't be VK_IMAGE_VIEW_TYPE_CUBE_ARRAY without " |
| 1221 | "enabling the imageCubeArray feature."); |
| 1222 | } |
| 1223 | |
Jeff Bolz | 99e3f63 | 2020-03-24 22:59:22 -0500 | [diff] [blame] | 1224 | if (pCreateInfo->subresourceRange.layerCount != VK_REMAINING_ARRAY_LAYERS) { |
| 1225 | if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE && pCreateInfo->subresourceRange.layerCount != 6) { |
| 1226 | skip |= LogError(device, "VUID-VkImageViewCreateInfo-viewType-02960", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1227 | "vkCreateImageView(): subresourceRange.layerCount (%" PRIu32 |
| 1228 | ") must be 6 or VK_REMAINING_ARRAY_LAYERS.", |
Jeff Bolz | 99e3f63 | 2020-03-24 22:59:22 -0500 | [diff] [blame] | 1229 | pCreateInfo->subresourceRange.layerCount); |
| 1230 | } |
| 1231 | if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY && (pCreateInfo->subresourceRange.layerCount % 6) != 0) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1232 | skip |= LogError(device, "VUID-VkImageViewCreateInfo-viewType-02961", |
| 1233 | "vkCreateImageView(): subresourceRange.layerCount (%" PRIu32 |
| 1234 | ") must be a multiple of 6 or VK_REMAINING_ARRAY_LAYERS.", |
| 1235 | pCreateInfo->subresourceRange.layerCount); |
Jeff Bolz | 99e3f63 | 2020-03-24 22:59:22 -0500 | [diff] [blame] | 1236 | } |
| 1237 | } |
sfricke-samsung | 0c4a06f | 2020-06-27 01:24:32 -0700 | [diff] [blame] | 1238 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 1239 | auto astc_decode_mode = LvlFindInChain<VkImageViewASTCDecodeModeEXT>(pCreateInfo->pNext); |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 1240 | if (IsExtEnabled(device_extensions.vk_ext_astc_decode_mode) && (astc_decode_mode != nullptr)) { |
sfricke-samsung | 0c4a06f | 2020-06-27 01:24:32 -0700 | [diff] [blame] | 1241 | if ((astc_decode_mode->decodeMode != VK_FORMAT_R16G16B16A16_SFLOAT) && |
| 1242 | (astc_decode_mode->decodeMode != VK_FORMAT_R8G8B8A8_UNORM) && |
| 1243 | (astc_decode_mode->decodeMode != VK_FORMAT_E5B9G9R9_UFLOAT_PACK32)) { |
| 1244 | skip |= LogError(device, "VUID-VkImageViewASTCDecodeModeEXT-decodeMode-02230", |
| 1245 | "vkCreateImageView(): VkImageViewASTCDecodeModeEXT::decodeMode must be " |
| 1246 | "VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R8G8B8A8_UNORM, or VK_FORMAT_E5B9G9R9_UFLOAT_PACK32."); |
| 1247 | } |
| 1248 | if (FormatIsCompressed_ASTC(pCreateInfo->format) == false) { |
| 1249 | skip |= LogError(device, "VUID-VkImageViewASTCDecodeModeEXT-format-04084", |
| 1250 | "vkCreateImageView(): is using a VkImageViewASTCDecodeModeEXT but the image view format is %s and " |
| 1251 | "not an ASTC format.", |
| 1252 | string_VkFormat(pCreateInfo->format)); |
| 1253 | } |
| 1254 | } |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 1255 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 1256 | auto ycbcr_conversion = LvlFindInChain<VkSamplerYcbcrConversionInfo>(pCreateInfo->pNext); |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 1257 | if (ycbcr_conversion != nullptr) { |
| 1258 | if (ycbcr_conversion->conversion != VK_NULL_HANDLE) { |
| 1259 | if (IsIdentitySwizzle(pCreateInfo->components) == false) { |
| 1260 | skip |= LogError( |
| 1261 | device, "VUID-VkImageViewCreateInfo-pNext-01970", |
| 1262 | "vkCreateImageView(): If there is a VkSamplerYcbcrConversion, the imageView must " |
| 1263 | "be created with the identity swizzle. Here are the actual swizzle values:\n" |
| 1264 | "r swizzle = %s\n" |
| 1265 | "g swizzle = %s\n" |
| 1266 | "b swizzle = %s\n" |
| 1267 | "a swizzle = %s\n", |
| 1268 | string_VkComponentSwizzle(pCreateInfo->components.r), string_VkComponentSwizzle(pCreateInfo->components.g), |
| 1269 | string_VkComponentSwizzle(pCreateInfo->components.b), string_VkComponentSwizzle(pCreateInfo->components.a)); |
| 1270 | } |
| 1271 | } |
| 1272 | } |
Jeff Bolz | 99e3f63 | 2020-03-24 22:59:22 -0500 | [diff] [blame] | 1273 | } |
| 1274 | return skip; |
| 1275 | } |
| 1276 | |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 1277 | bool StatelessValidation::manual_PreCallValidateViewport(const VkViewport &viewport, const char *fn_name, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1278 | const ParameterName ¶meter_name, VkCommandBuffer object) const { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1279 | bool skip = false; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1280 | |
| 1281 | // Note: for numerical correctness |
| 1282 | // - float comparisons should expect NaN (comparison always false). |
| 1283 | // - VkPhysicalDeviceLimits::maxViewportDimensions is uint32_t, not float -> careful. |
| 1284 | |
| 1285 | 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] | 1286 | if (std::isnan(v1_f)) return false; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1287 | if (v1_f <= 0.0f) return true; |
| 1288 | |
| 1289 | float intpart; |
| 1290 | const float fract = modff(v1_f, &intpart); |
| 1291 | |
| 1292 | assert(std::numeric_limits<float>::radix == 2); |
| 1293 | const float u32_max_plus1 = ldexpf(1.0f, 32); // hopefully exact |
| 1294 | if (intpart >= u32_max_plus1) return false; |
| 1295 | |
| 1296 | uint32_t v1_u32 = static_cast<uint32_t>(intpart); |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1297 | if (v1_u32 < v2_u32) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1298 | return true; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1299 | } else if (v1_u32 == v2_u32 && fract == 0.0f) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1300 | return true; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1301 | } else { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1302 | return false; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1303 | } |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1304 | }; |
| 1305 | |
| 1306 | const auto f_lte_u32_direct = [](const float v1_f, const uint32_t v2_u32) { |
| 1307 | const float v2_f = static_cast<float>(v2_u32); // not accurate for > radix^digits; and undefined rounding mode |
| 1308 | return (v1_f <= v2_f); |
| 1309 | }; |
| 1310 | |
| 1311 | // width |
| 1312 | bool width_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1313 | const auto max_w = device_limits.maxViewportDimensions[0]; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1314 | |
| 1315 | if (!(viewport.width > 0.0f)) { |
| 1316 | width_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1317 | skip |= LogError(object, "VUID-VkViewport-width-01770", "%s: %s.width (=%f) is not greater than 0.0.", fn_name, |
| 1318 | parameter_name.get_name().c_str(), viewport.width); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1319 | } else if (!(f_lte_u32_exact(viewport.width, max_w) || f_lte_u32_direct(viewport.width, max_w))) { |
| 1320 | width_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1321 | skip |= LogError(object, "VUID-VkViewport-width-01771", |
| 1322 | "%s: %s.width (=%f) exceeds VkPhysicalDeviceLimits::maxViewportDimensions[0] (=%" PRIu32 ").", fn_name, |
| 1323 | parameter_name.get_name().c_str(), viewport.width, max_w); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1324 | } |
| 1325 | |
| 1326 | // height |
| 1327 | bool height_healthy = true; |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 1328 | const bool negative_height_enabled = |
| 1329 | IsExtEnabled(device_extensions.vk_khr_maintenance1) || IsExtEnabled(device_extensions.vk_amd_negative_viewport_height); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1330 | const auto max_h = device_limits.maxViewportDimensions[1]; |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1331 | |
| 1332 | if (!negative_height_enabled && !(viewport.height > 0.0f)) { |
| 1333 | height_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1334 | skip |= LogError(object, "VUID-VkViewport-height-01772", "%s: %s.height (=%f) is not greater 0.0.", fn_name, |
| 1335 | parameter_name.get_name().c_str(), viewport.height); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1336 | } else if (!(f_lte_u32_exact(fabsf(viewport.height), max_h) || f_lte_u32_direct(fabsf(viewport.height), max_h))) { |
| 1337 | height_healthy = false; |
| 1338 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1339 | skip |= LogError(object, "VUID-VkViewport-height-01773", |
| 1340 | "%s: Absolute value of %s.height (=%f) exceeds VkPhysicalDeviceLimits::maxViewportDimensions[1] (=%" PRIu32 |
| 1341 | ").", |
| 1342 | fn_name, parameter_name.get_name().c_str(), viewport.height, max_h); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1343 | } |
| 1344 | |
| 1345 | // x |
| 1346 | bool x_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1347 | if (!(viewport.x >= device_limits.viewportBoundsRange[0])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1348 | x_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1349 | skip |= LogError(object, "VUID-VkViewport-x-01774", |
| 1350 | "%s: %s.x (=%f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", fn_name, |
| 1351 | parameter_name.get_name().c_str(), viewport.x, device_limits.viewportBoundsRange[0]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1352 | } |
| 1353 | |
| 1354 | // x + width |
| 1355 | if (x_healthy && width_healthy) { |
| 1356 | const float right_bound = viewport.x + viewport.width; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1357 | if (!(right_bound <= device_limits.viewportBoundsRange[1])) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1358 | skip |= LogError( |
| 1359 | object, "VUID-VkViewport-x-01232", |
| 1360 | "%s: %s.x + %s.width (=%f + %f = %f) is greater than VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", |
| 1361 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.x, viewport.width, |
| 1362 | right_bound, device_limits.viewportBoundsRange[1]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1363 | } |
| 1364 | } |
| 1365 | |
| 1366 | // y |
| 1367 | bool y_healthy = true; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1368 | if (!(viewport.y >= device_limits.viewportBoundsRange[0])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1369 | y_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1370 | skip |= LogError(object, "VUID-VkViewport-y-01775", |
| 1371 | "%s: %s.y (=%f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", fn_name, |
| 1372 | parameter_name.get_name().c_str(), viewport.y, device_limits.viewportBoundsRange[0]); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1373 | } else if (negative_height_enabled && !(viewport.y <= device_limits.viewportBoundsRange[1])) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1374 | y_healthy = false; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1375 | skip |= LogError(object, "VUID-VkViewport-y-01776", |
| 1376 | "%s: %s.y (=%f) exceeds VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", fn_name, |
| 1377 | parameter_name.get_name().c_str(), viewport.y, device_limits.viewportBoundsRange[1]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1378 | } |
| 1379 | |
| 1380 | // y + height |
| 1381 | if (y_healthy && height_healthy) { |
| 1382 | const float boundary = viewport.y + viewport.height; |
| 1383 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1384 | if (!(boundary <= device_limits.viewportBoundsRange[1])) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1385 | skip |= LogError(object, "VUID-VkViewport-y-01233", |
| 1386 | "%s: %s.y + %s.height (=%f + %f = %f) exceeds VkPhysicalDeviceLimits::viewportBoundsRange[1] (=%f).", |
| 1387 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.y, |
| 1388 | viewport.height, boundary, device_limits.viewportBoundsRange[1]); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1389 | } else if (negative_height_enabled && !(boundary >= device_limits.viewportBoundsRange[0])) { |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 1390 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1391 | LogError(object, "VUID-VkViewport-y-01777", |
| 1392 | "%s: %s.y + %s.height (=%f + %f = %f) is less than VkPhysicalDeviceLimits::viewportBoundsRange[0] (=%f).", |
| 1393 | fn_name, parameter_name.get_name().c_str(), parameter_name.get_name().c_str(), viewport.y, viewport.height, |
| 1394 | boundary, device_limits.viewportBoundsRange[0]); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1395 | } |
| 1396 | } |
| 1397 | |
sfricke-samsung | fd06d42 | 2021-01-22 02:17:21 -0800 | [diff] [blame] | 1398 | // The extension was not created with a feature bit whichs prevents displaying the 2 variations of the VUIDs |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 1399 | if (!IsExtEnabled(device_extensions.vk_ext_depth_range_unrestricted)) { |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1400 | // minDepth |
| 1401 | if (!(viewport.minDepth >= 0.0) || !(viewport.minDepth <= 1.0)) { |
sfricke-samsung | fd06d42 | 2021-01-22 02:17:21 -0800 | [diff] [blame] | 1402 | // Also VUID-VkViewport-minDepth-02540 |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1403 | skip |= LogError(object, "VUID-VkViewport-minDepth-01234", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1404 | "%s: VK_EXT_depth_range_unrestricted extension is not enabled and %s.minDepth (=%f) is not within the " |
| 1405 | "[0.0, 1.0] range.", |
| 1406 | fn_name, parameter_name.get_name().c_str(), viewport.minDepth); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1407 | } |
| 1408 | |
| 1409 | // maxDepth |
| 1410 | if (!(viewport.maxDepth >= 0.0) || !(viewport.maxDepth <= 1.0)) { |
sfricke-samsung | fd06d42 | 2021-01-22 02:17:21 -0800 | [diff] [blame] | 1411 | // Also VUID-VkViewport-maxDepth-02541 |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1412 | skip |= LogError(object, "VUID-VkViewport-maxDepth-01235", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1413 | "%s: VK_EXT_depth_range_unrestricted extension is not enabled and %s.maxDepth (=%f) is not within the " |
| 1414 | "[0.0, 1.0] range.", |
| 1415 | fn_name, parameter_name.get_name().c_str(), viewport.maxDepth); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | return skip; |
| 1420 | } |
| 1421 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1422 | struct SampleOrderInfo { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1423 | VkShadingRatePaletteEntryNV shadingRate; |
| 1424 | uint32_t width; |
| 1425 | uint32_t height; |
| 1426 | }; |
| 1427 | |
| 1428 | // All palette entries with more than one pixel per fragment |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1429 | static SampleOrderInfo sample_order_infos[] = { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1430 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV, 1, 2}, |
| 1431 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV, 2, 1}, |
| 1432 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV, 2, 2}, |
| 1433 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV, 4, 2}, |
| 1434 | {VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV, 2, 4}, |
| 1435 | {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] | 1436 | }; |
| 1437 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 1438 | bool StatelessValidation::ValidateCoarseSampleOrderCustomNV(const VkCoarseSampleOrderCustomNV *order) const { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1439 | bool skip = false; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1440 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1441 | SampleOrderInfo *sample_order_info; |
| 1442 | uint32_t info_idx = 0; |
| 1443 | for (sample_order_info = nullptr; info_idx < ARRAY_SIZE(sample_order_infos); ++info_idx) { |
| 1444 | if (sample_order_infos[info_idx].shadingRate == order->shadingRate) { |
| 1445 | sample_order_info = &sample_order_infos[info_idx]; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1446 | break; |
| 1447 | } |
| 1448 | } |
| 1449 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1450 | if (sample_order_info == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1451 | skip |= LogError(device, "VUID-VkCoarseSampleOrderCustomNV-shadingRate-02073", |
| 1452 | "VkCoarseSampleOrderCustomNV shadingRate must be a shading rate " |
| 1453 | "that generates fragments with more than one pixel."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1454 | return skip; |
| 1455 | } |
| 1456 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1457 | if (order->sampleCount == 0 || (order->sampleCount & (order->sampleCount - 1)) || |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1458 | !(order->sampleCount & device_limits.framebufferNoAttachmentsSampleCounts)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1459 | skip |= LogError(device, "VUID-VkCoarseSampleOrderCustomNV-sampleCount-02074", |
| 1460 | "VkCoarseSampleOrderCustomNV sampleCount (=%" PRIu32 |
| 1461 | ") must " |
| 1462 | "correspond to a sample count enumerated in VkSampleCountFlags whose corresponding bit " |
| 1463 | "is set in framebufferNoAttachmentsSampleCounts.", |
| 1464 | order->sampleCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1465 | } |
| 1466 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1467 | if (order->sampleLocationCount != order->sampleCount * sample_order_info->width * sample_order_info->height) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1468 | skip |= LogError(device, "VUID-VkCoarseSampleOrderCustomNV-sampleLocationCount-02075", |
| 1469 | "VkCoarseSampleOrderCustomNV sampleLocationCount (=%" PRIu32 |
| 1470 | ") must " |
| 1471 | "be equal to the product of sampleCount (=%" PRIu32 |
| 1472 | "), the fragment width for shadingRate " |
| 1473 | "(=%" PRIu32 "), and the fragment height for shadingRate (=%" PRIu32 ").", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1474 | order->sampleLocationCount, order->sampleCount, sample_order_info->width, sample_order_info->height); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1475 | } |
| 1476 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1477 | if (order->sampleLocationCount > phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1478 | skip |= LogError( |
| 1479 | device, "VUID-VkCoarseSampleOrderCustomNV-sampleLocationCount-02076", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1480 | "VkCoarseSampleOrderCustomNV sampleLocationCount (=%" PRIu32 |
| 1481 | ") must " |
| 1482 | "be less than or equal to VkPhysicalDeviceShadingRateImagePropertiesNV shadingRateMaxCoarseSamples (=%" PRIu32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1483 | order->sampleLocationCount, phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1484 | } |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1485 | |
| 1486 | // Accumulate a bitmask tracking which (x,y,sample) tuples are seen. Expect |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 1487 | // the first width*height*sampleCount bits to all be set. Note: There is no |
| 1488 | // guarantee that 64 bits is enough, but practically it's unlikely for an |
| 1489 | // implementation to support more than 32 bits for samplemask. |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 1490 | assert(phys_dev_ext_props.shading_rate_image_props.shadingRateMaxCoarseSamples <= 64); |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1491 | uint64_t sample_locations_mask = 0; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1492 | for (uint32_t i = 0; i < order->sampleLocationCount; ++i) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1493 | const VkCoarseSampleLocationNV *sample_loc = &order->pSampleLocations[i]; |
| 1494 | if (sample_loc->pixelX >= sample_order_info->width) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1495 | skip |= LogError(device, "VUID-VkCoarseSampleLocationNV-pixelX-02078", |
| 1496 | "pixelX must be less than the width (in pixels) of the fragment."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1497 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1498 | if (sample_loc->pixelY >= sample_order_info->height) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1499 | skip |= LogError(device, "VUID-VkCoarseSampleLocationNV-pixelY-02079", |
| 1500 | "pixelY must be less than the height (in pixels) of the fragment."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1501 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1502 | if (sample_loc->sample >= order->sampleCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1503 | skip |= LogError(device, "VUID-VkCoarseSampleLocationNV-sample-02080", |
| 1504 | "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] | 1505 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1506 | uint32_t idx = |
| 1507 | sample_loc->sample + order->sampleCount * (sample_loc->pixelX + sample_order_info->width * sample_loc->pixelY); |
| 1508 | sample_locations_mask |= 1ULL << idx; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1509 | } |
| 1510 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 1511 | uint64_t expected_mask = (order->sampleLocationCount == 64) ? ~0ULL : ((1ULL << order->sampleLocationCount) - 1); |
| 1512 | if (sample_locations_mask != expected_mask) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 1513 | skip |= LogError( |
| 1514 | device, "VUID-VkCoarseSampleOrderCustomNV-pSampleLocations-02077", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1515 | "The array pSampleLocations must contain exactly one entry for " |
| 1516 | "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] | 1517 | } |
| 1518 | |
| 1519 | return skip; |
| 1520 | } |
| 1521 | |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1522 | bool StatelessValidation::manual_PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, |
| 1523 | const VkAllocationCallbacks *pAllocator, |
| 1524 | VkPipelineLayout *pPipelineLayout) const { |
| 1525 | bool skip = false; |
| 1526 | // Validate layout count against device physical limit |
| 1527 | if (pCreateInfo->setLayoutCount > device_limits.maxBoundDescriptorSets) { |
| 1528 | skip |= LogError(device, "VUID-VkPipelineLayoutCreateInfo-setLayoutCount-00286", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1529 | "vkCreatePipelineLayout(): setLayoutCount (%" PRIu32 |
| 1530 | ") exceeds physical device maxBoundDescriptorSets limit (%" PRIu32 ").", |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1531 | pCreateInfo->setLayoutCount, device_limits.maxBoundDescriptorSets); |
| 1532 | } |
| 1533 | |
| 1534 | // Validate Push Constant ranges |
| 1535 | for (uint32_t i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) { |
| 1536 | const uint32_t offset = pCreateInfo->pPushConstantRanges[i].offset; |
| 1537 | const uint32_t size = pCreateInfo->pPushConstantRanges[i].size; |
| 1538 | const uint32_t max_push_constants_size = device_limits.maxPushConstantsSize; |
| 1539 | // Check that offset + size don't exceed the max. |
| 1540 | // Prevent arithetic overflow here by avoiding addition and testing in this order. |
| 1541 | if (offset >= max_push_constants_size) { |
| 1542 | skip |= LogError(device, "VUID-VkPushConstantRange-offset-00294", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1543 | "vkCreatePipelineLayout(): pCreateInfo->pPushConstantRanges[%" PRIu32 "].offset (%" PRIu32 |
| 1544 | ") that exceeds this " |
| 1545 | "device's maxPushConstantSize of %" PRIu32 ".", |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1546 | i, offset, max_push_constants_size); |
| 1547 | } |
| 1548 | if (size > max_push_constants_size - offset) { |
| 1549 | skip |= LogError(device, "VUID-VkPushConstantRange-size-00298", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1550 | "vkCreatePipelineLayout(): pCreateInfo->pPushConstantRanges[%" PRIu32 "] offset (%" PRIu32 |
| 1551 | ") and size (%" PRIu32 |
| 1552 | ") " |
| 1553 | "together exceeds this device's maxPushConstantSize of %" PRIu32 ".", |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1554 | i, offset, size, max_push_constants_size); |
| 1555 | } |
| 1556 | |
| 1557 | // size needs to be non-zero and a multiple of 4. |
| 1558 | if (size == 0) { |
| 1559 | skip |= LogError(device, "VUID-VkPushConstantRange-size-00296", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1560 | "vkCreatePipelineLayout(): pCreateInfo->pPushConstantRanges[%" PRIu32 "].size (%" PRIu32 |
| 1561 | ") is not greater than zero.", |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1562 | i, size); |
| 1563 | } |
| 1564 | if (size & 0x3) { |
| 1565 | skip |= LogError(device, "VUID-VkPushConstantRange-size-00297", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1566 | "vkCreatePipelineLayout(): pCreateInfo->pPushConstantRanges[%" PRIu32 "].size (%" PRIu32 |
| 1567 | ") is not a multiple of 4.", |
| 1568 | i, size); |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1569 | } |
| 1570 | |
| 1571 | // offset needs to be a multiple of 4. |
| 1572 | if ((offset & 0x3) != 0) { |
| 1573 | skip |= LogError(device, "VUID-VkPushConstantRange-offset-00295", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1574 | "vkCreatePipelineLayout(): pCreateInfo->pPushConstantRanges[%" PRIu32 "].offset (%" PRIu32 |
| 1575 | ") is not a multiple of 4.", |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1576 | i, offset); |
| 1577 | } |
| 1578 | } |
| 1579 | |
| 1580 | // As of 1.0.28, there is a VU that states that a stage flag cannot appear more than once in the list of push constant ranges. |
| 1581 | for (uint32_t i = 0; i < pCreateInfo->pushConstantRangeCount; ++i) { |
| 1582 | for (uint32_t j = i + 1; j < pCreateInfo->pushConstantRangeCount; ++j) { |
| 1583 | if (0 != (pCreateInfo->pPushConstantRanges[i].stageFlags & pCreateInfo->pPushConstantRanges[j].stageFlags)) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1584 | skip |= |
| 1585 | LogError(device, "VUID-VkPipelineLayoutCreateInfo-pPushConstantRanges-00292", |
| 1586 | "vkCreatePipelineLayout() Duplicate stage flags found in ranges %" PRIu32 " and %" PRIu32 ".", i, j); |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 1587 | } |
| 1588 | } |
| 1589 | } |
| 1590 | return skip; |
| 1591 | } |
| 1592 | |
ziga-lunarg | c634137 | 2021-07-28 12:57:42 +0200 | [diff] [blame] | 1593 | bool StatelessValidation::ValidatePipelineShaderStageCreateInfo(const char *func_name, const char *msg, |
| 1594 | const VkPipelineShaderStageCreateInfo *pCreateInfo) const { |
| 1595 | bool skip = false; |
| 1596 | |
| 1597 | const auto *required_subgroup_size_features = |
| 1598 | LvlFindInChain<VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT>(pCreateInfo->pNext); |
| 1599 | |
| 1600 | if (required_subgroup_size_features) { |
| 1601 | if ((pCreateInfo->flags & VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT) != 0) { |
| 1602 | skip |= LogError( |
| 1603 | device, "VUID-VkPipelineShaderStageCreateInfo-pNext-02754", |
| 1604 | "%s(): %s->flags (0x%x) includes VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT while " |
| 1605 | "VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT is included in the pNext chain.", |
| 1606 | func_name, msg, pCreateInfo->flags); |
| 1607 | } |
| 1608 | } |
| 1609 | |
| 1610 | return skip; |
| 1611 | } |
| 1612 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 1613 | bool StatelessValidation::manual_PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, |
| 1614 | uint32_t createInfoCount, |
| 1615 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 1616 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 1617 | VkPipeline *pPipelines) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1618 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 1619 | |
| 1620 | if (pCreateInfos != nullptr) { |
| 1621 | for (uint32_t i = 0; i < createInfoCount; ++i) { |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1622 | bool has_dynamic_viewport = false; |
| 1623 | bool has_dynamic_scissor = false; |
| 1624 | bool has_dynamic_line_width = false; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1625 | bool has_dynamic_depth_bias = false; |
| 1626 | bool has_dynamic_blend_constant = false; |
| 1627 | bool has_dynamic_depth_bounds = false; |
| 1628 | bool has_dynamic_stencil_compare = false; |
| 1629 | bool has_dynamic_stencil_write = false; |
| 1630 | bool has_dynamic_stencil_reference = false; |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 1631 | bool has_dynamic_viewport_w_scaling_nv = false; |
| 1632 | bool has_dynamic_discard_rectangle_ext = false; |
| 1633 | bool has_dynamic_sample_locations_ext = false; |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 1634 | bool has_dynamic_exclusive_scissor_nv = false; |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 1635 | bool has_dynamic_shading_rate_palette_nv = false; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1636 | bool has_dynamic_viewport_course_sample_order_nv = false; |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 1637 | bool has_dynamic_line_stipple = false; |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1638 | bool has_dynamic_cull_mode = false; |
| 1639 | bool has_dynamic_front_face = false; |
| 1640 | bool has_dynamic_primitive_topology = false; |
| 1641 | bool has_dynamic_viewport_with_count = false; |
| 1642 | bool has_dynamic_scissor_with_count = false; |
| 1643 | bool has_dynamic_vertex_input_binding_stride = false; |
| 1644 | bool has_dynamic_depth_test_enable = false; |
| 1645 | bool has_dynamic_depth_write_enable = false; |
| 1646 | bool has_dynamic_depth_compare_op = false; |
| 1647 | bool has_dynamic_depth_bounds_test_enable = false; |
| 1648 | bool has_dynamic_stencil_test_enable = false; |
| 1649 | bool has_dynamic_stencil_op = false; |
Vikram Kushwaha | a57b0c3 | 2021-04-19 12:21:46 -0700 | [diff] [blame] | 1650 | bool has_patch_control_points = false; |
| 1651 | bool has_rasterizer_discard_enable = false; |
| 1652 | bool has_depth_bias_enable = false; |
| 1653 | bool has_logic_op = false; |
| 1654 | bool has_primitive_restart_enable = false; |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 1655 | bool has_dynamic_vertex_input = false; |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1656 | if (pCreateInfos[i].pDynamicState != nullptr) { |
| 1657 | const auto &dynamic_state_info = *pCreateInfos[i].pDynamicState; |
| 1658 | for (uint32_t state_index = 0; state_index < dynamic_state_info.dynamicStateCount; ++state_index) { |
| 1659 | const auto &dynamic_state = dynamic_state_info.pDynamicStates[state_index]; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1660 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT) { |
| 1661 | if (has_dynamic_viewport == true) { |
| 1662 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1663 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1664 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1665 | i); |
| 1666 | } |
| 1667 | has_dynamic_viewport = true; |
| 1668 | } |
| 1669 | if (dynamic_state == VK_DYNAMIC_STATE_SCISSOR) { |
| 1670 | if (has_dynamic_scissor == true) { |
| 1671 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1672 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_SCISSOR was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1673 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1674 | i); |
| 1675 | } |
| 1676 | has_dynamic_scissor = true; |
| 1677 | } |
| 1678 | if (dynamic_state == VK_DYNAMIC_STATE_LINE_WIDTH) { |
| 1679 | if (has_dynamic_line_width == true) { |
| 1680 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1681 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_LINE_WIDTH was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1682 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1683 | i); |
| 1684 | } |
| 1685 | has_dynamic_line_width = true; |
| 1686 | } |
| 1687 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_BIAS) { |
| 1688 | if (has_dynamic_depth_bias == true) { |
| 1689 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1690 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_BIAS was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1691 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1692 | i); |
| 1693 | } |
| 1694 | has_dynamic_depth_bias = true; |
| 1695 | } |
| 1696 | if (dynamic_state == VK_DYNAMIC_STATE_BLEND_CONSTANTS) { |
| 1697 | if (has_dynamic_blend_constant == true) { |
| 1698 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1699 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_BLEND_CONSTANTS was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1700 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1701 | i); |
| 1702 | } |
| 1703 | has_dynamic_blend_constant = true; |
| 1704 | } |
| 1705 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_BOUNDS) { |
| 1706 | if (has_dynamic_depth_bounds == true) { |
| 1707 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1708 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_BOUNDS was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1709 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1710 | i); |
| 1711 | } |
| 1712 | has_dynamic_depth_bounds = true; |
| 1713 | } |
| 1714 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK) { |
| 1715 | if (has_dynamic_stencil_compare == true) { |
| 1716 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1717 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK was listed twice in " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1718 | "the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1719 | i); |
| 1720 | } |
| 1721 | has_dynamic_stencil_compare = true; |
| 1722 | } |
| 1723 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_WRITE_MASK) { |
| 1724 | if (has_dynamic_stencil_write == true) { |
| 1725 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1726 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_WRITE_MASK was listed twice in " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1727 | "the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1728 | i); |
| 1729 | } |
| 1730 | has_dynamic_stencil_write = true; |
| 1731 | } |
| 1732 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_REFERENCE) { |
| 1733 | if (has_dynamic_stencil_reference == true) { |
| 1734 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1735 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_REFERENCE was listed twice in " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1736 | "the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1737 | i); |
| 1738 | } |
| 1739 | has_dynamic_stencil_reference = true; |
| 1740 | } |
| 1741 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV) { |
| 1742 | if (has_dynamic_viewport_w_scaling_nv == true) { |
| 1743 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1744 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV was listed twice " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1745 | "in the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1746 | i); |
| 1747 | } |
| 1748 | has_dynamic_viewport_w_scaling_nv = true; |
| 1749 | } |
| 1750 | if (dynamic_state == VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT) { |
| 1751 | if (has_dynamic_discard_rectangle_ext == true) { |
| 1752 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1753 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT was listed twice " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1754 | "in the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1755 | i); |
| 1756 | } |
| 1757 | has_dynamic_discard_rectangle_ext = true; |
| 1758 | } |
| 1759 | if (dynamic_state == VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT) { |
| 1760 | if (has_dynamic_sample_locations_ext == true) { |
| 1761 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1762 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT was listed twice in " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1763 | "the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1764 | i); |
| 1765 | } |
| 1766 | has_dynamic_sample_locations_ext = true; |
| 1767 | } |
| 1768 | if (dynamic_state == VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV) { |
| 1769 | if (has_dynamic_exclusive_scissor_nv == true) { |
| 1770 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1771 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV was listed twice in " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1772 | "the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1773 | i); |
| 1774 | } |
| 1775 | has_dynamic_exclusive_scissor_nv = true; |
| 1776 | } |
| 1777 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV) { |
| 1778 | if (has_dynamic_shading_rate_palette_nv == true) { |
| 1779 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1780 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV was " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1781 | "listed twice in the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1782 | i); |
| 1783 | } |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 1784 | has_dynamic_shading_rate_palette_nv = true; |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1785 | } |
| 1786 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV) { |
| 1787 | if (has_dynamic_viewport_course_sample_order_nv == true) { |
| 1788 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1789 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV was " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1790 | "listed twice in the pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1791 | i); |
| 1792 | } |
| 1793 | has_dynamic_viewport_course_sample_order_nv = true; |
| 1794 | } |
| 1795 | if (dynamic_state == VK_DYNAMIC_STATE_LINE_STIPPLE_EXT) { |
| 1796 | if (has_dynamic_line_stipple == true) { |
| 1797 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1798 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_LINE_STIPPLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1799 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Spencer Fricke | 8d42888 | 2020-03-16 17:23:33 -0700 | [diff] [blame] | 1800 | i); |
| 1801 | } |
| 1802 | has_dynamic_line_stipple = true; |
| 1803 | } |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1804 | if (dynamic_state == VK_DYNAMIC_STATE_CULL_MODE_EXT) { |
| 1805 | if (has_dynamic_cull_mode) { |
| 1806 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1807 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_CULL_MODE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1808 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1809 | i); |
| 1810 | } |
| 1811 | has_dynamic_cull_mode = true; |
| 1812 | } |
| 1813 | if (dynamic_state == VK_DYNAMIC_STATE_FRONT_FACE_EXT) { |
| 1814 | if (has_dynamic_front_face) { |
| 1815 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1816 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_FRONT_FACE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1817 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1818 | i); |
| 1819 | } |
| 1820 | has_dynamic_front_face = true; |
| 1821 | } |
| 1822 | if (dynamic_state == VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT) { |
| 1823 | if (has_dynamic_primitive_topology) { |
| 1824 | skip |= LogError( |
| 1825 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1826 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1827 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1828 | i); |
| 1829 | } |
| 1830 | has_dynamic_primitive_topology = true; |
| 1831 | } |
| 1832 | if (dynamic_state == VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT) { |
| 1833 | if (has_dynamic_viewport_with_count) { |
| 1834 | skip |= LogError( |
| 1835 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1836 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1837 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1838 | i); |
| 1839 | } |
| 1840 | has_dynamic_viewport_with_count = true; |
| 1841 | } |
| 1842 | if (dynamic_state == VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT) { |
| 1843 | if (has_dynamic_scissor_with_count) { |
| 1844 | skip |= LogError( |
| 1845 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1846 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1847 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1848 | i); |
| 1849 | } |
| 1850 | has_dynamic_scissor_with_count = true; |
| 1851 | } |
| 1852 | if (dynamic_state == VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT) { |
| 1853 | if (has_dynamic_vertex_input_binding_stride) { |
| 1854 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1855 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT was " |
| 1856 | "listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1857 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1858 | i); |
| 1859 | } |
| 1860 | has_dynamic_vertex_input_binding_stride = true; |
| 1861 | } |
| 1862 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT) { |
| 1863 | if (has_dynamic_depth_test_enable) { |
| 1864 | skip |= LogError( |
| 1865 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1866 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1867 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1868 | i); |
| 1869 | } |
| 1870 | has_dynamic_depth_test_enable = true; |
| 1871 | } |
| 1872 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT) { |
| 1873 | if (has_dynamic_depth_write_enable) { |
| 1874 | skip |= LogError( |
| 1875 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1876 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1877 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1878 | i); |
| 1879 | } |
| 1880 | has_dynamic_depth_write_enable = true; |
| 1881 | } |
| 1882 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT) { |
| 1883 | if (has_dynamic_depth_compare_op) { |
| 1884 | skip |= |
| 1885 | LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1886 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1887 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1888 | i); |
| 1889 | } |
| 1890 | has_dynamic_depth_compare_op = true; |
| 1891 | } |
| 1892 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT) { |
| 1893 | if (has_dynamic_depth_bounds_test_enable) { |
| 1894 | skip |= LogError( |
| 1895 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1896 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1897 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1898 | i); |
| 1899 | } |
| 1900 | has_dynamic_depth_bounds_test_enable = true; |
| 1901 | } |
| 1902 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT) { |
| 1903 | if (has_dynamic_stencil_test_enable) { |
| 1904 | skip |= LogError( |
| 1905 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1906 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1907 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1908 | i); |
| 1909 | } |
| 1910 | has_dynamic_stencil_test_enable = true; |
| 1911 | } |
| 1912 | if (dynamic_state == VK_DYNAMIC_STATE_STENCIL_OP_EXT) { |
| 1913 | if (has_dynamic_stencil_op) { |
| 1914 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1915 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_STENCIL_OP_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1916 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 1917 | i); |
| 1918 | } |
| 1919 | has_dynamic_stencil_op = true; |
| 1920 | } |
sfricke-samsung | 5f8f970 | 2021-01-29 23:30:30 -0800 | [diff] [blame] | 1921 | if (dynamic_state == VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR) { |
| 1922 | // Not allowed for graphics pipelines |
| 1923 | skip |= LogError( |
| 1924 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-03578", |
| 1925 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR was listed the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1926 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates[%" PRIu32 |
| 1927 | "] but not allowed in graphic pipelines.", |
sfricke-samsung | 5f8f970 | 2021-01-29 23:30:30 -0800 | [diff] [blame] | 1928 | i, state_index); |
| 1929 | } |
Vikram Kushwaha | a57b0c3 | 2021-04-19 12:21:46 -0700 | [diff] [blame] | 1930 | if (dynamic_state == VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT) { |
| 1931 | if (has_patch_control_points) { |
| 1932 | skip |= LogError( |
| 1933 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1934 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1935 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Vikram Kushwaha | a57b0c3 | 2021-04-19 12:21:46 -0700 | [diff] [blame] | 1936 | i); |
| 1937 | } |
| 1938 | has_patch_control_points = true; |
| 1939 | } |
| 1940 | if (dynamic_state == VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT) { |
| 1941 | if (has_rasterizer_discard_enable) { |
| 1942 | skip |= LogError( |
| 1943 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1944 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1945 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Vikram Kushwaha | a57b0c3 | 2021-04-19 12:21:46 -0700 | [diff] [blame] | 1946 | i); |
| 1947 | } |
| 1948 | has_rasterizer_discard_enable = true; |
| 1949 | } |
| 1950 | if (dynamic_state == VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT) { |
| 1951 | if (has_depth_bias_enable) { |
| 1952 | skip |= LogError( |
| 1953 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1954 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1955 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Vikram Kushwaha | a57b0c3 | 2021-04-19 12:21:46 -0700 | [diff] [blame] | 1956 | i); |
| 1957 | } |
| 1958 | has_depth_bias_enable = true; |
| 1959 | } |
| 1960 | if (dynamic_state == VK_DYNAMIC_STATE_LOGIC_OP_EXT) { |
| 1961 | if (has_logic_op) { |
| 1962 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1963 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_LOGIC_OP_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1964 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Vikram Kushwaha | a57b0c3 | 2021-04-19 12:21:46 -0700 | [diff] [blame] | 1965 | i); |
| 1966 | } |
| 1967 | has_logic_op = true; |
| 1968 | } |
| 1969 | if (dynamic_state == VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT) { |
| 1970 | if (has_primitive_restart_enable) { |
| 1971 | skip |= LogError( |
| 1972 | device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
| 1973 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT was listed twice in the " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1974 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
Vikram Kushwaha | a57b0c3 | 2021-04-19 12:21:46 -0700 | [diff] [blame] | 1975 | i); |
| 1976 | } |
| 1977 | has_primitive_restart_enable = true; |
| 1978 | } |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 1979 | if (dynamic_state == VK_DYNAMIC_STATE_VERTEX_INPUT_EXT) { |
| 1980 | if (has_dynamic_vertex_input) { |
| 1981 | skip |= LogError(device, "VUID-VkPipelineDynamicStateCreateInfo-pDynamicStates-01442", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1982 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VERTEX_INPUT_EXT was listed twice in the " |
| 1983 | "pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
| 1984 | i); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 1985 | } |
| 1986 | has_dynamic_vertex_input = true; |
| 1987 | } |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 1988 | } |
| 1989 | } |
| 1990 | |
sfricke-samsung | 3b94442 | 2021-01-23 02:15:19 -0800 | [diff] [blame] | 1991 | if (has_dynamic_viewport_with_count && has_dynamic_viewport) { |
| 1992 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-04132", |
| 1993 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT and " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 1994 | "VK_DYNAMIC_STATE_VIEWPORT both listed in pCreateInfos[%" PRIu32 |
| 1995 | "].pDynamicState->pDynamicStates array", |
sfricke-samsung | 3b94442 | 2021-01-23 02:15:19 -0800 | [diff] [blame] | 1996 | i); |
| 1997 | } |
| 1998 | |
| 1999 | if (has_dynamic_scissor_with_count && has_dynamic_scissor) { |
| 2000 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-04133", |
| 2001 | "vkCreateGraphicsPipelines: VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT and VK_DYNAMIC_STATE_SCISSOR " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2002 | "both listed in pCreateInfos[%" PRIu32 "].pDynamicState->pDynamicStates array", |
sfricke-samsung | 3b94442 | 2021-01-23 02:15:19 -0800 | [diff] [blame] | 2003 | i); |
| 2004 | } |
| 2005 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 2006 | auto feedback_struct = LvlFindInChain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 2007 | if ((feedback_struct != nullptr) && |
| 2008 | (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2009 | skip |= LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02668", |
| 2010 | "vkCreateGraphicsPipelines(): in pCreateInfo[%" PRIu32 |
| 2011 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
| 2012 | "(=%" PRIu32 ") must equal VkGraphicsPipelineCreateInfo::stageCount(=%" PRIu32 ").", |
| 2013 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 2014 | } |
| 2015 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2016 | // 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] | 2017 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2018 | // Collect active stages and other information |
| 2019 | // Only want to loop through pStages once |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2020 | uint32_t active_shaders = 0; |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2021 | bool has_eval = false; |
| 2022 | bool has_control = false; |
| 2023 | if (pCreateInfos[i].pStages != nullptr) { |
| 2024 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 2025 | active_shaders |= pCreateInfos[i].pStages[stage_index].stage; |
| 2026 | |
| 2027 | if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) { |
| 2028 | has_control = true; |
| 2029 | } else if (pCreateInfos[i].pStages[stage_index].stage == VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) { |
| 2030 | has_eval = true; |
| 2031 | } |
| 2032 | |
| 2033 | skip |= validate_string( |
| 2034 | "vkCreateGraphicsPipelines", |
| 2035 | ParameterName("pCreateInfos[%i].pStages[%i].pName", ParameterName::IndexVector{i, stage_index}), |
| 2036 | "VUID-VkGraphicsPipelineCreateInfo-pStages-parameter", pCreateInfos[i].pStages[stage_index].pName); |
ziga-lunarg | c634137 | 2021-07-28 12:57:42 +0200 | [diff] [blame] | 2037 | |
| 2038 | std::stringstream msg; |
| 2039 | msg << "pCreateInfos[%" << i << "].pStages[%" << stage_index << "]"; |
| 2040 | ValidatePipelineShaderStageCreateInfo("vkCreateGraphicsPipelines", msg.str().c_str(), |
| 2041 | &pCreateInfos[i].pStages[stage_index]); |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2042 | } |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2043 | } |
| 2044 | |
| 2045 | if ((active_shaders & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) && |
| 2046 | (active_shaders & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) && (pCreateInfos[i].pTessellationState != nullptr)) { |
| 2047 | skip |= validate_struct_type("vkCreateGraphicsPipelines", "pCreateInfos[i].pTessellationState", |
| 2048 | "VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO", |
| 2049 | pCreateInfos[i].pTessellationState, |
| 2050 | VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO, false, kVUIDUndefined, |
| 2051 | "VUID-VkPipelineTessellationStateCreateInfo-sType-sType"); |
| 2052 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2053 | const VkStructureType allowed_structs_vk_pipeline_tessellation_state_create_info[] = { |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2054 | VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO}; |
| 2055 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2056 | skip |= validate_struct_pnext( |
| 2057 | "vkCreateGraphicsPipelines", "pCreateInfos[i].pTessellationState->pNext", |
| 2058 | "VkPipelineTessellationDomainOriginStateCreateInfo", pCreateInfos[i].pTessellationState->pNext, |
| 2059 | ARRAY_SIZE(allowed_structs_vk_pipeline_tessellation_state_create_info), |
| 2060 | allowed_structs_vk_pipeline_tessellation_state_create_info, GeneratedVulkanHeaderVersion, |
| 2061 | "VUID-VkPipelineTessellationStateCreateInfo-pNext-pNext", |
| 2062 | "VUID-VkPipelineTessellationStateCreateInfo-sType-unique"); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2063 | |
| 2064 | skip |= validate_reserved_flags("vkCreateGraphicsPipelines", "pCreateInfos[i].pTessellationState->flags", |
| 2065 | pCreateInfos[i].pTessellationState->flags, |
| 2066 | "VUID-VkPipelineTessellationStateCreateInfo-flags-zerobitmask"); |
| 2067 | } |
| 2068 | |
| 2069 | if (!(active_shaders & VK_SHADER_STAGE_MESH_BIT_NV) && (pCreateInfos[i].pInputAssemblyState != nullptr)) { |
| 2070 | skip |= validate_struct_type("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState", |
| 2071 | "VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO", |
| 2072 | pCreateInfos[i].pInputAssemblyState, |
| 2073 | VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, false, kVUIDUndefined, |
| 2074 | "VUID-VkPipelineInputAssemblyStateCreateInfo-sType-sType"); |
| 2075 | |
| 2076 | skip |= validate_struct_pnext("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->pNext", NULL, |
| 2077 | pCreateInfos[i].pInputAssemblyState->pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2078 | "VUID-VkPipelineInputAssemblyStateCreateInfo-pNext-pNext", nullptr); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2079 | |
| 2080 | skip |= validate_reserved_flags("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->flags", |
| 2081 | pCreateInfos[i].pInputAssemblyState->flags, |
| 2082 | "VUID-VkPipelineInputAssemblyStateCreateInfo-flags-zerobitmask"); |
| 2083 | |
| 2084 | skip |= validate_ranged_enum("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->topology", |
| 2085 | "VkPrimitiveTopology", AllVkPrimitiveTopologyEnums, |
| 2086 | pCreateInfos[i].pInputAssemblyState->topology, |
| 2087 | "VUID-VkPipelineInputAssemblyStateCreateInfo-topology-parameter"); |
| 2088 | |
| 2089 | skip |= validate_bool32("vkCreateGraphicsPipelines", "pCreateInfos[i].pInputAssemblyState->primitiveRestartEnable", |
| 2090 | pCreateInfos[i].pInputAssemblyState->primitiveRestartEnable); |
| 2091 | } |
| 2092 | |
| 2093 | 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] | 2094 | auto const &vertex_input_state = pCreateInfos[i].pVertexInputState; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2095 | |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2096 | if (pCreateInfos[i].pVertexInputState->flags != 0) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2097 | skip |= |
| 2098 | LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-flags-zerobitmask", |
| 2099 | "vkCreateGraphicsPipelines: pararameter " |
| 2100 | "pCreateInfos[%" PRIu32 "].pVertexInputState->flags (%" PRIu32 ") is reserved and must be zero.", |
| 2101 | i, vertex_input_state->flags); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2102 | } |
| 2103 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2104 | const VkStructureType allowed_structs_vk_pipeline_vertex_input_state_create_info[] = { |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2105 | VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT}; |
| 2106 | skip |= validate_struct_pnext("vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState->pNext", |
| 2107 | "VkPipelineVertexInputDivisorStateCreateInfoEXT", |
| 2108 | pCreateInfos[i].pVertexInputState->pNext, 1, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2109 | allowed_structs_vk_pipeline_vertex_input_state_create_info, |
| 2110 | GeneratedVulkanHeaderVersion, "VUID-VkPipelineVertexInputStateCreateInfo-pNext-pNext", |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2111 | "VUID-VkPipelineVertexInputStateCreateInfo-sType-unique"); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2112 | skip |= validate_struct_type("vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState", |
| 2113 | "VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO", vertex_input_state, |
Shannon McPherson | 3cc90bc | 2019-08-13 11:28:22 -0600 | [diff] [blame] | 2114 | VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, false, kVUIDUndefined, |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2115 | "VUID-VkPipelineVertexInputStateCreateInfo-sType-sType"); |
| 2116 | skip |= |
| 2117 | validate_array("vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState->vertexBindingDescriptionCount", |
| 2118 | "pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions", |
| 2119 | pCreateInfos[i].pVertexInputState->vertexBindingDescriptionCount, |
| 2120 | &pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions, false, true, kVUIDUndefined, |
| 2121 | "VUID-VkPipelineVertexInputStateCreateInfo-pVertexBindingDescriptions-parameter"); |
| 2122 | |
| 2123 | skip |= validate_array( |
| 2124 | "vkCreateGraphicsPipelines", "pCreateInfos[i].pVertexInputState->vertexAttributeDescriptionCount", |
| 2125 | "pCreateInfos[i]->pVertexAttributeDescriptions", vertex_input_state->vertexAttributeDescriptionCount, |
| 2126 | &vertex_input_state->pVertexAttributeDescriptions, false, true, kVUIDUndefined, |
| 2127 | "VUID-VkPipelineVertexInputStateCreateInfo-pVertexAttributeDescriptions-parameter"); |
| 2128 | |
| 2129 | if (pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions != NULL) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2130 | for (uint32_t vertex_binding_description_index = 0; |
| 2131 | vertex_binding_description_index < pCreateInfos[i].pVertexInputState->vertexBindingDescriptionCount; |
| 2132 | ++vertex_binding_description_index) { |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2133 | skip |= validate_ranged_enum( |
| 2134 | "vkCreateGraphicsPipelines", |
| 2135 | "pCreateInfos[i].pVertexInputState->pVertexBindingDescriptions[j].inputRate", "VkVertexInputRate", |
| 2136 | AllVkVertexInputRateEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2137 | pCreateInfos[i] |
| 2138 | .pVertexInputState->pVertexBindingDescriptions[vertex_binding_description_index] |
| 2139 | .inputRate, |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2140 | "VUID-VkVertexInputBindingDescription-inputRate-parameter"); |
| 2141 | } |
| 2142 | } |
| 2143 | |
| 2144 | if (pCreateInfos[i].pVertexInputState->pVertexAttributeDescriptions != NULL) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2145 | for (uint32_t vertex_attribute_description_index = 0; |
| 2146 | vertex_attribute_description_index < pCreateInfos[i].pVertexInputState->vertexAttributeDescriptionCount; |
| 2147 | ++vertex_attribute_description_index) { |
sfricke-samsung | 2e82721 | 2021-09-28 07:52:08 -0700 | [diff] [blame] | 2148 | const VkFormat format = |
| 2149 | pCreateInfos[i] |
| 2150 | .pVertexInputState->pVertexAttributeDescriptions[vertex_attribute_description_index] |
| 2151 | .format; |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2152 | skip |= validate_ranged_enum( |
| 2153 | "vkCreateGraphicsPipelines", |
| 2154 | "pCreateInfos[i].pVertexInputState->pVertexAttributeDescriptions[i].format", "VkFormat", |
| 2155 | AllVkFormatEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2156 | pCreateInfos[i] |
| 2157 | .pVertexInputState->pVertexAttributeDescriptions[vertex_attribute_description_index] |
| 2158 | .format, |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2159 | "VUID-VkVertexInputAttributeDescription-format-parameter"); |
sfricke-samsung | 2e82721 | 2021-09-28 07:52:08 -0700 | [diff] [blame] | 2160 | if (FormatIsDepthOrStencil(format)) { |
| 2161 | // Should never hopefully get here, but there are known driver advertising the wrong feature flags |
| 2162 | // see https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/4849 |
| 2163 | skip |= LogError(device, kVUID_Core_invalidDepthStencilFormat, |
| 2164 | "vkCreateGraphicsPipelines: " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2165 | "pCreateInfos[%" PRIu32 "].pVertexInputState->pVertexAttributeDescriptions[%" PRIu32 |
| 2166 | "].format is a " |
sfricke-samsung | 2e82721 | 2021-09-28 07:52:08 -0700 | [diff] [blame] | 2167 | "depth/stencil format (%s) but depth/stencil formats do not have a defined sizes for " |
| 2168 | "alignment, replace with a color format.", |
| 2169 | i, vertex_attribute_description_index, string_VkFormat(format)); |
| 2170 | } |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2171 | } |
| 2172 | } |
| 2173 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2174 | if (vertex_input_state->vertexBindingDescriptionCount > device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2175 | skip |= LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-vertexBindingDescriptionCount-00613", |
| 2176 | "vkCreateGraphicsPipelines: pararameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2177 | "pCreateInfo[%" PRIu32 "].pVertexInputState->vertexBindingDescriptionCount (%" PRIu32 |
| 2178 | ") is " |
| 2179 | "greater than VkPhysicalDeviceLimits::maxVertexInputBindings (%" PRIu32 ").", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2180 | i, vertex_input_state->vertexBindingDescriptionCount, device_limits.maxVertexInputBindings); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2181 | } |
| 2182 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2183 | if (vertex_input_state->vertexAttributeDescriptionCount > device_limits.maxVertexInputAttributes) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2184 | skip |= |
| 2185 | LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-vertexAttributeDescriptionCount-00614", |
| 2186 | "vkCreateGraphicsPipelines: pararameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2187 | "pCreateInfo[%" PRIu32 "].pVertexInputState->vertexAttributeDescriptionCount (%" PRIu32 |
| 2188 | ") is " |
| 2189 | "greater than VkPhysicalDeviceLimits::maxVertexInputAttributes (%" PRIu32 ").", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2190 | i, vertex_input_state->vertexAttributeDescriptionCount, device_limits.maxVertexInputAttributes); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2191 | } |
| 2192 | |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 2193 | layer_data::unordered_set<uint32_t> vertex_bindings(vertex_input_state->vertexBindingDescriptionCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2194 | for (uint32_t d = 0; d < vertex_input_state->vertexBindingDescriptionCount; ++d) { |
| 2195 | auto const &vertex_bind_desc = vertex_input_state->pVertexBindingDescriptions[d]; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2196 | auto const &binding_it = vertex_bindings.find(vertex_bind_desc.binding); |
| 2197 | if (binding_it != vertex_bindings.cend()) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2198 | skip |= LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-pVertexBindingDescriptions-00616", |
| 2199 | "vkCreateGraphicsPipelines: parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2200 | "pCreateInfo[%" PRIu32 "].pVertexInputState->pVertexBindingDescription[%" PRIu32 |
| 2201 | "].binding " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2202 | "(%" PRIu32 ") is not distinct.", |
| 2203 | i, d, vertex_bind_desc.binding); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2204 | } |
| 2205 | vertex_bindings.insert(vertex_bind_desc.binding); |
| 2206 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2207 | if (vertex_bind_desc.binding >= device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2208 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription-binding-00618", |
| 2209 | "vkCreateGraphicsPipelines: parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2210 | "pCreateInfos[%" PRIu32 "].pVertexInputState->pVertexBindingDescriptions[%" PRIu32 |
| 2211 | "].binding (%" PRIu32 |
| 2212 | ") is " |
| 2213 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings (%" PRIu32 ").", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2214 | i, d, vertex_bind_desc.binding, device_limits.maxVertexInputBindings); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2215 | } |
| 2216 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2217 | if (vertex_bind_desc.stride > device_limits.maxVertexInputBindingStride) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2218 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription-stride-00619", |
| 2219 | "vkCreateGraphicsPipelines: parameter " |
| 2220 | "pCreateInfos[%" PRIu32 "].pVertexInputState->pVertexBindingDescriptions[%" PRIu32 |
| 2221 | "].stride (%" PRIu32 |
| 2222 | ") is greater " |
| 2223 | "than VkPhysicalDeviceLimits::maxVertexInputBindingStride (%" PRIu32 ").", |
| 2224 | i, d, vertex_bind_desc.stride, device_limits.maxVertexInputBindingStride); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2225 | } |
| 2226 | } |
| 2227 | |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 2228 | layer_data::unordered_set<uint32_t> attribute_locations(vertex_input_state->vertexAttributeDescriptionCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2229 | for (uint32_t d = 0; d < vertex_input_state->vertexAttributeDescriptionCount; ++d) { |
| 2230 | auto const &vertex_attrib_desc = vertex_input_state->pVertexAttributeDescriptions[d]; |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2231 | auto const &location_it = attribute_locations.find(vertex_attrib_desc.location); |
| 2232 | if (location_it != attribute_locations.cend()) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2233 | skip |= LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-pVertexAttributeDescriptions-00617", |
| 2234 | "vkCreateGraphicsPipelines: parameter " |
| 2235 | "pCreateInfo[%" PRIu32 "].pVertexInputState->vertexAttributeDescriptions[%" PRIu32 |
| 2236 | "].location (%" PRIu32 ") is not distinct.", |
| 2237 | i, d, vertex_attrib_desc.location); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2238 | } |
| 2239 | attribute_locations.insert(vertex_attrib_desc.location); |
| 2240 | |
| 2241 | auto const &binding_it = vertex_bindings.find(vertex_attrib_desc.binding); |
| 2242 | if (binding_it == vertex_bindings.cend()) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2243 | skip |= LogError(device, "VUID-VkPipelineVertexInputStateCreateInfo-binding-00615", |
| 2244 | "vkCreateGraphicsPipelines: parameter " |
| 2245 | " pCreateInfo[%" PRIu32 "].pVertexInputState->vertexAttributeDescriptions[%" PRIu32 |
| 2246 | "].binding (%" PRIu32 |
| 2247 | ") does not exist " |
| 2248 | "in any pCreateInfo[%" PRIu32 "].pVertexInputState->pVertexBindingDescription.", |
| 2249 | i, d, vertex_attrib_desc.binding, i); |
Peter Kohaut | c7d9d39 | 2018-07-15 00:34:07 +0200 | [diff] [blame] | 2250 | } |
| 2251 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2252 | if (vertex_attrib_desc.location >= device_limits.maxVertexInputAttributes) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2253 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription-location-00620", |
| 2254 | "vkCreateGraphicsPipelines: parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2255 | "pCreateInfos[%" PRIu32 "].pVertexInputState->pVertexAttributeDescriptions[%" PRIu32 |
| 2256 | "].location (%" PRIu32 |
| 2257 | ") is " |
| 2258 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputAttributes (%" PRIu32 ").", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2259 | i, d, vertex_attrib_desc.location, device_limits.maxVertexInputAttributes); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2260 | } |
| 2261 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2262 | if (vertex_attrib_desc.binding >= device_limits.maxVertexInputBindings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2263 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription-binding-00621", |
| 2264 | "vkCreateGraphicsPipelines: parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2265 | "pCreateInfos[%" PRIu32 "].pVertexInputState->pVertexAttributeDescriptions[%" PRIu32 |
| 2266 | "].binding (%" PRIu32 |
| 2267 | ") is " |
| 2268 | "greater than or equal to VkPhysicalDeviceLimits::maxVertexInputBindings (%" PRIu32 ").", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2269 | i, d, vertex_attrib_desc.binding, device_limits.maxVertexInputBindings); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2270 | } |
| 2271 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2272 | if (vertex_attrib_desc.offset > device_limits.maxVertexInputAttributeOffset) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2273 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription-offset-00622", |
| 2274 | "vkCreateGraphicsPipelines: parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2275 | "pCreateInfos[%" PRIu32 "].pVertexInputState->pVertexAttributeDescriptions[%" PRIu32 |
| 2276 | "].offset (%" PRIu32 |
| 2277 | ") is " |
| 2278 | "greater than VkPhysicalDeviceLimits::maxVertexInputAttributeOffset (%" PRIu32 ").", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2279 | i, d, vertex_attrib_desc.offset, device_limits.maxVertexInputAttributeOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2280 | } |
| 2281 | } |
| 2282 | } |
| 2283 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2284 | // pTessellationState is ignored without both tessellation control and tessellation evaluation shaders stages |
| 2285 | if (has_control && has_eval) { |
| 2286 | if (pCreateInfos[i].pTessellationState == nullptr) { |
| 2287 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pStages-00731", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2288 | "vkCreateGraphicsPipelines: if pCreateInfos[%" PRIu32 |
| 2289 | "].pStages includes a tessellation control " |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2290 | "shader stage and a tessellation evaluation shader stage, " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2291 | "pCreateInfos[%" PRIu32 "].pTessellationState must not be NULL.", |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2292 | i, i); |
| 2293 | } else { |
| 2294 | const VkStructureType allowed_type = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO; |
| 2295 | skip |= validate_struct_pnext( |
| 2296 | "vkCreateGraphicsPipelines", |
| 2297 | ParameterName("pCreateInfos[%i].pTessellationState->pNext", ParameterName::IndexVector{i}), |
| 2298 | "VkPipelineTessellationDomainOriginStateCreateInfo", pCreateInfos[i].pTessellationState->pNext, 1, |
| 2299 | &allowed_type, GeneratedVulkanHeaderVersion, "VUID-VkGraphicsPipelineCreateInfo-pNext-pNext", |
| 2300 | "VUID-VkGraphicsPipelineCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2301 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2302 | skip |= validate_reserved_flags( |
| 2303 | "vkCreateGraphicsPipelines", |
| 2304 | ParameterName("pCreateInfos[%i].pTessellationState->flags", ParameterName::IndexVector{i}), |
| 2305 | pCreateInfos[i].pTessellationState->flags, "VUID-VkPipelineTessellationStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2306 | |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2307 | if (pCreateInfos[i].pTessellationState->patchControlPoints == 0 || |
| 2308 | pCreateInfos[i].pTessellationState->patchControlPoints > device_limits.maxTessellationPatchSize) { |
| 2309 | skip |= LogError(device, "VUID-VkPipelineTessellationStateCreateInfo-patchControlPoints-01214", |
| 2310 | "vkCreateGraphicsPipelines: invalid parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2311 | "pCreateInfos[%" PRIu32 "].pTessellationState->patchControlPoints value %" PRIu32 |
| 2312 | ". patchControlPoints " |
| 2313 | "should be >0 and <=%" PRIu32 ".", |
Spencer Fricke | f1b0a7d | 2020-03-16 17:38:55 -0700 | [diff] [blame] | 2314 | i, pCreateInfos[i].pTessellationState->patchControlPoints, |
| 2315 | device_limits.maxTessellationPatchSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2316 | } |
| 2317 | } |
| 2318 | } |
| 2319 | |
| 2320 | // pViewportState, pMultisampleState, pDepthStencilState, and pColorBlendState ignored when rasterization is disabled |
| 2321 | if ((pCreateInfos[i].pRasterizationState != nullptr) && |
| 2322 | (pCreateInfos[i].pRasterizationState->rasterizerDiscardEnable == VK_FALSE)) { |
| 2323 | if (pCreateInfos[i].pViewportState == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2324 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00750", |
| 2325 | "vkCreateGraphicsPipelines: Rasterization is enabled (pCreateInfos[%" PRIu32 |
| 2326 | "].pRasterizationState->rasterizerDiscardEnable is VK_FALSE), but pCreateInfos[%" PRIu32 |
| 2327 | "].pViewportState (=NULL) is not a valid pointer.", |
| 2328 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2329 | } else { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2330 | const auto &viewport_state = *pCreateInfos[i].pViewportState; |
| 2331 | |
| 2332 | if (viewport_state.sType != VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2333 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-sType-sType", |
| 2334 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2335 | "].pViewportState->sType is not VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO.", |
| 2336 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2337 | } |
| 2338 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2339 | const VkStructureType allowed_structs_vk_pipeline_viewport_state_create_info[] = { |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2340 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV, |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2341 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV, |
| 2342 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV, |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2343 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV, |
| 2344 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV, |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2345 | }; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2346 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2347 | "vkCreateGraphicsPipelines", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2348 | ParameterName("pCreateInfos[%i].pViewportState->pNext", ParameterName::IndexVector{i}), |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2349 | "VkPipelineViewportSwizzleStateCreateInfoNV, VkPipelineViewportWScalingStateCreateInfoNV, " |
Jeff Bolz | b8a8dd0 | 2018-09-18 02:39:24 -0500 | [diff] [blame] | 2350 | "VkPipelineViewportExclusiveScissorStateCreateInfoNV, VkPipelineViewportShadingRateImageStateCreateInfoNV, " |
| 2351 | "VkPipelineViewportCoarseSampleOrderStateCreateInfoNV", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2352 | viewport_state.pNext, ARRAY_SIZE(allowed_structs_vk_pipeline_viewport_state_create_info), |
| 2353 | allowed_structs_vk_pipeline_viewport_state_create_info, 65, |
| 2354 | "VUID-VkPipelineViewportStateCreateInfo-pNext-pNext", |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2355 | "VUID-VkPipelineViewportStateCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2356 | |
| 2357 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2358 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2359 | ParameterName("pCreateInfos[%i].pViewportState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2360 | viewport_state.flags, "VUID-VkPipelineViewportStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2361 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 2362 | auto exclusive_scissor_struct = |
| 2363 | LvlFindInChain<VkPipelineViewportExclusiveScissorStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
| 2364 | auto shading_rate_image_struct = |
| 2365 | LvlFindInChain<VkPipelineViewportShadingRateImageStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
| 2366 | auto coarse_sample_order_struct = |
| 2367 | LvlFindInChain<VkPipelineViewportCoarseSampleOrderStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 2368 | const auto vp_swizzle_struct = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 2369 | LvlFindInChain<VkPipelineViewportSwizzleStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 2370 | const auto vp_w_scaling_struct = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 2371 | LvlFindInChain<VkPipelineViewportWScalingStateCreateInfoNV>(pCreateInfos[i].pViewportState->pNext); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2372 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2373 | if (!physical_device_features.multiViewport) { |
Mark Lobodzinski | 8b9ddab | 2020-10-15 14:38:43 -0600 | [diff] [blame] | 2374 | if (!has_dynamic_viewport_with_count && (viewport_state.viewportCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2375 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-01216", |
| 2376 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 2377 | "disabled, but pCreateInfos[%" PRIu32 "].pViewportState->viewportCount (=%" PRIu32 |
| 2378 | ") is not 1.", |
| 2379 | i, viewport_state.viewportCount); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2380 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2381 | |
Mark Lobodzinski | 8b9ddab | 2020-10-15 14:38:43 -0600 | [diff] [blame] | 2382 | if (!has_dynamic_scissor_with_count && (viewport_state.scissorCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2383 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01217", |
| 2384 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 2385 | "disabled, but pCreateInfos[%" PRIu32 "].pViewportState->scissorCount (=%" PRIu32 |
| 2386 | ") is not 1.", |
| 2387 | i, viewport_state.scissorCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2388 | } |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2389 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2390 | if (exclusive_scissor_struct && (exclusive_scissor_struct->exclusiveScissorCount != 0 && |
| 2391 | exclusive_scissor_struct->exclusiveScissorCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2392 | skip |= LogError( |
| 2393 | device, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02027", |
| 2394 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 2395 | "disabled, but pCreateInfos[%" PRIu32 |
| 2396 | "] VkPipelineViewportExclusiveScissorStateCreateInfoNV::exclusiveScissorCount (=%" PRIu32 |
| 2397 | ") is not 1.", |
| 2398 | i, exclusive_scissor_struct->exclusiveScissorCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2399 | } |
| 2400 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2401 | if (shading_rate_image_struct && |
| 2402 | (shading_rate_image_struct->viewportCount != 0 && shading_rate_image_struct->viewportCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2403 | skip |= LogError(device, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-viewportCount-02054", |
| 2404 | "vkCreateGraphicsPipelines: The VkPhysicalDeviceFeatures::multiViewport feature is " |
| 2405 | "disabled, but pCreateInfos[%" PRIu32 |
| 2406 | "] VkPipelineViewportShadingRateImageStateCreateInfoNV::viewportCount (=%" PRIu32 |
| 2407 | ") is neither 0 nor 1.", |
| 2408 | i, shading_rate_image_struct->viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2409 | } |
| 2410 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2411 | } else { // multiViewport enabled |
| 2412 | if (viewport_state.viewportCount == 0) { |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 2413 | if (!has_dynamic_viewport_with_count) { |
| 2414 | skip |= LogError( |
| 2415 | device, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-arraylength", |
| 2416 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "].pViewportState->viewportCount is 0.", i); |
| 2417 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2418 | } else if (viewport_state.viewportCount > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2419 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-viewportCount-01218", |
| 2420 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2421 | "].pViewportState->viewportCount (=%" PRIu32 |
| 2422 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 2423 | i, viewport_state.viewportCount, device_limits.maxViewports); |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 2424 | } else if (has_dynamic_viewport_with_count) { |
| 2425 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-03379", |
| 2426 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2427 | "].pViewportState->viewportCount (=%" PRIu32 |
| 2428 | ") must be zero when VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT is used.", |
| 2429 | i, viewport_state.viewportCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2430 | } |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2431 | |
| 2432 | if (viewport_state.scissorCount == 0) { |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 2433 | if (!has_dynamic_scissor_with_count) { |
| 2434 | skip |= LogError( |
| 2435 | device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-arraylength", |
| 2436 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "].pViewportState->scissorCount is 0.", i); |
| 2437 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2438 | } else if (viewport_state.scissorCount > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2439 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01219", |
| 2440 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2441 | "].pViewportState->scissorCount (=%" PRIu32 |
| 2442 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 2443 | i, viewport_state.scissorCount, device_limits.maxViewports); |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 2444 | } else if (has_dynamic_scissor_with_count) { |
| 2445 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-03380", |
| 2446 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2447 | "].pViewportState->scissorCount (=%" PRIu32 |
| 2448 | ") must be zero when VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT is used.", |
| 2449 | i, viewport_state.viewportCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2450 | } |
| 2451 | } |
| 2452 | |
ziga-lunarg | 845883b | 2021-07-14 15:05:00 +0200 | [diff] [blame] | 2453 | if (!has_dynamic_scissor && viewport_state.pScissors) { |
| 2454 | for (uint32_t scissor_i = 0; scissor_i < viewport_state.scissorCount; ++scissor_i) { |
| 2455 | const auto &scissor = viewport_state.pScissors[scissor_i]; |
ziga-lunarg | a77dc80 | 2021-07-15 13:19:06 +0200 | [diff] [blame] | 2456 | |
| 2457 | if (scissor.offset.x < 0) { |
| 2458 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-x-02821", |
| 2459 | "vkCreateGraphicsPipelines: offset.x (=%" PRIi32 ") of pCreateInfos[%" PRIu32 |
| 2460 | "].pViewportState->pScissors[%" PRIu32 "] is negative.", |
| 2461 | scissor.offset.x, i, scissor_i); |
| 2462 | } |
| 2463 | |
| 2464 | if (scissor.offset.y < 0) { |
| 2465 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-x-02821", |
| 2466 | "vkCreateGraphicsPipelines: offset.y (=%" PRIi32 ") of pCreateInfos[%" PRIu32 |
| 2467 | "].pViewportState->pScissors[%" PRIu32 "] is negative.", |
| 2468 | scissor.offset.y, i, scissor_i); |
| 2469 | } |
| 2470 | |
ziga-lunarg | 845883b | 2021-07-14 15:05:00 +0200 | [diff] [blame] | 2471 | const int64_t x_sum = |
| 2472 | static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 2473 | if (x_sum > std::numeric_limits<int32_t>::max()) { |
| 2474 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-offset-02822", |
| 2475 | "vkCreateGraphicsPipelines: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 |
| 2476 | " = %" PRIi64 ") of pCreateInfos[%" PRIu32 "].pViewportState->pScissors[%" PRIu32 |
| 2477 | "] will overflow int32_t.", |
| 2478 | scissor.offset.x, scissor.extent.width, x_sum, i, scissor_i); |
| 2479 | } |
ziga-lunarg | a77dc80 | 2021-07-15 13:19:06 +0200 | [diff] [blame] | 2480 | |
ziga-lunarg | 845883b | 2021-07-14 15:05:00 +0200 | [diff] [blame] | 2481 | const int64_t y_sum = |
| 2482 | static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 2483 | if (y_sum > std::numeric_limits<int32_t>::max()) { |
| 2484 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-offset-02823", |
| 2485 | "vkCreateGraphicsPipelines: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 |
| 2486 | " = %" PRIi64 ") of pCreateInfos[%" PRIu32 "].pViewportState->pScissors[%" PRIu32 |
| 2487 | "] will overflow int32_t.", |
| 2488 | scissor.offset.y, scissor.extent.height, y_sum, i, scissor_i); |
| 2489 | } |
| 2490 | } |
| 2491 | } |
| 2492 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2493 | if (exclusive_scissor_struct && exclusive_scissor_struct->exclusiveScissorCount > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2494 | skip |= |
| 2495 | LogError(device, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02028", |
| 2496 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "] exclusiveScissorCount (=%" PRIu32 |
| 2497 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 2498 | i, exclusive_scissor_struct->exclusiveScissorCount, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2499 | } |
| 2500 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 2501 | 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] | 2502 | skip |= LogError(device, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-viewportCount-02055", |
| 2503 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2504 | "] VkPipelineViewportShadingRateImageStateCreateInfoNV viewportCount (=%" PRIu32 |
| 2505 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 2506 | i, shading_rate_image_struct->viewportCount, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2507 | } |
| 2508 | |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 2509 | if (viewport_state.scissorCount != viewport_state.viewportCount && |
| 2510 | !(has_dynamic_viewport_with_count || has_dynamic_scissor_with_count)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2511 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-scissorCount-01220", |
| 2512 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2513 | "].pViewportState->scissorCount (=%" PRIu32 ") is not identical to pCreateInfos[%" PRIu32 |
| 2514 | "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 2515 | i, viewport_state.scissorCount, i, viewport_state.viewportCount); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2516 | } |
| 2517 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2518 | if (exclusive_scissor_struct && exclusive_scissor_struct->exclusiveScissorCount != 0 && |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2519 | exclusive_scissor_struct->exclusiveScissorCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2520 | skip |= |
| 2521 | LogError(device, "VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02029", |
| 2522 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 "] exclusiveScissorCount (=%" PRIu32 |
| 2523 | ") must be zero or identical to pCreateInfos[%" PRIu32 |
| 2524 | "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 2525 | i, exclusive_scissor_struct->exclusiveScissorCount, i, viewport_state.viewportCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2526 | } |
| 2527 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2528 | if (shading_rate_image_struct && shading_rate_image_struct->shadingRateImageEnable && |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2529 | shading_rate_image_struct->viewportCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2530 | skip |= LogError( |
| 2531 | device, "VUID-VkPipelineViewportShadingRateImageStateCreateInfoNV-shadingRateImageEnable-02056", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2532 | "vkCreateGraphicsPipelines: If shadingRateImageEnable is enabled, pCreateInfos[%" PRIu32 |
| 2533 | "] " |
| 2534 | "VkPipelineViewportShadingRateImageStateCreateInfoNV viewportCount (=%" PRIu32 |
| 2535 | ") must identical to pCreateInfos[%" PRIu32 "].pViewportState->viewportCount (=%" PRIu32 ").", |
| 2536 | i, shading_rate_image_struct->viewportCount, i, viewport_state.viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2537 | } |
| 2538 | |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2539 | if (!has_dynamic_viewport && viewport_state.viewportCount > 0 && viewport_state.pViewports == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2540 | skip |= LogError( |
| 2541 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00747", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2542 | "vkCreateGraphicsPipelines: The viewport state is static (pCreateInfos[%" PRIu32 |
| 2543 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_VIEWPORT), but pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2544 | "].pViewportState->pViewports (=NULL) is an invalid pointer.", |
| 2545 | i, i); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2546 | } |
| 2547 | |
| 2548 | if (!has_dynamic_scissor && viewport_state.scissorCount > 0 && viewport_state.pScissors == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2549 | skip |= LogError( |
| 2550 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00748", |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2551 | "vkCreateGraphicsPipelines: The scissor state is static (pCreateInfos[%" PRIu32 |
| 2552 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_SCISSOR), but pCreateInfos[%" PRIu32 |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 2553 | "].pViewportState->pScissors (=NULL) is an invalid pointer.", |
| 2554 | i, i); |
Petr Kraus | a610355 | 2017-11-16 21:21:58 +0100 | [diff] [blame] | 2555 | } |
| 2556 | |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2557 | if (!has_dynamic_exclusive_scissor_nv && exclusive_scissor_struct && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2558 | exclusive_scissor_struct->exclusiveScissorCount > 0 && |
| 2559 | exclusive_scissor_struct->pExclusiveScissors == nullptr) { |
| 2560 | skip |= |
Shannon McPherson | 24c13d1 | 2020-06-18 15:51:41 -0600 | [diff] [blame] | 2561 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-04056", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2562 | "vkCreateGraphicsPipelines: The exclusive scissor state is static (pCreateInfos[%" PRIu32 |
| 2563 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV), but " |
| 2564 | "pCreateInfos[%" PRIu32 "] pExclusiveScissors (=NULL) is an invalid pointer.", |
| 2565 | i, i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2566 | } |
| 2567 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2568 | if (!has_dynamic_shading_rate_palette_nv && shading_rate_image_struct && |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2569 | shading_rate_image_struct->viewportCount > 0 && |
| 2570 | shading_rate_image_struct->pShadingRatePalettes == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2571 | skip |= LogError( |
Shannon McPherson | 24c13d1 | 2020-06-18 15:51:41 -0600 | [diff] [blame] | 2572 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-04057", |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2573 | "vkCreateGraphicsPipelines: The shading rate palette state is static (pCreateInfos[%" PRIu32 |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 2574 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV), " |
| 2575 | "but pCreateInfos[%" PRIu32 "] pShadingRatePalettes (=NULL) is an invalid pointer.", |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2576 | i, i); |
| 2577 | } |
| 2578 | |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 2579 | if (vp_swizzle_struct) { |
| 2580 | if (vp_swizzle_struct->viewportCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2581 | skip |= LogError(device, "VUID-VkPipelineViewportSwizzleStateCreateInfoNV-viewportCount-01215", |
| 2582 | "vkCreateGraphicsPipelines: The viewport swizzle state vieport count of %" PRIu32 |
| 2583 | " does " |
| 2584 | "not match the viewport count of %" PRIu32 " in VkPipelineViewportStateCreateInfo.", |
| 2585 | vp_swizzle_struct->viewportCount, viewport_state.viewportCount); |
Chris Mayer | 328d821 | 2018-12-11 14:16:18 +0100 | [diff] [blame] | 2586 | } |
| 2587 | } |
| 2588 | |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 2589 | // validate the VkViewports |
| 2590 | if (!has_dynamic_viewport && viewport_state.pViewports) { |
| 2591 | for (uint32_t viewport_i = 0; viewport_i < viewport_state.viewportCount; ++viewport_i) { |
| 2592 | 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] | 2593 | const char *fn_name = "vkCreateGraphicsPipelines"; |
| 2594 | skip |= manual_PreCallValidateViewport(viewport, fn_name, |
| 2595 | ParameterName("pCreateInfos[%i].pViewportState->pViewports[%i]", |
| 2596 | ParameterName::IndexVector{i, viewport_i}), |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2597 | VkCommandBuffer(0)); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 2598 | } |
| 2599 | } |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 2600 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 2601 | if (has_dynamic_viewport_w_scaling_nv && !IsExtEnabled(device_extensions.vk_nv_clip_space_w_scaling)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2602 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 2603 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2604 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV, but " |
| 2605 | "VK_NV_clip_space_w_scaling extension is not enabled.", |
| 2606 | i); |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 2607 | } |
| 2608 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 2609 | if (has_dynamic_discard_rectangle_ext && !IsExtEnabled(device_extensions.vk_ext_discard_rectangles)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2610 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 2611 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2612 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT, but " |
| 2613 | "VK_EXT_discard_rectangles extension is not enabled.", |
| 2614 | i); |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 2615 | } |
| 2616 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 2617 | if (has_dynamic_sample_locations_ext && !IsExtEnabled(device_extensions.vk_ext_sample_locations)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2618 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 2619 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2620 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT, but " |
| 2621 | "VK_EXT_sample_locations extension is not enabled.", |
| 2622 | i); |
Jeremy Kniager | 71fd5f0 | 2017-11-15 13:27:03 -0700 | [diff] [blame] | 2623 | } |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2624 | |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 2625 | if (has_dynamic_exclusive_scissor_nv && !IsExtEnabled(device_extensions.vk_nv_scissor_exclusive)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2626 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 2627 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2628 | "].pDynamicState->pDynamicStates contains VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV, but " |
| 2629 | "VK_NV_scissor_exclusive extension is not enabled.", |
| 2630 | i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 2631 | } |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2632 | |
| 2633 | if (coarse_sample_order_struct && |
| 2634 | coarse_sample_order_struct->sampleOrderType != VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV && |
| 2635 | coarse_sample_order_struct->customSampleOrderCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2636 | skip |= LogError(device, "VUID-VkPipelineViewportCoarseSampleOrderStateCreateInfoNV-sampleOrderType-02072", |
| 2637 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2638 | "] " |
| 2639 | "VkPipelineViewportCoarseSampleOrderStateCreateInfoNV sampleOrderType is not " |
| 2640 | "VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV and customSampleOrderCount is not 0.", |
| 2641 | i); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2642 | } |
| 2643 | |
| 2644 | if (coarse_sample_order_struct) { |
| 2645 | 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] | 2646 | skip |= ValidateCoarseSampleOrderCustomNV(&coarse_sample_order_struct->pCustomSampleOrders[order_i]); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 2647 | } |
| 2648 | } |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 2649 | |
| 2650 | if (vp_w_scaling_struct && (vp_w_scaling_struct->viewportWScalingEnable == VK_TRUE)) { |
| 2651 | if (vp_w_scaling_struct->viewportCount != viewport_state.viewportCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2652 | skip |= LogError(device, "VUID-VkPipelineViewportStateCreateInfo-viewportWScalingEnable-01726", |
| 2653 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2654 | "] " |
| 2655 | "VkPipelineViewportWScalingStateCreateInfoNV.viewportCount (=%" PRIu32 |
| 2656 | ") " |
| 2657 | "is not equal to VkPipelineViewportStateCreateInfo.viewportCount (=%" PRIu32 ").", |
| 2658 | i, vp_w_scaling_struct->viewportCount, viewport_state.viewportCount); |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 2659 | } |
| 2660 | if (!has_dynamic_viewport_w_scaling_nv && !vp_w_scaling_struct->pViewportWScalings) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2661 | skip |= LogError( |
| 2662 | device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-01715", |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 2663 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 2664 | "] " |
| 2665 | "VkPipelineViewportWScalingStateCreateInfoNV.pViewportWScalings (=NULL) is not a valid array.", |
| 2666 | i); |
| 2667 | } |
| 2668 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2669 | } |
| 2670 | |
| 2671 | if (pCreateInfos[i].pMultisampleState == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2672 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00751", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2673 | "vkCreateGraphicsPipelines: if pCreateInfos[%" PRIu32 |
| 2674 | "].pRasterizationState->rasterizerDiscardEnable " |
| 2675 | "is VK_FALSE, pCreateInfos[%" PRIu32 "].pMultisampleState must not be NULL.", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2676 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2677 | } else { |
Dave Houlton | b3bbec7 | 2018-01-17 10:13:33 -0700 | [diff] [blame] | 2678 | const VkStructureType valid_next_stypes[] = {LvlTypeMap<VkPipelineCoverageModulationStateCreateInfoNV>::kSType, |
Mark Lobodzinski | 1ddf16f | 2020-08-13 08:58:13 -0600 | [diff] [blame] | 2679 | LvlTypeMap<VkPipelineCoverageReductionStateCreateInfoNV>::kSType, |
Dave Houlton | b3bbec7 | 2018-01-17 10:13:33 -0700 | [diff] [blame] | 2680 | LvlTypeMap<VkPipelineCoverageToColorStateCreateInfoNV>::kSType, |
| 2681 | LvlTypeMap<VkPipelineSampleLocationsStateCreateInfoEXT>::kSType}; |
Mike Schuchardt | 97662b0 | 2017-12-06 13:31:29 -0700 | [diff] [blame] | 2682 | const char *valid_struct_names = |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 2683 | "VkPipelineCoverageModulationStateCreateInfoNV, VkPipelineCoverageToColorStateCreateInfoNV, " |
John Zulauf | 96b0e42 | 2017-11-14 11:43:19 -0700 | [diff] [blame] | 2684 | "VkPipelineSampleLocationsStateCreateInfoEXT"; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2685 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2686 | "vkCreateGraphicsPipelines", |
John Zulauf | 96b0e42 | 2017-11-14 11:43:19 -0700 | [diff] [blame] | 2687 | ParameterName("pCreateInfos[%i].pMultisampleState->pNext", ParameterName::IndexVector{i}), |
Mark Lobodzinski | 1ddf16f | 2020-08-13 08:58:13 -0600 | [diff] [blame] | 2688 | valid_struct_names, pCreateInfos[i].pMultisampleState->pNext, 4, valid_next_stypes, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2689 | GeneratedVulkanHeaderVersion, "VUID-VkPipelineMultisampleStateCreateInfo-pNext-pNext", |
| 2690 | "VUID-VkPipelineMultisampleStateCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2691 | |
| 2692 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2693 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2694 | ParameterName("pCreateInfos[%i].pMultisampleState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2695 | pCreateInfos[i].pMultisampleState->flags, "VUID-VkPipelineMultisampleStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2696 | |
| 2697 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2698 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2699 | ParameterName("pCreateInfos[%i].pMultisampleState->sampleShadingEnable", ParameterName::IndexVector{i}), |
| 2700 | pCreateInfos[i].pMultisampleState->sampleShadingEnable); |
| 2701 | |
| 2702 | skip |= validate_array( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2703 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2704 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 2705 | ParameterName("pCreateInfos[%i].pMultisampleState->pSampleMask", ParameterName::IndexVector{i}), |
GabrÃel Arthúr Pétursson | 092b29b | 2018-03-21 22:44:11 +0000 | [diff] [blame] | 2706 | pCreateInfos[i].pMultisampleState->rasterizationSamples, &pCreateInfos[i].pMultisampleState->pSampleMask, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2707 | true, false, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2708 | |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2709 | skip |= validate_flags( |
| 2710 | "vkCreateGraphicsPipelines", |
| 2711 | ParameterName("pCreateInfos[%i].pMultisampleState->rasterizationSamples", ParameterName::IndexVector{i}), |
| 2712 | "VkSampleCountFlagBits", AllVkSampleCountFlagBits, pCreateInfos[i].pMultisampleState->rasterizationSamples, |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 2713 | kRequiredSingleBit, "VUID-VkPipelineMultisampleStateCreateInfo-rasterizationSamples-parameter"); |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2714 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2715 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2716 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2717 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToCoverageEnable", ParameterName::IndexVector{i}), |
| 2718 | pCreateInfos[i].pMultisampleState->alphaToCoverageEnable); |
| 2719 | |
| 2720 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2721 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2722 | ParameterName("pCreateInfos[%i].pMultisampleState->alphaToOneEnable", ParameterName::IndexVector{i}), |
| 2723 | pCreateInfos[i].pMultisampleState->alphaToOneEnable); |
| 2724 | |
| 2725 | if (pCreateInfos[i].pMultisampleState->sType != VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO) { |
sfricke-samsung | 81c56f7 | 2020-08-23 22:14:41 -0700 | [diff] [blame] | 2726 | skip |= LogError(device, "VUID-VkPipelineMultisampleStateCreateInfo-sType-sType", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2727 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%" PRIu32 |
| 2728 | "].pMultisampleState->sType must be " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2729 | "VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO", |
| 2730 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2731 | } |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 2732 | if (pCreateInfos[i].pMultisampleState->sampleShadingEnable == VK_TRUE) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2733 | if (!physical_device_features.sampleRateShading) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2734 | skip |= LogError(device, "VUID-VkPipelineMultisampleStateCreateInfo-sampleShadingEnable-00784", |
| 2735 | "vkCreateGraphicsPipelines(): parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2736 | "pCreateInfos[%" PRIu32 "].pMultisampleState->sampleShadingEnable.", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2737 | i); |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 2738 | } |
| 2739 | // TODO Add documentation issue about when minSampleShading must be in range and when it is ignored |
| 2740 | // For now a "least noise" test *only* when sampleShadingEnable is VK_TRUE. |
| 2741 | if (!in_inclusive_range(pCreateInfos[i].pMultisampleState->minSampleShading, 0.F, 1.0F)) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2742 | skip |= LogError(device, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2743 | |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2744 | "VUID-VkPipelineMultisampleStateCreateInfo-minSampleShading-00786", |
| 2745 | "vkCreateGraphicsPipelines(): parameter pCreateInfos[%" PRIu32 |
| 2746 | "].pMultisampleState->minSampleShading.", |
| 2747 | i); |
John Zulauf | 7acac59 | 2017-11-06 11:15:53 -0700 | [diff] [blame] | 2748 | } |
| 2749 | } |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2750 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 2751 | const auto *line_state = |
| 2752 | LvlFindInChain<VkPipelineRasterizationLineStateCreateInfoEXT>(pCreateInfos[i].pRasterizationState->pNext); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2753 | |
| 2754 | if (line_state) { |
| 2755 | if ((line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT || |
| 2756 | line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT)) { |
| 2757 | if (pCreateInfos[i].pMultisampleState->alphaToCoverageEnable) { |
| 2758 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2759 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766", |
| 2760 | "vkCreateGraphicsPipelines(): Bresenham/Smooth line rasterization not supported with " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2761 | "pCreateInfos[%" PRIu32 "].pMultisampleState->alphaToCoverageEnable == VK_TRUE.", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2762 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2763 | } |
| 2764 | if (pCreateInfos[i].pMultisampleState->alphaToOneEnable) { |
| 2765 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2766 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766", |
| 2767 | "vkCreateGraphicsPipelines(): Bresenham/Smooth line rasterization not supported with " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2768 | "pCreateInfos[%" PRIu32 "].pMultisampleState->alphaToOneEnable == VK_TRUE.", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2769 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2770 | } |
| 2771 | if (pCreateInfos[i].pMultisampleState->sampleShadingEnable) { |
| 2772 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2773 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766", |
| 2774 | "vkCreateGraphicsPipelines(): Bresenham/Smooth line rasterization not supported with " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2775 | "pCreateInfos[%" PRIu32 "].pMultisampleState->sampleShadingEnable == VK_TRUE.", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2776 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2777 | } |
| 2778 | } |
| 2779 | if (line_state->stippledLineEnable && !has_dynamic_line_stipple) { |
| 2780 | if (line_state->lineStippleFactor < 1 || line_state->lineStippleFactor > 256) { |
| 2781 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2782 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-stippledLineEnable-02767", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2783 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 "] lineStippleFactor = %" PRIu32 |
| 2784 | " must be in the " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2785 | "range [1,256].", |
| 2786 | i, line_state->lineStippleFactor); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2787 | } |
| 2788 | } |
| 2789 | const auto *line_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 2790 | LvlFindInChain<VkPhysicalDeviceLineRasterizationFeaturesEXT>(device_createinfo_pnext); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2791 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT && |
| 2792 | (!line_features || !line_features->rectangularLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2793 | skip |= |
| 2794 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-lineRasterizationMode-02768", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2795 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 2796 | "] lineRasterizationMode = " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2797 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT requires the rectangularLines feature.", |
| 2798 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2799 | } |
| 2800 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT && |
| 2801 | (!line_features || !line_features->bresenhamLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2802 | skip |= |
| 2803 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-lineRasterizationMode-02769", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2804 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 2805 | "] lineRasterizationMode = " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2806 | "VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT requires the bresenhamLines feature.", |
| 2807 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2808 | } |
| 2809 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT && |
| 2810 | (!line_features || !line_features->smoothLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2811 | skip |= |
| 2812 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-lineRasterizationMode-02770", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2813 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 2814 | "] lineRasterizationMode = " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2815 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT requires the smoothLines feature.", |
| 2816 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2817 | } |
| 2818 | if (line_state->stippledLineEnable) { |
| 2819 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT && |
| 2820 | (!line_features || !line_features->stippledRectangularLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2821 | skip |= |
| 2822 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02771", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2823 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 2824 | "] lineRasterizationMode = " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2825 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT with stipple requires the " |
| 2826 | "stippledRectangularLines feature.", |
| 2827 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2828 | } |
| 2829 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT && |
| 2830 | (!line_features || !line_features->stippledBresenhamLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2831 | skip |= |
| 2832 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02772", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2833 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 2834 | "] lineRasterizationMode = " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2835 | "VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT with stipple requires the " |
| 2836 | "stippledBresenhamLines feature.", |
| 2837 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2838 | } |
| 2839 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT && |
| 2840 | (!line_features || !line_features->stippledSmoothLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2841 | skip |= |
| 2842 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02773", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2843 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 2844 | "] lineRasterizationMode = " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2845 | "VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT with stipple requires the " |
| 2846 | "stippledSmoothLines feature.", |
| 2847 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2848 | } |
| 2849 | if (line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT && |
| 2850 | (!line_features || !line_features->stippledSmoothLines || !device_limits.strictLines)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2851 | skip |= |
| 2852 | LogError(device, "VUID-VkPipelineRasterizationLineStateCreateInfoEXT-stippledLineEnable-02774", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2853 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 2854 | "] lineRasterizationMode = " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2855 | "VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT with stipple requires the " |
| 2856 | "stippledRectangularLines and strictLines features.", |
| 2857 | i); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 2858 | } |
| 2859 | } |
| 2860 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2861 | } |
| 2862 | |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2863 | bool uses_color_attachment = false; |
| 2864 | bool uses_depthstencil_attachment = false; |
| 2865 | { |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 2866 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2867 | const auto subpasses_uses_it = renderpasses_states.find(pCreateInfos[i].renderPass); |
| 2868 | if (subpasses_uses_it != renderpasses_states.end()) { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2869 | const auto &subpasses_uses = subpasses_uses_it->second; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2870 | if (subpasses_uses.subpasses_using_color_attachment.count(pCreateInfos[i].subpass)) { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2871 | uses_color_attachment = true; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2872 | } |
| 2873 | if (subpasses_uses.subpasses_using_depthstencil_attachment.count(pCreateInfos[i].subpass)) { |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2874 | uses_depthstencil_attachment = true; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2875 | } |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2876 | } |
Mark Lobodzinski | f27a6bc | 2019-02-04 13:00:49 -0700 | [diff] [blame] | 2877 | lock.unlock(); |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2878 | } |
| 2879 | |
| 2880 | if (pCreateInfos[i].pDepthStencilState != nullptr && uses_depthstencil_attachment) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2881 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2882 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2883 | ParameterName("pCreateInfos[%i].pDepthStencilState->pNext", ParameterName::IndexVector{i}), NULL, |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2884 | pCreateInfos[i].pDepthStencilState->pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2885 | "VUID-VkPipelineDepthStencilStateCreateInfo-pNext-pNext", nullptr); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2886 | |
| 2887 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2888 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2889 | ParameterName("pCreateInfos[%i].pDepthStencilState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2890 | pCreateInfos[i].pDepthStencilState->flags, "VUID-VkPipelineDepthStencilStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2891 | |
| 2892 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2893 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2894 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthTestEnable", ParameterName::IndexVector{i}), |
| 2895 | pCreateInfos[i].pDepthStencilState->depthTestEnable); |
| 2896 | |
| 2897 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2898 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2899 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthWriteEnable", ParameterName::IndexVector{i}), |
| 2900 | pCreateInfos[i].pDepthStencilState->depthWriteEnable); |
| 2901 | |
| 2902 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2903 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2904 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthCompareOp", ParameterName::IndexVector{i}), |
| 2905 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->depthCompareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2906 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2907 | |
| 2908 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2909 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2910 | ParameterName("pCreateInfos[%i].pDepthStencilState->depthBoundsTestEnable", ParameterName::IndexVector{i}), |
| 2911 | pCreateInfos[i].pDepthStencilState->depthBoundsTestEnable); |
| 2912 | |
| 2913 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2914 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2915 | ParameterName("pCreateInfos[%i].pDepthStencilState->stencilTestEnable", ParameterName::IndexVector{i}), |
| 2916 | pCreateInfos[i].pDepthStencilState->stencilTestEnable); |
| 2917 | |
| 2918 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2919 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2920 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.failOp", ParameterName::IndexVector{i}), |
| 2921 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.failOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2922 | "VUID-VkStencilOpState-failOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2923 | |
| 2924 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2925 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2926 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.passOp", ParameterName::IndexVector{i}), |
| 2927 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.passOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2928 | "VUID-VkStencilOpState-passOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2929 | |
| 2930 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2931 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2932 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.depthFailOp", ParameterName::IndexVector{i}), |
| 2933 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->front.depthFailOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2934 | "VUID-VkStencilOpState-depthFailOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2935 | |
| 2936 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2937 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2938 | ParameterName("pCreateInfos[%i].pDepthStencilState->front.compareOp", ParameterName::IndexVector{i}), |
| 2939 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->front.compareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2940 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2941 | |
| 2942 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2943 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2944 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.failOp", ParameterName::IndexVector{i}), |
| 2945 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.failOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2946 | "VUID-VkStencilOpState-failOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2947 | |
| 2948 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2949 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2950 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.passOp", ParameterName::IndexVector{i}), |
| 2951 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.passOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2952 | "VUID-VkStencilOpState-passOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2953 | |
| 2954 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2955 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2956 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.depthFailOp", ParameterName::IndexVector{i}), |
| 2957 | "VkStencilOp", AllVkStencilOpEnums, pCreateInfos[i].pDepthStencilState->back.depthFailOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2958 | "VUID-VkStencilOpState-depthFailOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2959 | |
| 2960 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2961 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2962 | ParameterName("pCreateInfos[%i].pDepthStencilState->back.compareOp", ParameterName::IndexVector{i}), |
| 2963 | "VkCompareOp", AllVkCompareOpEnums, pCreateInfos[i].pDepthStencilState->back.compareOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2964 | "VUID-VkPipelineDepthStencilStateCreateInfo-depthCompareOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2965 | |
| 2966 | if (pCreateInfos[i].pDepthStencilState->sType != VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO) { |
sfricke-samsung | 81c56f7 | 2020-08-23 22:14:41 -0700 | [diff] [blame] | 2967 | skip |= LogError(device, "VUID-VkPipelineDepthStencilStateCreateInfo-sType-sType", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 2968 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%" PRIu32 |
| 2969 | "].pDepthStencilState->sType must be " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 2970 | "VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO", |
| 2971 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2972 | } |
| 2973 | } |
| 2974 | |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2975 | const VkStructureType allowed_structs_vk_pipeline_color_blend_state_create_info[] = { |
ziga-lunarg | 8de0916 | 2021-08-05 15:21:33 +0200 | [diff] [blame] | 2976 | VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT, |
| 2977 | VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT}; |
Shannon McPherson | 9b9532b | 2018-10-24 12:00:09 -0600 | [diff] [blame] | 2978 | |
Petr Kraus | e91f7a1 | 2017-12-14 20:57:36 +0100 | [diff] [blame] | 2979 | if (pCreateInfos[i].pColorBlendState != nullptr && uses_color_attachment) { |
Mark Lobodzinski | 876d5b5 | 2019-08-06 16:32:27 -0600 | [diff] [blame] | 2980 | skip |= validate_struct_type("vkCreateGraphicsPipelines", |
| 2981 | ParameterName("pCreateInfos[%i].pColorBlendState", ParameterName::IndexVector{i}), |
| 2982 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 2983 | pCreateInfos[i].pColorBlendState, |
| 2984 | VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, false, kVUIDUndefined, |
| 2985 | "VUID-VkPipelineColorBlendStateCreateInfo-sType-sType"); |
| 2986 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2987 | skip |= validate_struct_pnext( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2988 | "vkCreateGraphicsPipelines", |
Shannon McPherson | 9b9532b | 2018-10-24 12:00:09 -0600 | [diff] [blame] | 2989 | ParameterName("pCreateInfos[%i].pColorBlendState->pNext", ParameterName::IndexVector{i}), |
ziga-lunarg | 8de0916 | 2021-08-05 15:21:33 +0200 | [diff] [blame] | 2990 | "VkPipelineColorBlendAdvancedStateCreateInfoEXT, VkPipelineColorWriteCreateInfoEXT", pCreateInfos[i].pColorBlendState->pNext, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 2991 | ARRAY_SIZE(allowed_structs_vk_pipeline_color_blend_state_create_info), |
| 2992 | allowed_structs_vk_pipeline_color_blend_state_create_info, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 2993 | "VUID-VkPipelineColorBlendStateCreateInfo-pNext-pNext", |
| 2994 | "VUID-VkPipelineColorBlendStateCreateInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2995 | |
| 2996 | skip |= validate_reserved_flags( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 2997 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 2998 | ParameterName("pCreateInfos[%i].pColorBlendState->flags", ParameterName::IndexVector{i}), |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 2999 | pCreateInfos[i].pColorBlendState->flags, "VUID-VkPipelineColorBlendStateCreateInfo-flags-zerobitmask"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3000 | |
| 3001 | skip |= validate_bool32( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3002 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3003 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOpEnable", ParameterName::IndexVector{i}), |
| 3004 | pCreateInfos[i].pColorBlendState->logicOpEnable); |
| 3005 | |
| 3006 | skip |= validate_array( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3007 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3008 | ParameterName("pCreateInfos[%i].pColorBlendState->attachmentCount", ParameterName::IndexVector{i}), |
| 3009 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments", ParameterName::IndexVector{i}), |
GabrÃel Arthúr Pétursson | 092b29b | 2018-03-21 22:44:11 +0000 | [diff] [blame] | 3010 | pCreateInfos[i].pColorBlendState->attachmentCount, &pCreateInfos[i].pColorBlendState->pAttachments, false, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3011 | true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3012 | |
| 3013 | if (pCreateInfos[i].pColorBlendState->pAttachments != NULL) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3014 | for (uint32_t attachment_index = 0; attachment_index < pCreateInfos[i].pColorBlendState->attachmentCount; |
| 3015 | ++attachment_index) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3016 | skip |= validate_bool32("vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3017 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].blendEnable", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3018 | ParameterName::IndexVector{i, attachment_index}), |
| 3019 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].blendEnable); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3020 | |
| 3021 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3022 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3023 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcColorBlendFactor", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3024 | ParameterName::IndexVector{i, attachment_index}), |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3025 | "VkBlendFactor", AllVkBlendFactorEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3026 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].srcColorBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3027 | "VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3028 | |
| 3029 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3030 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3031 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstColorBlendFactor", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3032 | ParameterName::IndexVector{i, attachment_index}), |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3033 | "VkBlendFactor", AllVkBlendFactorEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3034 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].dstColorBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3035 | "VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3036 | |
| 3037 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3038 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3039 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorBlendOp", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3040 | ParameterName::IndexVector{i, attachment_index}), |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3041 | "VkBlendOp", AllVkBlendOpEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3042 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].colorBlendOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3043 | "VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3044 | |
| 3045 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3046 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3047 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].srcAlphaBlendFactor", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3048 | ParameterName::IndexVector{i, attachment_index}), |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3049 | "VkBlendFactor", AllVkBlendFactorEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3050 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].srcAlphaBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3051 | "VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3052 | |
| 3053 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3054 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3055 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].dstAlphaBlendFactor", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3056 | ParameterName::IndexVector{i, attachment_index}), |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3057 | "VkBlendFactor", AllVkBlendFactorEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3058 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].dstAlphaBlendFactor, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3059 | "VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3060 | |
| 3061 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3062 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3063 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].alphaBlendOp", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3064 | ParameterName::IndexVector{i, attachment_index}), |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3065 | "VkBlendOp", AllVkBlendOpEnums, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3066 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].alphaBlendOp, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3067 | "VUID-VkPipelineColorBlendAttachmentState-alphaBlendOp-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3068 | |
| 3069 | skip |= |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3070 | validate_flags("vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3071 | ParameterName("pCreateInfos[%i].pColorBlendState->pAttachments[%i].colorWriteMask", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3072 | ParameterName::IndexVector{i, attachment_index}), |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3073 | "VkColorComponentFlagBits", AllVkColorComponentFlagBits, |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3074 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].colorWriteMask, |
Petr Kraus | 52758be | 2019-08-12 00:53:58 +0200 | [diff] [blame] | 3075 | kOptionalFlags, "VUID-VkPipelineColorBlendAttachmentState-colorWriteMask-parameter"); |
ziga-lunarg | a283d02 | 2021-08-04 18:35:23 +0200 | [diff] [blame] | 3076 | |
| 3077 | if (phys_dev_ext_props.blend_operation_advanced_props.advancedBlendAllOperations == VK_FALSE) { |
| 3078 | bool invalid = false; |
| 3079 | switch (pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].colorBlendOp) { |
| 3080 | case VK_BLEND_OP_ZERO_EXT: |
| 3081 | case VK_BLEND_OP_SRC_EXT: |
| 3082 | case VK_BLEND_OP_DST_EXT: |
| 3083 | case VK_BLEND_OP_SRC_OVER_EXT: |
| 3084 | case VK_BLEND_OP_DST_OVER_EXT: |
| 3085 | case VK_BLEND_OP_SRC_IN_EXT: |
| 3086 | case VK_BLEND_OP_DST_IN_EXT: |
| 3087 | case VK_BLEND_OP_SRC_OUT_EXT: |
| 3088 | case VK_BLEND_OP_DST_OUT_EXT: |
| 3089 | case VK_BLEND_OP_SRC_ATOP_EXT: |
| 3090 | case VK_BLEND_OP_DST_ATOP_EXT: |
| 3091 | case VK_BLEND_OP_XOR_EXT: |
| 3092 | case VK_BLEND_OP_INVERT_EXT: |
| 3093 | case VK_BLEND_OP_INVERT_RGB_EXT: |
| 3094 | case VK_BLEND_OP_LINEARDODGE_EXT: |
| 3095 | case VK_BLEND_OP_LINEARBURN_EXT: |
| 3096 | case VK_BLEND_OP_VIVIDLIGHT_EXT: |
| 3097 | case VK_BLEND_OP_LINEARLIGHT_EXT: |
| 3098 | case VK_BLEND_OP_PINLIGHT_EXT: |
| 3099 | case VK_BLEND_OP_HARDMIX_EXT: |
| 3100 | case VK_BLEND_OP_PLUS_EXT: |
| 3101 | case VK_BLEND_OP_PLUS_CLAMPED_EXT: |
| 3102 | case VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT: |
| 3103 | case VK_BLEND_OP_PLUS_DARKER_EXT: |
| 3104 | case VK_BLEND_OP_MINUS_EXT: |
| 3105 | case VK_BLEND_OP_MINUS_CLAMPED_EXT: |
| 3106 | case VK_BLEND_OP_CONTRAST_EXT: |
| 3107 | case VK_BLEND_OP_INVERT_OVG_EXT: |
| 3108 | case VK_BLEND_OP_RED_EXT: |
| 3109 | case VK_BLEND_OP_GREEN_EXT: |
| 3110 | case VK_BLEND_OP_BLUE_EXT: |
| 3111 | invalid = true; |
| 3112 | break; |
| 3113 | default: |
| 3114 | break; |
| 3115 | } |
| 3116 | if (invalid) { |
| 3117 | skip |= LogError( |
| 3118 | device, "VUID-VkPipelineColorBlendAttachmentState-advancedBlendAllOperations-01409", |
| 3119 | "vkCreateGraphicsPipelines: pCreateInfos[%" PRIu32 |
| 3120 | "].pColorBlendState->pAttachments[%" PRIu32 |
| 3121 | "].colorBlendOp (%s) is not valid when " |
| 3122 | "VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT::advancedBlendAllOperations is " |
| 3123 | "VK_FALSE", |
| 3124 | i, attachment_index, |
| 3125 | string_VkBlendOp( |
| 3126 | pCreateInfos[i].pColorBlendState->pAttachments[attachment_index].colorBlendOp)); |
| 3127 | } |
| 3128 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3129 | } |
| 3130 | } |
| 3131 | |
| 3132 | if (pCreateInfos[i].pColorBlendState->sType != VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO) { |
sfricke-samsung | 81c56f7 | 2020-08-23 22:14:41 -0700 | [diff] [blame] | 3133 | skip |= LogError(device, "VUID-VkPipelineColorBlendStateCreateInfo-sType-sType", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3134 | "vkCreateGraphicsPipelines: parameter pCreateInfos[%" PRIu32 |
| 3135 | "].pColorBlendState->sType must be " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3136 | "VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO", |
| 3137 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3138 | } |
| 3139 | |
| 3140 | // If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value |
| 3141 | if (pCreateInfos[i].pColorBlendState->logicOpEnable == VK_TRUE) { |
| 3142 | skip |= validate_ranged_enum( |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3143 | "vkCreateGraphicsPipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3144 | ParameterName("pCreateInfos[%i].pColorBlendState->logicOp", ParameterName::IndexVector{i}), "VkLogicOp", |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3145 | AllVkLogicOpEnums, pCreateInfos[i].pColorBlendState->logicOp, |
| 3146 | "VUID-VkPipelineColorBlendStateCreateInfo-logicOpEnable-00607"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3147 | } |
| 3148 | } |
| 3149 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3150 | |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3151 | const VkPipelineCreateFlags flags = pCreateInfos[i].flags; |
| 3152 | if (flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 3153 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 3154 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3155 | skip |= |
| 3156 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-00724", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3157 | "vkCreateGraphicsPipelines parameter, pCreateInfos[%" PRIu32 |
| 3158 | "]->basePipelineHandle, must be " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3159 | "VK_NULL_HANDLE if pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag " |
sfricke-samsung | a470e0e | 2020-05-16 00:47:36 -0700 | [diff] [blame] | 3160 | "and pCreateInfos->basePipelineIndex is not -1.", |
| 3161 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3162 | } |
| 3163 | } |
| 3164 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 3165 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
| 3166 | if (pCreateInfos[i].basePipelineIndex != -1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3167 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-00725", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3168 | "vkCreateGraphicsPipelines parameter, pCreateInfos[%" PRIu32 |
| 3169 | "]->basePipelineIndex, must be -1 if " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3170 | "pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and " |
sfricke-samsung | a470e0e | 2020-05-16 00:47:36 -0700 | [diff] [blame] | 3171 | "pCreateInfos->basePipelineHandle is not VK_NULL_HANDLE.", |
| 3172 | i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3173 | } |
Mark Lobodzinski | 4dfeb94 | 2019-09-13 12:11:13 -0600 | [diff] [blame] | 3174 | } else { |
Mike Schuchardt | e5c15cf | 2020-04-06 22:57:13 -0700 | [diff] [blame] | 3175 | if (static_cast<uint32_t>(pCreateInfos[i].basePipelineIndex) >= createInfoCount) { |
sfricke-samsung | a470e0e | 2020-05-16 00:47:36 -0700 | [diff] [blame] | 3176 | skip |= |
| 3177 | LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-00723", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3178 | "vkCreateGraphicsPipelines parameter pCreateInfos[%" PRIu32 "]->basePipelineIndex (%" PRId32 |
| 3179 | ") must be a valid" |
| 3180 | "index into the pCreateInfos array, of size %" PRIu32 ".", |
sfricke-samsung | a470e0e | 2020-05-16 00:47:36 -0700 | [diff] [blame] | 3181 | i, pCreateInfos[i].basePipelineIndex, createInfoCount); |
Mark Lobodzinski | 4dfeb94 | 2019-09-13 12:11:13 -0600 | [diff] [blame] | 3182 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3183 | } |
| 3184 | } |
| 3185 | |
Petr Kraus | 9752aae | 2017-11-24 03:05:50 +0100 | [diff] [blame] | 3186 | if (pCreateInfos[i].pRasterizationState) { |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 3187 | if (!IsExtEnabled(device_extensions.vk_nv_fill_rectangle)) { |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 3188 | if (pCreateInfos[i].pRasterizationState->polygonMode == VK_POLYGON_MODE_FILL_RECTANGLE_NV) { |
| 3189 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3190 | LogError(device, "VUID-VkPipelineRasterizationStateCreateInfo-polygonMode-01414", |
| 3191 | "vkCreateGraphicsPipelines parameter, VkPolygonMode " |
| 3192 | "pCreateInfos->pRasterizationState->polygonMode cannot be VK_POLYGON_MODE_FILL_RECTANGLE_NV " |
| 3193 | "if the extension VK_NV_fill_rectangle is not enabled."); |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 3194 | } else if ((pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
| 3195 | (physical_device_features.fillModeNonSolid == false)) { |
sfricke-samsung | a44586f | 2020-08-23 22:19:44 -0700 | [diff] [blame] | 3196 | skip |= LogError(device, "VUID-VkPipelineRasterizationStateCreateInfo-polygonMode-01413", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3197 | "vkCreateGraphicsPipelines parameter, VkPolygonMode " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3198 | "pCreateInfos[%" PRIu32 |
| 3199 | "]->pRasterizationState->polygonMode cannot be VK_POLYGON_MODE_POINT or " |
sfricke-samsung | a470e0e | 2020-05-16 00:47:36 -0700 | [diff] [blame] | 3200 | "VK_POLYGON_MODE_LINE if VkPhysicalDeviceFeatures->fillModeNonSolid is false.", |
| 3201 | i); |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 3202 | } |
| 3203 | } else { |
| 3204 | if ((pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL) && |
| 3205 | (pCreateInfos[i].pRasterizationState->polygonMode != VK_POLYGON_MODE_FILL_RECTANGLE_NV) && |
| 3206 | (physical_device_features.fillModeNonSolid == false)) { |
| 3207 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3208 | LogError(device, "VUID-VkPipelineRasterizationStateCreateInfo-polygonMode-01507", |
| 3209 | "vkCreateGraphicsPipelines parameter, VkPolygonMode " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3210 | "pCreateInfos[%" PRIu32 |
| 3211 | "]->pRasterizationState->polygonMode must be VK_POLYGON_MODE_FILL or " |
sfricke-samsung | a470e0e | 2020-05-16 00:47:36 -0700 | [diff] [blame] | 3212 | "VK_POLYGON_MODE_FILL_RECTANGLE_NV if VkPhysicalDeviceFeatures->fillModeNonSolid is false.", |
| 3213 | i); |
Chris Mayer | 840b2c4 | 2019-08-22 18:12:22 +0200 | [diff] [blame] | 3214 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3215 | } |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 3216 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3217 | if (!has_dynamic_line_width && !physical_device_features.wideLines && |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 3218 | (pCreateInfos[i].pRasterizationState->lineWidth != 1.0f)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3219 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-00749", |
| 3220 | "The line width state is static (pCreateInfos[%" PRIu32 |
| 3221 | "].pDynamicState->pDynamicStates does not contain VK_DYNAMIC_STATE_LINE_WIDTH) and " |
| 3222 | "VkPhysicalDeviceFeatures::wideLines is disabled, but pCreateInfos[%" PRIu32 |
| 3223 | "].pRasterizationState->lineWidth (=%f) is not 1.0.", |
| 3224 | i, i, pCreateInfos[i].pRasterizationState->lineWidth); |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 3225 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3226 | } |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3227 | |
| 3228 | // Validate no flags not allowed are used |
| 3229 | if ((flags & VK_PIPELINE_CREATE_DISPATCH_BASE) != 0) { |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3230 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-00764", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3231 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3232 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3233 | "VK_PIPELINE_CREATE_DISPATCH_BASE.", |
| 3234 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3235 | } |
| 3236 | if ((flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR) != 0) { |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3237 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03371", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3238 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3239 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3240 | "VK_PIPELINE_CREATE_LIBRARY_BIT_KHR.", |
| 3241 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3242 | } |
| 3243 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR) != 0) { |
| 3244 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03372", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3245 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3246 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3247 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR.", |
| 3248 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3249 | } |
| 3250 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR) != 0) { |
| 3251 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03373", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3252 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3253 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3254 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR.", |
| 3255 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3256 | } |
| 3257 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR) != 0) { |
| 3258 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03374", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3259 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3260 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3261 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR.", |
| 3262 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3263 | } |
| 3264 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR) != 0) { |
| 3265 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03375", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3266 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3267 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3268 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR.", |
| 3269 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3270 | } |
| 3271 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR) != 0) { |
| 3272 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03376", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3273 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3274 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3275 | "VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR.", |
| 3276 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3277 | } |
| 3278 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR) != 0) { |
| 3279 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03377", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3280 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3281 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3282 | "VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR.", |
| 3283 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3284 | } |
| 3285 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR) != 0) { |
| 3286 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-03577", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3287 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3288 | "]->flags (0x%x) must not include " |
sfricke-samsung | ad00890 | 2021-04-16 01:25:34 -0700 | [diff] [blame] | 3289 | "VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR.", |
| 3290 | i, flags); |
sfricke-samsung | 5ea45bd | 2021-01-23 02:38:36 -0800 | [diff] [blame] | 3291 | } |
ziga-lunarg | 4bd42e4 | 2021-10-04 13:19:29 +0200 | [diff] [blame] | 3292 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV) != 0) { |
| 3293 | skip |= LogError(device, "VUID-VkGraphicsPipelineCreateInfo-flags-04947", |
| 3294 | "vkCreateGraphicsPipelines(): pCreateInfos[%" PRIu32 |
| 3295 | "]->flags (0x%x) must not include " |
| 3296 | "VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV.", |
| 3297 | i, flags); |
| 3298 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3299 | } |
| 3300 | } |
| 3301 | |
| 3302 | return skip; |
| 3303 | } |
| 3304 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3305 | bool StatelessValidation::manual_PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, |
| 3306 | uint32_t createInfoCount, |
| 3307 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 3308 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3309 | VkPipeline *pPipelines) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3310 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3311 | for (uint32_t i = 0; i < createInfoCount; i++) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3312 | skip |= validate_string("vkCreateComputePipelines", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3313 | ParameterName("pCreateInfos[%i].stage.pName", ParameterName::IndexVector{i}), |
Mark Lobodzinski | ebee355 | 2018-05-29 09:55:54 -0600 | [diff] [blame] | 3314 | "VUID-VkPipelineShaderStageCreateInfo-pName-parameter", pCreateInfos[i].stage.pName); |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3315 | auto feedback_struct = LvlFindInChain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 3316 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != 1)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3317 | skip |= |
| 3318 | LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02669", |
| 3319 | "vkCreateComputePipelines(): in pCreateInfo[%" PRIu32 |
| 3320 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount must equal 1, found %" PRIu32 ".", |
| 3321 | i, feedback_struct->pipelineStageCreationFeedbackCount); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 3322 | } |
sfricke-samsung | c522715 | 2020-02-09 17:36:31 -0800 | [diff] [blame] | 3323 | |
| 3324 | // Make sure compute stage is selected |
| 3325 | if (pCreateInfos[i].stage.stage != VK_SHADER_STAGE_COMPUTE_BIT) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3326 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-stage-00701", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3327 | "vkCreateComputePipelines(): the pCreateInfo[%" PRIu32 |
| 3328 | "].stage.stage (%s) is not VK_SHADER_STAGE_COMPUTE_BIT", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3329 | i, string_VkShaderStageFlagBits(pCreateInfos[i].stage.stage)); |
sfricke-samsung | c522715 | 2020-02-09 17:36:31 -0800 | [diff] [blame] | 3330 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 3331 | |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3332 | const VkPipelineCreateFlags flags = pCreateInfos[i].flags; |
| 3333 | // Validate no flags not allowed are used |
| 3334 | if ((flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR) != 0) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3335 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03364", |
| 3336 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3337 | "]->flags (0x%x) must not include VK_PIPELINE_CREATE_LIBRARY_BIT_KHR.", |
| 3338 | i, flags); |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3339 | } |
| 3340 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR) != 0) { |
| 3341 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03365", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3342 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3343 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3344 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR.", |
| 3345 | i, flags); |
| 3346 | } |
| 3347 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR) != 0) { |
| 3348 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03366", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3349 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3350 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3351 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR.", |
| 3352 | i, flags); |
| 3353 | } |
| 3354 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR) != 0) { |
| 3355 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03367", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3356 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3357 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3358 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR.", |
| 3359 | i, flags); |
| 3360 | } |
| 3361 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR) != 0) { |
| 3362 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03368", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3363 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3364 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3365 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR.", |
| 3366 | i, flags); |
| 3367 | } |
| 3368 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR) != 0) { |
| 3369 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03369", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3370 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3371 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3372 | "VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR.", |
| 3373 | i, flags); |
| 3374 | } |
| 3375 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR) != 0) { |
| 3376 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03370", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3377 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3378 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3379 | "VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR.", |
| 3380 | i, flags); |
| 3381 | } |
| 3382 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR) != 0) { |
| 3383 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-03576", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3384 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3385 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3386 | "VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR.", |
| 3387 | i, flags); |
| 3388 | } |
ziga-lunarg | f51e65f | 2021-07-18 23:51:57 +0200 | [diff] [blame] | 3389 | if ((flags & VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV) != 0) { |
| 3390 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-04945", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3391 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3392 | "]->flags (0x%x) must not include " |
ziga-lunarg | f51e65f | 2021-07-18 23:51:57 +0200 | [diff] [blame] | 3393 | "VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV.", |
| 3394 | i, flags); |
| 3395 | } |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3396 | if ((flags & VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV) != 0) { |
| 3397 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-02874", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3398 | "vkCreateComputePipelines(): pCreateInfos[%" PRIu32 |
| 3399 | "]->flags (0x%x) must not include " |
sfricke-samsung | eb54901 | 2021-04-16 01:25:51 -0700 | [diff] [blame] | 3400 | "VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV.", |
| 3401 | i, flags); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 3402 | } |
ziga-lunarg | 065f240 | 2021-07-22 11:56:05 +0200 | [diff] [blame] | 3403 | if (flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 3404 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 3405 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
| 3406 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-00699", |
| 3407 | "vkCreateComputePipelines parameter, pCreateInfos[%" PRIu32 |
| 3408 | "]->basePipelineHandle, must be VK_NULL_HANDLE if pCreateInfos->flags contains the " |
| 3409 | "VK_PIPELINE_CREATE_DERIVATIVE_BIT flag and pCreateInfos->basePipelineIndex is not -1.", |
| 3410 | i); |
| 3411 | } |
| 3412 | } |
| 3413 | |
| 3414 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
| 3415 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 3416 | skip |= LogError( |
| 3417 | device, "VUID-VkComputePipelineCreateInfo-flags-00700", |
| 3418 | "vkCreateComputePipelines parameter, pCreateInfos[%" PRIu32 |
| 3419 | "]->basePipelineIndex, must be -1 if pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT " |
| 3420 | "flag and pCreateInfos->basePipelineHandle is not VK_NULL_HANDLE.", |
| 3421 | i); |
| 3422 | } |
| 3423 | } else { |
| 3424 | if (static_cast<uint32_t>(pCreateInfos[i].basePipelineIndex) >= createInfoCount) { |
| 3425 | skip |= LogError(device, "VUID-VkComputePipelineCreateInfo-flags-00698", |
| 3426 | "vkCreateComputePipelines parameter pCreateInfos[%" PRIu32 "]->basePipelineIndex (%" PRIi32 |
| 3427 | ") must be a valid index into the pCreateInfos array, of size %" PRIu32 ".", |
| 3428 | i, pCreateInfos[i].basePipelineIndex, createInfoCount); |
| 3429 | } |
| 3430 | } |
| 3431 | } |
ziga-lunarg | c634137 | 2021-07-28 12:57:42 +0200 | [diff] [blame] | 3432 | |
| 3433 | std::stringstream msg; |
| 3434 | msg << "pCreateInfos[%" << i << "].stage"; |
| 3435 | ValidatePipelineShaderStageCreateInfo("vkCreateComputePipelines", msg.str().c_str(), &pCreateInfos[i].stage); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3436 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3437 | return skip; |
| 3438 | } |
| 3439 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3440 | bool StatelessValidation::manual_PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3441 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3442 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3443 | |
| 3444 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3445 | const auto &features = physical_device_features; |
| 3446 | const auto &limits = device_limits; |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3447 | |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 3448 | if (pCreateInfo->anisotropyEnable == VK_TRUE) { |
| 3449 | if (!in_inclusive_range(pCreateInfo->maxAnisotropy, 1.0F, limits.maxSamplerAnisotropy)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3450 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-anisotropyEnable-01071", |
| 3451 | "vkCreateSampler(): value of %s must be in range [1.0, %f] %s, but %f found.", |
| 3452 | "pCreateInfo->maxAnisotropy", limits.maxSamplerAnisotropy, |
| 3453 | "VkPhysicalDeviceLimits::maxSamplerAnistropy", pCreateInfo->maxAnisotropy); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 3454 | } |
| 3455 | |
| 3456 | // Anistropy cannot be enabled in sampler unless enabled as a feature |
| 3457 | if (features.samplerAnisotropy == VK_FALSE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3458 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-anisotropyEnable-01070", |
| 3459 | "vkCreateSampler(): Anisotropic sampling feature is not enabled, %s must be VK_FALSE.", |
| 3460 | "pCreateInfo->anisotropyEnable"); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 3461 | } |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3462 | } |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 3463 | |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3464 | if (pCreateInfo->unnormalizedCoordinates == VK_TRUE) { |
| 3465 | if (pCreateInfo->minFilter != pCreateInfo->magFilter) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3466 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01072", |
| 3467 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 3468 | "pCreateInfo->minFilter (%s) and pCreateInfo->magFilter (%s) must be equal.", |
| 3469 | string_VkFilter(pCreateInfo->minFilter), string_VkFilter(pCreateInfo->magFilter)); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3470 | } |
| 3471 | if (pCreateInfo->mipmapMode != VK_SAMPLER_MIPMAP_MODE_NEAREST) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3472 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01073", |
| 3473 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 3474 | "pCreateInfo->mipmapMode (%s) must be VK_SAMPLER_MIPMAP_MODE_NEAREST.", |
| 3475 | string_VkSamplerMipmapMode(pCreateInfo->mipmapMode)); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3476 | } |
| 3477 | if (pCreateInfo->minLod != 0.0f || pCreateInfo->maxLod != 0.0f) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3478 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01074", |
| 3479 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 3480 | "pCreateInfo->minLod (%f) and pCreateInfo->maxLod (%f) must both be zero.", |
| 3481 | pCreateInfo->minLod, pCreateInfo->maxLod); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3482 | } |
| 3483 | if ((pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE && |
| 3484 | pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3485 | (pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE && |
| 3486 | pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3487 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01075", |
| 3488 | "vkCreateSampler(): when pCreateInfo->unnormalizedCoordinates is VK_TRUE, " |
| 3489 | "pCreateInfo->addressModeU (%s) and pCreateInfo->addressModeV (%s) must both be " |
| 3490 | "VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER.", |
| 3491 | string_VkSamplerAddressMode(pCreateInfo->addressModeU), |
| 3492 | string_VkSamplerAddressMode(pCreateInfo->addressModeV)); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3493 | } |
| 3494 | if (pCreateInfo->anisotropyEnable == VK_TRUE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3495 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01076", |
| 3496 | "vkCreateSampler(): pCreateInfo->anisotropyEnable and pCreateInfo->unnormalizedCoordinates must " |
| 3497 | "not both be VK_TRUE."); |
John Zulauf | 7196850 | 2017-10-26 13:51:15 -0600 | [diff] [blame] | 3498 | } |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3499 | if (pCreateInfo->compareEnable == VK_TRUE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3500 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01077", |
| 3501 | "vkCreateSampler(): pCreateInfo->compareEnable and pCreateInfo->unnormalizedCoordinates must " |
| 3502 | "not both be VK_TRUE."); |
Jesse Hall | cc1fbef | 2018-06-03 15:58:56 -0700 | [diff] [blame] | 3503 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3504 | } |
| 3505 | |
| 3506 | // If compareEnable is VK_TRUE, compareOp must be a valid VkCompareOp value |
| 3507 | if (pCreateInfo->compareEnable == VK_TRUE) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3508 | skip |= validate_ranged_enum("vkCreateSampler", "pCreateInfo->compareOp", "VkCompareOp", AllVkCompareOpEnums, |
| 3509 | pCreateInfo->compareOp, "VUID-VkSamplerCreateInfo-compareEnable-01080"); |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3510 | const auto *sampler_reduction = LvlFindInChain<VkSamplerReductionModeCreateInfo>(pCreateInfo->pNext); |
sfricke-samsung | 85252fb | 2020-05-08 20:44:06 -0700 | [diff] [blame] | 3511 | if (sampler_reduction != nullptr) { |
| 3512 | if (sampler_reduction->reductionMode != VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE) { |
| 3513 | skip |= LogError( |
| 3514 | device, "VUID-VkSamplerCreateInfo-compareEnable-01423", |
| 3515 | "copmareEnable is true so the sampler reduction mode must be VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE."); |
| 3516 | } |
| 3517 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3518 | } |
| 3519 | |
| 3520 | // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, borderColor must be a |
| 3521 | // valid VkBorderColor value |
| 3522 | if ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3523 | (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER) || |
| 3524 | (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3525 | skip |= validate_ranged_enum("vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor", AllVkBorderColorEnums, |
| 3526 | pCreateInfo->borderColor, "VUID-VkSamplerCreateInfo-addressModeU-01078"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3527 | } |
| 3528 | |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 3529 | // Checks for the IMG cubic filtering extension |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 3530 | if (IsExtEnabled(device_extensions.vk_img_filter_cubic)) { |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 3531 | if ((pCreateInfo->anisotropyEnable == VK_TRUE) && |
| 3532 | ((pCreateInfo->minFilter == VK_FILTER_CUBIC_IMG) || (pCreateInfo->magFilter == VK_FILTER_CUBIC_IMG))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3533 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-magFilter-01081", |
| 3534 | "vkCreateSampler(): Anisotropic sampling must not be VK_TRUE when either minFilter or magFilter " |
| 3535 | "are VK_FILTER_CUBIC_IMG."); |
John Zulauf | 275805c | 2017-10-26 15:34:49 -0600 | [diff] [blame] | 3536 | } |
| 3537 | } |
Mark Lobodzinski | 61992fc | 2020-01-14 14:00:08 -0700 | [diff] [blame] | 3538 | |
sfricke-samsung | d91da4a | 2020-02-09 17:19:04 -0800 | [diff] [blame] | 3539 | // Check for valid Lod range |
| 3540 | if (pCreateInfo->minLod > pCreateInfo->maxLod) { |
Mark Lobodzinski | 728ab48 | 2020-02-12 13:46:47 -0700 | [diff] [blame] | 3541 | skip |= |
| 3542 | LogError(device, "VUID-VkSamplerCreateInfo-maxLod-01973", |
| 3543 | "vkCreateSampler(): minLod (%f) is greater than maxLod (%f)", pCreateInfo->minLod, pCreateInfo->maxLod); |
sfricke-samsung | d91da4a | 2020-02-09 17:19:04 -0800 | [diff] [blame] | 3544 | } |
| 3545 | |
| 3546 | // Check mipLodBias to device limit |
| 3547 | if (pCreateInfo->mipLodBias > limits.maxSamplerLodBias) { |
Mark Lobodzinski | 728ab48 | 2020-02-12 13:46:47 -0700 | [diff] [blame] | 3548 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-mipLodBias-01069", |
| 3549 | "vkCreateSampler(): mipLodBias (%f) is greater than VkPhysicalDeviceLimits::maxSamplerLodBias (%f)", |
| 3550 | pCreateInfo->mipLodBias, limits.maxSamplerLodBias); |
sfricke-samsung | d91da4a | 2020-02-09 17:19:04 -0800 | [diff] [blame] | 3551 | } |
| 3552 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3553 | const auto *sampler_conversion = LvlFindInChain<VkSamplerYcbcrConversionInfo>(pCreateInfo->pNext); |
Mark Lobodzinski | 61992fc | 2020-01-14 14:00:08 -0700 | [diff] [blame] | 3554 | if (sampler_conversion != nullptr) { |
| 3555 | if ((pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) || |
| 3556 | (pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) || |
| 3557 | (pCreateInfo->addressModeW != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) || |
| 3558 | (pCreateInfo->anisotropyEnable != VK_FALSE) || (pCreateInfo->unnormalizedCoordinates != VK_FALSE)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3559 | skip |= LogError( |
Mark Lobodzinski | 728ab48 | 2020-02-12 13:46:47 -0700 | [diff] [blame] | 3560 | device, "VUID-VkSamplerCreateInfo-addressModeU-01646", |
Mark Lobodzinski | 61992fc | 2020-01-14 14:00:08 -0700 | [diff] [blame] | 3561 | "vkCreateSampler(): SamplerYCbCrConversion is enabled: " |
| 3562 | "addressModeU (%s), addressModeV (%s), addressModeW (%s) must be CLAMP_TO_EDGE, and anisotropyEnable (%s) " |
| 3563 | "and unnormalizedCoordinates (%s) must be VK_FALSE.", |
| 3564 | string_VkSamplerAddressMode(pCreateInfo->addressModeU), string_VkSamplerAddressMode(pCreateInfo->addressModeV), |
| 3565 | string_VkSamplerAddressMode(pCreateInfo->addressModeW), pCreateInfo->anisotropyEnable ? "VK_TRUE" : "VK_FALSE", |
| 3566 | pCreateInfo->unnormalizedCoordinates ? "VK_TRUE" : "VK_FALSE"); |
| 3567 | } |
| 3568 | } |
janharaldfredriksen-arm | 3b79377 | 2020-05-12 18:55:53 +0200 | [diff] [blame] | 3569 | |
| 3570 | if (pCreateInfo->flags & VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT) { |
| 3571 | if (pCreateInfo->minFilter != pCreateInfo->magFilter) { |
| 3572 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-flags-02574", |
| 3573 | "vkCreateSampler(): when flags includes VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, " |
| 3574 | "pCreateInfo->minFilter (%s) and pCreateInfo->magFilter (%s) must be equal.", |
| 3575 | string_VkFilter(pCreateInfo->minFilter), string_VkFilter(pCreateInfo->magFilter)); |
| 3576 | } |
| 3577 | if (pCreateInfo->mipmapMode != VK_SAMPLER_MIPMAP_MODE_NEAREST) { |
| 3578 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-flags-02575", |
| 3579 | "vkCreateSampler(): when flags includes VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, " |
| 3580 | "pCreateInfo->mipmapMode (%s) must be VK_SAMPLER_MIPMAP_MODE_NEAREST.", |
| 3581 | string_VkSamplerMipmapMode(pCreateInfo->mipmapMode)); |
| 3582 | } |
| 3583 | if (pCreateInfo->minLod != 0.0 || pCreateInfo->maxLod != 0.0) { |
| 3584 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-flags-02576", |
| 3585 | "vkCreateSampler(): when flags includes VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, " |
| 3586 | "pCreateInfo->minLod (%f) and pCreateInfo->maxLod (%f) must be zero.", |
| 3587 | pCreateInfo->minLod, pCreateInfo->maxLod); |
| 3588 | } |
| 3589 | if (((pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) && |
| 3590 | (pCreateInfo->addressModeU != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER)) || |
| 3591 | ((pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) && |
| 3592 | (pCreateInfo->addressModeV != VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER))) { |
| 3593 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-flags-02577", |
| 3594 | "vkCreateSampler(): when flags includes VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, " |
| 3595 | "pCreateInfo->addressModeU (%s) and pCreateInfo->addressModeV (%s) must be " |
| 3596 | "VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE or VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER", |
| 3597 | string_VkSamplerAddressMode(pCreateInfo->addressModeU), |
| 3598 | string_VkSamplerAddressMode(pCreateInfo->addressModeV)); |
| 3599 | } |
| 3600 | if (pCreateInfo->anisotropyEnable) { |
| 3601 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-flags-02578", |
| 3602 | "vkCreateSampler(): when flags includes VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, " |
| 3603 | "pCreateInfo->anisotropyEnable must be VK_FALSE"); |
| 3604 | } |
| 3605 | if (pCreateInfo->compareEnable) { |
| 3606 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-flags-02579", |
| 3607 | "vkCreateSampler(): when flags includes VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, " |
| 3608 | "pCreateInfo->compareEnable must be VK_FALSE"); |
| 3609 | } |
| 3610 | if (pCreateInfo->unnormalizedCoordinates) { |
| 3611 | skip |= LogError(device, "VUID-VkSamplerCreateInfo-flags-02580", |
| 3612 | "vkCreateSampler(): when flags includes VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT, " |
| 3613 | "pCreateInfo->unnormalizedCoordinates must be VK_FALSE"); |
| 3614 | } |
| 3615 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3616 | } |
| 3617 | |
Tony-LunarG | 7337b31 | 2020-04-15 16:40:25 -0600 | [diff] [blame] | 3618 | if (pCreateInfo->borderColor == VK_BORDER_COLOR_INT_CUSTOM_EXT || |
| 3619 | pCreateInfo->borderColor == VK_BORDER_COLOR_FLOAT_CUSTOM_EXT) { |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 3620 | if (!IsExtEnabled(device_extensions.vk_ext_custom_border_color)) { |
Tony-LunarG | 7337b31 | 2020-04-15 16:40:25 -0600 | [diff] [blame] | 3621 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 3622 | "VkSamplerCreateInfo->borderColor is %s but %s is not enabled.\n", |
| 3623 | string_VkBorderColor(pCreateInfo->borderColor), VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME); |
| 3624 | } |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3625 | auto custom_create_info = LvlFindInChain<VkSamplerCustomBorderColorCreateInfoEXT>(pCreateInfo->pNext); |
Tony-LunarG | 7337b31 | 2020-04-15 16:40:25 -0600 | [diff] [blame] | 3626 | if (!custom_create_info) { |
| 3627 | skip |= |
| 3628 | LogError(device, "VUID-VkSamplerCreateInfo-borderColor-04011", |
| 3629 | "VkSamplerCreateInfo->borderColor is set to %s but there is no VkSamplerCustomBorderColorCreateInfoEXT " |
| 3630 | "struct in pNext chain.\n", |
| 3631 | string_VkBorderColor(pCreateInfo->borderColor)); |
| 3632 | } else { |
| 3633 | if ((custom_create_info->format != VK_FORMAT_UNDEFINED) && |
| 3634 | ((pCreateInfo->borderColor == VK_BORDER_COLOR_INT_CUSTOM_EXT && !FormatIsSampledInt(custom_create_info->format)) || |
| 3635 | (pCreateInfo->borderColor == VK_BORDER_COLOR_FLOAT_CUSTOM_EXT && |
| 3636 | !FormatIsSampledFloat(custom_create_info->format)))) { |
| 3637 | skip |= LogError(device, "VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04013", |
| 3638 | "VkSamplerCreateInfo->borderColor is %s but VkSamplerCustomBorderColorCreateInfoEXT.format = %s " |
| 3639 | "whose type does not match\n", |
| 3640 | string_VkBorderColor(pCreateInfo->borderColor), string_VkFormat(custom_create_info->format)); |
| 3641 | ; |
| 3642 | } |
| 3643 | } |
| 3644 | } |
| 3645 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3646 | return skip; |
| 3647 | } |
| 3648 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3649 | bool StatelessValidation::manual_PreCallValidateCreateDescriptorSetLayout(VkDevice device, |
| 3650 | const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 3651 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3652 | VkDescriptorSetLayout *pSetLayout) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3653 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3654 | |
| 3655 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3656 | if ((pCreateInfo != nullptr) && (pCreateInfo->pBindings != nullptr)) { |
| 3657 | for (uint32_t i = 0; i < pCreateInfo->bindingCount; ++i) { |
| 3658 | if (pCreateInfo->pBindings[i].descriptorCount != 0) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3659 | if (((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3660 | (pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)) && |
| 3661 | (pCreateInfo->pBindings[i].pImmutableSamplers != nullptr)) { |
| 3662 | for (uint32_t descriptor_index = 0; descriptor_index < pCreateInfo->pBindings[i].descriptorCount; |
| 3663 | ++descriptor_index) { |
| 3664 | if (pCreateInfo->pBindings[i].pImmutableSamplers[descriptor_index] == VK_NULL_HANDLE) { |
Spencer Fricke | b0e3082 | 2020-03-23 10:32:30 -0700 | [diff] [blame] | 3665 | skip |= LogError(device, "VUID-VkDescriptorSetLayoutBinding-descriptorType-00282", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3666 | "vkCreateDescriptorSetLayout: required parameter " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3667 | "pCreateInfo->pBindings[%" PRIu32 "].pImmutableSamplers[%" PRIu32 |
| 3668 | "] specified as VK_NULL_HANDLE", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3669 | i, descriptor_index); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3670 | } |
| 3671 | } |
| 3672 | } |
| 3673 | |
| 3674 | // If descriptorCount is not 0, stageFlags must be a valid combination of VkShaderStageFlagBits values |
| 3675 | if ((pCreateInfo->pBindings[i].stageFlags != 0) && |
| 3676 | ((pCreateInfo->pBindings[i].stageFlags & (~AllVkShaderStageFlagBits)) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3677 | skip |= LogError(device, "VUID-VkDescriptorSetLayoutBinding-descriptorCount-00283", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3678 | "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%" PRIu32 |
| 3679 | "].descriptorCount is not 0, " |
| 3680 | "pCreateInfo->pBindings[%" PRIu32 |
| 3681 | "].stageFlags must be a valid combination of VkShaderStageFlagBits " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3682 | "values.", |
| 3683 | i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3684 | } |
Spencer Fricke | 84d0cc0 | 2020-03-16 17:21:59 -0700 | [diff] [blame] | 3685 | |
| 3686 | if ((pCreateInfo->pBindings[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT) && |
| 3687 | (pCreateInfo->pBindings[i].stageFlags != 0) && |
| 3688 | (pCreateInfo->pBindings[i].stageFlags != VK_SHADER_STAGE_FRAGMENT_BIT)) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3689 | skip |= LogError(device, "VUID-VkDescriptorSetLayoutBinding-descriptorType-01510", |
| 3690 | "vkCreateDescriptorSetLayout(): if pCreateInfo->pBindings[%" PRIu32 |
| 3691 | "].descriptorCount is not 0 and " |
| 3692 | "descriptorType is VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT then pCreateInfo->pBindings[%" PRIu32 |
| 3693 | "].stageFlags " |
| 3694 | "must be 0 or VK_SHADER_STAGE_FRAGMENT_BIT but is currently %s", |
| 3695 | i, i, string_VkShaderStageFlags(pCreateInfo->pBindings[i].stageFlags).c_str()); |
Spencer Fricke | 84d0cc0 | 2020-03-16 17:21:59 -0700 | [diff] [blame] | 3696 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3697 | } |
| 3698 | } |
| 3699 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3700 | return skip; |
| 3701 | } |
| 3702 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3703 | bool StatelessValidation::manual_PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, |
| 3704 | uint32_t descriptorSetCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3705 | const VkDescriptorSet *pDescriptorSets) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3706 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3707 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3708 | // validate_array() |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3709 | return validate_array("vkFreeDescriptorSets", "descriptorSetCount", "pDescriptorSets", descriptorSetCount, &pDescriptorSets, |
| 3710 | true, true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3711 | } |
| 3712 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 3713 | bool StatelessValidation::validate_WriteDescriptorSet(const char *vkCallingFunction, const uint32_t descriptorWriteCount, |
| 3714 | const VkWriteDescriptorSet *pDescriptorWrites, |
| 3715 | const bool validateDstSet) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3716 | bool skip = false; |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 3717 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3718 | if (pDescriptorWrites != NULL) { |
| 3719 | for (uint32_t i = 0; i < descriptorWriteCount; ++i) { |
| 3720 | // descriptorCount must be greater than 0 |
| 3721 | if (pDescriptorWrites[i].descriptorCount == 0) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3722 | skip |= LogError(device, "VUID-VkWriteDescriptorSet-descriptorCount-arraylength", |
| 3723 | "%s(): parameter pDescriptorWrites[%" PRIu32 "].descriptorCount must be greater than 0.", |
| 3724 | vkCallingFunction, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3725 | } |
| 3726 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 3727 | // If called from vkCmdPushDescriptorSetKHR, the dstSet member is ignored. |
| 3728 | if (validateDstSet) { |
| 3729 | // dstSet must be a valid VkDescriptorSet handle |
| 3730 | skip |= validate_required_handle(vkCallingFunction, |
| 3731 | ParameterName("pDescriptorWrites[%i].dstSet", ParameterName::IndexVector{i}), |
| 3732 | pDescriptorWrites[i].dstSet); |
| 3733 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3734 | |
| 3735 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 3736 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 3737 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 3738 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
| 3739 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 3740 | // If descriptorType is VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, |
| 3741 | // VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3742 | // pImageInfo must be a pointer to an array of descriptorCount valid VkDescriptorImageInfo structures. |
| 3743 | // Valid imageView handles are checked in ObjectLifetimes::ValidateDescriptorWrite. |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3744 | if (pDescriptorWrites[i].pImageInfo == nullptr) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3745 | skip |= |
| 3746 | LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00322", |
| 3747 | "%s(): if pDescriptorWrites[%" PRIu32 |
| 3748 | "].descriptorType is " |
| 3749 | "VK_DESCRIPTOR_TYPE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, " |
| 3750 | "VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or " |
| 3751 | "VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, pDescriptorWrites[%" PRIu32 "].pImageInfo must not be NULL.", |
| 3752 | vkCallingFunction, i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3753 | } else if (pDescriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER) { |
| 3754 | // If descriptorType is VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3755 | // VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the imageLayout |
| 3756 | // member of any given element of pImageInfo must be a valid VkImageLayout |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3757 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3758 | ++descriptor_index) { |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 3759 | skip |= validate_ranged_enum(vkCallingFunction, |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3760 | ParameterName("pDescriptorWrites[%i].pImageInfo[%i].imageLayout", |
| 3761 | ParameterName::IndexVector{i, descriptor_index}), |
| 3762 | "VkImageLayout", AllVkImageLayoutEnums, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 3763 | pDescriptorWrites[i].pImageInfo[descriptor_index].imageLayout, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3764 | } |
| 3765 | } |
| 3766 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3767 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3768 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 3769 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 3770 | // If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, |
| 3771 | // VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, pBufferInfo must be a |
| 3772 | // pointer to an array of descriptorCount valid VkDescriptorBufferInfo structures |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3773 | // Valid buffer handles are checked in ObjectLifetimes::ValidateDescriptorWrite. |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3774 | if (pDescriptorWrites[i].pBufferInfo == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3775 | skip |= LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00324", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3776 | "%s(): if pDescriptorWrites[%" PRIu32 |
| 3777 | "].descriptorType is " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3778 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, " |
| 3779 | "VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3780 | "pDescriptorWrites[%" PRIu32 "].pBufferInfo must not be NULL.", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3781 | vkCallingFunction, i, i); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3782 | } else { |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3783 | const auto *robustness2_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3784 | LvlFindInChain<VkPhysicalDeviceRobustness2FeaturesEXT>(device_createinfo_pnext); |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3785 | if (robustness2_features && robustness2_features->nullDescriptor) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3786 | for (uint32_t descriptor_index = 0; descriptor_index < pDescriptorWrites[i].descriptorCount; |
| 3787 | ++descriptor_index) { |
| 3788 | if (pDescriptorWrites[i].pBufferInfo[descriptor_index].buffer == VK_NULL_HANDLE && |
| 3789 | (pDescriptorWrites[i].pBufferInfo[descriptor_index].offset != 0 || |
| 3790 | pDescriptorWrites[i].pBufferInfo[descriptor_index].range != VK_WHOLE_SIZE)) { |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3791 | skip |= LogError(device, "VUID-VkDescriptorBufferInfo-buffer-02999", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3792 | "%s(): if pDescriptorWrites[%" PRIu32 |
| 3793 | "].buffer is VK_NULL_HANDLE, " |
baldurk | 751594b | 2020-09-09 09:41:02 +0100 | [diff] [blame] | 3794 | "offset (%" PRIu64 ") must be zero and range (%" PRIu64 ") must be VK_WHOLE_SIZE.", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3795 | vkCallingFunction, i, pDescriptorWrites[i].pBufferInfo[descriptor_index].offset, |
| 3796 | pDescriptorWrites[i].pBufferInfo[descriptor_index].range); |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3797 | } |
| 3798 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3799 | } |
| 3800 | } |
| 3801 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 3802 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 3803 | // Valid bufferView handles are checked in ObjectLifetimes::ValidateDescriptorWrite. |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3804 | } |
| 3805 | |
| 3806 | if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 3807 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3808 | VkDeviceSize uniform_alignment = device_limits.minUniformBufferOffsetAlignment; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3809 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3810 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3811 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniform_alignment) != 0) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 3812 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3813 | LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00327", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3814 | "%s(): pDescriptorWrites[%" PRIu32 "].pBufferInfo[%" PRIu32 "].offset (0x%" PRIxLEAST64 |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3815 | ") must be a multiple of device limit minUniformBufferOffsetAlignment 0x%" PRIxLEAST64 ".", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3816 | vkCallingFunction, i, j, pDescriptorWrites[i].pBufferInfo[j].offset, uniform_alignment); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3817 | } |
| 3818 | } |
| 3819 | } |
| 3820 | } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 3821 | (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3822 | VkDeviceSize storage_alignment = device_limits.minStorageBufferOffsetAlignment; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3823 | for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { |
| 3824 | if (pDescriptorWrites[i].pBufferInfo != NULL) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3825 | if (SafeModulo(pDescriptorWrites[i].pBufferInfo[j].offset, storage_alignment) != 0) { |
Mark Lobodzinski | 8852949 | 2018-04-01 10:38:15 -0600 | [diff] [blame] | 3826 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3827 | LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-00328", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3828 | "%s(): pDescriptorWrites[%" PRIu32 "].pBufferInfo[%" PRIu32 "].offset (0x%" PRIxLEAST64 |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3829 | ") must be a multiple of device limit minStorageBufferOffsetAlignment 0x%" PRIxLEAST64 ".", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 3830 | vkCallingFunction, i, j, pDescriptorWrites[i].pBufferInfo[j].offset, storage_alignment); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3831 | } |
| 3832 | } |
| 3833 | } |
| 3834 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 3835 | // pNext chain must be either NULL or a pointer to a valid instance of VkWriteDescriptorSetAccelerationStructureKHR |
| 3836 | // or VkWriteDescriptorSetInlineUniformBlockEX |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3837 | if (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3838 | const auto *pnext_struct = LvlFindInChain<VkWriteDescriptorSetAccelerationStructureKHR>(pDescriptorWrites[i].pNext); |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3839 | if (!pnext_struct || (pnext_struct->accelerationStructureCount != pDescriptorWrites[i].descriptorCount)) { |
| 3840 | skip |= LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-02382", |
| 3841 | "%s(): If descriptorType is VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, the pNext" |
| 3842 | "chain must include a VkWriteDescriptorSetAccelerationStructureKHR structure whose " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3843 | "accelerationStructureCount %" PRIu32 " member equals descriptorCount %" PRIu32 ".", |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3844 | vkCallingFunction, pnext_struct ? pnext_struct->accelerationStructureCount : -1, |
| 3845 | pDescriptorWrites[i].descriptorCount); |
| 3846 | } |
| 3847 | // further checks only if we have right structtype |
| 3848 | if (pnext_struct) { |
| 3849 | if (pnext_struct->accelerationStructureCount != pDescriptorWrites[i].descriptorCount) { |
| 3850 | skip |= LogError( |
| 3851 | device, "VUID-VkWriteDescriptorSetAccelerationStructureKHR-accelerationStructureCount-02236", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3852 | "%s(): accelerationStructureCount %" PRIu32 " must be equal to descriptorCount %" PRIu32 |
| 3853 | " in the extended structure " |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3854 | ".", |
| 3855 | vkCallingFunction, pnext_struct->accelerationStructureCount, pDescriptorWrites[i].descriptorCount); |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 3856 | } |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3857 | if (pnext_struct->accelerationStructureCount == 0) { |
| 3858 | skip |= LogError(device, |
| 3859 | "VUID-VkWriteDescriptorSetAccelerationStructureKHR-accelerationStructureCount-arraylength", |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 3860 | "%s(): accelerationStructureCount must be greater than 0 .", vkCallingFunction); |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3861 | } |
| 3862 | const auto *robustness2_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3863 | LvlFindInChain<VkPhysicalDeviceRobustness2FeaturesEXT>(device_createinfo_pnext); |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3864 | if (robustness2_features && robustness2_features->nullDescriptor == VK_FALSE) { |
| 3865 | for (uint32_t j = 0; j < pnext_struct->accelerationStructureCount; ++j) { |
| 3866 | if (pnext_struct->pAccelerationStructures[j] == VK_NULL_HANDLE) { |
| 3867 | skip |= LogError(device, |
| 3868 | "VUID-VkWriteDescriptorSetAccelerationStructureKHR-pAccelerationStructures-03580", |
| 3869 | "%s(): If the nullDescriptor feature is not enabled, each member of " |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 3870 | "pAccelerationStructures must not be VK_NULL_HANDLE.", vkCallingFunction); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 3871 | } |
| 3872 | } |
| 3873 | } |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3874 | } |
| 3875 | } else if (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3876 | const auto *pnext_struct = LvlFindInChain<VkWriteDescriptorSetAccelerationStructureNV>(pDescriptorWrites[i].pNext); |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3877 | if (!pnext_struct || (pnext_struct->accelerationStructureCount != pDescriptorWrites[i].descriptorCount)) { |
| 3878 | skip |= LogError(device, "VUID-VkWriteDescriptorSet-descriptorType-03817", |
| 3879 | "%s(): If descriptorType is VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV, the pNext" |
| 3880 | "chain must include a VkWriteDescriptorSetAccelerationStructureNV structure whose " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3881 | "accelerationStructureCount %" PRIu32 " member equals descriptorCount %" PRIu32 ".", |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3882 | vkCallingFunction, pnext_struct ? pnext_struct->accelerationStructureCount : -1, |
| 3883 | pDescriptorWrites[i].descriptorCount); |
| 3884 | } |
| 3885 | // further checks only if we have right structtype |
| 3886 | if (pnext_struct) { |
| 3887 | if (pnext_struct->accelerationStructureCount != pDescriptorWrites[i].descriptorCount) { |
| 3888 | skip |= LogError( |
| 3889 | device, "VUID-VkWriteDescriptorSetAccelerationStructureNV-accelerationStructureCount-03747", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 3890 | "%s(): accelerationStructureCount %" PRIu32 " must be equal to descriptorCount %" PRIu32 |
| 3891 | " in the extended structure " |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3892 | ".", |
| 3893 | vkCallingFunction, pnext_struct->accelerationStructureCount, pDescriptorWrites[i].descriptorCount); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 3894 | } |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3895 | if (pnext_struct->accelerationStructureCount == 0) { |
| 3896 | skip |= LogError(device, |
| 3897 | "VUID-VkWriteDescriptorSetAccelerationStructureNV-accelerationStructureCount-arraylength", |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 3898 | "%s(): accelerationStructureCount must be greater than 0 .", vkCallingFunction); |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3899 | } |
| 3900 | const auto *robustness2_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3901 | LvlFindInChain<VkPhysicalDeviceRobustness2FeaturesEXT>(device_createinfo_pnext); |
sourav parmar | bcee751 | 2020-12-28 14:34:49 -0800 | [diff] [blame] | 3902 | if (robustness2_features && robustness2_features->nullDescriptor == VK_FALSE) { |
| 3903 | for (uint32_t j = 0; j < pnext_struct->accelerationStructureCount; ++j) { |
| 3904 | if (pnext_struct->pAccelerationStructures[j] == VK_NULL_HANDLE) { |
| 3905 | skip |= LogError(device, |
| 3906 | "VUID-VkWriteDescriptorSetAccelerationStructureNV-pAccelerationStructures-03749", |
| 3907 | "%s(): If the nullDescriptor feature is not enabled, each member of " |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 3908 | "pAccelerationStructures must not be VK_NULL_HANDLE.", vkCallingFunction); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 3909 | } |
| 3910 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 3911 | } |
| 3912 | } |
| 3913 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3914 | } |
| 3915 | } |
| 3916 | return skip; |
| 3917 | } |
| 3918 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 3919 | bool StatelessValidation::manual_PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 3920 | const VkWriteDescriptorSet *pDescriptorWrites, |
| 3921 | uint32_t descriptorCopyCount, |
| 3922 | const VkCopyDescriptorSet *pDescriptorCopies) const { |
| 3923 | return validate_WriteDescriptorSet("vkUpdateDescriptorSets", descriptorWriteCount, pDescriptorWrites); |
| 3924 | } |
| 3925 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3926 | bool StatelessValidation::manual_PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3927 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3928 | VkRenderPass *pRenderPass) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3929 | return CreateRenderPassGeneric(device, pCreateInfo, pAllocator, pRenderPass, RENDER_PASS_VERSION_1); |
| 3930 | } |
| 3931 | |
sfricke-samsung | 681ab7b | 2020-10-29 01:53:35 -0700 | [diff] [blame] | 3932 | bool StatelessValidation::manual_PreCallValidateCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, |
| 3933 | const VkAllocationCallbacks *pAllocator, |
| 3934 | VkRenderPass *pRenderPass) const { |
| 3935 | return CreateRenderPassGeneric(device, pCreateInfo, pAllocator, pRenderPass, RENDER_PASS_VERSION_2); |
| 3936 | } |
| 3937 | |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 3938 | bool StatelessValidation::manual_PreCallValidateCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3939 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3940 | VkRenderPass *pRenderPass) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 3941 | return CreateRenderPassGeneric(device, pCreateInfo, pAllocator, pRenderPass, RENDER_PASS_VERSION_2); |
| 3942 | } |
| 3943 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3944 | bool StatelessValidation::manual_PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, |
| 3945 | uint32_t commandBufferCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3946 | const VkCommandBuffer *pCommandBuffers) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3947 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3948 | |
| 3949 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 3950 | // This is an array of handles, where the elements are allowed to be VK_NULL_HANDLE, and does not require any validation beyond |
| 3951 | // validate_array() |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3952 | skip |= validate_array("vkFreeCommandBuffers", "commandBufferCount", "pCommandBuffers", commandBufferCount, &pCommandBuffers, |
| 3953 | true, true, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3954 | return skip; |
| 3955 | } |
| 3956 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 3957 | bool StatelessValidation::manual_PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 3958 | const VkCommandBufferBeginInfo *pBeginInfo) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3959 | bool skip = false; |
Petr Kraus | e7bb9e8 | 2019-08-11 21:34:43 +0200 | [diff] [blame] | 3960 | |
| 3961 | // VkCommandBufferInheritanceInfo validation, due to a 'noautovalidity' of pBeginInfo->pInheritanceInfo in vkBeginCommandBuffer |
| 3962 | const char *cmd_name = "vkBeginCommandBuffer"; |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 3963 | bool cb_is_secondary; |
| 3964 | { |
| 3965 | auto lock = cb_read_lock(); |
| 3966 | cb_is_secondary = (secondary_cb_map.find(commandBuffer) != secondary_cb_map.end()); |
| 3967 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3968 | |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 3969 | if (cb_is_secondary) { |
| 3970 | // Implicit VUs |
| 3971 | // validate only sType here; pointer has to be validated in core_validation |
| 3972 | const bool k_not_required = false; |
| 3973 | const char *k_no_vuid = nullptr; |
| 3974 | const VkCommandBufferInheritanceInfo *info = pBeginInfo->pInheritanceInfo; |
| 3975 | skip |= validate_struct_type(cmd_name, "pBeginInfo->pInheritanceInfo", "VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO", |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3976 | info, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, k_not_required, k_no_vuid, |
| 3977 | "VUID-VkCommandBufferInheritanceInfo-sType-sType"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3978 | |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 3979 | if (info) { |
| 3980 | const VkStructureType allowed_structs_vk_command_buffer_inheritance_info[] = { |
David Zhao Akeley | 44139b1 | 2021-04-26 16:16:13 -0700 | [diff] [blame] | 3981 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT, |
| 3982 | VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV}; |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 3983 | skip |= validate_struct_pnext( |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 3984 | cmd_name, "pBeginInfo->pInheritanceInfo->pNext", "VkCommandBufferInheritanceConditionalRenderingInfoEXT", |
| 3985 | info->pNext, ARRAY_SIZE(allowed_structs_vk_command_buffer_inheritance_info), |
| 3986 | allowed_structs_vk_command_buffer_inheritance_info, GeneratedVulkanHeaderVersion, |
| 3987 | "VUID-VkCommandBufferInheritanceInfo-pNext-pNext", "VUID-VkCommandBufferInheritanceInfo-sType-unique"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3988 | |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 3989 | skip |= validate_bool32(cmd_name, "pBeginInfo->pInheritanceInfo->occlusionQueryEnable", info->occlusionQueryEnable); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 3990 | |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 3991 | // Explicit VUs |
| 3992 | if (!physical_device_features.inheritedQueries && info->occlusionQueryEnable == VK_TRUE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 3993 | skip |= LogError( |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 3994 | commandBuffer, "VUID-VkCommandBufferInheritanceInfo-occlusionQueryEnable-00056", |
| 3995 | "%s: Inherited queries feature is disabled, but pBeginInfo->pInheritanceInfo->occlusionQueryEnable is VK_TRUE.", |
| 3996 | cmd_name); |
| 3997 | } |
| 3998 | |
| 3999 | if (physical_device_features.inheritedQueries) { |
| 4000 | skip |= validate_flags(cmd_name, "pBeginInfo->pInheritanceInfo->queryFlags", "VkQueryControlFlagBits", |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4001 | AllVkQueryControlFlagBits, info->queryFlags, kOptionalFlags, |
| 4002 | "VUID-VkCommandBufferInheritanceInfo-queryFlags-00057"); |
| 4003 | } else { // !inheritedQueries |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 4004 | skip |= validate_reserved_flags(cmd_name, "pBeginInfo->pInheritanceInfo->queryFlags", info->queryFlags, |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4005 | "VUID-VkCommandBufferInheritanceInfo-queryFlags-02788"); |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 4006 | } |
| 4007 | |
| 4008 | if (physical_device_features.pipelineStatisticsQuery) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4009 | skip |= |
| 4010 | validate_flags(cmd_name, "pBeginInfo->pInheritanceInfo->pipelineStatistics", "VkQueryPipelineStatisticFlagBits", |
| 4011 | AllVkQueryPipelineStatisticFlagBits, info->pipelineStatistics, kOptionalFlags, |
| 4012 | "VUID-VkCommandBufferInheritanceInfo-pipelineStatistics-02789"); |
| 4013 | } else { // !pipelineStatisticsQuery |
| 4014 | skip |= |
| 4015 | validate_reserved_flags(cmd_name, "pBeginInfo->pInheritanceInfo->pipelineStatistics", info->pipelineStatistics, |
| 4016 | "VUID-VkCommandBufferInheritanceInfo-pipelineStatistics-00058"); |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 4017 | } |
| 4018 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4019 | const auto *conditional_rendering = LvlFindInChain<VkCommandBufferInheritanceConditionalRenderingInfoEXT>(info->pNext); |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 4020 | if (conditional_rendering) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4021 | const auto *cr_features = LvlFindInChain<VkPhysicalDeviceConditionalRenderingFeaturesEXT>(device_createinfo_pnext); |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 4022 | const auto inherited_conditional_rendering = cr_features && cr_features->inheritedConditionalRendering; |
| 4023 | if (!inherited_conditional_rendering && conditional_rendering->conditionalRenderingEnable == VK_TRUE) { |
| 4024 | skip |= LogError( |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4025 | commandBuffer, |
| 4026 | "VUID-VkCommandBufferInheritanceConditionalRenderingInfoEXT-conditionalRenderingEnable-01977", |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 4027 | "vkBeginCommandBuffer: Inherited conditional rendering is disabled, but " |
| 4028 | "pBeginInfo->pInheritanceInfo->pNext<VkCommandBufferInheritanceConditionalRenderingInfoEXT> is VK_TRUE."); |
| 4029 | } |
Petr Kraus | 139757b | 2019-08-15 17:19:33 +0200 | [diff] [blame] | 4030 | } |
ziga-lunarg | 9d01913 | 2021-07-19 01:05:31 +0200 | [diff] [blame] | 4031 | |
| 4032 | auto p_inherited_viewport_scissor_info = LvlFindInChain<VkCommandBufferInheritanceViewportScissorInfoNV>(info->pNext); |
| 4033 | if (p_inherited_viewport_scissor_info != nullptr && !physical_device_features.multiViewport && |
| 4034 | p_inherited_viewport_scissor_info->viewportScissor2D == VK_TRUE && |
| 4035 | p_inherited_viewport_scissor_info->viewportDepthCount != 1) { |
| 4036 | skip |= LogError(commandBuffer, "VUID-VkCommandBufferInheritanceViewportScissorInfoNV-viewportScissor2D-04783", |
| 4037 | "vkBeginCommandBuffer: multiViewport feature is disabled, but " |
| 4038 | "VkCommandBufferInheritanceViewportScissorInfoNV::viewportScissor2D in " |
| 4039 | "pBeginInfo->pInheritanceInfo->pNext is VK_TRUE and viewportDepthCount is not 1."); |
| 4040 | } |
Petr Kraus | 139757b | 2019-08-15 17:19:33 +0200 | [diff] [blame] | 4041 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4042 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4043 | return skip; |
| 4044 | } |
| 4045 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4046 | bool StatelessValidation::manual_PreCallValidateCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4047 | uint32_t viewportCount, const VkViewport *pViewports) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4048 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4049 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4050 | if (!physical_device_features.multiViewport) { |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 4051 | if (firstViewport != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4052 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewport-firstViewport-01224", |
| 4053 | "vkCmdSetViewport: The multiViewport feature is disabled, but firstViewport (=%" PRIu32 ") is not 0.", |
| 4054 | firstViewport); |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 4055 | } |
| 4056 | if (viewportCount > 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4057 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewport-viewportCount-01225", |
| 4058 | "vkCmdSetViewport: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 ") is not 1.", |
| 4059 | viewportCount); |
Petr Kraus | d55e77c | 2018-01-09 22:09:25 +0100 | [diff] [blame] | 4060 | } |
| 4061 | } else { // multiViewport enabled |
Petr Kraus | 7dfeed1 | 2018-02-27 20:51:20 +0100 | [diff] [blame] | 4062 | 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] | 4063 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4064 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewport-firstViewport-01223", |
| 4065 | "vkCmdSetViewport: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
| 4066 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 4067 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4068 | } |
| 4069 | } |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 4070 | |
| 4071 | if (pViewports) { |
| 4072 | for (uint32_t viewport_i = 0; viewport_i < viewportCount; ++viewport_i) { |
| 4073 | const auto &viewport = pViewports[viewport_i]; // will crash on invalid ptr |
Jeff Bolz | 6d3beaa | 2019-02-09 21:00:05 -0600 | [diff] [blame] | 4074 | const char *fn_name = "vkCmdSetViewport"; |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4075 | skip |= manual_PreCallValidateViewport( |
| 4076 | viewport, fn_name, ParameterName("pViewports[%i]", ParameterName::IndexVector{viewport_i}), commandBuffer); |
Petr Kraus | b3fcdb4 | 2018-01-09 22:09:09 +0100 | [diff] [blame] | 4077 | } |
| 4078 | } |
| 4079 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4080 | return skip; |
| 4081 | } |
| 4082 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4083 | bool StatelessValidation::manual_PreCallValidateCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4084 | uint32_t scissorCount, const VkRect2D *pScissors) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4085 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4086 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4087 | if (!physical_device_features.multiViewport) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4088 | if (firstScissor != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4089 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-firstScissor-00593", |
| 4090 | "vkCmdSetScissor: The multiViewport feature is disabled, but firstScissor (=%" PRIu32 ") is not 0.", |
| 4091 | firstScissor); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4092 | } |
| 4093 | if (scissorCount > 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4094 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-scissorCount-00594", |
| 4095 | "vkCmdSetScissor: The multiViewport feature is disabled, but scissorCount (=%" PRIu32 ") is not 1.", |
| 4096 | scissorCount); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4097 | } |
| 4098 | } else { // multiViewport enabled |
| 4099 | 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] | 4100 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4101 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-firstScissor-00592", |
| 4102 | "vkCmdSetScissor: firstScissor + scissorCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
| 4103 | ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 4104 | firstScissor, scissorCount, sum, device_limits.maxViewports); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4105 | } |
| 4106 | } |
| 4107 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4108 | if (pScissors) { |
| 4109 | for (uint32_t scissor_i = 0; scissor_i < scissorCount; ++scissor_i) { |
| 4110 | const auto &scissor = pScissors[scissor_i]; // will crash on invalid ptr |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4111 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4112 | if (scissor.offset.x < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4113 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-x-00595", |
| 4114 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.x (=%" PRIi32 ") is negative.", scissor_i, |
| 4115 | scissor.offset.x); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4116 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4117 | |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4118 | if (scissor.offset.y < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4119 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-x-00595", |
| 4120 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.y (=%" PRIi32 ") is negative.", scissor_i, |
| 4121 | scissor.offset.y); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4122 | } |
| 4123 | |
| 4124 | const int64_t x_sum = static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 4125 | if (x_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4126 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-offset-00596", |
| 4127 | "vkCmdSetScissor: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 4128 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 4129 | scissor.offset.x, scissor.extent.width, x_sum, scissor_i); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4130 | } |
| 4131 | |
| 4132 | const int64_t y_sum = static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 4133 | if (y_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4134 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissor-offset-00597", |
| 4135 | "vkCmdSetScissor: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 4136 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 4137 | scissor.offset.y, scissor.extent.height, y_sum, scissor_i); |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4138 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4139 | } |
| 4140 | } |
Petr Kraus | 6260f0a | 2018-02-27 21:15:55 +0100 | [diff] [blame] | 4141 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4142 | return skip; |
| 4143 | } |
| 4144 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4145 | bool StatelessValidation::manual_PreCallValidateCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) const { |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 4146 | bool skip = false; |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 4147 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4148 | if (!physical_device_features.wideLines && (lineWidth != 1.0f)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4149 | skip |= LogError(commandBuffer, "VUID-vkCmdSetLineWidth-lineWidth-00788", |
| 4150 | "VkPhysicalDeviceFeatures::wideLines is disabled, but lineWidth (=%f) is not 1.0.", lineWidth); |
Petr Kraus | 299ba62 | 2017-11-24 03:09:03 +0100 | [diff] [blame] | 4151 | } |
| 4152 | |
| 4153 | return skip; |
| 4154 | } |
| 4155 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4156 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 4157 | uint32_t drawCount, uint32_t stride) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4158 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4159 | |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 4160 | if (!physical_device_features.multiDrawIndirect && ((drawCount > 1))) { |
Mark Lobodzinski | 41ce65b | 2020-10-30 12:17:06 -0600 | [diff] [blame] | 4161 | skip |= LogError(device, "VUID-vkCmdDrawIndirect-drawCount-02718", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4162 | "CmdDrawIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %" PRIu32 "", |
| 4163 | drawCount); |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 4164 | } |
| 4165 | if (drawCount > device_limits.maxDrawIndirectCount) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4166 | skip |= |
| 4167 | LogError(commandBuffer, "VUID-vkCmdDrawIndirect-drawCount-02719", |
| 4168 | "CmdDrawIndirect(): drawCount (%" PRIu32 ") is not less than or equal to the maximum allowed (%" PRIu32 ").", |
| 4169 | drawCount, device_limits.maxDrawIndirectCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4170 | } |
| 4171 | return skip; |
| 4172 | } |
| 4173 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4174 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4175 | VkDeviceSize offset, uint32_t drawCount, |
| 4176 | uint32_t stride) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4177 | bool skip = false; |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 4178 | if (!physical_device_features.multiDrawIndirect && ((drawCount > 1))) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4179 | skip |= |
| 4180 | LogError(device, "VUID-vkCmdDrawIndexedIndirect-drawCount-02718", |
| 4181 | "CmdDrawIndexedIndirect(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %" PRIu32 "", |
| 4182 | drawCount); |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 4183 | } |
| 4184 | if (drawCount > device_limits.maxDrawIndirectCount) { |
| 4185 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawIndexedIndirect-drawCount-02719", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4186 | "CmdDrawIndexedIndirect(): drawCount (%" PRIu32 |
| 4187 | ") is not less than or equal to the maximum allowed (%" PRIu32 ").", |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4188 | drawCount, device_limits.maxDrawIndirectCount); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4189 | } |
| 4190 | return skip; |
| 4191 | } |
| 4192 | |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 4193 | bool StatelessValidation::ValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, |
| 4194 | VkDeviceSize countBufferOffset, bool khr) const { |
| 4195 | bool skip = false; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 4196 | const char *api_name = khr ? "vkCmdDrawIndirectCountKHR()" : "vkCmdDrawIndirectCount()"; |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 4197 | if (offset & 3) { |
| 4198 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawIndirectCount-offset-02710", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 4199 | "%s: parameter, VkDeviceSize offset (0x%" PRIxLEAST64 "), is not a multiple of 4.", api_name, offset); |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 4200 | } |
| 4201 | |
| 4202 | if (countBufferOffset & 3) { |
| 4203 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawIndirectCount-countBufferOffset-02716", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 4204 | "%s: parameter, VkDeviceSize countBufferOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", api_name, |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 4205 | countBufferOffset); |
| 4206 | } |
| 4207 | return skip; |
| 4208 | } |
| 4209 | |
| 4210 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 4211 | VkDeviceSize offset, VkBuffer countBuffer, |
| 4212 | VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 4213 | uint32_t stride) const { |
| 4214 | return ValidateCmdDrawIndirectCount(commandBuffer, offset, countBufferOffset, false); |
| 4215 | } |
| 4216 | |
| 4217 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 4218 | VkDeviceSize offset, VkBuffer countBuffer, |
| 4219 | VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 4220 | uint32_t stride) const { |
| 4221 | return ValidateCmdDrawIndirectCount(commandBuffer, offset, countBufferOffset, true); |
| 4222 | } |
| 4223 | |
| 4224 | bool StatelessValidation::ValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkDeviceSize offset, |
| 4225 | VkDeviceSize countBufferOffset, bool khr) const { |
| 4226 | bool skip = false; |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 4227 | const char *api_name = khr ? "vkCmdDrawIndexedIndirectCountKHR()" : "vkCmdDrawIndexedIndirectCount()"; |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 4228 | if (offset & 3) { |
| 4229 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawIndexedIndirectCount-offset-02710", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 4230 | "%s: parameter, VkDeviceSize offset (0x%" PRIxLEAST64 "), is not a multiple of 4.", api_name, offset); |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 4231 | } |
| 4232 | |
| 4233 | if (countBufferOffset & 3) { |
| 4234 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawIndexedIndirectCount-countBufferOffset-02716", |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 4235 | "%s: parameter, VkDeviceSize countBufferOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", api_name, |
sfricke-samsung | f692b97 | 2020-05-02 08:00:45 -0700 | [diff] [blame] | 4236 | countBufferOffset); |
| 4237 | } |
| 4238 | return skip; |
| 4239 | } |
| 4240 | |
| 4241 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 4242 | VkDeviceSize offset, VkBuffer countBuffer, |
| 4243 | VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 4244 | uint32_t stride) const { |
| 4245 | return ValidateCmdDrawIndexedIndirectCount(commandBuffer, offset, countBufferOffset, false); |
| 4246 | } |
| 4247 | |
| 4248 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 4249 | VkDeviceSize offset, VkBuffer countBuffer, |
| 4250 | VkDeviceSize countBufferOffset, |
| 4251 | uint32_t maxDrawCount, uint32_t stride) const { |
| 4252 | return ValidateCmdDrawIndexedIndirectCount(commandBuffer, offset, countBufferOffset, true); |
| 4253 | } |
| 4254 | |
Tony-LunarG | 4490de4 | 2021-06-21 15:49:19 -0600 | [diff] [blame] | 4255 | bool StatelessValidation::manual_PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, |
| 4256 | const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount, |
| 4257 | uint32_t firstInstance, uint32_t stride) const { |
| 4258 | bool skip = false; |
| 4259 | if (stride & 3) { |
| 4260 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMultiEXT-stride-04936", |
| 4261 | "CmdDrawMultiEXT: parameter, uint32_t stride (%" PRIu32 ") is not a multiple of 4.", stride); |
| 4262 | } |
| 4263 | if (drawCount && nullptr == pVertexInfo) { |
| 4264 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMultiEXT-drawCount-04935", |
| 4265 | "CmdDrawMultiEXT: parameter, VkMultiDrawInfoEXT *pVertexInfo must be a valid pointer to memory containing " |
| 4266 | "one or more valid instances of VkMultiDrawInfoEXT structures"); |
| 4267 | } |
| 4268 | return skip; |
| 4269 | } |
| 4270 | |
| 4271 | bool StatelessValidation::manual_PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, |
| 4272 | const VkMultiDrawIndexedInfoEXT *pIndexInfo, |
| 4273 | uint32_t instanceCount, uint32_t firstInstance, |
| 4274 | uint32_t stride, const int32_t *pVertexOffset) const { |
| 4275 | bool skip = false; |
| 4276 | if (stride & 3) { |
| 4277 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMultiIndexedEXT-stride-04941", |
| 4278 | "CmdDrawMultiIndexedEXT: parameter, uint32_t stride (%" PRIu32 ") is not a multiple of 4.", stride); |
| 4279 | } |
| 4280 | if (drawCount && nullptr == pIndexInfo) { |
| 4281 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMultiIndexedEXT-drawCount-04940", |
| 4282 | "CmdDrawMultiIndexedEXT: parameter, VkMultiDrawIndexedInfoEXT *pIndexInfo must be a valid pointer to " |
| 4283 | "memory containing one or more valid instances of VkMultiDrawIndexedInfoEXT structures"); |
| 4284 | } |
| 4285 | return skip; |
| 4286 | } |
| 4287 | |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 4288 | bool StatelessValidation::manual_PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 4289 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4290 | const VkClearRect *pRects) const { |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 4291 | bool skip = false; |
| 4292 | for (uint32_t rect = 0; rect < rectCount; rect++) { |
| 4293 | if (pRects[rect].layerCount == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4294 | skip |= LogError(commandBuffer, "VUID-vkCmdClearAttachments-layerCount-01934", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4295 | "CmdClearAttachments(): pRects[%" PRIu32 "].layerCount is zero.", rect); |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 4296 | } |
sfricke-samsung | 1086768 | 2020-04-25 02:20:39 -0700 | [diff] [blame] | 4297 | if (pRects[rect].rect.extent.width == 0) { |
| 4298 | skip |= LogError(commandBuffer, "VUID-vkCmdClearAttachments-rect-02682", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4299 | "CmdClearAttachments(): pRects[%" PRIu32 "].rect.extent.width is zero.", rect); |
sfricke-samsung | 1086768 | 2020-04-25 02:20:39 -0700 | [diff] [blame] | 4300 | } |
| 4301 | if (pRects[rect].rect.extent.height == 0) { |
| 4302 | skip |= LogError(commandBuffer, "VUID-vkCmdClearAttachments-rect-02683", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4303 | "CmdClearAttachments(): pRects[%" PRIu32 "].rect.extent.height is zero.", rect); |
sfricke-samsung | 1086768 | 2020-04-25 02:20:39 -0700 | [diff] [blame] | 4304 | } |
Mark Lobodzinski | f77a4ac | 2019-06-27 15:30:51 -0600 | [diff] [blame] | 4305 | } |
| 4306 | return skip; |
| 4307 | } |
| 4308 | |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 4309 | bool StatelessValidation::ValidateGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, |
| 4310 | const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 4311 | VkImageFormatProperties2 *pImageFormatProperties, |
| 4312 | const char *apiName) const { |
| 4313 | bool skip = false; |
| 4314 | |
| 4315 | if (pImageFormatInfo != nullptr) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4316 | const auto image_stencil_struct = LvlFindInChain<VkImageStencilUsageCreateInfo>(pImageFormatInfo->pNext); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 4317 | if (image_stencil_struct != nullptr) { |
| 4318 | if ((image_stencil_struct->stencilUsage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0) { |
| 4319 | VkImageUsageFlags legal_flags = (VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT); |
| 4320 | // No flags other than the legal attachment bits may be set |
| 4321 | legal_flags |= VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 4322 | if ((image_stencil_struct->stencilUsage & ~legal_flags) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4323 | skip |= LogError(physicalDevice, "VUID-VkImageStencilUsageCreateInfo-stencilUsage-02539", |
| 4324 | "%s(): in pNext chain, VkImageStencilUsageCreateInfo::stencilUsage " |
| 4325 | "includes VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, it must not include bits other than " |
| 4326 | "VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT or VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT", |
| 4327 | apiName); |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 4328 | } |
| 4329 | } |
| 4330 | } |
ziga-lunarg | d3da253 | 2021-08-11 11:50:12 +0200 | [diff] [blame] | 4331 | const auto image_drm_format = LvlFindInChain<VkPhysicalDeviceImageDrmFormatModifierInfoEXT>(pImageFormatInfo->pNext); |
| 4332 | if (image_drm_format) { |
| 4333 | if (pImageFormatInfo->tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) { |
| 4334 | skip |= LogError( |
| 4335 | physicalDevice, "VUID-VkPhysicalDeviceImageFormatInfo2-tiling-02249", |
| 4336 | "%s(): pNext chain of VkPhysicalDeviceImageFormatInfo2 includes VkPhysicalDeviceImageDrmFormatModifierInfoEXT, " |
| 4337 | "but tiling (%s) is not VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.", |
| 4338 | apiName, string_VkImageTiling(pImageFormatInfo->tiling)); |
| 4339 | } |
ziga-lunarg | 27e256d | 2021-10-07 23:38:12 +0200 | [diff] [blame] | 4340 | if (image_drm_format->sharingMode == VK_SHARING_MODE_CONCURRENT && image_drm_format->queueFamilyIndexCount <= 1) { |
| 4341 | skip |= LogError( |
| 4342 | physicalDevice, "VUID-VkPhysicalDeviceImageDrmFormatModifierInfoEXT-sharingMode-02315", |
| 4343 | "%s: pNext chain of VkPhysicalDeviceImageFormatInfo2 includes VkPhysicalDeviceImageDrmFormatModifierInfoEXT, " |
| 4344 | "with sharing mode VK_SHARING_MODE_CONCURRENT, but queueFamilyIndexCount is %" PRIu32 ".", |
| 4345 | apiName, image_drm_format->queueFamilyIndexCount); |
| 4346 | } |
ziga-lunarg | d3da253 | 2021-08-11 11:50:12 +0200 | [diff] [blame] | 4347 | } else { |
| 4348 | if (pImageFormatInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) { |
| 4349 | skip |= LogError( |
| 4350 | physicalDevice, "VUID-VkPhysicalDeviceImageFormatInfo2-tiling-02249", |
| 4351 | "%s(): pNext chain of VkPhysicalDeviceImageFormatInfo2 does not include " |
| 4352 | "VkPhysicalDeviceImageDrmFormatModifierInfoEXT, but tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.", |
| 4353 | apiName); |
| 4354 | } |
| 4355 | } |
| 4356 | if (pImageFormatInfo->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT && |
| 4357 | (pImageFormatInfo->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)) { |
| 4358 | const auto format_list = LvlFindInChain<VkImageFormatListCreateInfo>(pImageFormatInfo->pNext); |
| 4359 | if (!format_list || format_list->viewFormatCount == 0) { |
| 4360 | skip |= LogError( |
| 4361 | physicalDevice, "VUID-VkPhysicalDeviceImageFormatInfo2-tiling-02313", |
| 4362 | "%s(): tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT and flags contain VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT " |
| 4363 | "bit, but the pNext chain does not include VkImageFormatListCreateInfo with non-zero viewFormatCount.", |
| 4364 | apiName); |
| 4365 | } |
| 4366 | } |
Andrew Fobel | 3abeb99 | 2020-01-20 16:33:22 -0500 | [diff] [blame] | 4367 | } |
| 4368 | |
| 4369 | return skip; |
| 4370 | } |
| 4371 | |
| 4372 | bool StatelessValidation::manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2( |
| 4373 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 4374 | VkImageFormatProperties2 *pImageFormatProperties) const { |
| 4375 | return ValidateGetPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties, |
| 4376 | "vkGetPhysicalDeviceImageFormatProperties2"); |
| 4377 | } |
| 4378 | |
| 4379 | bool StatelessValidation::manual_PreCallValidateGetPhysicalDeviceImageFormatProperties2KHR( |
| 4380 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, |
| 4381 | VkImageFormatProperties2 *pImageFormatProperties) const { |
| 4382 | return ValidateGetPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties, |
| 4383 | "vkGetPhysicalDeviceImageFormatProperties2KHR"); |
| 4384 | } |
| 4385 | |
Lionel Landwerlin | 5fe5275 | 2020-07-22 08:18:14 +0300 | [diff] [blame] | 4386 | bool StatelessValidation::manual_PreCallValidateGetPhysicalDeviceImageFormatProperties( |
| 4387 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, |
| 4388 | VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties) const { |
| 4389 | bool skip = false; |
| 4390 | |
| 4391 | if (tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) { |
| 4392 | skip |= LogError(physicalDevice, "VUID-vkGetPhysicalDeviceImageFormatProperties-tiling-02248", |
| 4393 | "vkGetPhysicalDeviceImageFormatProperties(): tiling must not be VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT."); |
| 4394 | } |
| 4395 | |
| 4396 | return skip; |
| 4397 | } |
| 4398 | |
ziga-lunarg | 73b5ef2 | 2021-07-29 20:25:06 +0200 | [diff] [blame] | 4399 | bool StatelessValidation::manual_PreCallValidateGetPhysicalDeviceVideoFormatPropertiesKHR( |
| 4400 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoFormatInfoKHR *pVideoFormatInfo, |
| 4401 | uint32_t *pVideoFormatPropertyCount, VkVideoFormatPropertiesKHR *pVideoFormatProperties) const { |
| 4402 | bool skip = false; |
| 4403 | |
| 4404 | if ((pVideoFormatInfo->imageUsage & (VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR | |
| 4405 | VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR | VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR)) == 0) { |
| 4406 | skip |= LogError(physicalDevice, "VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-imageUsage-04844", |
| 4407 | "vkGetPhysicalDeviceVideoFormatPropertiesKHR(): pVideoFormatInfo->imageUsage does not contain any of " |
| 4408 | "VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR, VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR, " |
| 4409 | "VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR, or VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR."); |
| 4410 | } |
| 4411 | |
ziga-lunarg | 42f884b | 2021-08-25 16:13:20 +0200 | [diff] [blame] | 4412 | return skip; |
ziga-lunarg | 73b5ef2 | 2021-07-29 20:25:06 +0200 | [diff] [blame] | 4413 | } |
| 4414 | |
sfricke-samsung | 3999ef6 | 2020-02-09 17:05:59 -0800 | [diff] [blame] | 4415 | bool StatelessValidation::manual_PreCallValidateCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 4416 | uint32_t regionCount, const VkBufferCopy *pRegions) const { |
| 4417 | bool skip = false; |
| 4418 | |
| 4419 | if (pRegions != nullptr) { |
| 4420 | for (uint32_t i = 0; i < regionCount; i++) { |
| 4421 | if (pRegions[i].size == 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4422 | skip |= LogError(device, "VUID-VkBufferCopy-size-01988", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4423 | "vkCmdCopyBuffer() pRegions[%" PRIu32 "].size must be greater than zero", i); |
sfricke-samsung | 3999ef6 | 2020-02-09 17:05:59 -0800 | [diff] [blame] | 4424 | } |
| 4425 | } |
| 4426 | } |
| 4427 | return skip; |
| 4428 | } |
| 4429 | |
Jeff Leger | 178b1e5 | 2020-10-05 12:22:23 -0400 | [diff] [blame] | 4430 | bool StatelessValidation::manual_PreCallValidateCmdCopyBuffer2KHR(VkCommandBuffer commandBuffer, |
| 4431 | const VkCopyBufferInfo2KHR *pCopyBufferInfo) const { |
| 4432 | bool skip = false; |
| 4433 | |
| 4434 | if (pCopyBufferInfo->pRegions != nullptr) { |
| 4435 | for (uint32_t i = 0; i < pCopyBufferInfo->regionCount; i++) { |
| 4436 | if (pCopyBufferInfo->pRegions[i].size == 0) { |
| 4437 | skip |= LogError(device, "VUID-VkBufferCopy2KHR-size-01988", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4438 | "vkCmdCopyBuffer2KHR() pCopyBufferInfo->pRegions[%" PRIu32 "].size must be greater than zero", i); |
Jeff Leger | 178b1e5 | 2020-10-05 12:22:23 -0400 | [diff] [blame] | 4439 | } |
| 4440 | } |
| 4441 | } |
| 4442 | return skip; |
| 4443 | } |
| 4444 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4445 | bool StatelessValidation::manual_PreCallValidateCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4446 | VkDeviceSize dstOffset, VkDeviceSize dataSize, |
| 4447 | const void *pData) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4448 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4449 | |
| 4450 | if (dstOffset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4451 | skip |= LogError(device, "VUID-vkCmdUpdateBuffer-dstOffset-00036", |
| 4452 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", |
| 4453 | dstOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4454 | } |
| 4455 | |
| 4456 | if ((dataSize <= 0) || (dataSize > 65536)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4457 | skip |= LogError(device, "VUID-vkCmdUpdateBuffer-dataSize-00037", |
| 4458 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 |
| 4459 | "), must be greater than zero and less than or equal to 65536.", |
| 4460 | dataSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4461 | } else if (dataSize & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4462 | skip |= LogError(device, "VUID-vkCmdUpdateBuffer-dataSize-00038", |
| 4463 | "vkCmdUpdateBuffer() parameter, VkDeviceSize dataSize (0x%" PRIxLEAST64 "), is not a multiple of 4.", |
| 4464 | dataSize); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4465 | } |
| 4466 | return skip; |
| 4467 | } |
| 4468 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4469 | bool StatelessValidation::manual_PreCallValidateCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4470 | VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4471 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4472 | |
| 4473 | if (dstOffset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4474 | skip |= LogError(device, "VUID-vkCmdFillBuffer-dstOffset-00025", |
| 4475 | "vkCmdFillBuffer() parameter, VkDeviceSize dstOffset (0x%" PRIxLEAST64 "), is not a multiple of 4.", |
| 4476 | dstOffset); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4477 | } |
| 4478 | |
| 4479 | if (size != VK_WHOLE_SIZE) { |
| 4480 | if (size <= 0) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 4481 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4482 | LogError(device, "VUID-vkCmdFillBuffer-size-00026", |
| 4483 | "vkCmdFillBuffer() parameter, VkDeviceSize size (0x%" PRIxLEAST64 "), must be greater than zero.", size); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4484 | } else if (size & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4485 | skip |= LogError(device, "VUID-vkCmdFillBuffer-size-00028", |
| 4486 | "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] | 4487 | } |
| 4488 | } |
| 4489 | return skip; |
| 4490 | } |
| 4491 | |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4492 | bool StatelessValidation::ValidateSwapchainCreateInfo(const char *func_name, VkSwapchainCreateInfoKHR const *pCreateInfo) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4493 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4494 | |
| 4495 | if (pCreateInfo != nullptr) { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4496 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 4497 | if (pCreateInfo->imageSharingMode == VK_SHARING_MODE_CONCURRENT) { |
| 4498 | // If imageSharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1 |
| 4499 | if (pCreateInfo->queueFamilyIndexCount <= 1) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4500 | skip |= LogError(device, "VUID-VkSwapchainCreateInfoKHR-imageSharingMode-01278", |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4501 | "%s: if pCreateInfo->imageSharingMode is VK_SHARING_MODE_CONCURRENT, " |
| 4502 | "pCreateInfo->queueFamilyIndexCount must be greater than 1.", |
| 4503 | func_name); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4504 | } |
| 4505 | |
| 4506 | // If imageSharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of |
| 4507 | // queueFamilyIndexCount uint32_t values |
| 4508 | if (pCreateInfo->pQueueFamilyIndices == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4509 | skip |= LogError(device, "VUID-VkSwapchainCreateInfoKHR-imageSharingMode-01277", |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4510 | "%s: if pCreateInfo->imageSharingMode is VK_SHARING_MODE_CONCURRENT, " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4511 | "pCreateInfo->pQueueFamilyIndices must be a pointer to an array of " |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4512 | "pCreateInfo->queueFamilyIndexCount uint32_t values.", |
| 4513 | func_name); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4514 | } |
| 4515 | } |
| 4516 | |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 4517 | skip |= ValidateGreaterThanZero(pCreateInfo->imageArrayLayers, "pCreateInfo->imageArrayLayers", |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4518 | "VUID-VkSwapchainCreateInfoKHR-imageArrayLayers-01275", func_name); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4519 | |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4520 | // Validate VK_KHR_image_format_list VkImageFormatListCreateInfo |
| 4521 | const auto format_list_info = LvlFindInChain<VkImageFormatListCreateInfo>(pCreateInfo->pNext); |
| 4522 | if (format_list_info) { |
| 4523 | const uint32_t viewFormatCount = format_list_info->viewFormatCount; |
| 4524 | if (((pCreateInfo->flags & VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) == 0) && (viewFormatCount > 1)) { |
| 4525 | skip |= LogError(device, "VUID-VkSwapchainCreateInfoKHR-flags-04100", |
| 4526 | "%s: If the VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR is not set, then " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4527 | "VkImageFormatListCreateInfo::viewFormatCount (%" PRIu32 |
| 4528 | ") must be 0 or 1 if it is in the pNext chain.", |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4529 | func_name, viewFormatCount); |
| 4530 | } |
| 4531 | |
| 4532 | // Using the first format, compare the rest of the formats against it that they are compatible |
| 4533 | for (uint32_t i = 1; i < viewFormatCount; i++) { |
| 4534 | if (FormatCompatibilityClass(format_list_info->pViewFormats[0]) != |
| 4535 | FormatCompatibilityClass(format_list_info->pViewFormats[i])) { |
| 4536 | skip |= LogError(device, "VUID-VkSwapchainCreateInfoKHR-pNext-04099", |
| 4537 | "%s: VkImageFormatListCreateInfo::pViewFormats[0] (%s) and " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4538 | "VkImageFormatListCreateInfo::pViewFormats[%" PRIu32 |
| 4539 | "] (%s) are not compatible in the pNext chain.", |
sfricke-samsung | a1d0027 | 2021-03-10 21:37:41 -0800 | [diff] [blame] | 4540 | func_name, string_VkFormat(format_list_info->pViewFormats[0]), i, |
| 4541 | string_VkFormat(format_list_info->pViewFormats[i])); |
| 4542 | } |
| 4543 | } |
| 4544 | } |
| 4545 | |
| 4546 | // Validate VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR |
| 4547 | if ((pCreateInfo->flags & VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) != 0) { |
| 4548 | if (!IsExtEnabled(device_extensions.vk_khr_swapchain_mutable_format)) { |
| 4549 | skip |= LogError(device, kVUID_PVError_ExtensionNotEnabled, |
| 4550 | "%s: pCreateInfo->flags contains VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR which requires the " |
| 4551 | "VK_KHR_swapchain_mutable_format extension, which has not been enabled.", |
| 4552 | func_name); |
| 4553 | } else { |
| 4554 | if (format_list_info == nullptr) { |
| 4555 | skip |= LogError( |
| 4556 | device, "VUID-VkSwapchainCreateInfoKHR-flags-03168", |
| 4557 | "%s: pCreateInfo->flags contains VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR but the pNext chain of " |
| 4558 | "pCreateInfo does not contain an instance of VkImageFormatListCreateInfo.", |
| 4559 | func_name); |
| 4560 | } else if (format_list_info->viewFormatCount == 0) { |
| 4561 | skip |= LogError( |
| 4562 | device, "VUID-VkSwapchainCreateInfoKHR-flags-03168", |
| 4563 | "%s: pCreateInfo->flags contains VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR but the viewFormatCount " |
| 4564 | "member of VkImageFormatListCreateInfo in the pNext chain is zero.", |
| 4565 | func_name); |
| 4566 | } else { |
| 4567 | bool found_base_format = false; |
| 4568 | for (uint32_t i = 0; i < format_list_info->viewFormatCount; ++i) { |
| 4569 | if (format_list_info->pViewFormats[i] == pCreateInfo->imageFormat) { |
| 4570 | found_base_format = true; |
| 4571 | break; |
| 4572 | } |
| 4573 | } |
| 4574 | if (!found_base_format) { |
| 4575 | skip |= |
| 4576 | LogError(device, "VUID-VkSwapchainCreateInfoKHR-flags-03168", |
| 4577 | "%s: pCreateInfo->flags contains VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR but none of the " |
| 4578 | "elements of the pViewFormats member of VkImageFormatListCreateInfo match " |
| 4579 | "pCreateInfo->imageFormat.", |
| 4580 | func_name); |
| 4581 | } |
| 4582 | } |
| 4583 | } |
| 4584 | } |
| 4585 | } |
| 4586 | return skip; |
| 4587 | } |
| 4588 | |
| 4589 | bool StatelessValidation::manual_PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
| 4590 | const VkAllocationCallbacks *pAllocator, |
| 4591 | VkSwapchainKHR *pSwapchain) const { |
| 4592 | bool skip = false; |
| 4593 | skip |= ValidateSwapchainCreateInfo("vkCreateSwapchainKHR()", pCreateInfo); |
| 4594 | return skip; |
| 4595 | } |
| 4596 | |
| 4597 | bool StatelessValidation::manual_PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 4598 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 4599 | const VkAllocationCallbacks *pAllocator, |
| 4600 | VkSwapchainKHR *pSwapchains) const { |
| 4601 | bool skip = false; |
| 4602 | if (pCreateInfos) { |
| 4603 | for (uint32_t i = 0; i < swapchainCount; i++) { |
| 4604 | std::stringstream func_name; |
| 4605 | func_name << "vkCreateSharedSwapchainsKHR[" << swapchainCount << "]()"; |
| 4606 | skip |= ValidateSwapchainCreateInfo(func_name.str().c_str(), &pCreateInfos[i]); |
| 4607 | } |
| 4608 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4609 | return skip; |
| 4610 | } |
| 4611 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4612 | bool StatelessValidation::manual_PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4613 | bool skip = false; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4614 | |
| 4615 | if (pPresentInfo && pPresentInfo->pNext) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4616 | const auto *present_regions = LvlFindInChain<VkPresentRegionsKHR>(pPresentInfo->pNext); |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 4617 | if (present_regions) { |
| 4618 | // 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] | 4619 | skip |= require_device_extension(IsExtEnabled(device_extensions.vk_khr_incremental_present), "vkQueuePresentKHR", |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 4620 | VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME); |
| 4621 | if (present_regions->swapchainCount != pPresentInfo->swapchainCount) { |
sfricke-samsung | a4cc4ff | 2020-08-23 22:05:49 -0700 | [diff] [blame] | 4622 | skip |= LogError(device, "VUID-VkPresentRegionsKHR-swapchainCount-01260", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4623 | "QueuePresentKHR(): pPresentInfo->swapchainCount has a value of %i but VkPresentRegionsKHR " |
| 4624 | "extension swapchainCount is %i. These values must be equal.", |
| 4625 | pPresentInfo->swapchainCount, present_regions->swapchainCount); |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 4626 | } |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4627 | 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] | 4628 | GeneratedVulkanHeaderVersion, "VUID-VkPresentInfoKHR-pNext-pNext", |
| 4629 | "VUID-VkPresentInfoKHR-sType-unique"); |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4630 | skip |= validate_array("QueuePresentKHR", "pCreateInfo->pNext->swapchainCount", "pCreateInfo->pNext->pRegions", |
| 4631 | present_regions->swapchainCount, &present_regions->pRegions, true, false, kVUIDUndefined, |
| 4632 | kVUIDUndefined); |
John Zulauf | de972ac | 2017-10-26 12:07:05 -0600 | [diff] [blame] | 4633 | for (uint32_t i = 0; i < present_regions->swapchainCount; ++i) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4634 | skip |= validate_array("QueuePresentKHR", "pCreateInfo->pNext->pRegions[].rectangleCount", |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4635 | "pCreateInfo->pNext->pRegions[].pRectangles", present_regions->pRegions[i].rectangleCount, |
Dave Houlton | 413a678 | 2018-05-22 13:01:54 -0600 | [diff] [blame] | 4636 | &present_regions->pRegions[i].pRectangles, true, false, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4637 | } |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4638 | } |
| 4639 | } |
| 4640 | |
| 4641 | return skip; |
| 4642 | } |
| 4643 | |
sfricke-samsung | 5c1b739 | 2020-12-13 22:17:15 -0800 | [diff] [blame] | 4644 | bool StatelessValidation::manual_PreCallValidateCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 4645 | const VkDisplayModeCreateInfoKHR *pCreateInfo, |
| 4646 | const VkAllocationCallbacks *pAllocator, |
| 4647 | VkDisplayModeKHR *pMode) const { |
| 4648 | bool skip = false; |
| 4649 | |
| 4650 | const VkDisplayModeParametersKHR display_mode_parameters = pCreateInfo->parameters; |
| 4651 | if (display_mode_parameters.visibleRegion.width == 0) { |
| 4652 | skip |= LogError(device, "VUID-VkDisplayModeParametersKHR-width-01990", |
| 4653 | "vkCreateDisplayModeKHR(): pCreateInfo->parameters.visibleRegion.width must be greater than 0."); |
| 4654 | } |
| 4655 | if (display_mode_parameters.visibleRegion.height == 0) { |
| 4656 | skip |= LogError(device, "VUID-VkDisplayModeParametersKHR-height-01991", |
| 4657 | "vkCreateDisplayModeKHR(): pCreateInfo->parameters.visibleRegion.height must be greater than 0."); |
| 4658 | } |
| 4659 | if (display_mode_parameters.refreshRate == 0) { |
| 4660 | skip |= LogError(device, "VUID-VkDisplayModeParametersKHR-refreshRate-01992", |
| 4661 | "vkCreateDisplayModeKHR(): pCreateInfo->parameters.refreshRate must be greater than 0."); |
| 4662 | } |
| 4663 | |
| 4664 | return skip; |
| 4665 | } |
| 4666 | |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4667 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4668 | bool StatelessValidation::manual_PreCallValidateCreateWin32SurfaceKHR(VkInstance instance, |
| 4669 | const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 4670 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4671 | VkSurfaceKHR *pSurface) const { |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4672 | bool skip = false; |
| 4673 | |
| 4674 | if (pCreateInfo->hwnd == nullptr) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4675 | skip |= LogError(device, "VUID-VkWin32SurfaceCreateInfoKHR-hwnd-01308", |
| 4676 | "vkCreateWin32SurfaceKHR(): hwnd must be a valid Win32 HWND but hwnd is NULL."); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 4677 | } |
| 4678 | |
| 4679 | return skip; |
| 4680 | } |
| 4681 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 4682 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4683 | bool StatelessValidation::manual_PreCallValidateCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4684 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4685 | VkDescriptorPool *pDescriptorPool) const { |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 4686 | bool skip = false; |
| 4687 | |
| 4688 | if (pCreateInfo) { |
| 4689 | if (pCreateInfo->maxSets <= 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4690 | skip |= LogError(device, "VUID-VkDescriptorPoolCreateInfo-maxSets-00301", |
| 4691 | "vkCreateDescriptorPool(): pCreateInfo->maxSets is not greater than 0."); |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 4692 | } |
| 4693 | |
| 4694 | if (pCreateInfo->pPoolSizes) { |
| 4695 | for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; ++i) { |
| 4696 | if (pCreateInfo->pPoolSizes[i].descriptorCount <= 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4697 | skip |= LogError( |
| 4698 | device, "VUID-VkDescriptorPoolSize-descriptorCount-00302", |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 4699 | "vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[%" PRIu32 "].descriptorCount is not greater than 0.", i); |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 4700 | } |
Jeff Bolz | e54ae89 | 2018-09-08 12:16:29 -0500 | [diff] [blame] | 4701 | if (pCreateInfo->pPoolSizes[i].type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT && |
| 4702 | (pCreateInfo->pPoolSizes[i].descriptorCount % 4) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4703 | skip |= LogError(device, "VUID-VkDescriptorPoolSize-type-02218", |
| 4704 | "vkCreateDescriptorPool(): pCreateInfo->pPoolSizes[%" PRIu32 |
| 4705 | "].type is VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT " |
| 4706 | " and pCreateInfo->pPoolSizes[%" PRIu32 "].descriptorCount is not a multiple of 4.", |
| 4707 | i, i); |
Jeff Bolz | e54ae89 | 2018-09-08 12:16:29 -0500 | [diff] [blame] | 4708 | } |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 4709 | } |
| 4710 | } |
ziga-lunarg | 0cf8521 | 2021-07-19 01:26:17 +0200 | [diff] [blame] | 4711 | |
| 4712 | if ((pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE) && |
| 4713 | (pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT)) { |
| 4714 | skip |= LogError(device, "VUID-VkDescriptorPoolCreateInfo-flags-04607", |
| 4715 | "vkCreateDescriptorPool(): pCreateInfo->flags must not contain both " |
| 4716 | "VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE and VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT"); |
| 4717 | } |
Petr Kraus | c8655be | 2017-09-27 18:56:51 +0200 | [diff] [blame] | 4718 | } |
| 4719 | |
| 4720 | return skip; |
| 4721 | } |
| 4722 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4723 | bool StatelessValidation::manual_PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4724 | uint32_t groupCountY, uint32_t groupCountZ) const { |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4725 | bool skip = false; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4726 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4727 | if (groupCountX > device_limits.maxComputeWorkGroupCount[0]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 4728 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4729 | LogError(commandBuffer, "VUID-vkCmdDispatch-groupCountX-00386", |
| 4730 | "vkCmdDispatch(): groupCountX (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 4731 | groupCountX, device_limits.maxComputeWorkGroupCount[0]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4732 | } |
| 4733 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4734 | if (groupCountY > device_limits.maxComputeWorkGroupCount[1]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 4735 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4736 | LogError(commandBuffer, "VUID-vkCmdDispatch-groupCountY-00387", |
| 4737 | "vkCmdDispatch(): groupCountY (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 4738 | groupCountY, device_limits.maxComputeWorkGroupCount[1]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4739 | } |
| 4740 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4741 | if (groupCountZ > device_limits.maxComputeWorkGroupCount[2]) { |
Mark Lobodzinski | 487a0d1 | 2018-03-30 10:09:03 -0600 | [diff] [blame] | 4742 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4743 | LogError(commandBuffer, "VUID-vkCmdDispatch-groupCountZ-00388", |
| 4744 | "vkCmdDispatch(): groupCountZ (%" PRIu32 ") exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 4745 | groupCountZ, device_limits.maxComputeWorkGroupCount[2]); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4746 | } |
| 4747 | |
| 4748 | return skip; |
| 4749 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4750 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4751 | bool StatelessValidation::manual_PreCallValidateCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4752 | VkDeviceSize offset) const { |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 4753 | bool skip = false; |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 4754 | |
| 4755 | if ((offset % 4) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4756 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchIndirect-offset-02710", |
| 4757 | "vkCmdDispatchIndirect(): offset (%" PRIu64 ") must be a multiple of 4.", offset); |
John Zulauf | a999d1b | 2018-11-29 13:38:40 -0700 | [diff] [blame] | 4758 | } |
| 4759 | return skip; |
| 4760 | } |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4761 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4762 | bool StatelessValidation::manual_PreCallValidateCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, |
| 4763 | uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4764 | uint32_t groupCountY, uint32_t groupCountZ) const { |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4765 | bool skip = false; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4766 | |
| 4767 | // Paired if {} else if {} tests used to avoid any possible uint underflow |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4768 | uint32_t limit = device_limits.maxComputeWorkGroupCount[0]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4769 | if (baseGroupX >= limit) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4770 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-baseGroupX-00421", |
| 4771 | "vkCmdDispatch(): baseGroupX (%" PRIu32 |
| 4772 | ") equals or exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 4773 | baseGroupX, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4774 | } else if (groupCountX > (limit - baseGroupX)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4775 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-groupCountX-00424", |
| 4776 | "vkCmdDispatchBaseKHR(): baseGroupX (%" PRIu32 ") + groupCountX (%" PRIu32 |
| 4777 | ") exceeds device limit maxComputeWorkGroupCount[0] (%" PRIu32 ").", |
| 4778 | baseGroupX, groupCountX, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4779 | } |
| 4780 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4781 | limit = device_limits.maxComputeWorkGroupCount[1]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4782 | if (baseGroupY >= limit) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4783 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-baseGroupX-00422", |
| 4784 | "vkCmdDispatch(): baseGroupY (%" PRIu32 |
| 4785 | ") equals or exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 4786 | baseGroupY, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4787 | } else if (groupCountY > (limit - baseGroupY)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4788 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-groupCountY-00425", |
| 4789 | "vkCmdDispatchBaseKHR(): baseGroupY (%" PRIu32 ") + groupCountY (%" PRIu32 |
| 4790 | ") exceeds device limit maxComputeWorkGroupCount[1] (%" PRIu32 ").", |
| 4791 | baseGroupY, groupCountY, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4792 | } |
| 4793 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4794 | limit = device_limits.maxComputeWorkGroupCount[2]; |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4795 | if (baseGroupZ >= limit) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4796 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-baseGroupZ-00423", |
| 4797 | "vkCmdDispatch(): baseGroupZ (%" PRIu32 |
| 4798 | ") equals or exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 4799 | baseGroupZ, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4800 | } else if (groupCountZ > (limit - baseGroupZ)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4801 | skip |= LogError(commandBuffer, "VUID-vkCmdDispatchBase-groupCountZ-00426", |
| 4802 | "vkCmdDispatchBaseKHR(): baseGroupZ (%" PRIu32 ") + groupCountZ (%" PRIu32 |
| 4803 | ") exceeds device limit maxComputeWorkGroupCount[2] (%" PRIu32 ").", |
| 4804 | baseGroupZ, groupCountZ, limit); |
Dave Houlton | bb7d3fe | 2018-01-11 17:09:16 -0700 | [diff] [blame] | 4805 | } |
| 4806 | |
| 4807 | return skip; |
| 4808 | } |
| 4809 | |
Jeremy Hayes | 390ff6f | 2020-02-10 13:48:57 -0700 | [diff] [blame] | 4810 | bool StatelessValidation::manual_PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, |
| 4811 | VkPipelineBindPoint pipelineBindPoint, |
| 4812 | VkPipelineLayout layout, uint32_t set, |
| 4813 | uint32_t descriptorWriteCount, |
| 4814 | const VkWriteDescriptorSet *pDescriptorWrites) const { |
| 4815 | return validate_WriteDescriptorSet("vkCmdPushDescriptorSetKHR", descriptorWriteCount, pDescriptorWrites, false); |
| 4816 | } |
| 4817 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4818 | bool StatelessValidation::manual_PreCallValidateCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, |
| 4819 | uint32_t firstExclusiveScissor, |
| 4820 | uint32_t exclusiveScissorCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4821 | const VkRect2D *pExclusiveScissors) const { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4822 | bool skip = false; |
| 4823 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4824 | if (!physical_device_features.multiViewport) { |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4825 | if (firstExclusiveScissor != 0) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 4826 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4827 | LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02035", |
| 4828 | "vkCmdSetExclusiveScissorNV: The multiViewport feature is disabled, but firstExclusiveScissor (=%" PRIu32 |
| 4829 | ") is not 0.", |
| 4830 | firstExclusiveScissor); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4831 | } |
| 4832 | if (exclusiveScissorCount > 1) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 4833 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4834 | LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-exclusiveScissorCount-02036", |
| 4835 | "vkCmdSetExclusiveScissorNV: The multiViewport feature is disabled, but exclusiveScissorCount (=%" PRIu32 |
| 4836 | ") is not 1.", |
| 4837 | exclusiveScissorCount); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4838 | } |
| 4839 | } else { // multiViewport enabled |
| 4840 | 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] | 4841 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4842 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02034", |
| 4843 | "vkCmdSetExclusiveScissorNV: firstExclusiveScissor + exclusiveScissorCount (=%" PRIu32 " + %" PRIu32 |
| 4844 | " = %" PRIu64 ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 4845 | firstExclusiveScissor, exclusiveScissorCount, sum, device_limits.maxViewports); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4846 | } |
| 4847 | } |
| 4848 | |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4849 | if (pExclusiveScissors) { |
| 4850 | for (uint32_t scissor_i = 0; scissor_i < exclusiveScissorCount; ++scissor_i) { |
| 4851 | const auto &scissor = pExclusiveScissors[scissor_i]; // will crash on invalid ptr |
| 4852 | |
| 4853 | if (scissor.offset.x < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4854 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-x-02037", |
| 4855 | "vkCmdSetExclusiveScissorNV: pScissors[%" PRIu32 "].offset.x (=%" PRIi32 ") is negative.", |
| 4856 | scissor_i, scissor.offset.x); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4857 | } |
| 4858 | |
| 4859 | if (scissor.offset.y < 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4860 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-x-02037", |
| 4861 | "vkCmdSetExclusiveScissorNV: pScissors[%" PRIu32 "].offset.y (=%" PRIi32 ") is negative.", |
| 4862 | scissor_i, scissor.offset.y); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4863 | } |
| 4864 | |
| 4865 | const int64_t x_sum = static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 4866 | if (x_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4867 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-offset-02038", |
| 4868 | "vkCmdSetExclusiveScissorNV: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 4869 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 4870 | scissor.offset.x, scissor.extent.width, x_sum, scissor_i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4871 | } |
| 4872 | |
| 4873 | const int64_t y_sum = static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 4874 | if (y_sum > INT32_MAX) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4875 | skip |= LogError(commandBuffer, "VUID-vkCmdSetExclusiveScissorNV-offset-02039", |
| 4876 | "vkCmdSetExclusiveScissorNV: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 4877 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 4878 | scissor.offset.y, scissor.extent.height, y_sum, scissor_i); |
Jeff Bolz | 3e71f78 | 2018-08-29 23:15:45 -0500 | [diff] [blame] | 4879 | } |
| 4880 | } |
| 4881 | } |
| 4882 | |
| 4883 | return skip; |
| 4884 | } |
| 4885 | |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 4886 | bool StatelessValidation::manual_PreCallValidateCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, |
| 4887 | uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4888 | const VkViewportWScalingNV *pViewportWScalings) const { |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 4889 | bool skip = false; |
Shannon McPherson | 169d0c7 | 2020-11-13 18:48:19 -0700 | [diff] [blame] | 4890 | const uint64_t sum = static_cast<uint64_t>(firstViewport) + static_cast<uint64_t>(viewportCount); |
| 4891 | if ((sum < 1) || (sum > device_limits.maxViewports)) { |
| 4892 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportWScalingNV-firstViewport-01324", |
| 4893 | "vkCmdSetViewportWScalingNV: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 " = %" PRIu64 |
| 4894 | ") must be between 1 and VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 "), inculsive.", |
| 4895 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Chris Mayer | 9ded5eb | 2019-09-19 16:33:26 +0200 | [diff] [blame] | 4896 | } |
| 4897 | |
| 4898 | return skip; |
| 4899 | } |
| 4900 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4901 | bool StatelessValidation::manual_PreCallValidateCmdSetViewportShadingRatePaletteNV( |
| 4902 | VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4903 | const VkShadingRatePaletteNV *pShadingRatePalettes) const { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4904 | bool skip = false; |
| 4905 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4906 | if (!physical_device_features.multiViewport) { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4907 | if (firstViewport != 0) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 4908 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4909 | LogError(commandBuffer, "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02068", |
| 4910 | "vkCmdSetViewportShadingRatePaletteNV: The multiViewport feature is disabled, but firstViewport (=%" PRIu32 |
| 4911 | ") is not 0.", |
| 4912 | firstViewport); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4913 | } |
| 4914 | if (viewportCount > 1) { |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 4915 | skip |= |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4916 | LogError(commandBuffer, "VUID-vkCmdSetViewportShadingRatePaletteNV-viewportCount-02069", |
| 4917 | "vkCmdSetViewportShadingRatePaletteNV: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 |
| 4918 | ") is not 1.", |
| 4919 | viewportCount); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4920 | } |
| 4921 | } |
| 4922 | |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4923 | 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] | 4924 | if (sum > device_limits.maxViewports) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4925 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportShadingRatePaletteNV-firstViewport-02067", |
| 4926 | "vkCmdSetViewportShadingRatePaletteNV: firstViewport + viewportCount (=%" PRIu32 " + %" PRIu32 |
| 4927 | " = %" PRIu64 ") is greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 4928 | firstViewport, viewportCount, sum, device_limits.maxViewports); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4929 | } |
| 4930 | |
| 4931 | return skip; |
| 4932 | } |
| 4933 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4934 | bool StatelessValidation::manual_PreCallValidateCmdSetCoarseSampleOrderNV( |
| 4935 | VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, |
| 4936 | const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) const { |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4937 | bool skip = false; |
| 4938 | |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 4939 | if (sampleOrderType != VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV && customSampleOrderCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4940 | skip |= LogError(commandBuffer, "VUID-vkCmdSetCoarseSampleOrderNV-sampleOrderType-02081", |
| 4941 | "vkCmdSetCoarseSampleOrderNV: If sampleOrderType is not VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV, " |
| 4942 | "customSampleOrderCount must be 0."); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4943 | } |
| 4944 | |
| 4945 | for (uint32_t order_i = 0; order_i < customSampleOrderCount; ++order_i) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4946 | skip |= ValidateCoarseSampleOrderCustomNV(&pCustomSampleOrders[order_i]); |
Jeff Bolz | 9af91c5 | 2018-09-01 21:53:57 -0500 | [diff] [blame] | 4947 | } |
| 4948 | |
| 4949 | return skip; |
| 4950 | } |
| 4951 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4952 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4953 | uint32_t firstTask) const { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 4954 | bool skip = false; |
| 4955 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4956 | if (taskCount > phys_dev_ext_props.mesh_shader_props.maxDrawMeshTasksCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4957 | skip |= LogError( |
| 4958 | commandBuffer, "VUID-vkCmdDrawMeshTasksNV-taskCount-02119", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 4959 | "vkCmdDrawMeshTasksNV() parameter, uint32_t taskCount (0x%" PRIxLEAST32 |
| 4960 | "), must be less than or equal to VkPhysicalDeviceMeshShaderPropertiesNV::maxDrawMeshTasksCount (0x%" PRIxLEAST32 ").", |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4961 | taskCount, phys_dev_ext_props.mesh_shader_props.maxDrawMeshTasksCount); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 4962 | } |
| 4963 | |
| 4964 | return skip; |
| 4965 | } |
| 4966 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4967 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 4968 | VkDeviceSize offset, uint32_t drawCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 4969 | uint32_t stride) const { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 4970 | bool skip = false; |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 4971 | static const int condition_multiples = 0b0011; |
| 4972 | if (offset & condition_multiples) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4973 | skip |= LogError( |
| 4974 | commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectNV-offset-02710", |
Dave Houlton | 142c4cb | 2018-10-17 15:04:41 -0600 | [diff] [blame] | 4975 | "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] | 4976 | } |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 4977 | if (drawCount > 1 && ((stride & condition_multiples) || stride < sizeof(VkDrawMeshTasksIndirectCommandNV))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4978 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02146", |
| 4979 | "vkCmdDrawMeshTasksIndirectNV() parameter, uint32_t stride (0x%" PRIxLEAST32 |
| 4980 | "), is not a multiple of 4 or smaller than sizeof (VkDrawMeshTasksIndirectCommandNV).", |
| 4981 | stride); |
Locke | e1c2288 | 2019-06-10 16:02:54 -0600 | [diff] [blame] | 4982 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 4983 | if (!physical_device_features.multiDrawIndirect && ((drawCount > 1))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 4984 | skip |= LogError( |
| 4985 | commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02718", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4986 | "vkCmdDrawMeshTasksIndirectNV(): Device feature multiDrawIndirect disabled: count must be 0 or 1 but is %" PRIu32 "", |
| 4987 | drawCount); |
Jeff Bolz | b574c34 | 2018-11-08 15:36:57 -0600 | [diff] [blame] | 4988 | } |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 4989 | if (drawCount > device_limits.maxDrawIndirectCount) { |
| 4990 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02719", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 4991 | "vkCmdDrawMeshTasksIndirectNV: drawCount (%" PRIu32 |
| 4992 | ") is not less than or equal to the maximum allowed (%" PRIu32 ").", |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 4993 | drawCount, device_limits.maxDrawIndirectCount); |
Tony-LunarG | c0c3df5 | 2020-11-20 13:47:10 -0700 | [diff] [blame] | 4994 | } |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 4995 | return skip; |
| 4996 | } |
| 4997 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 4998 | bool StatelessValidation::manual_PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, |
| 4999 | VkDeviceSize offset, VkBuffer countBuffer, |
| 5000 | VkDeviceSize countBufferOffset, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5001 | uint32_t maxDrawCount, uint32_t stride) const { |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 5002 | bool skip = false; |
| 5003 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 5004 | if (offset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5005 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectCountNV-offset-02710", |
| 5006 | "vkCmdDrawMeshTasksIndirectCountNV() parameter, VkDeviceSize offset (0x%" PRIxLEAST64 |
| 5007 | "), is not a multiple of 4.", |
| 5008 | offset); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 5009 | } |
| 5010 | |
| 5011 | if (countBufferOffset & 3) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5012 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawMeshTasksIndirectCountNV-countBufferOffset-02716", |
| 5013 | "vkCmdDrawMeshTasksIndirectCountNV() parameter, VkDeviceSize countBufferOffset (0x%" PRIxLEAST64 |
| 5014 | "), is not a multiple of 4.", |
| 5015 | countBufferOffset); |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 5016 | } |
| 5017 | |
Jeff Bolz | 45bf7d6 | 2018-09-18 15:39:58 -0500 | [diff] [blame] | 5018 | return skip; |
| 5019 | } |
| 5020 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5021 | bool StatelessValidation::manual_PreCallValidateCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5022 | const VkAllocationCallbacks *pAllocator, |
| 5023 | VkQueryPool *pQueryPool) const { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5024 | bool skip = false; |
| 5025 | |
| 5026 | // Validation for parameters excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 5027 | if (pCreateInfo != nullptr) { |
| 5028 | // If queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, pipelineStatistics must be a valid combination of |
| 5029 | // VkQueryPipelineStatisticFlagBits values |
| 5030 | if ((pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) && (pCreateInfo->pipelineStatistics != 0) && |
| 5031 | ((pCreateInfo->pipelineStatistics & (~AllVkQueryPipelineStatisticFlagBits)) != 0)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5032 | skip |= LogError(device, "VUID-VkQueryPoolCreateInfo-queryType-00792", |
| 5033 | "vkCreateQueryPool(): if pCreateInfo->queryType is VK_QUERY_TYPE_PIPELINE_STATISTICS, " |
| 5034 | "pCreateInfo->pipelineStatistics must be a valid combination of VkQueryPipelineStatisticFlagBits " |
| 5035 | "values."); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5036 | } |
sfricke-samsung | 7d69d0d | 2020-04-25 10:27:27 -0700 | [diff] [blame] | 5037 | if (pCreateInfo->queryCount == 0) { |
| 5038 | skip |= LogError(device, "VUID-VkQueryPoolCreateInfo-queryCount-02763", |
| 5039 | "vkCreateQueryPool(): queryCount must be greater than zero."); |
| 5040 | } |
Mark Lobodzinski | b7a2638 | 2018-07-02 13:14:26 -0600 | [diff] [blame] | 5041 | } |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5042 | return skip; |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 5043 | } |
| 5044 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 5045 | bool StatelessValidation::manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 5046 | const char *pLayerName, uint32_t *pPropertyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5047 | VkExtensionProperties *pProperties) const { |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 5048 | return validate_array("vkEnumerateDeviceExtensionProperties", "pPropertyCount", "pProperties", pPropertyCount, &pProperties, |
| 5049 | true, false, false, kVUIDUndefined, "VUID-vkEnumerateDeviceExtensionProperties-pProperties-parameter"); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 5050 | } |
| 5051 | |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5052 | void StatelessValidation::PostCallRecordCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 5053 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 5054 | VkResult result) { |
| 5055 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5056 | RecordRenderPass(*pRenderPass, pCreateInfo); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 5057 | } |
| 5058 | |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5059 | void StatelessValidation::PostCallRecordCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 5060 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass, |
| 5061 | VkResult result) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5062 | // 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] | 5063 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5064 | RecordRenderPass(*pRenderPass, pCreateInfo); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 5065 | } |
| 5066 | |
Mark Lobodzinski | bf599b9 | 2018-12-31 12:15:55 -0700 | [diff] [blame] | 5067 | void StatelessValidation::PostCallRecordDestroyRenderPass(VkDevice device, VkRenderPass renderPass, |
| 5068 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5069 | // 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] | 5070 | std::unique_lock<std::mutex> lock(renderpass_map_mutex); |
Mark Lobodzinski | af7c038 | 2018-12-18 11:55:55 -0700 | [diff] [blame] | 5071 | renderpasses_states.erase(renderPass); |
Mark Lobodzinski | d495007 | 2017-08-01 13:02:20 -0600 | [diff] [blame] | 5072 | } |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 5073 | |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 5074 | void StatelessValidation::PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5075 | VkCommandBuffer *pCommandBuffers, VkResult result) { |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 5076 | if ((result == VK_SUCCESS) && pAllocateInfo && (pAllocateInfo->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY)) { |
| 5077 | auto lock = cb_write_lock(); |
| 5078 | for (uint32_t cb_index = 0; cb_index < pAllocateInfo->commandBufferCount; cb_index++) { |
Jeremy Gebben | fc6f815 | 2021-03-18 16:58:55 -0600 | [diff] [blame] | 5079 | secondary_cb_map.emplace(pCommandBuffers[cb_index], pAllocateInfo->commandPool); |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 5080 | } |
| 5081 | } |
| 5082 | } |
| 5083 | |
| 5084 | void StatelessValidation::PostCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5085 | const VkCommandBuffer *pCommandBuffers) { |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 5086 | auto lock = cb_write_lock(); |
| 5087 | for (uint32_t cb_index = 0; cb_index < commandBufferCount; cb_index++) { |
| 5088 | secondary_cb_map.erase(pCommandBuffers[cb_index]); |
| 5089 | } |
| 5090 | } |
| 5091 | |
| 5092 | void StatelessValidation::PostCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool, |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5093 | const VkAllocationCallbacks *pAllocator) { |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 5094 | auto lock = cb_write_lock(); |
| 5095 | for (auto item = secondary_cb_map.begin(); item != secondary_cb_map.end();) { |
| 5096 | if (item->second == commandPool) { |
| 5097 | item = secondary_cb_map.erase(item); |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5098 | } else { |
Tony-LunarG | 3c287f6 | 2020-12-17 12:39:49 -0700 | [diff] [blame] | 5099 | ++item; |
| 5100 | } |
| 5101 | } |
| 5102 | } |
| 5103 | |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 5104 | bool StatelessValidation::manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5105 | const VkAllocationCallbacks *pAllocator, |
| 5106 | VkDeviceMemory *pMemory) const { |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 5107 | bool skip = false; |
| 5108 | |
| 5109 | if (pAllocateInfo) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5110 | auto chained_prio_struct = LvlFindInChain<VkMemoryPriorityAllocateInfoEXT>(pAllocateInfo->pNext); |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 5111 | 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] | 5112 | skip |= LogError(device, "VUID-VkMemoryPriorityAllocateInfoEXT-priority-02602", |
| 5113 | "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] | 5114 | } |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5115 | |
| 5116 | VkMemoryAllocateFlags flags = 0; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5117 | auto flags_info = LvlFindInChain<VkMemoryAllocateFlagsInfo>(pAllocateInfo->pNext); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5118 | if (flags_info) { |
| 5119 | flags = flags_info->flags; |
| 5120 | } |
| 5121 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5122 | auto opaque_alloc_info = LvlFindInChain<VkMemoryOpaqueCaptureAddressAllocateInfo>(pAllocateInfo->pNext); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5123 | if (opaque_alloc_info && opaque_alloc_info->opaqueCaptureAddress != 0) { |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5124 | if (!(flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5125 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-opaqueCaptureAddress-03329", |
| 5126 | "If opaqueCaptureAddress is non-zero, VkMemoryAllocateFlagsInfo::flags must include " |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5127 | "VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5128 | } |
| 5129 | |
| 5130 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5131 | auto import_memory_win32_handle = LvlFindInChain<VkImportMemoryWin32HandleInfoKHR>(pAllocateInfo->pNext); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5132 | #endif |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5133 | auto import_memory_fd = LvlFindInChain<VkImportMemoryFdInfoKHR>(pAllocateInfo->pNext); |
| 5134 | auto import_memory_host_pointer = LvlFindInChain<VkImportMemoryHostPointerInfoEXT>(pAllocateInfo->pNext); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5135 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5136 | auto import_memory_ahb = LvlFindInChain<VkImportAndroidHardwareBufferInfoANDROID>(pAllocateInfo->pNext); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5137 | #endif |
| 5138 | |
| 5139 | if (import_memory_host_pointer) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5140 | skip |= LogError( |
| 5141 | device, "VUID-VkMemoryAllocateInfo-pNext-03332", |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5142 | "If the pNext chain includes a VkImportMemoryHostPointerInfoEXT structure, opaqueCaptureAddress must be zero."); |
| 5143 | } |
| 5144 | if ( |
| 5145 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5146 | (import_memory_win32_handle && import_memory_win32_handle->handleType) || |
| 5147 | #endif |
| 5148 | (import_memory_fd && import_memory_fd->handleType) || |
| 5149 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 5150 | (import_memory_ahb && import_memory_ahb->buffer) || |
| 5151 | #endif |
| 5152 | (import_memory_host_pointer && import_memory_host_pointer->handleType)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5153 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-opaqueCaptureAddress-03333", |
| 5154 | "If the parameters define an import operation, opaqueCaptureAddress must be zero."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5155 | } |
| 5156 | } |
| 5157 | |
ziga-lunarg | 1d5e11d | 2021-07-18 13:13:40 +0200 | [diff] [blame] | 5158 | auto export_memory = LvlFindInChain<VkExportMemoryAllocateInfo>(pAllocateInfo->pNext); |
| 5159 | if (export_memory) { |
| 5160 | auto export_memory_nv = LvlFindInChain<VkExportMemoryAllocateInfoNV>(pAllocateInfo->pNext); |
| 5161 | if (export_memory_nv) { |
| 5162 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-pNext-00640", |
| 5163 | "pNext chain of VkMemoryAllocateInfo includes both VkExportMemoryAllocateInfo and " |
| 5164 | "VkExportMemoryAllocateInfoNV"); |
| 5165 | } |
| 5166 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5167 | auto export_memory_win32_nv = LvlFindInChain<VkExportMemoryWin32HandleInfoNV>(pAllocateInfo->pNext); |
| 5168 | if (export_memory_win32_nv) { |
| 5169 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-pNext-00640", |
| 5170 | "pNext chain of VkMemoryAllocateInfo includes both VkExportMemoryAllocateInfo and " |
| 5171 | "VkExportMemoryWin32HandleInfoNV"); |
| 5172 | } |
| 5173 | #endif |
| 5174 | } |
| 5175 | |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5176 | if (flags) { |
Tony-LunarG | a74d3fe | 2019-11-22 15:43:20 -0700 | [diff] [blame] | 5177 | VkBool32 capture_replay = false; |
| 5178 | VkBool32 buffer_device_address = false; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5179 | const auto *vulkan_12_features = LvlFindInChain<VkPhysicalDeviceVulkan12Features>(device_createinfo_pnext); |
Tony-LunarG | a74d3fe | 2019-11-22 15:43:20 -0700 | [diff] [blame] | 5180 | if (vulkan_12_features) { |
| 5181 | capture_replay = vulkan_12_features->bufferDeviceAddressCaptureReplay; |
| 5182 | buffer_device_address = vulkan_12_features->bufferDeviceAddress; |
| 5183 | } else { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5184 | const auto *bda_features = LvlFindInChain<VkPhysicalDeviceBufferDeviceAddressFeatures>(device_createinfo_pnext); |
Tony-LunarG | a74d3fe | 2019-11-22 15:43:20 -0700 | [diff] [blame] | 5185 | if (bda_features) { |
| 5186 | capture_replay = bda_features->bufferDeviceAddressCaptureReplay; |
| 5187 | buffer_device_address = bda_features->bufferDeviceAddress; |
| 5188 | } |
| 5189 | } |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5190 | if ((flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT) && !capture_replay) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5191 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-flags-03330", |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5192 | "If VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT is set, " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5193 | "bufferDeviceAddressCaptureReplay must be enabled."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5194 | } |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5195 | if ((flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT) && !buffer_device_address) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5196 | skip |= LogError(device, "VUID-VkMemoryAllocateInfo-flags-03331", |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5197 | "If VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT is set, bufferDeviceAddress must be enabled."); |
Jeff Bolz | 4563f2a | 2019-12-10 13:30:30 -0600 | [diff] [blame] | 5198 | } |
| 5199 | } |
Jeff Bolz | 7e7e6e0 | 2019-01-11 22:53:41 -0600 | [diff] [blame] | 5200 | } |
| 5201 | return skip; |
| 5202 | } |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 5203 | |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5204 | bool StatelessValidation::ValidateGeometryTrianglesNV(const VkGeometryTrianglesNV &triangles, |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5205 | VkAccelerationStructureNV object_handle, const char *func_name) const { |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5206 | bool skip = false; |
| 5207 | |
| 5208 | if (triangles.vertexFormat != VK_FORMAT_R32G32B32_SFLOAT && triangles.vertexFormat != VK_FORMAT_R16G16B16_SFLOAT && |
| 5209 | triangles.vertexFormat != VK_FORMAT_R16G16B16_SNORM && triangles.vertexFormat != VK_FORMAT_R32G32_SFLOAT && |
| 5210 | triangles.vertexFormat != VK_FORMAT_R16G16_SFLOAT && triangles.vertexFormat != VK_FORMAT_R16G16_SNORM) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5211 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-vertexFormat-02430", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5212 | } else { |
| 5213 | uint32_t vertex_component_size = 0; |
| 5214 | if (triangles.vertexFormat == VK_FORMAT_R32G32B32_SFLOAT || triangles.vertexFormat == VK_FORMAT_R32G32_SFLOAT) { |
| 5215 | vertex_component_size = 4; |
| 5216 | } else if (triangles.vertexFormat == VK_FORMAT_R16G16B16_SFLOAT || triangles.vertexFormat == VK_FORMAT_R16G16B16_SNORM || |
| 5217 | triangles.vertexFormat == VK_FORMAT_R16G16_SFLOAT || triangles.vertexFormat == VK_FORMAT_R16G16_SNORM) { |
| 5218 | vertex_component_size = 2; |
| 5219 | } |
| 5220 | if (vertex_component_size > 0 && SafeModulo(triangles.vertexOffset, vertex_component_size) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5221 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-vertexOffset-02429", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5222 | } |
| 5223 | } |
| 5224 | |
| 5225 | if (triangles.indexType != VK_INDEX_TYPE_UINT32 && triangles.indexType != VK_INDEX_TYPE_UINT16 && |
| 5226 | triangles.indexType != VK_INDEX_TYPE_NONE_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5227 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexType-02433", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5228 | } else { |
| 5229 | uint32_t index_element_size = 0; |
| 5230 | if (triangles.indexType == VK_INDEX_TYPE_UINT32) { |
| 5231 | index_element_size = 4; |
| 5232 | } else if (triangles.indexType == VK_INDEX_TYPE_UINT16) { |
| 5233 | index_element_size = 2; |
| 5234 | } |
| 5235 | if (index_element_size > 0 && SafeModulo(triangles.indexOffset, index_element_size) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5236 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexOffset-02432", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5237 | } |
| 5238 | } |
| 5239 | if (triangles.indexType == VK_INDEX_TYPE_NONE_NV) { |
| 5240 | if (triangles.indexCount != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5241 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexCount-02436", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5242 | } |
| 5243 | if (triangles.indexData != VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5244 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-indexData-02434", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5245 | } |
| 5246 | } |
| 5247 | |
| 5248 | if (SafeModulo(triangles.transformOffset, 16) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5249 | skip |= LogError(object_handle, "VUID-VkGeometryTrianglesNV-transformOffset-02438", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5250 | } |
| 5251 | |
| 5252 | return skip; |
| 5253 | } |
| 5254 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5255 | bool StatelessValidation::ValidateGeometryAABBNV(const VkGeometryAABBNV &aabbs, VkAccelerationStructureNV object_handle, |
| 5256 | const char *func_name) const { |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5257 | bool skip = false; |
| 5258 | |
| 5259 | if (SafeModulo(aabbs.offset, 8) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5260 | skip |= LogError(object_handle, "VUID-VkGeometryAABBNV-offset-02440", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5261 | } |
| 5262 | if (SafeModulo(aabbs.stride, 8) != 0) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5263 | skip |= LogError(object_handle, "VUID-VkGeometryAABBNV-stride-02441", "%s", func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5264 | } |
| 5265 | |
| 5266 | return skip; |
| 5267 | } |
| 5268 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5269 | bool StatelessValidation::ValidateGeometryNV(const VkGeometryNV &geometry, VkAccelerationStructureNV object_handle, |
| 5270 | const char *func_name) const { |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5271 | bool skip = false; |
| 5272 | if (geometry.geometryType == VK_GEOMETRY_TYPE_TRIANGLES_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5273 | skip = ValidateGeometryTrianglesNV(geometry.geometry.triangles, object_handle, func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5274 | } else if (geometry.geometryType == VK_GEOMETRY_TYPE_AABBS_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5275 | skip = ValidateGeometryAABBNV(geometry.geometry.aabbs, object_handle, func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5276 | } |
| 5277 | return skip; |
| 5278 | } |
| 5279 | |
| 5280 | bool StatelessValidation::ValidateAccelerationStructureInfoNV(const VkAccelerationStructureInfoNV &info, |
sourav parmar | a24fb7b | 2020-05-26 10:50:04 -0700 | [diff] [blame] | 5281 | VkAccelerationStructureNV object_handle, const char *func_name, |
Mark Lobodzinski | 17dc460 | 2020-05-29 07:48:40 -0600 | [diff] [blame] | 5282 | bool is_cmd) const { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5283 | bool skip = false; |
| 5284 | 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] | 5285 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-type-02425", |
| 5286 | "VkAccelerationStructureInfoNV: If type is VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV then " |
| 5287 | "geometryCount must be 0."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5288 | } |
| 5289 | 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] | 5290 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-type-02426", |
| 5291 | "VkAccelerationStructureInfoNV: If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV then " |
| 5292 | "instanceCount must be 0."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5293 | } |
ziga-lunarg | 10309ee | 2021-08-02 13:11:21 +0200 | [diff] [blame] | 5294 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR) { |
| 5295 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-type-04623", |
| 5296 | "VkAccelerationStructureInfoNV: type is invalid VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR."); |
| 5297 | } |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5298 | if (info.flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV && |
| 5299 | info.flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5300 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-flags-02592", |
| 5301 | "VkAccelerationStructureInfoNV: If flags has the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV" |
| 5302 | "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] | 5303 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5304 | if (info.geometryCount > phys_dev_ext_props.ray_tracing_propsNV.maxGeometryCount) { |
sourav parmar | a24fb7b | 2020-05-26 10:50:04 -0700 | [diff] [blame] | 5305 | skip |= LogError(object_handle, |
Mark Lobodzinski | 17dc460 | 2020-05-29 07:48:40 -0600 | [diff] [blame] | 5306 | is_cmd ? "VUID-vkCmdBuildAccelerationStructureNV-geometryCount-02241" |
| 5307 | : "VUID-VkAccelerationStructureInfoNV-geometryCount-02422", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5308 | "VkAccelerationStructureInfoNV: geometryCount must be less than or equal to " |
| 5309 | "VkPhysicalDeviceRayTracingPropertiesNV::maxGeometryCount."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5310 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5311 | if (info.instanceCount > phys_dev_ext_props.ray_tracing_propsNV.maxInstanceCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5312 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-instanceCount-02423", |
| 5313 | "VkAccelerationStructureInfoNV: instanceCount must be less than or equal to " |
| 5314 | "VkPhysicalDeviceRayTracingPropertiesNV::maxInstanceCount."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5315 | } |
Jason Macnak | 21ba97e | 2019-08-09 12:57:44 -0700 | [diff] [blame] | 5316 | 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] | 5317 | uint64_t total_triangle_count = 0; |
| 5318 | for (uint32_t i = 0; i < info.geometryCount; i++) { |
| 5319 | const VkGeometryNV &geometry = info.pGeometries[i]; |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5320 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5321 | skip |= ValidateGeometryNV(geometry, object_handle, func_name); |
Jason Macnak | 192fa0e | 2019-07-26 15:07:16 -0700 | [diff] [blame] | 5322 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5323 | if (geometry.geometryType != VK_GEOMETRY_TYPE_TRIANGLES_NV) { |
| 5324 | continue; |
| 5325 | } |
| 5326 | total_triangle_count += geometry.geometry.triangles.indexCount / 3; |
| 5327 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5328 | if (total_triangle_count > phys_dev_ext_props.ray_tracing_propsNV.maxTriangleCount) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5329 | skip |= LogError(object_handle, "VUID-VkAccelerationStructureInfoNV-maxTriangleCount-02424", |
| 5330 | "VkAccelerationStructureInfoNV: The total number of triangles in all geometries must be less than " |
| 5331 | "or equal to VkPhysicalDeviceRayTracingPropertiesNV::maxTriangleCount."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5332 | } |
| 5333 | } |
Jason Macnak | 21ba97e | 2019-08-09 12:57:44 -0700 | [diff] [blame] | 5334 | if (info.type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV && info.geometryCount > 1) { |
| 5335 | const VkGeometryTypeNV first_geometry_type = info.pGeometries[0].geometryType; |
| 5336 | for (uint32_t i = 1; i < info.geometryCount; i++) { |
| 5337 | const VkGeometryNV &geometry = info.pGeometries[i]; |
| 5338 | if (geometry.geometryType != first_geometry_type) { |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5339 | skip |= LogError(device, "VUID-VkAccelerationStructureInfoNV-type-02786", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 5340 | "VkAccelerationStructureInfoNV: info.pGeometries[%" PRIu32 |
| 5341 | "].geometryType does not match " |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5342 | "info.pGeometries[0].geometryType.", |
| 5343 | i); |
Jason Macnak | 21ba97e | 2019-08-09 12:57:44 -0700 | [diff] [blame] | 5344 | } |
| 5345 | } |
| 5346 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5347 | for (uint32_t geometry_index = 0; geometry_index < info.geometryCount; ++geometry_index) { |
| 5348 | if (!(info.pGeometries[geometry_index].geometryType == VK_GEOMETRY_TYPE_TRIANGLES_NV || |
| 5349 | info.pGeometries[geometry_index].geometryType == VK_GEOMETRY_TYPE_AABBS_NV)) { |
| 5350 | skip |= LogError(device, "VUID-VkGeometryNV-geometryType-03503", |
| 5351 | "VkGeometryNV: geometryType must be VK_GEOMETRY_TYPE_TRIANGLES_NV" |
| 5352 | "or VK_GEOMETRY_TYPE_AABBS_NV."); |
| 5353 | } |
| 5354 | } |
| 5355 | skip |= |
| 5356 | validate_flags(func_name, "info.flags", "VkBuildAccelerationStructureFlagBitsNV", AllVkBuildAccelerationStructureFlagBitsNV, |
Shannon McPherson | 93970b1 | 2020-06-12 14:34:35 -0600 | [diff] [blame] | 5357 | info.flags, kOptionalFlags, "VUID-VkAccelerationStructureInfoNV-flags-parameter"); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5358 | return skip; |
| 5359 | } |
| 5360 | |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 5361 | bool StatelessValidation::manual_PreCallValidateCreateAccelerationStructureNV( |
| 5362 | VkDevice device, const VkAccelerationStructureCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5363 | VkAccelerationStructureNV *pAccelerationStructure) const { |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 5364 | bool skip = false; |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 5365 | if (pCreateInfo) { |
| 5366 | if ((pCreateInfo->compactedSize != 0) && |
| 5367 | ((pCreateInfo->info.geometryCount != 0) || (pCreateInfo->info.instanceCount != 0))) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5368 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoNV-compactedSize-02421", |
| 5369 | "vkCreateAccelerationStructureNV(): pCreateInfo->compactedSize nonzero (%" PRIu64 |
| 5370 | ") with info.geometryCount (%" PRIu32 ") or info.instanceCount (%" PRIu32 ") nonzero.", |
| 5371 | pCreateInfo->compactedSize, pCreateInfo->info.geometryCount, pCreateInfo->info.instanceCount); |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 5372 | } |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5373 | |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5374 | skip |= ValidateAccelerationStructureInfoNV(pCreateInfo->info, VkAccelerationStructureNV(0), |
sourav parmar | a24fb7b | 2020-05-26 10:50:04 -0700 | [diff] [blame] | 5375 | "vkCreateAccelerationStructureNV()", false); |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 5376 | } |
Ricardo Garcia | a493597 | 2019-02-21 17:43:18 +0100 | [diff] [blame] | 5377 | return skip; |
| 5378 | } |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5379 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5380 | bool StatelessValidation::manual_PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, |
| 5381 | const VkAccelerationStructureInfoNV *pInfo, |
| 5382 | VkBuffer instanceData, VkDeviceSize instanceOffset, |
| 5383 | VkBool32 update, VkAccelerationStructureNV dst, |
| 5384 | VkAccelerationStructureNV src, VkBuffer scratch, |
| 5385 | VkDeviceSize scratchOffset) const { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5386 | bool skip = false; |
| 5387 | |
| 5388 | if (pInfo != nullptr) { |
sourav parmar | a24fb7b | 2020-05-26 10:50:04 -0700 | [diff] [blame] | 5389 | skip |= ValidateAccelerationStructureInfoNV(*pInfo, dst, "vkCmdBuildAccelerationStructureNV()", true); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5390 | } |
| 5391 | |
| 5392 | return skip; |
| 5393 | } |
| 5394 | |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5395 | bool StatelessValidation::manual_PreCallValidateCreateAccelerationStructureKHR( |
| 5396 | VkDevice device, const VkAccelerationStructureCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 5397 | VkAccelerationStructureKHR *pAccelerationStructure) const { |
| 5398 | bool skip = false; |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5399 | const auto *acceleration_structure_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5400 | LvlFindInChain<VkPhysicalDeviceAccelerationStructureFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5401 | if (!acceleration_structure_features || |
| 5402 | (acceleration_structure_features && acceleration_structure_features->accelerationStructure == VK_FALSE)) { |
| 5403 | skip |= LogError(device, "VUID-vkCreateAccelerationStructureKHR-accelerationStructure-03611", |
| 5404 | "vkCreateAccelerationStructureKHR(): The accelerationStructure feature must be enabled"); |
| 5405 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5406 | if (pCreateInfo) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5407 | if (pCreateInfo->createFlags & VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR && |
| 5408 | (!acceleration_structure_features || |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5409 | (acceleration_structure_features && |
| 5410 | acceleration_structure_features->accelerationStructureCaptureReplay == VK_FALSE))) { |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5411 | skip |= |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5412 | LogError(device, "VUID-VkAccelerationStructureCreateInfoKHR-createFlags-03613", |
| 5413 | "vkCreateAccelerationStructureKHR(): If createFlags includes " |
| 5414 | "VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR, " |
| 5415 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureCaptureReplay must be VK_TRUE"); |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5416 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5417 | if (pCreateInfo->deviceAddress && |
| 5418 | !(pCreateInfo->createFlags & VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR)) { |
| 5419 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoKHR-deviceAddress-03612", |
| 5420 | "vkCreateAccelerationStructureKHR(): If deviceAddress is not zero, createFlags must include " |
| 5421 | "VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR"); |
| 5422 | } |
ziga-lunarg | 8ddbe46 | 2021-09-06 16:14:17 +0200 | [diff] [blame] | 5423 | if (pCreateInfo->deviceAddress && (!acceleration_structure_features || |
| 5424 | (acceleration_structure_features && |
| 5425 | acceleration_structure_features->accelerationStructureCaptureReplay == VK_FALSE))) { |
| 5426 | skip |= LogError( |
| 5427 | device, "VUID-vkCreateAccelerationStructureKHR-deviceAddress-03488", |
| 5428 | "VkAccelerationStructureCreateInfoKHR(): VkAccelerationStructureCreateInfoKHR::deviceAddress is not zero, but " |
| 5429 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureCaptureReplay is not enabled."); |
| 5430 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5431 | if (SafeModulo(pCreateInfo->offset, 256) != 0) { |
| 5432 | skip |= LogError(device, "VUID-VkAccelerationStructureCreateInfoKHR-offset-03734", |
ziga-lunarg | 8ddbe46 | 2021-09-06 16:14:17 +0200 | [diff] [blame] | 5433 | "vkCreateAccelerationStructureKHR(): offset %" PRIu64 " must be a multiple of 256 bytes", |
| 5434 | pCreateInfo->offset); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5435 | } |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 5436 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5437 | return skip; |
| 5438 | } |
| 5439 | |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5440 | bool StatelessValidation::manual_PreCallValidateGetAccelerationStructureHandleNV(VkDevice device, |
| 5441 | VkAccelerationStructureNV accelerationStructure, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5442 | size_t dataSize, void *pData) const { |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5443 | bool skip = false; |
| 5444 | if (dataSize < 8) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5445 | skip = LogError(accelerationStructure, "VUID-vkGetAccelerationStructureHandleNV-dataSize-02240", |
| 5446 | "vkGetAccelerationStructureHandleNV(): dataSize must be greater than or equal to 8."); |
Jason Macnak | 5c95495 | 2019-07-09 15:46:12 -0700 | [diff] [blame] | 5447 | } |
| 5448 | return skip; |
| 5449 | } |
| 5450 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5451 | bool StatelessValidation::manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesNV( |
| 5452 | VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureNV *pAccelerationStructures, |
| 5453 | VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) const { |
| 5454 | bool skip = false; |
Mark Lobodzinski | c0df6b6 | 2021-01-08 12:34:11 -0700 | [diff] [blame] | 5455 | if (queryType != VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV) { |
Mike Schuchardt | 7b152fa | 2021-08-03 16:30:27 -0700 | [diff] [blame] | 5456 | skip |= LogError(device, "VUID-vkCmdWriteAccelerationStructuresPropertiesNV-queryType-06216", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5457 | "vkCmdWriteAccelerationStructuresPropertiesNV: queryType must be " |
Mark Lobodzinski | c0df6b6 | 2021-01-08 12:34:11 -0700 | [diff] [blame] | 5458 | "VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV."); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5459 | } |
| 5460 | return skip; |
| 5461 | } |
| 5462 | |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 5463 | bool StatelessValidation::manual_PreCallValidateCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, |
| 5464 | uint32_t createInfoCount, |
| 5465 | const VkRayTracingPipelineCreateInfoNV *pCreateInfos, |
| 5466 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5467 | VkPipeline *pPipelines) const { |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 5468 | bool skip = false; |
| 5469 | |
| 5470 | for (uint32_t i = 0; i < createInfoCount; i++) { |
ziga-lunarg | c634137 | 2021-07-28 12:57:42 +0200 | [diff] [blame] | 5471 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 5472 | std::stringstream msg; |
| 5473 | msg << "pCreateInfos[%" << i << "].pStages[%" << stage_index << "]"; |
| 5474 | ValidatePipelineShaderStageCreateInfo("vkCreateRayTracingPipelinesNV", msg.str().c_str(), &pCreateInfos[i].pStages[i]); |
| 5475 | } |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5476 | auto feedback_struct = LvlFindInChain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 5477 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 5478 | skip |= LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02969", |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5479 | "vkCreateRayTracingPipelinesNV(): in pCreateInfo[%" PRIu32 |
| 5480 | "], VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
| 5481 | "(=%" PRIu32 ") must equal VkRayTracingPipelineCreateInfoNV::stageCount(=%" PRIu32 ").", |
| 5482 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 5483 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5484 | |
| 5485 | const auto *pipeline_cache_contol_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5486 | LvlFindInChain<VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT>(device_createinfo_pnext); |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5487 | if (!pipeline_cache_contol_features || pipeline_cache_contol_features->pipelineCreationCacheControl == VK_FALSE) { |
| 5488 | if (pCreateInfos[i].flags & (VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT | |
| 5489 | VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT)) { |
| 5490 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-pipelineCreationCacheControl-02905", |
| 5491 | "vkCreateRayTracingPipelinesNV(): If the pipelineCreationCacheControl feature is not enabled," |
| 5492 | "flags must not include VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT or" |
| 5493 | "VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT."); |
| 5494 | } |
| 5495 | } |
| 5496 | |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5497 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV) { |
| 5498 | skip |= |
| 5499 | LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-02904", |
| 5500 | "vkCreateRayTracingPipelinesNV(): flags must not include VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV."); |
| 5501 | } |
| 5502 | if ((pCreateInfos[i].flags & VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV) && |
| 5503 | (pCreateInfos[i].flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT)) { |
| 5504 | skip |= |
| 5505 | LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-02957", |
| 5506 | "vkCreateRayTracingPipelinesNV(): flags must not include both VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV and" |
| 5507 | "VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT at the same time."); |
| 5508 | } |
| 5509 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 5510 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 5511 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
| 5512 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03423", |
| 5513 | "vkCreateRayTracingPipelinesNV parameter, pCreateInfos->basePipelineHandle, must be " |
| 5514 | "VK_NULL_HANDLE if pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag " |
| 5515 | "and pCreateInfos->basePipelineIndex is not -1."); |
| 5516 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 5517 | if (pCreateInfos[i].basePipelineIndex > static_cast<int32_t>(i)) { |
sourav parmar | a24fb7b | 2020-05-26 10:50:04 -0700 | [diff] [blame] | 5518 | skip |= |
| 5519 | LogError(device, "VUID-vkCreateRayTracingPipelinesNV-flags-03415", |
| 5520 | "vkCreateRayTracingPipelinesNV: If the flags member of any element of pCreateInfos contains the" |
| 5521 | "VK_PIPELINE_CREATE_DERIVATIVE_BIT flag, and the basePipelineIndex member of that same element" |
| 5522 | "is not -1, basePipelineIndex must be less than the index into pCreateInfos that corresponds to " |
| 5523 | "that element."); |
| 5524 | } |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5525 | } |
| 5526 | if (pCreateInfos[i].basePipelineHandle == VK_NULL_HANDLE) { |
David Neto | d9d7b76 | 2020-07-27 15:37:58 -0400 | [diff] [blame] | 5527 | if (static_cast<uint32_t>(pCreateInfos[i].basePipelineIndex) >= createInfoCount) { |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5528 | skip |= |
| 5529 | LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03422", |
| 5530 | "vkCreateRayTracingPipelinesNV if flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT and" |
| 5531 | "basePipelineHandle is VK_NULL_HANDLE, basePipelineIndex must be a valid index into the calling" |
| 5532 | "commands pCreateInfos parameter."); |
| 5533 | } |
| 5534 | } else { |
| 5535 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 5536 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03424", |
| 5537 | "vkCreateRayTracingPipelinesNV if flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT and" |
| 5538 | "basePipelineHandle is not VK_NULL_HANDLE, basePipelineIndex must be -1."); |
| 5539 | } |
| 5540 | } |
| 5541 | } |
| 5542 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR) { |
| 5543 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03456", |
| 5544 | "vkCreateRayTracingPipelinesNV: flags must not include VK_PIPELINE_CREATE_LIBRARY_BIT_KHR."); |
| 5545 | } |
| 5546 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR) { |
| 5547 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03458", |
| 5548 | "vkCreateRayTracingPipelinesNV: flags must not include " |
| 5549 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR."); |
| 5550 | } |
| 5551 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR) { |
| 5552 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03459", |
| 5553 | "vkCreateRayTracingPipelinesNV: flags must not include " |
| 5554 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR."); |
| 5555 | } |
| 5556 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR) { |
| 5557 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03460", |
| 5558 | "vkCreateRayTracingPipelinesNV: flags must not include " |
| 5559 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR."); |
| 5560 | } |
| 5561 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR) { |
| 5562 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03461", |
| 5563 | "vkCreateRayTracingPipelinesNV: flags must not include " |
| 5564 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR."); |
| 5565 | } |
| 5566 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR) { |
| 5567 | skip |= LogError( |
| 5568 | device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03462", |
| 5569 | "vkCreateRayTracingPipelinesNV: flags must not include VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR."); |
| 5570 | } |
| 5571 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR) { |
| 5572 | skip |= LogError( |
| 5573 | device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03463", |
| 5574 | "vkCreateRayTracingPipelinesNV: flags must not include VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR ."); |
| 5575 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5576 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR) { |
| 5577 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-03588", |
| 5578 | "vkCreateRayTracingPipelinesNV: flags must not include " |
| 5579 | "VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR."); |
| 5580 | } |
| 5581 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_DISPATCH_BASE) { |
| 5582 | skip |= LogError(device, "VUID-vkCreateRayTracingPipelinesNV-flags-03816", |
| 5583 | "vkCreateRayTracingPipelinesNV: flags must not contain the VK_PIPELINE_CREATE_DISPATCH_BASE flag."); |
| 5584 | } |
ziga-lunarg | dfffee4 | 2021-10-10 11:49:59 +0200 | [diff] [blame^] | 5585 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV) { |
| 5586 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoNV-flags-04948", |
| 5587 | "vkCreateRayTracingPipelinesNV: flags must not contain the " |
| 5588 | "VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV flag."); |
| 5589 | } |
Peter Chen | 8536639 | 2019-05-14 15:20:11 -0400 | [diff] [blame] | 5590 | } |
| 5591 | |
| 5592 | return skip; |
| 5593 | } |
| 5594 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5595 | bool StatelessValidation::manual_PreCallValidateCreateRayTracingPipelinesKHR( |
| 5596 | VkDevice device, VkDeferredOperationKHR deferredOperation, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 5597 | const VkRayTracingPipelineCreateInfoKHR *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) const { |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5598 | bool skip = false; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5599 | const auto *raytracing_features = LvlFindInChain<VkPhysicalDeviceRayTracingPipelineFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5600 | if (!raytracing_features || raytracing_features->rayTracingPipeline == VK_FALSE) { |
| 5601 | skip |= LogError(device, "VUID-vkCreateRayTracingPipelinesKHR-rayTracingPipeline-03586", |
| 5602 | "vkCreateRayTracingPipelinesKHR: The rayTracingPipeline feature must be enabled."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 5603 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5604 | for (uint32_t i = 0; i < createInfoCount; i++) { |
ziga-lunarg | c634137 | 2021-07-28 12:57:42 +0200 | [diff] [blame] | 5605 | for (uint32_t stage_index = 0; stage_index < pCreateInfos[i].stageCount; ++stage_index) { |
| 5606 | std::stringstream msg; |
| 5607 | msg << "pCreateInfos[%" << i << "].pStages[%" << stage_index << "]"; |
| 5608 | ValidatePipelineShaderStageCreateInfo("vkCreateRayTracingPipelinesKHR", msg.str().c_str(), |
| 5609 | &pCreateInfos[i].pStages[i]); |
| 5610 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5611 | if (!raytracing_features || (raytracing_features && raytracing_features->rayTraversalPrimitiveCulling == VK_FALSE)) { |
| 5612 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR) { |
| 5613 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-rayTraversalPrimitiveCulling-03596", |
| 5614 | "vkCreateRayTracingPipelinesKHR: If the rayTraversalPrimitiveCulling feature is not enabled, " |
| 5615 | "flags must not include VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR."); |
| 5616 | } |
| 5617 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR) { |
| 5618 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-rayTraversalPrimitiveCulling-03597", |
| 5619 | "vkCreateRayTracingPipelinesKHR: If the rayTraversalPrimitiveCulling feature is not enabled, " |
| 5620 | "flags must not include VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR."); |
| 5621 | } |
| 5622 | } |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5623 | auto feedback_struct = LvlFindInChain<VkPipelineCreationFeedbackCreateInfoEXT>(pCreateInfos[i].pNext); |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5624 | if ((feedback_struct != nullptr) && (feedback_struct->pipelineStageCreationFeedbackCount != pCreateInfos[i].stageCount)) { |
| 5625 | skip |= LogError(device, "VUID-VkPipelineCreationFeedbackCreateInfoEXT-pipelineStageCreationFeedbackCount-02670", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5626 | "vkCreateRayTracingPipelinesKHR: in pCreateInfo[%" PRIu32 |
| 5627 | "], When chained to VkRayTracingPipelineCreateInfoKHR, " |
| 5628 | "VkPipelineCreationFeedbackEXT::pipelineStageCreationFeedbackCount" |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5629 | "(=%" PRIu32 ") must equal VkRayTracingPipelineCreateInfoKHR::stageCount(=%" PRIu32 ").", |
| 5630 | i, feedback_struct->pipelineStageCreationFeedbackCount, pCreateInfos[i].stageCount); |
| 5631 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5632 | const auto *pipeline_cache_contol_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5633 | LvlFindInChain<VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT>(device_createinfo_pnext); |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5634 | if (!pipeline_cache_contol_features || pipeline_cache_contol_features->pipelineCreationCacheControl == VK_FALSE) { |
| 5635 | if (pCreateInfos[i].flags & (VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT | |
| 5636 | VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT)) { |
| 5637 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-pipelineCreationCacheControl-02905", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5638 | "vkCreateRayTracingPipelinesKHR: If the pipelineCreationCacheControl feature is not enabled," |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 5639 | "flags must not include VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT or" |
| 5640 | "VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT."); |
| 5641 | } |
| 5642 | } |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5643 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5644 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-02904", |
| 5645 | "vkCreateRayTracingPipelinesKHR: flags must not include VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV."); |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5646 | } |
| 5647 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR) { |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 5648 | if (pCreateInfos[i].pLibraryInterface == NULL) { |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5649 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-03465", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5650 | "vkCreateRayTracingPipelinesKHR: If flags includes VK_PIPELINE_CREATE_LIBRARY_BIT_KHR, " |
| 5651 | "pLibraryInterface must not be NULL."); |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 5652 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5653 | } |
| 5654 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_DISPATCH_BASE) { |
| 5655 | skip |= LogError(device, "VUID-vkCreateRayTracingPipelinesKHR-flags-03816", |
| 5656 | "vkCreateRayTracingPipelinesKHR: flags must not contain the VK_PIPELINE_CREATE_DISPATCH_BASE flag."); |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5657 | } |
| 5658 | for (uint32_t group_index = 0; group_index < pCreateInfos[i].groupCount; ++group_index) { |
| 5659 | if ((pCreateInfos[i].pGroups[group_index].type == VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR) || |
| 5660 | (pCreateInfos[i].pGroups[group_index].type == VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR)) { |
| 5661 | if ((pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR) && |
| 5662 | (pCreateInfos[i].pGroups[group_index].anyHitShader == VK_SHADER_UNUSED_KHR)) { |
| 5663 | skip |= LogError( |
| 5664 | device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-03470", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5665 | "vkCreateRayTracingPipelinesKHR: If flags includes " |
| 5666 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR," |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5667 | "for any element of pGroups with a type of VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR" |
| 5668 | "or VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR, the anyHitShader of that element " |
| 5669 | "must not be VK_SHADER_UNUSED_KHR"); |
| 5670 | } |
| 5671 | if ((pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR) && |
| 5672 | (pCreateInfos[i].pGroups[group_index].closestHitShader == VK_SHADER_UNUSED_KHR)) { |
| 5673 | skip |= LogError( |
| 5674 | device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-03471", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5675 | "vkCreateRayTracingPipelinesKHR: If flags includes " |
| 5676 | "VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR," |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5677 | "for any element of pGroups with a type of VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR" |
| 5678 | "or VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR, the closestHitShader of that " |
| 5679 | "element must not be VK_SHADER_UNUSED_KHR"); |
| 5680 | } |
| 5681 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5682 | if (raytracing_features && raytracing_features->rayTracingPipelineShaderGroupHandleCaptureReplay == VK_TRUE && |
| 5683 | pCreateInfos[i].pGroups[group_index].pShaderGroupCaptureReplayHandle) { |
| 5684 | if (!(pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR)) { |
| 5685 | skip |= LogError( |
| 5686 | device, "VUID-VkRayTracingPipelineCreateInfoKHR-rayTracingPipelineShaderGroupHandleCaptureReplay-03599", |
| 5687 | "vkCreateRayTracingPipelinesKHR: If " |
| 5688 | "VkPhysicalDeviceRayTracingPipelineFeaturesKHR::rayTracingPipelineShaderGroupHandleCaptureReplay is " |
| 5689 | "VK_TRUE and the pShaderGroupCaptureReplayHandle member of any element of pGroups is not NULL, flags must " |
| 5690 | "include VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR."); |
| 5691 | } |
| 5692 | } |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5693 | } |
| 5694 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT) { |
| 5695 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 5696 | if (pCreateInfos[i].basePipelineHandle != VK_NULL_HANDLE) { |
| 5697 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-03423", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5698 | "vkCreateRayTracingPipelinesKHR: parameter, pCreateInfos->basePipelineHandle, must be " |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5699 | "VK_NULL_HANDLE if pCreateInfos->flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT flag " |
| 5700 | "and pCreateInfos->basePipelineIndex is not -1."); |
| 5701 | } |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 5702 | if (pCreateInfos[i].basePipelineIndex > static_cast<int32_t>(i)) { |
sourav parmar | a24fb7b | 2020-05-26 10:50:04 -0700 | [diff] [blame] | 5703 | skip |= |
| 5704 | LogError(device, "VUID-vkCreateRayTracingPipelinesKHR-flags-03415", |
| 5705 | "vkCreateRayTracingPipelinesKHR: If the flags member of any element of pCreateInfos contains the" |
| 5706 | "VK_PIPELINE_CREATE_DERIVATIVE_BIT flag, and the basePipelineIndex member of that same element is" |
| 5707 | "not -1, basePipelineIndex must be less than the index into pCreateInfos that corresponds to that " |
| 5708 | "element."); |
| 5709 | } |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5710 | } |
| 5711 | if (pCreateInfos[i].basePipelineHandle == VK_NULL_HANDLE) { |
David Neto | d9d7b76 | 2020-07-27 15:37:58 -0400 | [diff] [blame] | 5712 | if (static_cast<uint32_t>(pCreateInfos[i].basePipelineIndex) >= createInfoCount) { |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5713 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-03422", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5714 | "vkCreateRayTracingPipelinesKHR: if flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT and" |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 5715 | "basePipelineHandle is VK_NULL_HANDLE, basePipelineIndex (%" PRId32 |
| 5716 | ") must be a valid into the calling" |
| 5717 | "commands pCreateInfos parameter %" PRIu32 ".", |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5718 | pCreateInfos[i].basePipelineIndex, createInfoCount); |
| 5719 | } |
| 5720 | } else { |
| 5721 | if (pCreateInfos[i].basePipelineIndex != -1) { |
| 5722 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-03424", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5723 | "vkCreateRayTracingPipelinesKHR: if flags contains the VK_PIPELINE_CREATE_DERIVATIVE_BIT and" |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5724 | "basePipelineHandle is not VK_NULL_HANDLE, basePipelineIndex must be -1."); |
| 5725 | } |
| 5726 | } |
| 5727 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5728 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR && |
| 5729 | (raytracing_features && raytracing_features->rayTracingPipelineShaderGroupHandleCaptureReplay == VK_FALSE)) { |
| 5730 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-flags-03598", |
| 5731 | "vkCreateRayTracingPipelinesKHR: If flags includes " |
| 5732 | "VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR, " |
| 5733 | "rayTracingPipelineShaderGroupHandleCaptureReplay must be enabled."); |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5734 | } |
| 5735 | bool library_enabled = IsExtEnabled(device_extensions.vk_khr_pipeline_library); |
| 5736 | if (!library_enabled && (pCreateInfos[i].pLibraryInfo || pCreateInfos[i].pLibraryInterface)) { |
| 5737 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-pLibraryInfo-03595", |
| 5738 | "vkCreateRayTracingPipelinesKHR: If the VK_KHR_pipeline_library extension is not enabled, " |
| 5739 | "pLibraryInfo and pLibraryInterface must be NULL."); |
| 5740 | } |
| 5741 | if (pCreateInfos[i].pLibraryInfo) { |
| 5742 | if (pCreateInfos[i].pLibraryInfo->libraryCount == 0) { |
| 5743 | if (pCreateInfos[i].stageCount == 0) { |
| 5744 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-pLibraryInfo-03600", |
| 5745 | "vkCreateRayTracingPipelinesKHR: If pLibraryInfo is not NULL and its libraryCount is 0, " |
| 5746 | "stageCount must not be 0."); |
| 5747 | } |
| 5748 | if (pCreateInfos[i].groupCount == 0) { |
| 5749 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-pLibraryInfo-03601", |
| 5750 | "vkCreateRayTracingPipelinesKHR: If pLibraryInfo is not NULL and its libraryCount is 0, " |
| 5751 | "groupCount must not be 0."); |
| 5752 | } |
| 5753 | } else { |
| 5754 | if (pCreateInfos[i].pLibraryInterface == NULL) { |
| 5755 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-pLibraryInfo-03590", |
| 5756 | "vkCreateRayTracingPipelinesKHR: If pLibraryInfo is not NULL and its libraryCount member " |
| 5757 | "is greater than 0, its " |
| 5758 | "pLibraryInterface member must not be NULL."); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5759 | } |
| 5760 | } |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5761 | } |
| 5762 | if (pCreateInfos[i].pLibraryInterface) { |
| 5763 | if (pCreateInfos[i].pLibraryInterface->maxPipelineRayHitAttributeSize > |
| 5764 | phys_dev_ext_props.ray_tracing_propsKHR.maxRayHitAttributeSize) { |
| 5765 | skip |= LogError(device, "VUID-VkRayTracingPipelineInterfaceCreateInfoKHR-maxPipelineRayHitAttributeSize-03605", |
| 5766 | "vkCreateRayTracingPipelinesKHR: maxPipelineRayHitAttributeSize must be less than or equal to " |
| 5767 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxRayHitAttributeSize."); |
| 5768 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 5769 | } |
| 5770 | if (deferredOperation != VK_NULL_HANDLE) { |
| 5771 | if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT) { |
| 5772 | skip |= LogError(device, "VUID-vkCreateRayTracingPipelinesKHR-deferredOperation-03587", |
| 5773 | "vkCreateRayTracingPipelinesKHR: If deferredOperation is not VK_NULL_HANDLE, the flags member of " |
| 5774 | "elements of pCreateInfos must not include VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT."); |
sourav parmar | f4a7825 | 2020-04-10 13:04:21 -0700 | [diff] [blame] | 5775 | } |
| 5776 | } |
ziga-lunarg | dea7658 | 2021-09-17 14:38:08 +0200 | [diff] [blame] | 5777 | if (pCreateInfos[i].pDynamicState) { |
| 5778 | for (uint32_t j = 0; j < pCreateInfos[i].pDynamicState->dynamicStateCount; ++j) { |
| 5779 | if (pCreateInfos[i].pDynamicState->pDynamicStates[j] != VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR) { |
| 5780 | skip |= LogError(device, "VUID-VkRayTracingPipelineCreateInfoKHR-pDynamicStates-03602", |
| 5781 | "vkCreateRayTracingPipelinesKHR(): pCreateInfos[%" PRIu32 |
| 5782 | "].pDynamicState->pDynamicStates[%" PRIu32 "] is %s.", |
| 5783 | i, j, string_VkDynamicState(pCreateInfos[i].pDynamicState->pDynamicStates[j])); |
| 5784 | } |
| 5785 | } |
| 5786 | } |
Jeff Bolz | 443c2ca | 2020-03-19 12:11:51 -0500 | [diff] [blame] | 5787 | } |
| 5788 | |
| 5789 | return skip; |
| 5790 | } |
| 5791 | |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5792 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 5793 | bool StatelessValidation::PreCallValidateGetDeviceGroupSurfacePresentModes2EXT(VkDevice device, |
| 5794 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5795 | VkDeviceGroupPresentModeFlagsKHR *pModes) const { |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5796 | bool skip = false; |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 5797 | if (!IsExtEnabled(device_extensions.vk_khr_swapchain)) |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5798 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_SWAPCHAIN_EXTENSION_NAME); |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 5799 | if (!IsExtEnabled(device_extensions.vk_khr_get_surface_capabilities2)) |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5800 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME); |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 5801 | if (!IsExtEnabled(device_extensions.vk_khr_surface)) |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5802 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_SURFACE_EXTENSION_NAME); |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 5803 | if (!IsExtEnabled(device_extensions.vk_khr_get_physical_device_properties2)) |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5804 | skip |= |
| 5805 | OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); |
sfricke-samsung | 45996a4 | 2021-09-16 13:45:27 -0700 | [diff] [blame] | 5806 | if (!IsExtEnabled(device_extensions.vk_ext_full_screen_exclusive)) |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5807 | skip |= OutputExtensionError("vkGetDeviceGroupSurfacePresentModes2EXT", VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME); |
| 5808 | skip |= validate_struct_type( |
| 5809 | "vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo", "VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR", |
| 5810 | pSurfaceInfo, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR, true, |
| 5811 | "VUID-vkGetDeviceGroupSurfacePresentModes2EXT-pSurfaceInfo-parameter", "VUID-VkPhysicalDeviceSurfaceInfo2KHR-sType-sType"); |
| 5812 | if (pSurfaceInfo != NULL) { |
| 5813 | const VkStructureType allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR[] = { |
| 5814 | VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT, |
| 5815 | VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT}; |
| 5816 | |
| 5817 | skip |= validate_struct_pnext("vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo->pNext", |
| 5818 | "VkSurfaceFullScreenExclusiveInfoEXT, VkSurfaceFullScreenExclusiveWin32InfoEXT", |
| 5819 | pSurfaceInfo->pNext, ARRAY_SIZE(allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR), |
| 5820 | allowed_structs_VkPhysicalDeviceSurfaceInfo2KHR, GeneratedVulkanHeaderVersion, |
sfricke-samsung | 32a2736 | 2020-02-28 09:06:42 -0800 | [diff] [blame] | 5821 | "VUID-VkPhysicalDeviceSurfaceInfo2KHR-pNext-pNext", |
| 5822 | "VUID-VkPhysicalDeviceSurfaceInfo2KHR-sType-unique"); |
Mike Schuchardt | 21638df | 2019-03-16 10:52:02 -0700 | [diff] [blame] | 5823 | |
| 5824 | skip |= validate_required_handle("vkGetDeviceGroupSurfacePresentModes2EXT", "pSurfaceInfo->surface", pSurfaceInfo->surface); |
| 5825 | } |
| 5826 | return skip; |
| 5827 | } |
| 5828 | #endif |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 5829 | |
| 5830 | bool StatelessValidation::manual_PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
| 5831 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5832 | VkFramebuffer *pFramebuffer) const { |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 5833 | // Validation for pAttachments which is excluded from the generated validation code due to a 'noautovalidity' tag in vk.xml |
| 5834 | bool skip = false; |
Mike Schuchardt | 2df0891 | 2020-12-15 16:28:09 -0800 | [diff] [blame] | 5835 | if ((pCreateInfo->flags & VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT) == 0) { |
Tobias Hector | ebb855f | 2019-07-23 12:17:33 +0100 | [diff] [blame] | 5836 | skip |= validate_array("vkCreateFramebuffer", "attachmentCount", "pAttachments", pCreateInfo->attachmentCount, |
| 5837 | &pCreateInfo->pAttachments, false, true, kVUIDUndefined, kVUIDUndefined); |
| 5838 | } |
| 5839 | return skip; |
| 5840 | } |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 5841 | |
| 5842 | bool StatelessValidation::manual_PreCallValidateCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5843 | uint16_t lineStipplePattern) const { |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 5844 | bool skip = false; |
| 5845 | |
| 5846 | if (lineStippleFactor < 1 || lineStippleFactor > 256) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5847 | skip |= LogError(commandBuffer, "VUID-vkCmdSetLineStippleEXT-lineStippleFactor-02776", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 5848 | "vkCmdSetLineStippleEXT::lineStippleFactor=%" PRIu32 " is not in [1,256].", lineStippleFactor); |
Jeff Bolz | 8125a8b | 2019-08-16 16:29:45 -0500 | [diff] [blame] | 5849 | } |
| 5850 | |
| 5851 | return skip; |
| 5852 | } |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 5853 | |
| 5854 | bool StatelessValidation::manual_PreCallValidateCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5855 | VkDeviceSize offset, VkIndexType indexType) const { |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 5856 | bool skip = false; |
| 5857 | |
| 5858 | if (indexType == VK_INDEX_TYPE_NONE_NV) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5859 | skip |= LogError(commandBuffer, "VUID-vkCmdBindIndexBuffer-indexType-02507", |
| 5860 | "vkCmdBindIndexBuffer() indexType must not be VK_INDEX_TYPE_NONE_NV."); |
Piers Daniell | 8fd03f5 | 2019-08-21 12:07:53 -0600 | [diff] [blame] | 5861 | } |
| 5862 | |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5863 | const auto *index_type_uint8_features = LvlFindInChain<VkPhysicalDeviceIndexTypeUint8FeaturesEXT>(device_createinfo_pnext); |
Mark Lobodzinski | 804fde8 | 2020-05-08 07:49:25 -0600 | [diff] [blame] | 5864 | if (indexType == VK_INDEX_TYPE_UINT8_EXT && (!index_type_uint8_features || !index_type_uint8_features->indexTypeUint8)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5865 | skip |= LogError(commandBuffer, "VUID-vkCmdBindIndexBuffer-indexType-02765", |
| 5866 | "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] | 5867 | } |
| 5868 | |
| 5869 | return skip; |
| 5870 | } |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 5871 | |
sfricke-samsung | 4ada8d4 | 2020-02-09 17:43:11 -0800 | [diff] [blame] | 5872 | bool StatelessValidation::manual_PreCallValidateCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, |
| 5873 | uint32_t bindingCount, const VkBuffer *pBuffers, |
| 5874 | const VkDeviceSize *pOffsets) const { |
| 5875 | bool skip = false; |
| 5876 | if (firstBinding > device_limits.maxVertexInputBindings) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 5877 | skip |= |
| 5878 | LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers-firstBinding-00624", |
| 5879 | "vkCmdBindVertexBuffers() firstBinding (%" PRIu32 ") must be less than maxVertexInputBindings (%" PRIu32 ")", |
| 5880 | firstBinding, device_limits.maxVertexInputBindings); |
sfricke-samsung | 4ada8d4 | 2020-02-09 17:43:11 -0800 | [diff] [blame] | 5881 | } else if ((firstBinding + bindingCount) > device_limits.maxVertexInputBindings) { |
| 5882 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers-firstBinding-00625", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 5883 | "vkCmdBindVertexBuffers() sum of firstBinding (%" PRIu32 ") and bindingCount (%" PRIu32 |
| 5884 | ") must be less than " |
| 5885 | "maxVertexInputBindings (%" PRIu32 ")", |
sfricke-samsung | 4ada8d4 | 2020-02-09 17:43:11 -0800 | [diff] [blame] | 5886 | firstBinding, bindingCount, device_limits.maxVertexInputBindings); |
| 5887 | } |
| 5888 | |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 5889 | for (uint32_t i = 0; i < bindingCount; ++i) { |
| 5890 | if (pBuffers[i] == VK_NULL_HANDLE) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 5891 | const auto *robustness2_features = LvlFindInChain<VkPhysicalDeviceRobustness2FeaturesEXT>(device_createinfo_pnext); |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 5892 | if (!(robustness2_features && robustness2_features->nullDescriptor)) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 5893 | skip |= |
| 5894 | LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers-pBuffers-04001", |
| 5895 | "vkCmdBindVertexBuffers() required parameter pBuffers[%" PRIu32 "] specified as VK_NULL_HANDLE", i); |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 5896 | } else { |
| 5897 | if (pOffsets[i] != 0) { |
| 5898 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers-pBuffers-04002", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 5899 | "vkCmdBindVertexBuffers() pBuffers[%" PRIu32 "] is VK_NULL_HANDLE, but pOffsets[%" PRIu32 |
| 5900 | "] is not 0", |
| 5901 | i, i); |
Jeff Bolz | 165818a | 2020-05-08 11:19:03 -0500 | [diff] [blame] | 5902 | } |
| 5903 | } |
| 5904 | } |
| 5905 | } |
| 5906 | |
sfricke-samsung | 4ada8d4 | 2020-02-09 17:43:11 -0800 | [diff] [blame] | 5907 | return skip; |
| 5908 | } |
| 5909 | |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 5910 | bool StatelessValidation::manual_PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5911 | const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const { |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 5912 | bool skip = false; |
| 5913 | if (pNameInfo->objectType == VK_OBJECT_TYPE_UNKNOWN) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5914 | skip |= LogError(device, "VUID-VkDebugUtilsObjectNameInfoEXT-objectType-02589", |
| 5915 | "vkSetDebugUtilsObjectNameEXT() pNameInfo->objectType cannot be VK_OBJECT_TYPE_UNKNOWN."); |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 5916 | } |
| 5917 | return skip; |
| 5918 | } |
| 5919 | |
| 5920 | bool StatelessValidation::manual_PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 5921 | const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const { |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 5922 | bool skip = false; |
| 5923 | if (pTagInfo->objectType == VK_OBJECT_TYPE_UNKNOWN) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5924 | skip |= LogError(device, "VUID-VkDebugUtilsObjectTagInfoEXT-objectType-01908", |
| 5925 | "vkSetDebugUtilsObjectTagEXT() pTagInfo->objectType cannot be VK_OBJECT_TYPE_UNKNOWN."); |
Mark Lobodzinski | 8498840 | 2019-09-11 15:27:30 -0600 | [diff] [blame] | 5926 | } |
| 5927 | return skip; |
| 5928 | } |
Petr Kraus | 3d72039 | 2019-11-13 02:52:39 +0100 | [diff] [blame] | 5929 | |
| 5930 | bool StatelessValidation::manual_PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
| 5931 | VkSemaphore semaphore, VkFence fence, |
| 5932 | uint32_t *pImageIndex) const { |
| 5933 | bool skip = false; |
| 5934 | |
| 5935 | if (semaphore == VK_NULL_HANDLE && fence == VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5936 | skip |= LogError(swapchain, "VUID-vkAcquireNextImageKHR-semaphore-01780", |
| 5937 | "vkAcquireNextImageKHR: semaphore and fence are both VK_NULL_HANDLE."); |
Petr Kraus | 3d72039 | 2019-11-13 02:52:39 +0100 | [diff] [blame] | 5938 | } |
| 5939 | |
| 5940 | return skip; |
| 5941 | } |
| 5942 | |
| 5943 | bool StatelessValidation::manual_PreCallValidateAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, |
| 5944 | uint32_t *pImageIndex) const { |
| 5945 | bool skip = false; |
| 5946 | |
| 5947 | if (pAcquireInfo->semaphore == VK_NULL_HANDLE && pAcquireInfo->fence == VK_NULL_HANDLE) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 5948 | skip |= LogError(pAcquireInfo->swapchain, "VUID-VkAcquireNextImageInfoKHR-semaphore-01782", |
| 5949 | "vkAcquireNextImage2KHR: pAcquireInfo->semaphore and pAcquireInfo->fence are both VK_NULL_HANDLE."); |
Petr Kraus | 3d72039 | 2019-11-13 02:52:39 +0100 | [diff] [blame] | 5950 | } |
| 5951 | |
| 5952 | return skip; |
| 5953 | } |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 5954 | |
Jeremy Hayes | 9bda85a | 2020-05-21 16:36:17 -0600 | [diff] [blame] | 5955 | bool StatelessValidation::manual_PreCallValidateCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, |
| 5956 | uint32_t firstBinding, uint32_t bindingCount, |
| 5957 | const VkBuffer *pBuffers, |
| 5958 | const VkDeviceSize *pOffsets, |
| 5959 | const VkDeviceSize *pSizes) const { |
| 5960 | bool skip = false; |
| 5961 | |
| 5962 | char const *const cmd_name = "CmdBindTransformFeedbackBuffersEXT"; |
| 5963 | for (uint32_t i = 0; i < bindingCount; ++i) { |
| 5964 | if (pOffsets[i] & 3) { |
| 5965 | skip |= LogError(commandBuffer, "VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-02359", |
| 5966 | "%s: pOffsets[%" PRIu32 "](0x%" PRIxLEAST64 ") is not a multiple of 4.", cmd_name, i, pOffsets[i]); |
| 5967 | } |
| 5968 | } |
| 5969 | |
| 5970 | if (firstBinding >= phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers) { |
| 5971 | skip |= LogError(commandBuffer, "VUID-vkCmdBindTransformFeedbackBuffersEXT-firstBinding-02356", |
| 5972 | "%s: The firstBinding(%" PRIu32 |
| 5973 | ") index is greater than or equal to " |
| 5974 | "VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers(%" PRIu32 ").", |
| 5975 | cmd_name, firstBinding, phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers); |
| 5976 | } |
| 5977 | |
| 5978 | if (firstBinding + bindingCount > phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers) { |
| 5979 | skip |= |
| 5980 | LogError(commandBuffer, "VUID-vkCmdBindTransformFeedbackBuffersEXT-firstBinding-02357", |
| 5981 | "%s: The sum of firstBinding(%" PRIu32 ") and bindCount(%" PRIu32 |
| 5982 | ") is greater than VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers(%" PRIu32 ").", |
| 5983 | cmd_name, firstBinding, bindingCount, phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers); |
| 5984 | } |
| 5985 | |
| 5986 | for (uint32_t i = 0; i < bindingCount; ++i) { |
| 5987 | // pSizes is optional and may be nullptr. |
| 5988 | if (pSizes != nullptr) { |
| 5989 | if (pSizes[i] != VK_WHOLE_SIZE && |
| 5990 | pSizes[i] > phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBufferSize) { |
| 5991 | skip |= LogError(commandBuffer, "VUID-vkCmdBindTransformFeedbackBuffersEXT-pSize-02361", |
| 5992 | "%s: pSizes[%" PRIu32 "] (0x%" PRIxLEAST64 |
| 5993 | ") is not VK_WHOLE_SIZE and is greater than " |
| 5994 | "VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBufferSize.", |
| 5995 | cmd_name, i, pSizes[i]); |
| 5996 | } |
| 5997 | } |
| 5998 | } |
| 5999 | |
| 6000 | return skip; |
| 6001 | } |
| 6002 | |
| 6003 | bool StatelessValidation::manual_PreCallValidateCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, |
| 6004 | uint32_t firstCounterBuffer, |
| 6005 | uint32_t counterBufferCount, |
| 6006 | const VkBuffer *pCounterBuffers, |
| 6007 | const VkDeviceSize *pCounterBufferOffsets) const { |
| 6008 | bool skip = false; |
| 6009 | |
| 6010 | char const *const cmd_name = "CmdBeginTransformFeedbackEXT"; |
| 6011 | if (firstCounterBuffer >= phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers) { |
| 6012 | skip |= LogError(commandBuffer, "VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02368", |
| 6013 | "%s: The firstCounterBuffer(%" PRIu32 |
| 6014 | ") index is greater than or equal to " |
| 6015 | "VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers(%" PRIu32 ").", |
| 6016 | cmd_name, firstCounterBuffer, phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers); |
| 6017 | } |
| 6018 | |
| 6019 | if (firstCounterBuffer + counterBufferCount > phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers) { |
| 6020 | skip |= |
| 6021 | LogError(commandBuffer, "VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02369", |
| 6022 | "%s: The sum of firstCounterBuffer(%" PRIu32 ") and counterBufferCount(%" PRIu32 |
| 6023 | ") is greater than VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers(%" PRIu32 ").", |
| 6024 | cmd_name, firstCounterBuffer, counterBufferCount, |
| 6025 | phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers); |
| 6026 | } |
| 6027 | |
| 6028 | return skip; |
| 6029 | } |
| 6030 | |
| 6031 | bool StatelessValidation::manual_PreCallValidateCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, |
| 6032 | uint32_t firstCounterBuffer, uint32_t counterBufferCount, |
| 6033 | const VkBuffer *pCounterBuffers, |
| 6034 | const VkDeviceSize *pCounterBufferOffsets) const { |
| 6035 | bool skip = false; |
| 6036 | |
| 6037 | char const *const cmd_name = "CmdEndTransformFeedbackEXT"; |
| 6038 | if (firstCounterBuffer >= phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers) { |
| 6039 | skip |= LogError(commandBuffer, "VUID-vkCmdEndTransformFeedbackEXT-firstCounterBuffer-02376", |
| 6040 | "%s: The firstCounterBuffer(%" PRIu32 |
| 6041 | ") index is greater than or equal to " |
| 6042 | "VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers(%" PRIu32 ").", |
| 6043 | cmd_name, firstCounterBuffer, phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers); |
| 6044 | } |
| 6045 | |
| 6046 | if (firstCounterBuffer + counterBufferCount > phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers) { |
| 6047 | skip |= |
| 6048 | LogError(commandBuffer, "VUID-vkCmdEndTransformFeedbackEXT-firstCounterBuffer-02377", |
| 6049 | "%s: The sum of firstCounterBuffer(%" PRIu32 ") and counterBufferCount(%" PRIu32 |
| 6050 | ") is greater than VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers(%" PRIu32 ").", |
| 6051 | cmd_name, firstCounterBuffer, counterBufferCount, |
| 6052 | phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBuffers); |
| 6053 | } |
| 6054 | |
| 6055 | return skip; |
| 6056 | } |
| 6057 | |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 6058 | bool StatelessValidation::manual_PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, |
| 6059 | uint32_t firstInstance, VkBuffer counterBuffer, |
| 6060 | VkDeviceSize counterBufferOffset, |
| 6061 | uint32_t counterOffset, uint32_t vertexStride) const { |
| 6062 | bool skip = false; |
| 6063 | |
| 6064 | if ((vertexStride <= 0) || (vertexStride > phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBufferDataStride)) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 6065 | skip |= LogError(counterBuffer, "VUID-vkCmdDrawIndirectByteCountEXT-vertexStride-02289", |
| 6066 | "vkCmdDrawIndirectByteCountEXT: vertexStride (%" PRIu32 |
| 6067 | ") must be between 0 and maxTransformFeedbackBufferDataStride (%" PRIu32 ").", |
| 6068 | vertexStride, phys_dev_ext_props.transform_feedback_props.maxTransformFeedbackBufferDataStride); |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 6069 | } |
| 6070 | |
sfricke-samsung | d5e9adb | 2020-10-26 03:59:29 -0700 | [diff] [blame] | 6071 | if ((counterOffset % 4) != 0) { |
sfricke-samsung | 6886c4b | 2021-01-16 08:37:35 -0800 | [diff] [blame] | 6072 | skip |= LogError(commandBuffer, "VUID-vkCmdDrawIndirectByteCountEXT-counterBufferOffset-04568", |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 6073 | "vkCmdDrawIndirectByteCountEXT(): offset (%" PRIu32 ") must be a multiple of 4.", counterOffset); |
sfricke-samsung | d5e9adb | 2020-10-26 03:59:29 -0700 | [diff] [blame] | 6074 | } |
| 6075 | |
Mark Lobodzinski | 953b7bc | 2019-12-19 13:50:10 -0700 | [diff] [blame] | 6076 | return skip; |
| 6077 | } |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 6078 | |
| 6079 | bool StatelessValidation::ValidateCreateSamplerYcbcrConversion(VkDevice device, |
| 6080 | const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, |
| 6081 | const VkAllocationCallbacks *pAllocator, |
| 6082 | VkSamplerYcbcrConversion *pYcbcrConversion, |
| 6083 | const char *apiName) const { |
| 6084 | bool skip = false; |
| 6085 | |
| 6086 | // Check samplerYcbcrConversion feature is set |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6087 | const auto *ycbcr_features = LvlFindInChain<VkPhysicalDeviceSamplerYcbcrConversionFeatures>(device_createinfo_pnext); |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 6088 | if ((ycbcr_features == nullptr) || (ycbcr_features->samplerYcbcrConversion == VK_FALSE)) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6089 | const auto *vulkan_11_features = LvlFindInChain<VkPhysicalDeviceVulkan11Features>(device_createinfo_pnext); |
Ricardo Garcia | 3a34ffb | 2020-06-24 09:36:18 +0200 | [diff] [blame] | 6090 | if ((vulkan_11_features == nullptr) || (vulkan_11_features->samplerYcbcrConversion == VK_FALSE)) { |
| 6091 | skip |= LogError(device, "VUID-vkCreateSamplerYcbcrConversion-None-01648", |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6092 | "%s: samplerYcbcrConversion must be enabled.", apiName); |
Ricardo Garcia | 3a34ffb | 2020-06-24 09:36:18 +0200 | [diff] [blame] | 6093 | } |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 6094 | } |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6095 | |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6096 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6097 | const VkExternalFormatANDROID *external_format_android = LvlFindInChain<VkExternalFormatANDROID>(pCreateInfo); |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 6098 | const bool is_external_format = external_format_android != nullptr && external_format_android->externalFormat != 0; |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6099 | #else |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 6100 | const bool is_external_format = false; |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6101 | #endif |
| 6102 | |
sfricke-samsung | 1a72f94 | 2020-07-25 12:09:18 -0700 | [diff] [blame] | 6103 | const VkFormat format = pCreateInfo->format; |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6104 | |
| 6105 | // If there is a VkExternalFormatANDROID with externalFormat != 0, the value of components is ignored. |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 6106 | if (!is_external_format) { |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6107 | const VkComponentMapping components = pCreateInfo->components; |
| 6108 | // XChroma Subsampled is same as "the format has a _422 or _420 suffix" from spec |
| 6109 | if (FormatIsXChromaSubsampled(format) == true) { |
| 6110 | if ((components.g != VK_COMPONENT_SWIZZLE_G) && (components.g != VK_COMPONENT_SWIZZLE_IDENTITY)) { |
| 6111 | skip |= |
| 6112 | LogError(device, "VUID-VkSamplerYcbcrConversionCreateInfo-components-02581", |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6113 | "%s: When using a XChroma subsampled format (%s) the components.g needs to be VK_COMPONENT_SWIZZLE_G " |
| 6114 | "or VK_COMPONENT_SWIZZLE_IDENTITY, but is %s.", |
sfricke-samsung | 1a72f94 | 2020-07-25 12:09:18 -0700 | [diff] [blame] | 6115 | apiName, string_VkFormat(format), string_VkComponentSwizzle(components.g)); |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6116 | } |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6117 | |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6118 | if ((components.a != VK_COMPONENT_SWIZZLE_A) && (components.a != VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 6119 | (components.a != VK_COMPONENT_SWIZZLE_ONE) && (components.a != VK_COMPONENT_SWIZZLE_ZERO)) { |
| 6120 | skip |= LogError( |
| 6121 | device, "VUID-VkSamplerYcbcrConversionCreateInfo-components-02582", |
| 6122 | "%s: When using a XChroma subsampled format (%s) the components.a needs to be VK_COMPONENT_SWIZZLE_A or " |
| 6123 | "VK_COMPONENT_SWIZZLE_IDENTITY or VK_COMPONENT_SWIZZLE_ONE or VK_COMPONENT_SWIZZLE_ZERO, but is %s.", |
| 6124 | apiName, string_VkFormat(format), string_VkComponentSwizzle(components.a)); |
| 6125 | } |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6126 | |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6127 | if ((components.r != VK_COMPONENT_SWIZZLE_R) && (components.r != VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 6128 | (components.r != VK_COMPONENT_SWIZZLE_B)) { |
| 6129 | skip |= |
| 6130 | LogError(device, "VUID-VkSamplerYcbcrConversionCreateInfo-components-02583", |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6131 | "%s: When using a XChroma subsampled format (%s) the components.r needs to be VK_COMPONENT_SWIZZLE_R " |
| 6132 | "or VK_COMPONENT_SWIZZLE_IDENTITY or VK_COMPONENT_SWIZZLE_B, but is %s.", |
sfricke-samsung | 1a72f94 | 2020-07-25 12:09:18 -0700 | [diff] [blame] | 6133 | apiName, string_VkFormat(format), string_VkComponentSwizzle(components.r)); |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6134 | } |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6135 | |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6136 | if ((components.b != VK_COMPONENT_SWIZZLE_B) && (components.b != VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 6137 | (components.b != VK_COMPONENT_SWIZZLE_R)) { |
| 6138 | skip |= |
| 6139 | LogError(device, "VUID-VkSamplerYcbcrConversionCreateInfo-components-02584", |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6140 | "%s: When using a XChroma subsampled format (%s) the components.b needs to be VK_COMPONENT_SWIZZLE_B " |
| 6141 | "or VK_COMPONENT_SWIZZLE_IDENTITY or VK_COMPONENT_SWIZZLE_R, but is %s.", |
sfricke-samsung | 1a72f94 | 2020-07-25 12:09:18 -0700 | [diff] [blame] | 6142 | apiName, string_VkFormat(format), string_VkComponentSwizzle(components.b)); |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6143 | } |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6144 | |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6145 | // If one is identity, both need to be |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 6146 | const bool r_identity = ((components.r == VK_COMPONENT_SWIZZLE_R) || (components.r == VK_COMPONENT_SWIZZLE_IDENTITY)); |
| 6147 | const bool b_identity = ((components.b == VK_COMPONENT_SWIZZLE_B) || (components.b == VK_COMPONENT_SWIZZLE_IDENTITY)); |
| 6148 | if ((r_identity != b_identity) && ((r_identity == true) || (b_identity == true))) { |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6149 | skip |= |
| 6150 | LogError(device, "VUID-VkSamplerYcbcrConversionCreateInfo-components-02585", |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6151 | "%s: When using a XChroma subsampled format (%s) if either the components.r (%s) or components.b (%s) " |
| 6152 | "are an identity swizzle, then both need to be an identity swizzle.", |
sfricke-samsung | 1a72f94 | 2020-07-25 12:09:18 -0700 | [diff] [blame] | 6153 | apiName, string_VkFormat(format), string_VkComponentSwizzle(components.r), |
| 6154 | string_VkComponentSwizzle(components.b)); |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6155 | } |
sfricke-samsung | 1a72f94 | 2020-07-25 12:09:18 -0700 | [diff] [blame] | 6156 | } |
| 6157 | |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6158 | if (pCreateInfo->ycbcrModel != VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY) { |
| 6159 | // Checks same VU multiple ways in order to give a more useful error message |
| 6160 | const char *vuid = "VUID-VkSamplerYcbcrConversionCreateInfo-ycbcrModel-01655"; |
| 6161 | if ((components.r == VK_COMPONENT_SWIZZLE_ONE) || (components.r == VK_COMPONENT_SWIZZLE_ZERO) || |
| 6162 | (components.g == VK_COMPONENT_SWIZZLE_ONE) || (components.g == VK_COMPONENT_SWIZZLE_ZERO) || |
| 6163 | (components.b == VK_COMPONENT_SWIZZLE_ONE) || (components.b == VK_COMPONENT_SWIZZLE_ZERO)) { |
| 6164 | skip |= LogError( |
| 6165 | device, vuid, |
| 6166 | "%s: The ycbcrModel is not VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY so components.r (%s), " |
| 6167 | "components.g (%s), nor components.b (%s) can't be VK_COMPONENT_SWIZZLE_ZERO or VK_COMPONENT_SWIZZLE_ONE.", |
| 6168 | apiName, string_VkComponentSwizzle(components.r), string_VkComponentSwizzle(components.g), |
| 6169 | string_VkComponentSwizzle(components.b)); |
| 6170 | } |
sfricke-samsung | 1a72f94 | 2020-07-25 12:09:18 -0700 | [diff] [blame] | 6171 | |
sfricke-samsung | ed028b0 | 2021-09-06 23:14:51 -0700 | [diff] [blame] | 6172 | // "must not correspond to a component which contains zero or one as a consequence of conversion to RGBA" |
| 6173 | // 4 component format = no issue |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6174 | // 3 = no [a] |
| 6175 | // 2 = no [b,a] |
| 6176 | // 1 = no [g,b,a] |
| 6177 | // depth/stencil = no [g,b,a] (shouldn't ever occur, but no VU preventing it) |
sfricke-samsung | ed028b0 | 2021-09-06 23:14:51 -0700 | [diff] [blame] | 6178 | const uint32_t component_count = (FormatIsDepthOrStencil(format) == true) ? 1 : FormatComponentCount(format); |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6179 | |
sfricke-samsung | ed028b0 | 2021-09-06 23:14:51 -0700 | [diff] [blame] | 6180 | if ((component_count < 4) && ((components.r == VK_COMPONENT_SWIZZLE_A) || (components.g == VK_COMPONENT_SWIZZLE_A) || |
| 6181 | (components.b == VK_COMPONENT_SWIZZLE_A))) { |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6182 | skip |= LogError(device, vuid, |
| 6183 | "%s: The ycbcrModel is not VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY so components.r (%s), " |
| 6184 | "components.g (%s), or components.b (%s) can't be VK_COMPONENT_SWIZZLE_A.", |
| 6185 | apiName, string_VkComponentSwizzle(components.r), string_VkComponentSwizzle(components.g), |
| 6186 | string_VkComponentSwizzle(components.b)); |
sfricke-samsung | ed028b0 | 2021-09-06 23:14:51 -0700 | [diff] [blame] | 6187 | } else if ((component_count < 3) && |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6188 | ((components.r == VK_COMPONENT_SWIZZLE_B) || (components.g == VK_COMPONENT_SWIZZLE_B) || |
| 6189 | (components.b == VK_COMPONENT_SWIZZLE_B) || (components.b == VK_COMPONENT_SWIZZLE_IDENTITY))) { |
| 6190 | skip |= LogError(device, vuid, |
| 6191 | "%s: The ycbcrModel is not VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY so components.r (%s), " |
| 6192 | "components.g (%s), or components.b (%s) can't be VK_COMPONENT_SWIZZLE_B " |
| 6193 | "(components.b also can't be VK_COMPONENT_SWIZZLE_IDENTITY).", |
| 6194 | apiName, string_VkComponentSwizzle(components.r), string_VkComponentSwizzle(components.g), |
| 6195 | string_VkComponentSwizzle(components.b)); |
sfricke-samsung | ed028b0 | 2021-09-06 23:14:51 -0700 | [diff] [blame] | 6196 | } else if ((component_count < 2) && |
Benjamin Thaut | d0bc2a9 | 2020-08-25 17:09:09 +0200 | [diff] [blame] | 6197 | ((components.r == VK_COMPONENT_SWIZZLE_G) || (components.g == VK_COMPONENT_SWIZZLE_G) || |
| 6198 | (components.g == VK_COMPONENT_SWIZZLE_IDENTITY) || (components.b == VK_COMPONENT_SWIZZLE_G))) { |
| 6199 | skip |= LogError(device, vuid, |
| 6200 | "%s: The ycbcrModel is not VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY so components.r (%s), " |
| 6201 | "components.g (%s), or components.b (%s) can't be VK_COMPONENT_SWIZZLE_G " |
| 6202 | "(components.g also can't be VK_COMPONENT_SWIZZLE_IDENTITY).", |
| 6203 | apiName, string_VkComponentSwizzle(components.r), string_VkComponentSwizzle(components.g), |
| 6204 | string_VkComponentSwizzle(components.b)); |
| 6205 | } |
sfricke-samsung | 83d9812 | 2020-07-04 06:21:15 -0700 | [diff] [blame] | 6206 | } |
| 6207 | } |
| 6208 | |
sfricke-samsung | 11ea8ed | 2020-01-07 22:24:56 -0800 | [diff] [blame] | 6209 | return skip; |
| 6210 | } |
| 6211 | |
| 6212 | bool StatelessValidation::manual_PreCallValidateCreateSamplerYcbcrConversion(VkDevice device, |
| 6213 | const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, |
| 6214 | const VkAllocationCallbacks *pAllocator, |
| 6215 | VkSamplerYcbcrConversion *pYcbcrConversion) const { |
| 6216 | return ValidateCreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion, |
| 6217 | "vkCreateSamplerYcbcrConversion"); |
| 6218 | } |
| 6219 | |
| 6220 | bool StatelessValidation::manual_PreCallValidateCreateSamplerYcbcrConversionKHR( |
| 6221 | VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 6222 | VkSamplerYcbcrConversion *pYcbcrConversion) const { |
| 6223 | return ValidateCreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion, |
| 6224 | "vkCreateSamplerYcbcrConversionKHR"); |
| 6225 | } |
sfricke-samsung | 1708a8c | 2020-02-10 00:35:06 -0800 | [diff] [blame] | 6226 | |
| 6227 | bool StatelessValidation::manual_PreCallValidateImportSemaphoreFdKHR( |
| 6228 | VkDevice device, const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) const { |
| 6229 | bool skip = false; |
| 6230 | VkExternalSemaphoreHandleTypeFlags supported_handle_types = |
| 6231 | VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT | VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT; |
| 6232 | |
| 6233 | if (0 == (pImportSemaphoreFdInfo->handleType & supported_handle_types)) { |
Mark Lobodzinski | 5d8244a | 2020-01-23 13:00:43 -0700 | [diff] [blame] | 6234 | skip |= LogError(device, "VUID-VkImportSemaphoreFdInfoKHR-handleType-01143", |
| 6235 | "vkImportSemaphoreFdKHR() to semaphore %s handleType %s is not one of the supported handleTypes (%s).", |
| 6236 | report_data->FormatHandle(pImportSemaphoreFdInfo->semaphore).c_str(), |
| 6237 | string_VkExternalSemaphoreHandleTypeFlagBits(pImportSemaphoreFdInfo->handleType), |
| 6238 | string_VkExternalSemaphoreHandleTypeFlags(supported_handle_types).c_str()); |
sfricke-samsung | 1708a8c | 2020-02-10 00:35:06 -0800 | [diff] [blame] | 6239 | } |
| 6240 | return skip; |
| 6241 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6242 | |
| 6243 | bool StatelessValidation::manual_PreCallValidateCopyAccelerationStructureToMemoryKHR( |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6244 | VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const { |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6245 | bool skip = false; |
| 6246 | if (pInfo->mode != VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR) { |
| 6247 | skip |= LogError(device, "VUID-VkCopyAccelerationStructureToMemoryInfoKHR-mode-03412", |
| 6248 | "vkCopyAccelerationStructureToMemoryKHR: mode must be VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR."); |
| 6249 | } |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6250 | const auto *acc_struct_features = LvlFindInChain<VkPhysicalDeviceAccelerationStructureFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6251 | if (!acc_struct_features || acc_struct_features->accelerationStructureHostCommands == VK_FALSE) { |
| 6252 | skip |= LogError( |
| 6253 | device, "VUID-vkCopyAccelerationStructureToMemoryKHR-accelerationStructureHostCommands-03584", |
| 6254 | "vkCopyAccelerationStructureToMemoryKHR: The " |
| 6255 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureHostCommands feature must be enabled."); |
| 6256 | } |
| 6257 | skip |= validate_required_pointer("vkCopyAccelerationStructureToMemoryKHR", "pInfo->dst.hostAddress", pInfo->dst.hostAddress, |
| 6258 | "VUID-vkCopyAccelerationStructureToMemoryKHR-pInfo-03732"); |
| 6259 | if (SafeModulo((VkDeviceSize)pInfo->dst.hostAddress, 16) != 0) { |
| 6260 | skip |= LogError(device, "VUID-vkCopyAccelerationStructureToMemoryKHR-pInfo-03751", |
| 6261 | "vkCopyAccelerationStructureToMemoryKHR(): pInfo->dst.hostAddress must be aligned to 16 bytes."); |
| 6262 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6263 | return skip; |
| 6264 | } |
| 6265 | |
| 6266 | bool StatelessValidation::manual_PreCallValidateCmdCopyAccelerationStructureToMemoryKHR( |
| 6267 | VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) const { |
| 6268 | bool skip = false; |
| 6269 | if (pInfo->mode != VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR) { |
| 6270 | skip |= // to update VUID to VkCmdCopyAccelerationStructureToMemoryInfoKHR after spec update |
| 6271 | LogError(commandBuffer, "VUID-VkCopyAccelerationStructureToMemoryInfoKHR-mode-03412", |
| 6272 | "vkCmdCopyAccelerationStructureToMemoryKHR: mode must be VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR."); |
| 6273 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6274 | if (SafeModulo(pInfo->dst.deviceAddress, 256) != 0) { |
| 6275 | skip |= LogError(device, "VUID-vkCmdCopyAccelerationStructureToMemoryKHR-pInfo-03740", |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 6276 | "vkCmdCopyAccelerationStructureToMemoryKHR(): pInfo->dst.deviceAddress (0x%" PRIx64 ") must be aligned to 256 bytes.", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6277 | pInfo->dst.deviceAddress); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6278 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6279 | return skip; |
| 6280 | } |
| 6281 | |
| 6282 | bool StatelessValidation::ValidateCopyAccelerationStructureInfoKHR(const VkCopyAccelerationStructureInfoKHR *pInfo, |
| 6283 | const char *api_name) const { |
| 6284 | bool skip = false; |
| 6285 | if (!(pInfo->mode == VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR || |
| 6286 | pInfo->mode == VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR)) { |
| 6287 | skip |= LogError(device, "VUID-VkCopyAccelerationStructureInfoKHR-mode-03410", |
| 6288 | "(%s): mode must be VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR" |
| 6289 | "or VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR.", |
| 6290 | api_name); |
| 6291 | } |
| 6292 | return skip; |
| 6293 | } |
| 6294 | |
| 6295 | bool StatelessValidation::manual_PreCallValidateCopyAccelerationStructureKHR( |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6296 | VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureInfoKHR *pInfo) const { |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6297 | bool skip = false; |
| 6298 | skip |= ValidateCopyAccelerationStructureInfoKHR(pInfo, "vkCopyAccelerationStructureKHR()"); |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6299 | const auto *acc_struct_features = LvlFindInChain<VkPhysicalDeviceAccelerationStructureFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6300 | if (!acc_struct_features || acc_struct_features->accelerationStructureHostCommands == VK_FALSE) { |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6301 | skip |= LogError( |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6302 | device, "VUID-vkCopyAccelerationStructureKHR-accelerationStructureHostCommands-03582", |
| 6303 | "vkCopyAccelerationStructureKHR: The " |
| 6304 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureHostCommands feature must be enabled."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6305 | } |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6306 | return skip; |
| 6307 | } |
| 6308 | |
| 6309 | bool StatelessValidation::manual_PreCallValidateCmdCopyAccelerationStructureKHR( |
| 6310 | VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureInfoKHR *pInfo) const { |
| 6311 | bool skip = false; |
| 6312 | skip |= ValidateCopyAccelerationStructureInfoKHR(pInfo, "vkCmdCopyAccelerationStructureKHR()"); |
| 6313 | return skip; |
| 6314 | } |
| 6315 | |
| 6316 | bool StatelessValidation::ValidateCopyMemoryToAccelerationStructureInfoKHR(const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo, |
Mark Lobodzinski | aad69e4 | 2020-05-12 08:44:21 -0600 | [diff] [blame] | 6317 | const char *api_name, bool is_cmd) const { |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6318 | bool skip = false; |
| 6319 | if (pInfo->mode != VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6320 | skip |= LogError(device, "VUID-VkCopyMemoryToAccelerationStructureInfoKHR-mode-03413", |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6321 | "(%s): mode must be VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR.", api_name); |
| 6322 | } |
| 6323 | return skip; |
| 6324 | } |
| 6325 | |
| 6326 | bool StatelessValidation::manual_PreCallValidateCopyMemoryToAccelerationStructureKHR( |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6327 | VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const { |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6328 | bool skip = false; |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6329 | skip |= ValidateCopyMemoryToAccelerationStructureInfoKHR(pInfo, "vkCopyMemoryToAccelerationStructureKHR()", true); |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6330 | const auto *acc_struct_features = LvlFindInChain<VkPhysicalDeviceAccelerationStructureFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6331 | if (!acc_struct_features || acc_struct_features->accelerationStructureHostCommands == VK_FALSE) { |
| 6332 | skip |= LogError( |
| 6333 | device, "VUID-vkCopyMemoryToAccelerationStructureKHR-accelerationStructureHostCommands-03583", |
| 6334 | "vkCopyMemoryToAccelerationStructureKHR: The " |
| 6335 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureHostCommands feature must be enabled."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6336 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6337 | skip |= validate_required_pointer("vkCopyMemoryToAccelerationStructureKHR", "pInfo->src.hostAddress", pInfo->src.hostAddress, |
| 6338 | "VUID-vkCopyMemoryToAccelerationStructureKHR-pInfo-03729"); |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6339 | return skip; |
| 6340 | } |
Jeremy Hayes | 9bda85a | 2020-05-21 16:36:17 -0600 | [diff] [blame] | 6341 | |
sourav parmar | a96ab1a | 2020-04-25 16:28:23 -0700 | [diff] [blame] | 6342 | bool StatelessValidation::manual_PreCallValidateCmdCopyMemoryToAccelerationStructureKHR( |
| 6343 | VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) const { |
| 6344 | bool skip = false; |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6345 | skip |= ValidateCopyMemoryToAccelerationStructureInfoKHR(pInfo, "vkCmdCopyMemoryToAccelerationStructureKHR()", false); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6346 | if (SafeModulo(pInfo->src.deviceAddress, 256) != 0) { |
| 6347 | skip |= LogError(device, "VUID-vkCmdCopyMemoryToAccelerationStructureKHR-pInfo-03743", |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 6348 | "vkCmdCopyMemoryToAccelerationStructureKHR(): pInfo->src.deviceAddress (0x%" PRIx64 ") must be aligned to 256 bytes.", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6349 | pInfo->src.deviceAddress); |
| 6350 | } |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6351 | return skip; |
| 6352 | } |
| 6353 | bool StatelessValidation::manual_PreCallValidateCmdWriteAccelerationStructuresPropertiesKHR( |
| 6354 | VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR *pAccelerationStructures, |
| 6355 | VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) const { |
| 6356 | bool skip = false; |
| 6357 | if (!(queryType == VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR || |
| 6358 | queryType == VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR)) { |
| 6359 | skip |= LogError(device, "VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-queryType-03432", |
| 6360 | "vkCmdWriteAccelerationStructuresPropertiesKHR: queryType must be " |
| 6361 | "VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR or " |
| 6362 | "VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR."); |
| 6363 | } |
| 6364 | return skip; |
| 6365 | } |
| 6366 | bool StatelessValidation::manual_PreCallValidateWriteAccelerationStructuresPropertiesKHR( |
| 6367 | VkDevice device, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR *pAccelerationStructures, |
| 6368 | VkQueryType queryType, size_t dataSize, void *pData, size_t stride) const { |
| 6369 | bool skip = false; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6370 | const auto *acc_structure_features = LvlFindInChain<VkPhysicalDeviceAccelerationStructureFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6371 | if (!acc_structure_features || acc_structure_features->accelerationStructureHostCommands == VK_FALSE) { |
| 6372 | skip |= LogError( |
| 6373 | device, "VUID-vkWriteAccelerationStructuresPropertiesKHR-accelerationStructureHostCommands-03585", |
| 6374 | "vkCmdWriteAccelerationStructuresPropertiesKHR: The " |
| 6375 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureHostCommands feature must be enabled."); |
| 6376 | } |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6377 | if (dataSize < accelerationStructureCount * stride) { |
| 6378 | skip |= LogError(device, "VUID-vkWriteAccelerationStructuresPropertiesKHR-dataSize-03452", |
| 6379 | "vkWriteAccelerationStructuresPropertiesKHR: dataSize (%zu) must be greater than or equal to " |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 6380 | "accelerationStructureCount (%" PRIu32 ") *stride(%zu).", |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6381 | dataSize, accelerationStructureCount, stride); |
| 6382 | } |
| 6383 | if (!(queryType == VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR || |
| 6384 | queryType == VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR)) { |
| 6385 | skip |= LogError(device, "VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-03432", |
| 6386 | "vkWriteAccelerationStructuresPropertiesKHR: queryType must be " |
| 6387 | "VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR or " |
| 6388 | "VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR."); |
| 6389 | } |
| 6390 | if (queryType == VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR) { |
| 6391 | if (SafeModulo(stride, sizeof(VkDeviceSize)) != 0) { |
| 6392 | skip |= LogError(device, "VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-03448", |
| 6393 | "vkWriteAccelerationStructuresPropertiesKHR: If queryType is " |
| 6394 | "VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR," |
| 6395 | "then stride (%zu) must be a multiple of the size of VkDeviceSize", |
| 6396 | stride); |
| 6397 | } |
| 6398 | } |
| 6399 | if (queryType == VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR) { |
| 6400 | if (SafeModulo(stride, sizeof(VkDeviceSize)) != 0) { |
| 6401 | skip |= LogError(device, "VUID-vkWriteAccelerationStructuresPropertiesKHR-queryType-03450", |
| 6402 | "vkWriteAccelerationStructuresPropertiesKHR: If queryType is " |
| 6403 | "VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR," |
| 6404 | "then stride (%zu) must be a multiple of the size of VkDeviceSize", |
| 6405 | stride); |
| 6406 | } |
| 6407 | } |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6408 | return skip; |
| 6409 | } |
| 6410 | bool StatelessValidation::manual_PreCallValidateGetRayTracingCaptureReplayShaderGroupHandlesKHR( |
| 6411 | VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData) const { |
| 6412 | bool skip = false; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6413 | const auto *raytracing_features = LvlFindInChain<VkPhysicalDeviceRayTracingPipelineFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6414 | if (!raytracing_features || raytracing_features->rayTracingPipelineShaderGroupHandleCaptureReplay == VK_FALSE) { |
| 6415 | skip |= LogError( |
| 6416 | device, "VUID-vkGetRayTracingCaptureReplayShaderGroupHandlesKHR-rayTracingPipelineShaderGroupHandleCaptureReplay-03606", |
| 6417 | "vkGetRayTracingCaptureReplayShaderGroupHandlesKHR:VkPhysicalDeviceRayTracingPipelineFeaturesKHR::" |
| 6418 | "rayTracingPipelineShaderGroupHandleCaptureReplay must be enabled to call this function."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6419 | } |
| 6420 | return skip; |
| 6421 | } |
| 6422 | |
| 6423 | bool StatelessValidation::manual_PreCallValidateCmdTraceRaysKHR(VkCommandBuffer commandBuffer, |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6424 | const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, |
| 6425 | const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, |
| 6426 | const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, |
| 6427 | const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6428 | uint32_t width, uint32_t height, uint32_t depth) const { |
| 6429 | bool skip = false; |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6430 | // RayGen |
| 6431 | if (pRaygenShaderBindingTable->size != pRaygenShaderBindingTable->stride) { |
| 6432 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-size-04023", |
| 6433 | "vkCmdTraceRaysKHR: The size member of pRayGenShaderBindingTable must be equal to its stride member"); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6434 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6435 | if (SafeModulo(pRaygenShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != |
| 6436 | 0) { |
| 6437 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-pRayGenShaderBindingTable-03682", |
| 6438 | "vkCmdTraceRaysKHR: pRaygenShaderBindingTable->deviceAddress must be a multiple of " |
| 6439 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
| 6440 | } |
| 6441 | // Callable |
| 6442 | if (SafeModulo(pCallableShaderBindingTable->stride, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupHandleAlignment) != 0) { |
| 6443 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-stride-03694", |
| 6444 | "vkCmdTraceRaysKHR: The stride member of pCallableShaderBindingTable must be a multiple of " |
| 6445 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6446 | } |
| 6447 | if (pCallableShaderBindingTable->stride > phys_dev_ext_props.ray_tracing_propsKHR.maxShaderGroupStride) { |
| 6448 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-stride-04041", |
| 6449 | "vkCmdTraceRaysKHR: The stride member of pCallableShaderBindingTable must be" |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6450 | "less than or equal to VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride."); |
| 6451 | } |
| 6452 | if (SafeModulo(pCallableShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != |
| 6453 | 0) { |
| 6454 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-pCallableShaderBindingTable-03693", |
| 6455 | "vkCmdTraceRaysKHR: pCallableShaderBindingTable->deviceAddress must be a multiple of " |
| 6456 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6457 | } |
| 6458 | // hitShader |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6459 | if (SafeModulo(pHitShaderBindingTable->stride, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupHandleAlignment) != 0) { |
| 6460 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-stride-03690", |
| 6461 | "vkCmdTraceRaysKHR: The stride member of pHitShaderBindingTable must be a multiple of " |
| 6462 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6463 | } |
| 6464 | if (pHitShaderBindingTable->stride > phys_dev_ext_props.ray_tracing_propsKHR.maxShaderGroupStride) { |
| 6465 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-stride-04035", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6466 | "vkCmdTraceRaysKHR: TThe stride member of pHitShaderBindingTable must be less than or equal to " |
| 6467 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride"); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6468 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6469 | if (SafeModulo(pHitShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != 0) { |
| 6470 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-pHitShaderBindingTable-03689", |
| 6471 | "vkCmdTraceRaysKHR: pHitShaderBindingTable->deviceAddress must be a multiple of " |
| 6472 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
| 6473 | } |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6474 | // missShader |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6475 | if (SafeModulo(pMissShaderBindingTable->stride, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupHandleAlignment) != 0) { |
| 6476 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-stride-03686", |
| 6477 | "vkCmdTraceRaysKHR: The stride member of pMissShaderBindingTable must be a multiple of " |
| 6478 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment"); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6479 | } |
| 6480 | if (pMissShaderBindingTable->stride > phys_dev_ext_props.ray_tracing_propsKHR.maxShaderGroupStride) { |
| 6481 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-stride-04029", |
| 6482 | "vkCmdTraceRaysKHR: The stride member of pMissShaderBindingTable must be" |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6483 | "less than or equal to VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride."); |
| 6484 | } |
| 6485 | if (SafeModulo(pMissShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != 0) { |
| 6486 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-pMissShaderBindingTable-03685", |
| 6487 | "vkCmdTraceRaysKHR: pMissShaderBindingTable->deviceAddress must be a multiple of " |
| 6488 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
| 6489 | } |
| 6490 | if (width * depth * height > phys_dev_ext_props.ray_tracing_propsKHR.maxRayDispatchInvocationCount) { |
| 6491 | skip |= LogError(device, "VUID-vkCmdTraceRaysKHR-width-03629", |
| 6492 | "vkCmdTraceRaysKHR: width {times} height {times} depth must be less than or equal to " |
| 6493 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxRayDispatchInvocationCount"); |
| 6494 | } |
| 6495 | if (width > device_limits.maxComputeWorkGroupCount[0] * device_limits.maxComputeWorkGroupSize[0]) { |
| 6496 | skip |= |
| 6497 | LogError(device, "VUID-vkCmdTraceRaysKHR-width-03626", |
| 6498 | "vkCmdTraceRaysKHR: width must be less than or equal to VkPhysicalDeviceLimits::maxComputeWorkGroupCount[0] " |
| 6499 | "{times} VkPhysicalDeviceLimits::maxComputeWorkGroupSize[0]"); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6500 | } |
| 6501 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6502 | if (height > device_limits.maxComputeWorkGroupCount[1] * device_limits.maxComputeWorkGroupSize[1]) { |
| 6503 | skip |= |
| 6504 | LogError(device, "VUID-vkCmdTraceRaysKHR-height-03627", |
| 6505 | "vkCmdTraceRaysKHR: height must be less than or equal to VkPhysicalDeviceLimits::maxComputeWorkGroupCount[1] " |
| 6506 | "{times} VkPhysicalDeviceLimits::maxComputeWorkGroupSize[1]"); |
| 6507 | } |
| 6508 | |
| 6509 | if (depth > device_limits.maxComputeWorkGroupCount[2] * device_limits.maxComputeWorkGroupSize[2]) { |
| 6510 | skip |= |
| 6511 | LogError(device, "VUID-vkCmdTraceRaysKHR-depth-03628", |
| 6512 | "vkCmdTraceRaysKHR: depth must be less than or equal to VkPhysicalDeviceLimits::maxComputeWorkGroupCount[2] " |
| 6513 | "{times} VkPhysicalDeviceLimits::maxComputeWorkGroupSize[2]"); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6514 | } |
| 6515 | return skip; |
| 6516 | } |
| 6517 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6518 | bool StatelessValidation::manual_PreCallValidateCmdTraceRaysIndirectKHR( |
| 6519 | VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR *pRaygenShaderBindingTable, |
| 6520 | const VkStridedDeviceAddressRegionKHR *pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR *pHitShaderBindingTable, |
| 6521 | const VkStridedDeviceAddressRegionKHR *pCallableShaderBindingTable, VkDeviceAddress indirectDeviceAddress) const { |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6522 | bool skip = false; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6523 | const auto *raytracing_features = LvlFindInChain<VkPhysicalDeviceRayTracingPipelineFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6524 | if (!raytracing_features || raytracing_features->rayTracingPipelineTraceRaysIndirect == VK_FALSE) { |
| 6525 | skip |= LogError( |
| 6526 | device, "VUID-vkCmdTraceRaysIndirectKHR-rayTracingPipelineTraceRaysIndirect-03637", |
| 6527 | "vkCmdTraceRaysIndirectKHR: the VkPhysicalDeviceRayTracingPipelineFeaturesKHR::rayTracingPipelineTraceRaysIndirect " |
| 6528 | "feature must be enabled."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6529 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6530 | // RayGen |
| 6531 | if (pRaygenShaderBindingTable->size != pRaygenShaderBindingTable->stride) { |
| 6532 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-size-04023", |
| 6533 | "vkCmdTraceRaysKHR: The size member of pRayGenShaderBindingTable must be equal to its stride member"); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6534 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6535 | if (SafeModulo(pRaygenShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != |
| 6536 | 0) { |
| 6537 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-pRayGenShaderBindingTable-03682", |
| 6538 | "vkCmdTraceRaysIndirectKHR: pRaygenShaderBindingTable->deviceAddress must be a multiple of " |
| 6539 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
| 6540 | } |
| 6541 | // Callabe |
| 6542 | if (SafeModulo(pCallableShaderBindingTable->stride, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupHandleAlignment) != 0) { |
| 6543 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-stride-03694", |
| 6544 | "vkCmdTraceRaysIndirectKHR: The stride member of pCallableShaderBindingTable must be a multiple of " |
| 6545 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6546 | } |
| 6547 | if (pCallableShaderBindingTable->stride > phys_dev_ext_props.ray_tracing_propsKHR.maxShaderGroupStride) { |
| 6548 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-stride-04041", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6549 | "vkCmdTraceRaysIndirectKHR: The stride member of pCallableShaderBindingTable must be less than or equal " |
| 6550 | "to VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride."); |
| 6551 | } |
| 6552 | if (SafeModulo(pCallableShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != |
| 6553 | 0) { |
| 6554 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-pCallableShaderBindingTable-03693", |
| 6555 | "vkCmdTraceRaysIndirectKHR: pCallableShaderBindingTable->deviceAddress must be a multiple of " |
| 6556 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6557 | } |
| 6558 | // hitShader |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6559 | if (SafeModulo(pHitShaderBindingTable->stride, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupHandleAlignment) != 0) { |
| 6560 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-stride-03690", |
| 6561 | "vkCmdTraceRaysIndirectKHR: The stride member of pHitShaderBindingTable must be a multiple of " |
| 6562 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6563 | } |
| 6564 | if (pHitShaderBindingTable->stride > phys_dev_ext_props.ray_tracing_propsKHR.maxShaderGroupStride) { |
| 6565 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-stride-04035", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6566 | "vkCmdTraceRaysIndirectKHR: The stride member of pHitShaderBindingTable must be less than or equal to " |
| 6567 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6568 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6569 | if (SafeModulo(pHitShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != 0) { |
| 6570 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-pHitShaderBindingTable-03689", |
| 6571 | "vkCmdTraceRaysIndirectKHR: pHitShaderBindingTable->deviceAddress must be a multiple of " |
| 6572 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
| 6573 | } |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6574 | // missShader |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6575 | if (SafeModulo(pMissShaderBindingTable->stride, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupHandleAlignment) != 0) { |
| 6576 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-stride-03686", |
| 6577 | "vkCmdTraceRaysIndirectKHR:The stride member of pMissShaderBindingTable must be a multiple of " |
| 6578 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupHandleAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6579 | } |
| 6580 | if (pMissShaderBindingTable->stride > phys_dev_ext_props.ray_tracing_propsKHR.maxShaderGroupStride) { |
| 6581 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-stride-04029", |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6582 | "vkCmdTraceRaysIndirectKHR: The stride member of pMissShaderBindingTable must be less than or equal to " |
| 6583 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::maxShaderGroupStride."); |
| 6584 | } |
| 6585 | if (SafeModulo(pMissShaderBindingTable->deviceAddress, phys_dev_ext_props.ray_tracing_propsKHR.shaderGroupBaseAlignment) != 0) { |
| 6586 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-pMissShaderBindingTable-03685", |
| 6587 | "vkCmdTraceRaysIndirectKHR: pMissShaderBindingTable->deviceAddress must be a multiple of " |
| 6588 | "VkPhysicalDeviceRayTracingPipelinePropertiesKHR::shaderGroupBaseAlignment."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6589 | } |
| 6590 | |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6591 | if (SafeModulo(indirectDeviceAddress, 4) != 0) { |
| 6592 | skip |= LogError(device, "VUID-vkCmdTraceRaysIndirectKHR-indirectDeviceAddress-03634", |
| 6593 | "vkCmdTraceRaysIndirectKHR: indirectDeviceAddress must be a multiple of 4."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6594 | } |
| 6595 | return skip; |
| 6596 | } |
| 6597 | bool StatelessValidation::manual_PreCallValidateCmdTraceRaysNV( |
| 6598 | VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, |
| 6599 | VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, |
| 6600 | VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, |
| 6601 | VkBuffer callableShaderBindingTableBuffer, VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, |
| 6602 | uint32_t width, uint32_t height, uint32_t depth) const { |
| 6603 | bool skip = false; |
| 6604 | if (SafeModulo(callableShaderBindingOffset, phys_dev_ext_props.ray_tracing_propsNV.shaderGroupBaseAlignment) != 0) { |
| 6605 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-callableShaderBindingOffset-02462", |
| 6606 | "vkCmdTraceRaysNV: callableShaderBindingOffset must be a multiple of " |
| 6607 | "VkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignment."); |
| 6608 | } |
| 6609 | if (SafeModulo(callableShaderBindingStride, phys_dev_ext_props.ray_tracing_propsNV.shaderGroupHandleSize) != 0) { |
| 6610 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-callableShaderBindingStride-02465", |
| 6611 | "vkCmdTraceRaysNV: callableShaderBindingStride must be a multiple of " |
| 6612 | "VkPhysicalDeviceRayTracingPropertiesNV::shaderGroupHandleSize."); |
| 6613 | } |
| 6614 | if (callableShaderBindingStride > phys_dev_ext_props.ray_tracing_propsNV.maxShaderGroupStride) { |
| 6615 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-callableShaderBindingStride-02468", |
| 6616 | "vkCmdTraceRaysNV: callableShaderBindingStride must be less than or equal to " |
| 6617 | "VkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStride. "); |
| 6618 | } |
| 6619 | |
| 6620 | // hitShader |
| 6621 | if (SafeModulo(hitShaderBindingOffset, phys_dev_ext_props.ray_tracing_propsNV.shaderGroupBaseAlignment) != 0) { |
| 6622 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-hitShaderBindingOffset-02460", |
| 6623 | "vkCmdTraceRaysNV: hitShaderBindingOffset must be a multiple of " |
| 6624 | "VkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignment."); |
| 6625 | } |
| 6626 | if (SafeModulo(hitShaderBindingStride, phys_dev_ext_props.ray_tracing_propsNV.shaderGroupHandleSize) != 0) { |
| 6627 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-hitShaderBindingStride-02464", |
| 6628 | "vkCmdTraceRaysNV: hitShaderBindingStride must be a multiple of " |
| 6629 | "VkPhysicalDeviceRayTracingPropertiesNV::shaderGroupHandleSize."); |
| 6630 | } |
| 6631 | if (hitShaderBindingStride > phys_dev_ext_props.ray_tracing_propsNV.maxShaderGroupStride) { |
| 6632 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-hitShaderBindingStride-02467", |
| 6633 | "vkCmdTraceRaysNV: hitShaderBindingStride must be less than or equal to " |
| 6634 | "VkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStride."); |
| 6635 | } |
| 6636 | |
| 6637 | // missShader |
| 6638 | if (SafeModulo(missShaderBindingOffset, phys_dev_ext_props.ray_tracing_propsNV.shaderGroupBaseAlignment) != 0) { |
| 6639 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-missShaderBindingOffset-02458", |
| 6640 | "vkCmdTraceRaysNV: missShaderBindingOffset must be a multiple of " |
| 6641 | "VkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignment."); |
| 6642 | } |
| 6643 | if (SafeModulo(missShaderBindingStride, phys_dev_ext_props.ray_tracing_propsNV.shaderGroupHandleSize) != 0) { |
| 6644 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-missShaderBindingStride-02463", |
| 6645 | "vkCmdTraceRaysNV: missShaderBindingStride must be a multiple of " |
| 6646 | "VkPhysicalDeviceRayTracingPropertiesNV::shaderGroupHandleSize."); |
| 6647 | } |
| 6648 | if (missShaderBindingStride > phys_dev_ext_props.ray_tracing_propsNV.maxShaderGroupStride) { |
| 6649 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-missShaderBindingStride-02466", |
| 6650 | "vkCmdTraceRaysNV: missShaderBindingStride must be less than or equal to " |
| 6651 | "VkPhysicalDeviceRayTracingPropertiesNV::maxShaderGroupStride."); |
| 6652 | } |
| 6653 | |
| 6654 | // raygenShader |
| 6655 | if (SafeModulo(raygenShaderBindingOffset, phys_dev_ext_props.ray_tracing_propsNV.shaderGroupBaseAlignment) != 0) { |
| 6656 | skip |= LogError(device, "VUID-vkCmdTraceRaysNV-raygenShaderBindingOffset-02456", |
| 6657 | "vkCmdTraceRaysNV: raygenShaderBindingOffset must be a multiple of " |
sourav parmar | d152180 | 2020-06-07 21:49:02 -0700 | [diff] [blame] | 6658 | "VkPhysicalDeviceRayTracingPropertiesNV::shaderGroupBaseAlignment."); |
| 6659 | } |
| 6660 | if (width > device_limits.maxComputeWorkGroupCount[0]) { |
| 6661 | skip |= |
| 6662 | LogError(device, "VUID-vkCmdTraceRaysNV-width-02469", |
| 6663 | "vkCmdTraceRaysNV: width must be less than or equal to VkPhysicalDeviceLimits::maxComputeWorkGroupCount[o]."); |
| 6664 | } |
| 6665 | if (height > device_limits.maxComputeWorkGroupCount[1]) { |
| 6666 | skip |= |
| 6667 | LogError(device, "VUID-vkCmdTraceRaysNV-height-02470", |
| 6668 | "vkCmdTraceRaysNV: height must be less than or equal to VkPhysicalDeviceLimits::maxComputeWorkGroupCount[1]."); |
| 6669 | } |
| 6670 | if (depth > device_limits.maxComputeWorkGroupCount[2]) { |
| 6671 | skip |= |
| 6672 | LogError(device, "VUID-vkCmdTraceRaysNV-depth-02471", |
| 6673 | "vkCmdTraceRaysNV: depth must be less than or equal to VkPhysicalDeviceLimits::maxComputeWorkGroupCount[2]."); |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6674 | } |
| 6675 | return skip; |
| 6676 | } |
| 6677 | |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6678 | bool StatelessValidation::manual_PreCallValidateGetDeviceAccelerationStructureCompatibilityKHR( |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6679 | VkDevice device, const VkAccelerationStructureVersionInfoKHR *pVersionInfo, |
| 6680 | VkAccelerationStructureCompatibilityKHR *pCompatibility) const { |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6681 | bool skip = false; |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6682 | const auto *ray_query_features = LvlFindInChain<VkPhysicalDeviceRayQueryFeaturesKHR>(device_createinfo_pnext); |
| 6683 | const auto *raytracing_features = LvlFindInChain<VkPhysicalDeviceRayTracingPipelineFeaturesKHR>(device_createinfo_pnext); |
Nathaniel Cesario | ce9b481 | 2020-12-17 08:55:28 -0700 | [diff] [blame] | 6684 | if ((!raytracing_features && !ray_query_features) || ((ray_query_features && !(ray_query_features->rayQuery)) || |
| 6685 | (raytracing_features && !raytracing_features->rayTracingPipeline))) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6686 | skip |= LogError(device, "VUID-vkGetDeviceAccelerationStructureCompatibilityKHR-rayTracingPipeline-03661", |
sourav parmar | 83c31b1 | 2020-05-06 12:30:54 -0700 | [diff] [blame] | 6687 | "vkGetDeviceAccelerationStructureCompatibilityKHR: The rayTracing or rayQuery feature must be enabled."); |
| 6688 | } |
| 6689 | return skip; |
| 6690 | } |
| 6691 | |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 6692 | bool StatelessValidation::manual_PreCallValidateCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount, |
| 6693 | const VkViewport *pViewports) const { |
| 6694 | bool skip = false; |
| 6695 | |
| 6696 | if (!physical_device_features.multiViewport) { |
| 6697 | if (viewportCount != 1) { |
| 6698 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportWithCountEXT-viewportCount-03395", |
| 6699 | "vkCmdSetViewportWithCountEXT: The multiViewport feature is disabled, but viewportCount (=%" PRIu32 |
| 6700 | ") is not 1.", |
| 6701 | viewportCount); |
| 6702 | } |
| 6703 | } else { // multiViewport enabled |
| 6704 | if (viewportCount < 1 || viewportCount > device_limits.maxViewports) { |
| 6705 | skip |= LogError(commandBuffer, "VUID-vkCmdSetViewportWithCountEXT-viewportCount-03394", |
| 6706 | "vkCmdSetViewportWithCountEXT: viewportCount (=%" PRIu32 |
| 6707 | ") must " |
| 6708 | "not be greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 6709 | viewportCount, device_limits.maxViewports); |
| 6710 | } |
| 6711 | } |
| 6712 | |
| 6713 | if (pViewports) { |
| 6714 | for (uint32_t viewport_i = 0; viewport_i < viewportCount; ++viewport_i) { |
| 6715 | const auto &viewport = pViewports[viewport_i]; // will crash on invalid ptr |
| 6716 | const char *fn_name = "vkCmdSetViewportWithCountEXT"; |
| 6717 | skip |= manual_PreCallValidateViewport( |
| 6718 | viewport, fn_name, ParameterName("pViewports[%i]", ParameterName::IndexVector{viewport_i}), commandBuffer); |
| 6719 | } |
| 6720 | } |
| 6721 | |
| 6722 | return skip; |
| 6723 | } |
| 6724 | |
| 6725 | bool StatelessValidation::manual_PreCallValidateCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount, |
| 6726 | const VkRect2D *pScissors) const { |
| 6727 | bool skip = false; |
| 6728 | |
| 6729 | if (!physical_device_features.multiViewport) { |
| 6730 | if (scissorCount != 1) { |
| 6731 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissorWithCountEXT-scissorCount-03398", |
| 6732 | "vkCmdSetScissorWithCountEXT: scissorCount (=%" PRIu32 |
| 6733 | ") must " |
| 6734 | "be 1 when the multiViewport feature is disabled.", |
| 6735 | scissorCount); |
| 6736 | } |
| 6737 | } else { // multiViewport enabled |
| 6738 | if (scissorCount == 0) { |
| 6739 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissorWithCountEXT-scissorCount-03397", |
| 6740 | "vkCmdSetScissorWithCountEXT: scissorCount (=%" PRIu32 |
| 6741 | ") must " |
| 6742 | "be great than zero.", |
| 6743 | scissorCount); |
| 6744 | } else if (scissorCount > device_limits.maxViewports) { |
| 6745 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissorWithCountEXT-scissorCount-03397", |
| 6746 | "vkCmdSetScissorWithCountEXT: scissorCount (=%" PRIu32 |
| 6747 | ") must " |
| 6748 | "not be greater than VkPhysicalDeviceLimits::maxViewports (=%" PRIu32 ").", |
| 6749 | scissorCount, device_limits.maxViewports); |
| 6750 | } |
| 6751 | } |
| 6752 | |
| 6753 | if (pScissors) { |
| 6754 | for (uint32_t scissor_i = 0; scissor_i < scissorCount; ++scissor_i) { |
| 6755 | const auto &scissor = pScissors[scissor_i]; // will crash on invalid ptr |
| 6756 | |
| 6757 | if (scissor.offset.x < 0) { |
| 6758 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissorWithCountEXT-x-03399", |
| 6759 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.x (=%" PRIi32 ") is negative.", scissor_i, |
| 6760 | scissor.offset.x); |
| 6761 | } |
| 6762 | |
| 6763 | if (scissor.offset.y < 0) { |
| 6764 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissorWithCountEXT-x-03399", |
| 6765 | "vkCmdSetScissor: pScissors[%" PRIu32 "].offset.y (=%" PRIi32 ") is negative.", scissor_i, |
| 6766 | scissor.offset.y); |
| 6767 | } |
| 6768 | |
| 6769 | const int64_t x_sum = static_cast<int64_t>(scissor.offset.x) + static_cast<int64_t>(scissor.extent.width); |
| 6770 | if (x_sum > INT32_MAX) { |
| 6771 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissorWithCountEXT-offset-03400", |
| 6772 | "vkCmdSetScissor: offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 6773 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 6774 | scissor.offset.x, scissor.extent.width, x_sum, scissor_i); |
| 6775 | } |
| 6776 | |
| 6777 | const int64_t y_sum = static_cast<int64_t>(scissor.offset.y) + static_cast<int64_t>(scissor.extent.height); |
| 6778 | if (y_sum > INT32_MAX) { |
| 6779 | skip |= LogError(commandBuffer, "VUID-vkCmdSetScissorWithCountEXT-offset-03401", |
| 6780 | "vkCmdSetScissor: offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 6781 | ") of pScissors[%" PRIu32 "] will overflow int32_t.", |
| 6782 | scissor.offset.y, scissor.extent.height, y_sum, scissor_i); |
| 6783 | } |
| 6784 | } |
| 6785 | } |
| 6786 | |
| 6787 | return skip; |
| 6788 | } |
| 6789 | |
| 6790 | bool StatelessValidation::manual_PreCallValidateCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, |
| 6791 | uint32_t bindingCount, const VkBuffer *pBuffers, |
| 6792 | const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes, |
| 6793 | const VkDeviceSize *pStrides) const { |
| 6794 | bool skip = false; |
| 6795 | if (firstBinding >= device_limits.maxVertexInputBindings) { |
| 6796 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers2EXT-firstBinding-03355", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 6797 | "vkCmdBindVertexBuffers2EXT() firstBinding (%" PRIu32 |
| 6798 | ") must be less than maxVertexInputBindings (%" PRIu32 ")", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 6799 | firstBinding, device_limits.maxVertexInputBindings); |
| 6800 | } else if ((firstBinding + bindingCount) > device_limits.maxVertexInputBindings) { |
| 6801 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers2EXT-firstBinding-03356", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 6802 | "vkCmdBindVertexBuffers2EXT() sum of firstBinding (%" PRIu32 ") and bindingCount (%" PRIu32 |
| 6803 | ") must be less than " |
| 6804 | "maxVertexInputBindings (%" PRIu32 ")", |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 6805 | firstBinding, bindingCount, device_limits.maxVertexInputBindings); |
| 6806 | } |
| 6807 | |
| 6808 | for (uint32_t i = 0; i < bindingCount; ++i) { |
| 6809 | if (pBuffers[i] == VK_NULL_HANDLE) { |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 6810 | const auto *robustness2_features = LvlFindInChain<VkPhysicalDeviceRobustness2FeaturesEXT>(device_createinfo_pnext); |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 6811 | if (!(robustness2_features && robustness2_features->nullDescriptor)) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 6812 | skip |= LogError( |
| 6813 | commandBuffer, "VUID-vkCmdBindVertexBuffers2EXT-pBuffers-04111", |
| 6814 | "vkCmdBindVertexBuffers2EXT() required parameter pBuffers[%" PRIu32 "] specified as VK_NULL_HANDLE", i); |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 6815 | } else { |
| 6816 | if (pOffsets[i] != 0) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 6817 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers2EXT-pBuffers-04112", |
| 6818 | "vkCmdBindVertexBuffers2EXT() pBuffers[%" PRIu32 "] is VK_NULL_HANDLE, but pOffsets[%" PRIu32 |
| 6819 | "] is not 0", |
| 6820 | i, i); |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 6821 | } |
| 6822 | } |
| 6823 | } |
| 6824 | if (pStrides) { |
| 6825 | if (pStrides[i] > device_limits.maxVertexInputBindingStride) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 6826 | skip |= LogError(commandBuffer, "VUID-vkCmdBindVertexBuffers2EXT-pStrides-03362", |
| 6827 | "vkCmdBindVertexBuffers2EXT() pStrides[%" PRIu32 "] (%" PRIu64 |
| 6828 | ") must be less than maxVertexInputBindingStride (%" PRIu32 ")", |
| 6829 | i, pStrides[i], device_limits.maxVertexInputBindingStride); |
Piers Daniell | 39842ee | 2020-07-10 16:42:33 -0600 | [diff] [blame] | 6830 | } |
| 6831 | } |
| 6832 | } |
| 6833 | |
| 6834 | return skip; |
| 6835 | } |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6836 | |
| 6837 | bool StatelessValidation::ValidateAccelerationStructureBuildGeometryInfoKHR( |
| 6838 | const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, uint32_t infoCount, const char *api_name) const { |
| 6839 | bool skip = false; |
| 6840 | for (uint32_t i = 0; i < infoCount; ++i) { |
| 6841 | if (pInfos[i].type == VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR) { |
| 6842 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03654", |
| 6843 | "(%s): type must not be VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR.", api_name); |
| 6844 | } |
| 6845 | if (pInfos[i].flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR && |
| 6846 | pInfos[i].flags & VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR) { |
| 6847 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-flags-03796", |
| 6848 | "(%s): If flags has the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR bit set," |
| 6849 | "then it must not have the VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR bit set.", |
| 6850 | api_name); |
| 6851 | } |
| 6852 | if (pInfos[i].pGeometries && pInfos[i].ppGeometries) { |
| 6853 | skip |= |
| 6854 | LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-pGeometries-03788", |
| 6855 | "(%s): Only one of pGeometries or ppGeometries can be a valid pointer, the other must be NULL", api_name); |
| 6856 | } |
| 6857 | if (pInfos[i].type == VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR && pInfos[i].geometryCount != 1) { |
| 6858 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03790", |
| 6859 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, geometryCount must be 1", api_name); |
| 6860 | } |
| 6861 | if (pInfos[i].type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR && |
| 6862 | pInfos[i].geometryCount > phys_dev_ext_props.acc_structure_props.maxGeometryCount) { |
| 6863 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03793", |
| 6864 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR then geometryCount must be" |
| 6865 | " less than or equal to VkPhysicalDeviceAccelerationStructurePropertiesKHR::maxGeometryCount", |
| 6866 | api_name); |
| 6867 | } |
| 6868 | if (pInfos[i].pGeometries) { |
| 6869 | for (uint32_t j = 0; j < pInfos[i].geometryCount; ++j) { |
| 6870 | skip |= validate_ranged_enum( |
| 6871 | api_name, ParameterName("pInfos[%i].pGeometries[%i].geometryType", ParameterName::IndexVector{i, j}), |
| 6872 | "VkGeometryTypeKHR", AllVkGeometryTypeKHREnums, pInfos[i].pGeometries[j].geometryType, |
| 6873 | "VUID-VkAccelerationStructureGeometryKHR-geometryType-parameter"); |
| 6874 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_TRIANGLES_KHR) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6875 | skip |= validate_struct_type( |
| 6876 | api_name, ParameterName("pInfos[%i].pGeometries[%i].geometry.triangles", ParameterName::IndexVector{i, j}), |
| 6877 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR", |
| 6878 | &(pInfos[i].pGeometries[j].geometry.triangles), |
| 6879 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR, false, kVUIDUndefined, |
| 6880 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-sType-sType"); |
| 6881 | skip |= validate_struct_pnext( |
| 6882 | api_name, |
| 6883 | ParameterName("pInfos[%i].pGeometries[%i].geometry.triangles.pNext", ParameterName::IndexVector{i, j}), |
| 6884 | NULL, pInfos[i].pGeometries[j].geometry.triangles.pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
| 6885 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-pNext-pNext", kVUIDUndefined); |
| 6886 | skip |= |
| 6887 | validate_ranged_enum(api_name, |
| 6888 | ParameterName("pInfos[%i].pGeometries[%i].geometry.triangles.vertexFormat", |
| 6889 | ParameterName::IndexVector{i, j}), |
| 6890 | "VkFormat", AllVkFormatEnums, pInfos[i].pGeometries[j].geometry.triangles.vertexFormat, |
| 6891 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexFormat-parameter"); |
| 6892 | skip |= validate_struct_type(api_name, "pInfos[i].pGeometries[j].geometry.triangles", |
| 6893 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR", |
| 6894 | &pInfos[i].pGeometries[j].geometry.triangles, |
| 6895 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR, true, |
| 6896 | "VUID-VkAccelerationStructureGeometryKHR-triangles-parameter", kVUIDUndefined); |
| 6897 | skip |= validate_ranged_enum( |
| 6898 | api_name, |
| 6899 | ParameterName("pInfos[%i].pGeometries[%i].geometry.triangles.indexType", ParameterName::IndexVector{i, j}), |
| 6900 | "VkIndexType", AllVkIndexTypeEnums, pInfos[i].pGeometries[j].geometry.triangles.indexType, |
| 6901 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-indexType-parameter"); |
| 6902 | |
| 6903 | if (pInfos[i].pGeometries[j].geometry.triangles.vertexStride > UINT32_MAX) { |
| 6904 | skip |= LogError(device, "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexStride-03819", |
| 6905 | "(%s):vertexStride must be less than or equal to 2^32-1", api_name); |
| 6906 | } |
| 6907 | if (pInfos[i].pGeometries[j].geometry.triangles.indexType != VK_INDEX_TYPE_UINT16 && |
| 6908 | pInfos[i].pGeometries[j].geometry.triangles.indexType != VK_INDEX_TYPE_UINT32 && |
| 6909 | pInfos[i].pGeometries[j].geometry.triangles.indexType != VK_INDEX_TYPE_NONE_KHR) { |
| 6910 | skip |= |
| 6911 | LogError(device, "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-indexType-03798", |
| 6912 | "(%s):indexType must be VK_INDEX_TYPE_UINT16, VK_INDEX_TYPE_UINT32, or VK_INDEX_TYPE_NONE_KHR", |
| 6913 | api_name); |
| 6914 | } |
| 6915 | } |
| 6916 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 6917 | skip |= validate_struct_type(api_name, "pInfos[i].pGeometries[j].geometry.instances", |
| 6918 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR", |
| 6919 | &pInfos[i].pGeometries[j].geometry.instances, |
| 6920 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR, true, |
| 6921 | "VUID-VkAccelerationStructureGeometryKHR-instances-parameter", kVUIDUndefined); |
| 6922 | skip |= validate_struct_type( |
| 6923 | api_name, ParameterName("pInfos[%i].pGeometries[%i].geometry.instances", ParameterName::IndexVector{i, j}), |
| 6924 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR", |
| 6925 | &(pInfos[i].pGeometries[j].geometry.instances), |
| 6926 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR, false, kVUIDUndefined, |
| 6927 | "VUID-VkAccelerationStructureGeometryInstancesDataKHR-sType-sType"); |
| 6928 | skip |= validate_struct_pnext( |
| 6929 | api_name, |
| 6930 | ParameterName("pInfos[%i].pGeometries[%i].geometry.instances.pNext", ParameterName::IndexVector{i, j}), |
| 6931 | NULL, pInfos[i].pGeometries[j].geometry.instances.pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
| 6932 | "VUID-VkAccelerationStructureGeometryInstancesDataKHR-pNext-pNext", kVUIDUndefined); |
| 6933 | |
| 6934 | skip |= validate_bool32(api_name, |
| 6935 | ParameterName("pInfos[%i].pGeometries[%i].geometry.instances.arrayOfPointers", |
| 6936 | ParameterName::IndexVector{i, j}), |
| 6937 | pInfos[i].pGeometries[j].geometry.instances.arrayOfPointers); |
| 6938 | } |
| 6939 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_AABBS_KHR) { |
| 6940 | skip |= validate_struct_type(api_name, "pInfos[i].pGeometries[j].geometry.aabbs", |
| 6941 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR", |
| 6942 | &pInfos[i].pGeometries[j].geometry.aabbs, |
| 6943 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR, true, |
| 6944 | "VUID-VkAccelerationStructureGeometryKHR-aabbs-parameter", kVUIDUndefined); |
| 6945 | skip |= validate_struct_type( |
| 6946 | api_name, ParameterName("pInfos[%i].pGeometries[%i].geometry.aabbs", ParameterName::IndexVector{i, j}), |
| 6947 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR", |
| 6948 | &(pInfos[i].pGeometries[j].geometry.aabbs), |
| 6949 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR, false, kVUIDUndefined, |
| 6950 | "VUID-VkAccelerationStructureGeometryAabbsDataKHR-sType-sType"); |
| 6951 | skip |= validate_struct_pnext( |
| 6952 | api_name, |
| 6953 | ParameterName("pInfos[%i].pGeometries[%i].geometry.aabbs.pNext", ParameterName::IndexVector{i, j}), NULL, |
| 6954 | pInfos[i].pGeometries[j].geometry.aabbs.pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
| 6955 | "VUID-VkAccelerationStructureGeometryAabbsDataKHR-pNext-pNext", kVUIDUndefined); |
| 6956 | if (pInfos[i].pGeometries[j].geometry.aabbs.stride > UINT32_MAX) { |
| 6957 | skip |= LogError(device, "VUID-VkAccelerationStructureGeometryAabbsDataKHR-stride-03820", |
| 6958 | "(%s):stride must be less than or equal to 2^32-1", api_name); |
| 6959 | } |
| 6960 | } |
| 6961 | if (pInfos[i].type == VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR && |
| 6962 | pInfos[i].pGeometries[j].geometryType != VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 6963 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03789", |
| 6964 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, the geometryType member" |
| 6965 | " of elements of either pGeometries or ppGeometries must be VK_GEOMETRY_TYPE_INSTANCES_KHR", |
| 6966 | api_name); |
| 6967 | } |
| 6968 | if (pInfos[i].type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR) { |
| 6969 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 6970 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03791", |
| 6971 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR the geometryType member " |
| 6972 | "of elements of" |
| 6973 | " either pGeometries or ppGeometries must not be VK_GEOMETRY_TYPE_INSTANCES_KHR", |
| 6974 | api_name); |
| 6975 | } |
| 6976 | if (pInfos[i].pGeometries[j].geometryType != pInfos[i].pGeometries[0].geometryType) { |
| 6977 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03792", |
| 6978 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR then the geometryType" |
| 6979 | " member of each geometry in either pGeometries or ppGeometries must be the same.", |
| 6980 | api_name); |
| 6981 | } |
| 6982 | } |
| 6983 | } |
| 6984 | } |
| 6985 | if (pInfos[i].ppGeometries != NULL) { |
| 6986 | for (uint32_t j = 0; j < pInfos[i].geometryCount; ++j) { |
| 6987 | skip |= validate_ranged_enum( |
| 6988 | api_name, ParameterName("pInfos[%i].ppGeometries[%i]->geometryType", ParameterName::IndexVector{i, j}), |
| 6989 | "VkGeometryTypeKHR", AllVkGeometryTypeKHREnums, pInfos[i].ppGeometries[j]->geometryType, |
| 6990 | "VUID-VkAccelerationStructureGeometryKHR-geometryType-parameter"); |
| 6991 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_TRIANGLES_KHR) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 6992 | skip |= validate_struct_type(api_name, "pInfos[i].pGeometries[j].geometry.triangles", |
| 6993 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR", |
| 6994 | &pInfos[i].ppGeometries[j]->geometry.triangles, |
| 6995 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR, true, |
| 6996 | "VUID-VkAccelerationStructureGeometryKHR-triangles-parameter", kVUIDUndefined); |
| 6997 | skip |= validate_struct_type( |
| 6998 | api_name, |
| 6999 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.triangles", ParameterName::IndexVector{i, j}), |
| 7000 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR", |
| 7001 | &(pInfos[i].ppGeometries[j]->geometry.triangles), |
| 7002 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR, false, kVUIDUndefined, |
| 7003 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-sType-sType"); |
| 7004 | skip |= validate_struct_pnext( |
| 7005 | api_name, |
| 7006 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.triangles.pNext", ParameterName::IndexVector{i, j}), |
| 7007 | NULL, pInfos[i].ppGeometries[j]->geometry.triangles.pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
| 7008 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-pNext-pNext", kVUIDUndefined); |
| 7009 | skip |= validate_ranged_enum(api_name, |
| 7010 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.triangles.vertexFormat", |
| 7011 | ParameterName::IndexVector{i, j}), |
| 7012 | "VkFormat", AllVkFormatEnums, |
| 7013 | pInfos[i].ppGeometries[j]->geometry.triangles.vertexFormat, |
| 7014 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexFormat-parameter"); |
| 7015 | skip |= validate_ranged_enum(api_name, |
| 7016 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.triangles.indexType", |
| 7017 | ParameterName::IndexVector{i, j}), |
| 7018 | "VkIndexType", AllVkIndexTypeEnums, |
| 7019 | pInfos[i].ppGeometries[j]->geometry.triangles.indexType, |
| 7020 | "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-indexType-parameter"); |
| 7021 | if (pInfos[i].ppGeometries[j]->geometry.triangles.vertexStride > UINT32_MAX) { |
| 7022 | skip |= LogError(device, "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-vertexStride-03819", |
| 7023 | "(%s):vertexStride must be less than or equal to 2^32-1", api_name); |
| 7024 | } |
| 7025 | if (pInfos[i].ppGeometries[j]->geometry.triangles.indexType != VK_INDEX_TYPE_UINT16 && |
| 7026 | pInfos[i].ppGeometries[j]->geometry.triangles.indexType != VK_INDEX_TYPE_UINT32 && |
| 7027 | pInfos[i].ppGeometries[j]->geometry.triangles.indexType != VK_INDEX_TYPE_NONE_KHR) { |
| 7028 | skip |= |
| 7029 | LogError(device, "VUID-VkAccelerationStructureGeometryTrianglesDataKHR-indexType-03798", |
| 7030 | "(%s):indexType must be VK_INDEX_TYPE_UINT16, VK_INDEX_TYPE_UINT32, or VK_INDEX_TYPE_NONE_KHR", |
| 7031 | api_name); |
| 7032 | } |
| 7033 | } |
| 7034 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 7035 | skip |= validate_struct_type(api_name, "pInfos[i].pGeometries[j].geometry.instances", |
| 7036 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR", |
| 7037 | &pInfos[i].ppGeometries[j]->geometry.instances, |
| 7038 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR, true, |
| 7039 | "VUID-VkAccelerationStructureGeometryKHR-instances-parameter", kVUIDUndefined); |
| 7040 | skip |= validate_struct_type( |
| 7041 | api_name, |
| 7042 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.instances", ParameterName::IndexVector{i, j}), |
| 7043 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR", |
| 7044 | &(pInfos[i].ppGeometries[j]->geometry.instances), |
| 7045 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR, false, kVUIDUndefined, |
| 7046 | "VUID-VkAccelerationStructureGeometryInstancesDataKHR-sType-sType"); |
| 7047 | skip |= validate_struct_pnext( |
| 7048 | api_name, |
| 7049 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.instances.pNext", ParameterName::IndexVector{i, j}), |
| 7050 | NULL, pInfos[i].ppGeometries[j]->geometry.instances.pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
| 7051 | "VUID-VkAccelerationStructureGeometryInstancesDataKHR-pNext-pNext", kVUIDUndefined); |
| 7052 | skip |= validate_bool32(api_name, |
| 7053 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.instances.arrayOfPointers", |
| 7054 | ParameterName::IndexVector{i, j}), |
| 7055 | pInfos[i].ppGeometries[j]->geometry.instances.arrayOfPointers); |
| 7056 | } |
| 7057 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_AABBS_KHR) { |
| 7058 | skip |= validate_struct_type(api_name, "pInfos[i].pGeometries[j].geometry.aabbs", |
| 7059 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR", |
| 7060 | &pInfos[i].ppGeometries[j]->geometry.aabbs, |
| 7061 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR, true, |
| 7062 | "VUID-VkAccelerationStructureGeometryKHR-aabbs-parameter", kVUIDUndefined); |
| 7063 | skip |= validate_struct_type( |
| 7064 | api_name, ParameterName("pInfos[%i].ppGeometries[%i]->geometry.aabbs", ParameterName::IndexVector{i, j}), |
| 7065 | "VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR", |
| 7066 | &(pInfos[i].ppGeometries[j]->geometry.aabbs), |
| 7067 | VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR, false, kVUIDUndefined, |
| 7068 | "VUID-VkAccelerationStructureGeometryAabbsDataKHR-sType-sType"); |
| 7069 | skip |= validate_struct_pnext( |
| 7070 | api_name, |
| 7071 | ParameterName("pInfos[%i].ppGeometries[%i]->geometry.aabbs.pNext", ParameterName::IndexVector{i, j}), NULL, |
| 7072 | pInfos[i].ppGeometries[j]->geometry.aabbs.pNext, 0, NULL, GeneratedVulkanHeaderVersion, |
| 7073 | "VUID-VkAccelerationStructureGeometryAabbsDataKHR-pNext-pNext", kVUIDUndefined); |
| 7074 | if (pInfos[i].ppGeometries[j]->geometry.aabbs.stride > UINT32_MAX) { |
| 7075 | skip |= LogError(device, "VUID-VkAccelerationStructureGeometryAabbsDataKHR-stride-03820", |
| 7076 | "(%s):stride must be less than or equal to 2^32-1", api_name); |
| 7077 | } |
| 7078 | } |
| 7079 | if (pInfos[i].type == VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR && |
| 7080 | pInfos[i].ppGeometries[j]->geometryType != VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 7081 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03789", |
| 7082 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, the geometryType member" |
| 7083 | " of elements of either pGeometries or ppGeometries must be VK_GEOMETRY_TYPE_INSTANCES_KHR", |
| 7084 | api_name); |
| 7085 | } |
| 7086 | if (pInfos[i].type == VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR) { |
| 7087 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 7088 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03791", |
| 7089 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR the geometryType member " |
| 7090 | "of elements of" |
| 7091 | " either pGeometries or ppGeometries must not be VK_GEOMETRY_TYPE_INSTANCES_KHR", |
| 7092 | api_name); |
| 7093 | } |
| 7094 | if (pInfos[i].ppGeometries[j]->geometryType != pInfos[i].ppGeometries[0]->geometryType) { |
| 7095 | skip |= LogError(device, "VUID-VkAccelerationStructureBuildGeometryInfoKHR-type-03792", |
| 7096 | "(%s): If type is VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR then the geometryType" |
| 7097 | " member of each geometry in either pGeometries or ppGeometries must be the same.", |
| 7098 | api_name); |
| 7099 | } |
| 7100 | } |
| 7101 | } |
| 7102 | } |
| 7103 | } |
| 7104 | return skip; |
| 7105 | } |
| 7106 | bool StatelessValidation::manual_PreCallValidateCmdBuildAccelerationStructuresKHR( |
| 7107 | VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, |
| 7108 | const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const { |
| 7109 | bool skip = false; |
| 7110 | skip |= ValidateAccelerationStructureBuildGeometryInfoKHR(pInfos, infoCount, "vkCmdBuildAccelerationStructuresKHR"); |
| 7111 | for (uint32_t i = 0; i < infoCount; ++i) { |
| 7112 | if (SafeModulo(pInfos[i].scratchData.deviceAddress, |
| 7113 | phys_dev_ext_props.acc_structure_props.minAccelerationStructureScratchOffsetAlignment) != 0) { |
| 7114 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03710", |
| 7115 | "vkCmdBuildAccelerationStructuresKHR:For each element of pInfos, its " |
| 7116 | "scratchData.deviceAddress member must be a multiple of " |
| 7117 | "VkPhysicalDeviceAccelerationStructurePropertiesKHR::minAccelerationStructureScratchOffsetAlignment."); |
| 7118 | } |
| 7119 | for (uint32_t k = 0; k < infoCount; ++k) { |
| 7120 | if (i == k) continue; |
| 7121 | bool found = false; |
| 7122 | if (pInfos[i].dstAccelerationStructure == pInfos[k].dstAccelerationStructure) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7123 | skip |= |
| 7124 | LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-dstAccelerationStructure-03698", |
| 7125 | "vkCmdBuildAccelerationStructuresKHR:The dstAccelerationStructure member of any element (%" PRIu32 |
| 7126 | ") of pInfos must " |
| 7127 | "not be " |
| 7128 | "the same acceleration structure as the dstAccelerationStructure member of any other element (%" PRIu32 |
| 7129 | ") of pInfos.", |
| 7130 | i, k); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7131 | found = true; |
| 7132 | } |
| 7133 | if (pInfos[i].srcAccelerationStructure == pInfos[k].dstAccelerationStructure) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7134 | skip |= |
| 7135 | LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03403", |
| 7136 | "vkCmdBuildAccelerationStructuresKHR:The srcAccelerationStructure member of any element (%" PRIu32 |
| 7137 | ") of pInfos must " |
| 7138 | "not be " |
| 7139 | "the same acceleration structure as the dstAccelerationStructure member of any other element (%" PRIu32 |
| 7140 | ") of pInfos.", |
| 7141 | i, k); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7142 | found = true; |
| 7143 | } |
| 7144 | if (found) break; |
| 7145 | } |
| 7146 | for (uint32_t j = 0; j < pInfos[i].geometryCount; ++j) { |
| 7147 | if (pInfos[i].pGeometries) { |
| 7148 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 7149 | if (pInfos[i].pGeometries[j].geometry.instances.arrayOfPointers == VK_TRUE) { |
| 7150 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.instances.data.deviceAddress, 8) != 0) { |
| 7151 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03716", |
| 7152 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries with a " |
| 7153 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is " |
| 7154 | "VK_TRUE, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7155 | } |
| 7156 | } else { |
| 7157 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.instances.data.deviceAddress, 16) != 0) { |
| 7158 | skip |= |
| 7159 | LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03715", |
| 7160 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries with a " |
| 7161 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is VK_FALSE, " |
| 7162 | "geometry.data->deviceAddress must be aligned to 16 bytes."); |
| 7163 | } |
| 7164 | } |
Ricardo Garcia | 2ba3da8 | 2020-12-02 11:27:53 +0100 | [diff] [blame] | 7165 | } else if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_AABBS_KHR) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7166 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.instances.data.deviceAddress, 8) != 0) { |
| 7167 | skip |= LogError( |
| 7168 | device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03714", |
| 7169 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries with a " |
| 7170 | "geometryType of VK_GEOMETRY_TYPE_AABBS_KHR, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7171 | } |
Ricardo Garcia | 2ba3da8 | 2020-12-02 11:27:53 +0100 | [diff] [blame] | 7172 | } else if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_TRIANGLES_KHR) { |
| 7173 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.triangles.transformData.deviceAddress, 16) != 0) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7174 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03810", |
| 7175 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries " |
| 7176 | "with a geometryType of VK_GEOMETRY_TYPE_TRIANGLES_KHR, " |
| 7177 | "geometry.transformData->deviceAddress must be aligned to 16 bytes."); |
| 7178 | } |
| 7179 | } |
| 7180 | } else if (pInfos[i].ppGeometries) { |
| 7181 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 7182 | if (pInfos[i].ppGeometries[j]->geometry.instances.arrayOfPointers == VK_TRUE) { |
| 7183 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.instances.data.deviceAddress, 8) != 0) { |
| 7184 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03716", |
| 7185 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries with a " |
| 7186 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is " |
| 7187 | "VK_TRUE, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7188 | } |
| 7189 | } else { |
| 7190 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.instances.data.deviceAddress, 16) != 0) { |
| 7191 | skip |= |
| 7192 | LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03715", |
| 7193 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries with a " |
| 7194 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is VK_FALSE, " |
| 7195 | "geometry.data->deviceAddress must be aligned to 16 bytes."); |
| 7196 | } |
| 7197 | } |
Ricardo Garcia | 2ba3da8 | 2020-12-02 11:27:53 +0100 | [diff] [blame] | 7198 | } else if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_AABBS_KHR) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7199 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.instances.data.deviceAddress, 8) != 0) { |
| 7200 | skip |= LogError( |
| 7201 | device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03714", |
| 7202 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries with a " |
| 7203 | "geometryType of VK_GEOMETRY_TYPE_AABBS_KHR, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7204 | } |
Ricardo Garcia | 2ba3da8 | 2020-12-02 11:27:53 +0100 | [diff] [blame] | 7205 | } else if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_TRIANGLES_KHR) { |
| 7206 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.triangles.transformData.deviceAddress, 16) != 0) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7207 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03810", |
| 7208 | "vkCmdBuildAccelerationStructuresKHR:For any element of pInfos[i].pGeometries " |
| 7209 | "with a geometryType of VK_GEOMETRY_TYPE_TRIANGLES_KHR, " |
| 7210 | "geometry.transformData->deviceAddress must be aligned to 16 bytes."); |
| 7211 | } |
| 7212 | } |
| 7213 | } |
| 7214 | } |
| 7215 | } |
| 7216 | return skip; |
| 7217 | } |
| 7218 | |
| 7219 | bool StatelessValidation::manual_PreCallValidateCmdBuildAccelerationStructuresIndirectKHR( |
| 7220 | VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, |
| 7221 | const VkDeviceAddress *pIndirectDeviceAddresses, const uint32_t *pIndirectStrides, |
| 7222 | const uint32_t *const *ppMaxPrimitiveCounts) const { |
| 7223 | bool skip = false; |
| 7224 | skip |= ValidateAccelerationStructureBuildGeometryInfoKHR(pInfos, infoCount, "vkCmdBuildAccelerationStructuresIndirectKHR"); |
| 7225 | const auto *ray_tracing_acceleration_structure_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 7226 | LvlFindInChain<VkPhysicalDeviceAccelerationStructureFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7227 | if (!ray_tracing_acceleration_structure_features || |
| 7228 | ray_tracing_acceleration_structure_features->accelerationStructureIndirectBuild == VK_FALSE) { |
| 7229 | skip |= LogError( |
| 7230 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-accelerationStructureIndirectBuild-03650", |
| 7231 | "vkCmdBuildAccelerationStructuresIndirectKHR: The " |
| 7232 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureIndirectBuild feature must be enabled."); |
| 7233 | } |
| 7234 | for (uint32_t i = 0; i < infoCount; ++i) { |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7235 | if (SafeModulo(pInfos[i].scratchData.deviceAddress, |
| 7236 | phys_dev_ext_props.acc_structure_props.minAccelerationStructureScratchOffsetAlignment) != 0) { |
| 7237 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03710", |
| 7238 | "vkCmdBuildAccelerationStructuresIndirectKHR:For each element of pInfos, its " |
| 7239 | "scratchData.deviceAddress member must be a multiple of " |
| 7240 | "VkPhysicalDeviceAccelerationStructurePropertiesKHR::minAccelerationStructureScratchOffsetAlignment."); |
| 7241 | } |
| 7242 | for (uint32_t k = 0; k < infoCount; ++k) { |
| 7243 | if (i == k) continue; |
| 7244 | if (pInfos[i].srcAccelerationStructure == pInfos[k].dstAccelerationStructure) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7245 | skip |= LogError( |
| 7246 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03403", |
| 7247 | "vkCmdBuildAccelerationStructuresIndirectKHR:The srcAccelerationStructure member of any element (%" PRIu32 |
| 7248 | ") " |
| 7249 | "of pInfos must not be the same acceleration structure as the dstAccelerationStructure member of " |
| 7250 | "any other element [%" PRIu32 ") of pInfos.", |
| 7251 | i, k); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7252 | break; |
| 7253 | } |
| 7254 | } |
| 7255 | for (uint32_t j = 0; j < pInfos[i].geometryCount; ++j) { |
| 7256 | if (pInfos[i].pGeometries) { |
| 7257 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 7258 | if (pInfos[i].pGeometries[j].geometry.instances.arrayOfPointers == VK_TRUE) { |
| 7259 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.instances.data.deviceAddress, 8) != 0) { |
| 7260 | skip |= LogError( |
| 7261 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03716", |
| 7262 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries with a " |
| 7263 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is " |
| 7264 | "VK_TRUE, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7265 | } |
| 7266 | } else { |
| 7267 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.instances.data.deviceAddress, 16) != 0) { |
| 7268 | skip |= LogError( |
| 7269 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03715", |
| 7270 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries with a " |
| 7271 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is VK_FALSE, " |
| 7272 | "geometry.data->deviceAddress must be aligned to 16 bytes."); |
| 7273 | } |
| 7274 | } |
| 7275 | } |
| 7276 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_AABBS_KHR) { |
| 7277 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.instances.data.deviceAddress, 8) != 0) { |
| 7278 | skip |= LogError( |
| 7279 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03714", |
| 7280 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries with a " |
| 7281 | "geometryType of VK_GEOMETRY_TYPE_AABBS_KHR, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7282 | } |
| 7283 | } |
| 7284 | if (pInfos[i].pGeometries[j].geometryType == VK_GEOMETRY_TYPE_TRIANGLES_KHR) { |
| 7285 | if (SafeModulo(pInfos[i].pGeometries[j].geometry.triangles.indexData.deviceAddress, 16) != 0) { |
| 7286 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03810", |
| 7287 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries " |
| 7288 | "with a geometryType of VK_GEOMETRY_TYPE_TRIANGLES_KHR, " |
| 7289 | "geometry.transformData->deviceAddress must be aligned to 16 bytes."); |
| 7290 | } |
| 7291 | } |
| 7292 | } else if (pInfos[i].ppGeometries) { |
| 7293 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_INSTANCES_KHR) { |
| 7294 | if (pInfos[i].ppGeometries[j]->geometry.instances.arrayOfPointers == VK_TRUE) { |
| 7295 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.instances.data.deviceAddress, 8) != 0) { |
| 7296 | skip |= LogError( |
| 7297 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03716", |
| 7298 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries with a " |
| 7299 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is " |
| 7300 | "VK_TRUE, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7301 | } |
| 7302 | } else { |
| 7303 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.instances.data.deviceAddress, 16) != 0) { |
| 7304 | skip |= LogError( |
| 7305 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03715", |
| 7306 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries with a " |
| 7307 | "geometryType of VK_GEOMETRY_TYPE_INSTANCES_KHR, if geometry.arrayOfPointers is VK_FALSE, " |
| 7308 | "geometry.data->deviceAddress must be aligned to 16 bytes."); |
| 7309 | } |
| 7310 | } |
| 7311 | } |
| 7312 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_AABBS_KHR) { |
| 7313 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.instances.data.deviceAddress, 8) != 0) { |
| 7314 | skip |= LogError( |
| 7315 | device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03714", |
| 7316 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries with a " |
| 7317 | "geometryType of VK_GEOMETRY_TYPE_AABBS_KHR, geometry.data->deviceAddress must be aligned to 8 bytes."); |
| 7318 | } |
| 7319 | } |
| 7320 | if (pInfos[i].ppGeometries[j]->geometryType == VK_GEOMETRY_TYPE_TRIANGLES_KHR) { |
| 7321 | if (SafeModulo(pInfos[i].ppGeometries[j]->geometry.triangles.indexData.deviceAddress, 16) != 0) { |
| 7322 | skip |= LogError(device, "VUID-vkCmdBuildAccelerationStructuresIndirectKHR-pInfos-03810", |
| 7323 | "vkCmdBuildAccelerationStructuresIndirectKHR:For any element of pInfos[i].pGeometries " |
| 7324 | "with a geometryType of VK_GEOMETRY_TYPE_TRIANGLES_KHR, " |
| 7325 | "geometry.transformData->deviceAddress must be aligned to 16 bytes."); |
| 7326 | } |
| 7327 | } |
| 7328 | } |
| 7329 | } |
| 7330 | } |
| 7331 | return skip; |
| 7332 | } |
| 7333 | |
| 7334 | bool StatelessValidation::manual_PreCallValidateBuildAccelerationStructuresKHR( |
| 7335 | VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, |
| 7336 | const VkAccelerationStructureBuildGeometryInfoKHR *pInfos, |
| 7337 | const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos) const { |
| 7338 | bool skip = false; |
| 7339 | skip |= ValidateAccelerationStructureBuildGeometryInfoKHR(pInfos, infoCount, "vkBuildAccelerationStructuresKHR"); |
| 7340 | const auto *ray_tracing_acceleration_structure_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 7341 | LvlFindInChain<VkPhysicalDeviceAccelerationStructureFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7342 | if (!ray_tracing_acceleration_structure_features || |
| 7343 | ray_tracing_acceleration_structure_features->accelerationStructureHostCommands == VK_FALSE) { |
| 7344 | skip |= |
| 7345 | LogError(device, "VUID-vkBuildAccelerationStructuresKHR-accelerationStructureHostCommands-03581", |
| 7346 | "vkBuildAccelerationStructuresKHR: The " |
| 7347 | "VkPhysicalDeviceAccelerationStructureFeaturesKHR::accelerationStructureHostCommands feature must be enabled"); |
| 7348 | } |
| 7349 | for (uint32_t i = 0; i < infoCount; ++i) { |
| 7350 | for (uint32_t j = 0; j < infoCount; ++j) { |
| 7351 | if (i == j) continue; |
| 7352 | bool found = false; |
| 7353 | if (pInfos[i].dstAccelerationStructure == pInfos[j].dstAccelerationStructure) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7354 | skip |= |
| 7355 | LogError(device, "VUID-vkBuildAccelerationStructuresKHR-dstAccelerationStructure-03698", |
| 7356 | "vkBuildAccelerationStructuresKHR(): The dstAccelerationStructure member of any element (%" PRIu32 |
| 7357 | ") of pInfos must " |
| 7358 | "not be " |
| 7359 | "the same acceleration structure as the dstAccelerationStructure member of any other element (%" PRIu32 |
| 7360 | ") of pInfos.", |
| 7361 | i, j); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7362 | found = true; |
| 7363 | } |
| 7364 | if (pInfos[i].srcAccelerationStructure == pInfos[j].dstAccelerationStructure) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7365 | skip |= |
| 7366 | LogError(device, "VUID-vkBuildAccelerationStructuresKHR-pInfos-03403", |
| 7367 | "vkBuildAccelerationStructuresKHR(): The srcAccelerationStructure member of any element (%" PRIu32 |
| 7368 | ") of pInfos must " |
| 7369 | "not be " |
| 7370 | "the same acceleration structure as the dstAccelerationStructure member of any other element (%" PRIu32 |
| 7371 | ") of pInfos.", |
| 7372 | i, j); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7373 | found = true; |
| 7374 | } |
| 7375 | if (found) break; |
| 7376 | } |
| 7377 | } |
| 7378 | return skip; |
| 7379 | } |
| 7380 | |
| 7381 | bool StatelessValidation::manual_PreCallValidateGetAccelerationStructureBuildSizesKHR( |
| 7382 | VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo, |
| 7383 | const uint32_t *pMaxPrimitiveCounts, VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo) const { |
| 7384 | bool skip = false; |
| 7385 | skip |= ValidateAccelerationStructureBuildGeometryInfoKHR(pBuildInfo, 1, "vkGetAccelerationStructureBuildSizesKHR"); |
| 7386 | const auto *ray_tracing_pipeline_features = |
Mark Lobodzinski | 1f887d3 | 2020-12-30 15:31:33 -0700 | [diff] [blame] | 7387 | LvlFindInChain<VkPhysicalDeviceRayTracingPipelineFeaturesKHR>(device_createinfo_pnext); |
| 7388 | const auto *ray_query_features = LvlFindInChain<VkPhysicalDeviceRayQueryFeaturesKHR>(device_createinfo_pnext); |
sourav parmar | cd5fb18 | 2020-07-17 12:58:44 -0700 | [diff] [blame] | 7389 | if (!(ray_tracing_pipeline_features || ray_query_features) || |
| 7390 | ((ray_tracing_pipeline_features && ray_tracing_pipeline_features->rayTracingPipeline == VK_FALSE) || |
| 7391 | (ray_query_features && ray_query_features->rayQuery == VK_FALSE))) { |
| 7392 | skip |= LogError(device, "VUID-vkGetAccelerationStructureBuildSizesKHR-rayTracingPipeline-03617", |
| 7393 | "vkGetAccelerationStructureBuildSizesKHR:The rayTracingPipeline or rayQuery feature must be enabled"); |
| 7394 | } |
| 7395 | return skip; |
| 7396 | } |
sfricke-samsung | ecafb19 | 2021-01-17 08:21:14 -0800 | [diff] [blame] | 7397 | |
| 7398 | bool StatelessValidation::manual_PreCallValidateCreatePrivateDataSlotEXT(VkDevice device, |
| 7399 | const VkPrivateDataSlotCreateInfoEXT *pCreateInfo, |
| 7400 | const VkAllocationCallbacks *pAllocator, |
| 7401 | VkPrivateDataSlotEXT *pPrivateDataSlot) const { |
| 7402 | bool skip = false; |
| 7403 | const auto *private_data_features = LvlFindInChain<VkPhysicalDevicePrivateDataFeaturesEXT>(device_createinfo_pnext); |
| 7404 | if (private_data_features && private_data_features->privateData == VK_FALSE) { |
| 7405 | skip |= LogError(device, "VUID-vkCreatePrivateDataSlotEXT-privateData-04564", |
| 7406 | "vkCreatePrivateDataSlotEXT(): The privateData feature must be enabled."); |
| 7407 | } |
| 7408 | return skip; |
Jeremy Gebben | cbf2286 | 2021-03-03 12:01:22 -0700 | [diff] [blame] | 7409 | } |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7410 | |
| 7411 | bool StatelessValidation::manual_PreCallValidateCmdSetVertexInputEXT( |
| 7412 | VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount, |
| 7413 | const VkVertexInputBindingDescription2EXT *pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount, |
| 7414 | const VkVertexInputAttributeDescription2EXT *pVertexAttributeDescriptions) const { |
| 7415 | bool skip = false; |
| 7416 | const auto *vertex_input_dynamic_state_features = |
| 7417 | LvlFindInChain<VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT>(device_createinfo_pnext); |
| 7418 | const auto *vertex_attribute_divisor_features = |
| 7419 | LvlFindInChain<VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT>(device_createinfo_pnext); |
| 7420 | |
| 7421 | // VUID-vkCmdSetVertexInputEXT-None-04790 |
| 7422 | if (!vertex_input_dynamic_state_features || vertex_input_dynamic_state_features->vertexInputDynamicState == VK_FALSE) { |
| 7423 | skip |= LogError(device, "VUID-vkCmdSetVertexInputEXT-None-04790", |
| 7424 | "vkCmdSetVertexInputEXT(): The vertexInputDynamicState feature must be enabled."); |
| 7425 | } |
| 7426 | |
| 7427 | // VUID-vkCmdSetVertexInputEXT-vertexBindingDescriptionCount-04791 |
| 7428 | if (vertexBindingDescriptionCount > device_limits.maxVertexInputBindings) { |
| 7429 | skip |= |
| 7430 | LogError(device, "VUID-vkCmdSetVertexInputEXT-vertexBindingDescriptionCount-04791", |
| 7431 | "vkCmdSetVertexInputEXT(): vertexBindingDescriptionCount is greater than the maxVertexInputBindings limit"); |
| 7432 | } |
| 7433 | |
| 7434 | // VUID-vkCmdSetVertexInputEXT-vertexAttributeDescriptionCount-04792 |
| 7435 | if (vertexAttributeDescriptionCount > device_limits.maxVertexInputAttributes) { |
| 7436 | skip |= LogError( |
| 7437 | device, "VUID-vkCmdSetVertexInputEXT-vertexAttributeDescriptionCount-04792", |
| 7438 | "vkCmdSetVertexInputEXT(): vertexAttributeDescriptionCount is greater than the maxVertexInputAttributes limit"); |
| 7439 | } |
| 7440 | |
| 7441 | // VUID-vkCmdSetVertexInputEXT-binding-04793 |
| 7442 | for (uint32_t attribute = 0; attribute < vertexAttributeDescriptionCount; ++attribute) { |
| 7443 | bool binding_found = false; |
| 7444 | for (uint32_t binding = 0; binding < vertexBindingDescriptionCount; ++binding) { |
| 7445 | if (pVertexAttributeDescriptions[attribute].binding == pVertexBindingDescriptions[binding].binding) { |
| 7446 | binding_found = true; |
| 7447 | break; |
| 7448 | } |
| 7449 | } |
| 7450 | if (!binding_found) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7451 | skip |= LogError( |
| 7452 | device, "VUID-vkCmdSetVertexInputEXT-binding-04793", |
| 7453 | "vkCmdSetVertexInputEXT(): pVertexAttributeDescriptions[%" PRIu32 "] references an unspecified binding", attribute); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7454 | } |
| 7455 | } |
| 7456 | |
| 7457 | // VUID-vkCmdSetVertexInputEXT-pVertexBindingDescriptions-04794 |
| 7458 | if (vertexBindingDescriptionCount > 1) { |
| 7459 | for (uint32_t binding = 0; binding < vertexBindingDescriptionCount - 1; ++binding) { |
| 7460 | uint32_t binding_value = pVertexBindingDescriptions[binding].binding; |
| 7461 | for (uint32_t next_binding = binding + 1; next_binding < vertexBindingDescriptionCount; ++next_binding) { |
| 7462 | if (binding_value == pVertexBindingDescriptions[next_binding].binding) { |
| 7463 | skip |= LogError(device, "VUID-vkCmdSetVertexInputEXT-pVertexBindingDescriptions-04794", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7464 | "vkCmdSetVertexInputEXT(): binding description for binding %" PRIu32 " already specified", |
| 7465 | binding_value); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7466 | } |
| 7467 | } |
| 7468 | } |
| 7469 | } |
| 7470 | |
| 7471 | // VUID-vkCmdSetVertexInputEXT-pVertexAttributeDescriptions-04795 |
| 7472 | if (vertexAttributeDescriptionCount > 1) { |
| 7473 | for (uint32_t attribute = 0; attribute < vertexAttributeDescriptionCount - 1; ++attribute) { |
| 7474 | uint32_t location = pVertexAttributeDescriptions[attribute].location; |
| 7475 | for (uint32_t next_attribute = attribute + 1; next_attribute < vertexAttributeDescriptionCount; ++next_attribute) { |
| 7476 | if (location == pVertexAttributeDescriptions[next_attribute].location) { |
| 7477 | skip |= LogError(device, "VUID-vkCmdSetVertexInputEXT-pVertexAttributeDescriptions-04795", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7478 | "vkCmdSetVertexInputEXT(): attribute description for location %" PRIu32 " already specified", |
| 7479 | location); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7480 | } |
| 7481 | } |
| 7482 | } |
| 7483 | } |
| 7484 | |
| 7485 | for (uint32_t binding = 0; binding < vertexBindingDescriptionCount; ++binding) { |
| 7486 | // VUID-VkVertexInputBindingDescription2EXT-binding-04796 |
| 7487 | if (pVertexBindingDescriptions[binding].binding > device_limits.maxVertexInputBindings) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7488 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription2EXT-binding-04796", |
| 7489 | "vkCmdSetVertexInputEXT(): pVertexBindingDescriptions[%" PRIu32 |
| 7490 | "].binding is greater than maxVertexInputBindings", |
| 7491 | binding); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7492 | } |
| 7493 | |
| 7494 | // VUID-VkVertexInputBindingDescription2EXT-stride-04797 |
| 7495 | if (pVertexBindingDescriptions[binding].stride > device_limits.maxVertexInputBindingStride) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7496 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription2EXT-stride-04797", |
| 7497 | "vkCmdSetVertexInputEXT(): pVertexBindingDescriptions[%" PRIu32 |
| 7498 | "].stride is greater than maxVertexInputBindingStride", |
| 7499 | binding); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7500 | } |
| 7501 | |
| 7502 | // VUID-VkVertexInputBindingDescription2EXT-divisor-04798 |
| 7503 | if (pVertexBindingDescriptions[binding].divisor == 0 && |
| 7504 | (!vertex_attribute_divisor_features || !vertex_attribute_divisor_features->vertexAttributeInstanceRateZeroDivisor)) { |
| 7505 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription2EXT-divisor-04798", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7506 | "vkCmdSetVertexInputEXT(): pVertexBindingDescriptions[%" PRIu32 |
| 7507 | "].divisor is zero but " |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7508 | "vertexAttributeInstanceRateZeroDivisor is not enabled", |
| 7509 | binding); |
| 7510 | } |
| 7511 | |
| 7512 | if (pVertexBindingDescriptions[binding].divisor > 1) { |
| 7513 | // VUID-VkVertexInputBindingDescription2EXT-divisor-04799 |
| 7514 | if (!vertex_attribute_divisor_features || !vertex_attribute_divisor_features->vertexAttributeInstanceRateDivisor) { |
| 7515 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription2EXT-divisor-04799", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7516 | "vkCmdSetVertexInputEXT(): pVertexBindingDescriptions[%" PRIu32 |
| 7517 | "].divisor is greater than one but " |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7518 | "vertexAttributeInstanceRateDivisor is not enabled", |
| 7519 | binding); |
| 7520 | } else { |
Mike Schuchardt | 7b152fa | 2021-08-03 16:30:27 -0700 | [diff] [blame] | 7521 | // VUID-VkVertexInputBindingDescription2EXT-divisor-06226 |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7522 | if (pVertexBindingDescriptions[binding].divisor > |
| 7523 | phys_dev_ext_props.vertex_attribute_divisor_props.maxVertexAttribDivisor) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7524 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription2EXT-divisor-06226", |
| 7525 | "vkCmdSetVertexInputEXT(): pVertexBindingDescriptions[%" PRIu32 |
| 7526 | "].divisor is greater than maxVertexAttribDivisor", |
| 7527 | binding); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7528 | } |
| 7529 | |
Mike Schuchardt | 7b152fa | 2021-08-03 16:30:27 -0700 | [diff] [blame] | 7530 | // VUID-VkVertexInputBindingDescription2EXT-divisor-06227 |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7531 | if (pVertexBindingDescriptions[binding].inputRate != VK_VERTEX_INPUT_RATE_INSTANCE) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7532 | skip |= LogError(device, "VUID-VkVertexInputBindingDescription2EXT-divisor-06227", |
| 7533 | "vkCmdSetVertexInputEXT(): pVertexBindingDescriptions[%" PRIu32 |
| 7534 | "].divisor is greater than 1 but inputRate " |
| 7535 | "is not VK_VERTEX_INPUT_RATE_INSTANCE", |
| 7536 | binding); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7537 | } |
| 7538 | } |
| 7539 | } |
| 7540 | } |
| 7541 | |
| 7542 | for (uint32_t attribute = 0; attribute < vertexAttributeDescriptionCount; ++attribute) { |
Mike Schuchardt | 7b152fa | 2021-08-03 16:30:27 -0700 | [diff] [blame] | 7543 | // VUID-VkVertexInputAttributeDescription2EXT-location-06228 |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7544 | if (pVertexAttributeDescriptions[attribute].location > device_limits.maxVertexInputAttributes) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7545 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription2EXT-location-06228", |
| 7546 | "vkCmdSetVertexInputEXT(): pVertexAttributeDescriptions[%" PRIu32 |
| 7547 | "].location is greater than maxVertexInputAttributes", |
| 7548 | attribute); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7549 | } |
| 7550 | |
Mike Schuchardt | 7b152fa | 2021-08-03 16:30:27 -0700 | [diff] [blame] | 7551 | // VUID-VkVertexInputAttributeDescription2EXT-binding-06229 |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7552 | if (pVertexAttributeDescriptions[attribute].binding > device_limits.maxVertexInputBindings) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7553 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription2EXT-binding-06229", |
| 7554 | "vkCmdSetVertexInputEXT(): pVertexAttributeDescriptions[%" PRIu32 |
| 7555 | "].binding is greater than maxVertexInputBindings", |
| 7556 | attribute); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7557 | } |
| 7558 | |
Mike Schuchardt | 7b152fa | 2021-08-03 16:30:27 -0700 | [diff] [blame] | 7559 | // VUID-VkVertexInputAttributeDescription2EXT-offset-06230 |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7560 | if (pVertexAttributeDescriptions[attribute].offset > device_limits.maxVertexInputAttributeOffset) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7561 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription2EXT-offset-06230", |
| 7562 | "vkCmdSetVertexInputEXT(): pVertexAttributeDescriptions[%" PRIu32 |
| 7563 | "].offset is greater than maxVertexInputAttributeOffset", |
| 7564 | attribute); |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7565 | } |
| 7566 | |
| 7567 | // VUID-VkVertexInputAttributeDescription2EXT-format-04805 |
| 7568 | VkFormatProperties properties; |
| 7569 | DispatchGetPhysicalDeviceFormatProperties(physical_device, pVertexAttributeDescriptions[attribute].format, &properties); |
| 7570 | if ((properties.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) == 0) { |
| 7571 | skip |= LogError(device, "VUID-VkVertexInputAttributeDescription2EXT-format-04805", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7572 | "vkCmdSetVertexInputEXT(): pVertexAttributeDescriptions[%" PRIu32 |
| 7573 | "].format is not a " |
Piers Daniell | cb6d803 | 2021-04-19 18:51:26 -0600 | [diff] [blame] | 7574 | "VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT supported format", |
| 7575 | attribute); |
| 7576 | } |
| 7577 | } |
| 7578 | |
| 7579 | return skip; |
| 7580 | } |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 7581 | |
| 7582 | bool StatelessValidation::manual_PreCallValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, |
| 7583 | VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, |
| 7584 | const void *pValues) const { |
| 7585 | bool skip = false; |
| 7586 | const uint32_t max_push_constants_size = device_limits.maxPushConstantsSize; |
| 7587 | // Check that offset + size don't exceed the max. |
| 7588 | // Prevent arithetic overflow here by avoiding addition and testing in this order. |
| 7589 | if (offset >= max_push_constants_size) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7590 | skip |= |
| 7591 | LogError(device, "VUID-vkCmdPushConstants-offset-00370", |
| 7592 | "vkCmdPushConstants(): offset (%" PRIu32 ") that exceeds this device's maxPushConstantSize of %" PRIu32 ".", |
| 7593 | offset, max_push_constants_size); |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 7594 | } |
| 7595 | if (size > max_push_constants_size - offset) { |
| 7596 | skip |= LogError(device, "VUID-vkCmdPushConstants-size-00371", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7597 | "vkCmdPushConstants(): offset (%" PRIu32 ") and size (%" PRIu32 |
| 7598 | ") that exceeds this device's maxPushConstantSize of %" PRIu32 ".", |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 7599 | offset, size, max_push_constants_size); |
| 7600 | } |
| 7601 | |
| 7602 | // size needs to be non-zero and a multiple of 4. |
| 7603 | if (size & 0x3) { |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7604 | skip |= LogError(device, "VUID-vkCmdPushConstants-size-00369", |
| 7605 | "vkCmdPushConstants(): size (%" PRIu32 ") must be a multiple of 4.", size); |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 7606 | } |
| 7607 | |
| 7608 | // offset needs to be a multiple of 4. |
| 7609 | if ((offset & 0x3) != 0) { |
| 7610 | skip |= LogError(device, "VUID-vkCmdPushConstants-offset-00368", |
sfricke-samsung | a3d4fc1 | 2021-09-28 22:25:46 -0700 | [diff] [blame] | 7611 | "vkCmdPushConstants(): offset (%" PRIu32 ") must be a multiple of 4.", offset); |
sfricke-samsung | 51303fb | 2021-05-09 19:09:13 -0700 | [diff] [blame] | 7612 | } |
| 7613 | return skip; |
Jeremy Gebben | da6b48f | 2021-05-13 10:46:18 -0600 | [diff] [blame] | 7614 | } |
ziga-lunarg | b1dd8a2 | 2021-07-15 17:47:19 +0200 | [diff] [blame] | 7615 | |
| 7616 | bool StatelessValidation::manual_PreCallValidateMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, |
| 7617 | uint32_t srcCacheCount, |
| 7618 | const VkPipelineCache *pSrcCaches) const { |
| 7619 | bool skip = false; |
| 7620 | if (pSrcCaches) { |
| 7621 | for (uint32_t index0 = 0; index0 < srcCacheCount; ++index0) { |
| 7622 | if (pSrcCaches[index0] == dstCache) { |
| 7623 | skip |= LogError(instance, "VUID-vkMergePipelineCaches-dstCache-00770", |
| 7624 | "vkMergePipelineCaches(): dstCache %s is in pSrcCaches list.", |
| 7625 | report_data->FormatHandle(dstCache).c_str()); |
| 7626 | break; |
| 7627 | } |
| 7628 | } |
| 7629 | } |
| 7630 | return skip; |
| 7631 | } |
Nathaniel Cesario | 298d3cb | 2021-08-03 13:49:02 -0600 | [diff] [blame] | 7632 | |
| 7633 | bool StatelessValidation::manual_PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, |
| 7634 | VkImageLayout imageLayout, const VkClearColorValue *pColor, |
| 7635 | uint32_t rangeCount, |
| 7636 | const VkImageSubresourceRange *pRanges) const { |
| 7637 | bool skip = false; |
| 7638 | if (!pColor) { |
| 7639 | skip |= |
| 7640 | LogError(commandBuffer, "VUID-vkCmdClearColorImage-pColor-04961", "vkCmdClearColorImage(): pColor must not be null"); |
| 7641 | } |
| 7642 | return skip; |
| 7643 | } |
| 7644 | |
| 7645 | bool StatelessValidation::ValidateCmdBeginRenderPass(const char *const func_name, |
| 7646 | const VkRenderPassBeginInfo *const rp_begin) const { |
| 7647 | bool skip = false; |
| 7648 | if ((rp_begin->clearValueCount != 0) && !rp_begin->pClearValues) { |
| 7649 | skip |= LogError(rp_begin->renderPass, "VUID-VkRenderPassBeginInfo-clearValueCount-04962", |
| 7650 | "%s: VkRenderPassBeginInfo::clearValueCount != 0 (%" PRIu32 |
ziga-lunarg | 47109fb | 2021-09-03 18:41:12 +0200 | [diff] [blame] | 7651 | "), but VkRenderPassBeginInfo::pClearValues is null.", |
Nathaniel Cesario | 298d3cb | 2021-08-03 13:49:02 -0600 | [diff] [blame] | 7652 | func_name, rp_begin->clearValueCount); |
| 7653 | } |
| 7654 | return skip; |
| 7655 | } |
| 7656 | |
| 7657 | bool StatelessValidation::manual_PreCallValidateCmdBeginRenderPass(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 7658 | VkSubpassContents) const { |
| 7659 | bool skip = ValidateCmdBeginRenderPass("vkCmdBeginRenderPass", pRenderPassBegin); |
| 7660 | return skip; |
| 7661 | } |
| 7662 | |
| 7663 | bool StatelessValidation::manual_PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer, |
| 7664 | const VkRenderPassBeginInfo *pRenderPassBegin, |
| 7665 | const VkSubpassBeginInfo *) const { |
| 7666 | bool skip = ValidateCmdBeginRenderPass("vkCmdBeginRenderPass2KHR", pRenderPassBegin); |
| 7667 | return skip; |
| 7668 | } |
| 7669 | |
| 7670 | bool StatelessValidation::manual_PreCallValidateCmdBeginRenderPass2(VkCommandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 7671 | const VkSubpassBeginInfo *) const { |
| 7672 | bool skip = ValidateCmdBeginRenderPass("vkCmdBeginRenderPass2", pRenderPassBegin); |
| 7673 | return skip; |
| 7674 | } |
ziga-lunarg | c7bb56a | 2021-08-10 09:28:52 +0200 | [diff] [blame] | 7675 | |
| 7676 | bool StatelessValidation::manual_PreCallValidateCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, |
| 7677 | uint32_t firstDiscardRectangle, |
| 7678 | uint32_t discardRectangleCount, |
| 7679 | const VkRect2D *pDiscardRectangles) const { |
| 7680 | bool skip = false; |
| 7681 | |
| 7682 | if (pDiscardRectangles) { |
| 7683 | for (uint32_t i = 0; i < discardRectangleCount; ++i) { |
| 7684 | const int64_t x_sum = |
| 7685 | static_cast<int64_t>(pDiscardRectangles[i].offset.x) + static_cast<int64_t>(pDiscardRectangles[i].extent.width); |
| 7686 | if (x_sum > std::numeric_limits<int32_t>::max()) { |
| 7687 | skip |= LogError(device, "VUID-vkCmdSetDiscardRectangleEXT-offset-00588", |
| 7688 | "vkCmdSetDiscardRectangleEXT(): offset.x + extent.width (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 7689 | ") of pDiscardRectangles[%" PRIu32 "] will overflow int32_t.", |
| 7690 | pDiscardRectangles[i].offset.x, pDiscardRectangles[i].extent.width, x_sum, i); |
| 7691 | } |
| 7692 | |
| 7693 | const int64_t y_sum = |
| 7694 | static_cast<int64_t>(pDiscardRectangles[i].offset.y) + static_cast<int64_t>(pDiscardRectangles[i].extent.height); |
| 7695 | if (y_sum > std::numeric_limits<int32_t>::max()) { |
| 7696 | skip |= LogError(device, "VUID-vkCmdSetDiscardRectangleEXT-offset-00589", |
| 7697 | "vkCmdSetDiscardRectangleEXT(): offset.y + extent.height (=%" PRIi32 " + %" PRIu32 " = %" PRIi64 |
| 7698 | ") of pDiscardRectangles[%" PRIu32 "] will overflow int32_t.", |
| 7699 | pDiscardRectangles[i].offset.y, pDiscardRectangles[i].extent.height, y_sum, i); |
| 7700 | } |
| 7701 | } |
| 7702 | } |
| 7703 | |
| 7704 | return skip; |
| 7705 | } |
ziga-lunarg | 3c37dfb | 2021-08-24 12:51:07 +0200 | [diff] [blame] | 7706 | |
| 7707 | bool StatelessValidation::manual_PreCallValidateGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, |
| 7708 | uint32_t queryCount, size_t dataSize, void *pData, |
| 7709 | VkDeviceSize stride, VkQueryResultFlags flags) const { |
| 7710 | bool skip = false; |
| 7711 | |
| 7712 | if ((flags & VK_QUERY_RESULT_WITH_STATUS_BIT_KHR) && (flags & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT)) { |
| 7713 | skip |= LogError(device, "VUID-vkGetQueryPoolResults-flags-04811", |
| 7714 | "vkGetQueryPoolResults(): flags include both VK_QUERY_RESULT_WITH_STATUS_BIT_KHR bit and VK_QUERY_RESULT_WITH_AVAILABILITY_BIT bit."); |
| 7715 | } |
| 7716 | |
| 7717 | return skip; |
| 7718 | } |
ziga-lunarg | cf340c4 | 2021-08-19 00:13:38 +0200 | [diff] [blame] | 7719 | |
| 7720 | bool StatelessValidation::manual_PreCallValidateCmdBeginConditionalRenderingEXT( |
| 7721 | VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin) const { |
| 7722 | bool skip = false; |
| 7723 | |
| 7724 | if ((pConditionalRenderingBegin->offset & 3) != 0) { |
| 7725 | skip |= LogError(commandBuffer, "VUID-VkConditionalRenderingBeginInfoEXT-offset-01984", |
| 7726 | "vkCmdBeginConditionalRenderingEXT(): pConditionalRenderingBegin->offset (%" PRIu64 |
| 7727 | ") is not a multiple of 4.", |
| 7728 | pConditionalRenderingBegin->offset); |
| 7729 | } |
| 7730 | |
| 7731 | return skip; |
| 7732 | } |