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