Tony-LunarG | 7371999 | 2020-01-15 10:20:28 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2020 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2020 Valve Corporation |
| 3 | * Copyright (c) 2015-2020 LunarG, Inc. |
| 4 | * Copyright (C) 2015-2020 Google Inc. |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -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> |
| 19 | * Author: Jon Ashburn <jon@lunarg.com> |
| 20 | * Author: Tobin Ehlis <tobin@lunarg.com> |
| 21 | */ |
| 22 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 23 | #include "chassis.h" |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 24 | |
Mark Lobodzinski | 63902f0 | 2018-09-21 10:36:44 -0600 | [diff] [blame] | 25 | #include "object_lifetime_validation.h" |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 26 | |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 27 | uint64_t object_track_index = 0; |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 28 | |
John Zulauf | 1c3844a | 2019-04-01 17:39:48 -0600 | [diff] [blame] | 29 | VulkanTypedHandle ObjTrackStateTypedHandle(const ObjTrackState &track_state) { |
| 30 | // TODO: Unify Typed Handle representation (i.e. VulkanTypedHandle everywhere there are handle/type pairs) |
| 31 | VulkanTypedHandle typed_handle; |
| 32 | typed_handle.handle = track_state.handle; |
| 33 | typed_handle.type = track_state.object_type; |
| 34 | return typed_handle; |
| 35 | } |
| 36 | |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 37 | // Destroy memRef lists and free all memory |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 38 | void ObjectLifetimes::DestroyQueueDataStructures() { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 39 | // Destroy the items in the queue map |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 40 | auto snapshot = object_map[kVulkanObjectTypeQueue].snapshot(); |
| 41 | for (const auto &queue : snapshot) { |
| 42 | uint32_t obj_index = queue.second->object_type; |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 43 | assert(num_total_objects > 0); |
| 44 | num_total_objects--; |
| 45 | assert(num_objects[obj_index] > 0); |
| 46 | num_objects[obj_index]--; |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 47 | object_map[kVulkanObjectTypeQueue].erase(queue.first); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 48 | } |
| 49 | } |
| 50 | |
Mark Lobodzinski | c763f58 | 2019-09-11 11:35:43 -0600 | [diff] [blame] | 51 | void ObjectLifetimes::DestroyUndestroyedObjects(VulkanObjectType object_type) { |
| 52 | auto snapshot = object_map[object_type].snapshot(); |
| 53 | for (const auto &item : snapshot) { |
| 54 | auto object_info = item.second; |
| 55 | DestroyObjectSilently(object_info->handle, object_type); |
| 56 | } |
| 57 | } |
| 58 | |
Mark Lobodzinski | 9bd8119 | 2017-11-13 09:38:23 -0700 | [diff] [blame] | 59 | // Look for this device object in any of the instance child devices lists. |
| 60 | // NOTE: This is of dubious value. In most circumstances Vulkan will die a flaming death if a dispatchable object is invalid. |
| 61 | // However, if this layer is loaded first and GetProcAddress is used to make API calls, it will detect bad DOs. |
John Zulauf | 1c3844a | 2019-04-01 17:39:48 -0600 | [diff] [blame] | 62 | bool ObjectLifetimes::ValidateDeviceObject(const VulkanTypedHandle &device_typed, const char *invalid_handle_code, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 63 | const char *wrong_device_code) const { |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 64 | auto instance_data = GetLayerDataPtr(get_dispatch_key(instance), layer_data_map); |
| 65 | auto instance_object_lifetime_data = GetObjectLifetimeData(instance_data->object_dispatch); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 66 | if (instance_object_lifetime_data->object_map[kVulkanObjectTypeDevice].contains(device_typed.handle)) { |
| 67 | return false; |
Mark Lobodzinski | 9bd8119 | 2017-11-13 09:38:23 -0700 | [diff] [blame] | 68 | } |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 69 | return LogError(instance, invalid_handle_code, "Invalid %s.", report_data->FormatHandle(device_typed).c_str()); |
Mark Lobodzinski | 9bd8119 | 2017-11-13 09:38:23 -0700 | [diff] [blame] | 70 | } |
| 71 | |
Mark Lobodzinski | 8af6bb4 | 2019-09-11 14:37:29 -0600 | [diff] [blame] | 72 | bool ObjectLifetimes::ValidateAnonymousObject(uint64_t object_handle, VkObjectType core_object_type, bool null_allowed, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 73 | const char *invalid_handle_code, const char *wrong_device_code) const { |
Mark Lobodzinski | 8af6bb4 | 2019-09-11 14:37:29 -0600 | [diff] [blame] | 74 | if (null_allowed && (object_handle == VK_NULL_HANDLE)) return false; |
| 75 | auto object_type = ConvertCoreObjectToVulkanObject(core_object_type); |
| 76 | |
| 77 | if (object_type == kVulkanObjectTypeDevice) { |
| 78 | return ValidateDeviceObject(VulkanTypedHandle(reinterpret_cast<VkDevice>(object_handle), object_type), invalid_handle_code, |
| 79 | wrong_device_code); |
| 80 | } |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 81 | |
Mark Lobodzinski | 8af6bb4 | 2019-09-11 14:37:29 -0600 | [diff] [blame] | 82 | return CheckObjectValidity(object_handle, object_type, null_allowed, invalid_handle_code, wrong_device_code); |
| 83 | } |
| 84 | |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 85 | void ObjectLifetimes::AllocateCommandBuffer(const VkCommandPool command_pool, const VkCommandBuffer command_buffer, |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 86 | VkCommandBufferLevel level) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 87 | auto pNewObjNode = std::make_shared<ObjTrackState>(); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 88 | pNewObjNode->object_type = kVulkanObjectTypeCommandBuffer; |
| 89 | pNewObjNode->handle = HandleToUint64(command_buffer); |
| 90 | pNewObjNode->parent_object = HandleToUint64(command_pool); |
| 91 | if (level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) { |
| 92 | pNewObjNode->status = OBJSTATUS_COMMAND_BUFFER_SECONDARY; |
| 93 | } else { |
| 94 | pNewObjNode->status = OBJSTATUS_NONE; |
| 95 | } |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 96 | InsertObject(object_map[kVulkanObjectTypeCommandBuffer], command_buffer, kVulkanObjectTypeCommandBuffer, pNewObjNode); |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 97 | num_objects[kVulkanObjectTypeCommandBuffer]++; |
| 98 | num_total_objects++; |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 99 | } |
| 100 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 101 | bool ObjectLifetimes::ValidateCommandBuffer(VkCommandPool command_pool, VkCommandBuffer command_buffer) const { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 102 | bool skip = false; |
| 103 | uint64_t object_handle = HandleToUint64(command_buffer); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 104 | auto iter = object_map[kVulkanObjectTypeCommandBuffer].find(object_handle); |
| 105 | if (iter != object_map[kVulkanObjectTypeCommandBuffer].end()) { |
| 106 | auto pNode = iter->second; |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 107 | |
| 108 | if (pNode->parent_object != HandleToUint64(command_pool)) { |
John Zulauf | 1c3844a | 2019-04-01 17:39:48 -0600 | [diff] [blame] | 109 | // We know that the parent *must* be a command pool |
| 110 | const auto parent_pool = CastFromUint64<VkCommandPool>(pNode->parent_object); |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 111 | skip |= LogError(command_buffer, "VUID-vkFreeCommandBuffers-pCommandBuffers-parent", |
| 112 | "FreeCommandBuffers is attempting to free %s belonging to %s from %s).", |
| 113 | report_data->FormatHandle(command_buffer).c_str(), report_data->FormatHandle(parent_pool).c_str(), |
| 114 | report_data->FormatHandle(command_pool).c_str()); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 115 | } |
| 116 | } else { |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 117 | skip |= LogError(command_buffer, "VUID-vkFreeCommandBuffers-pCommandBuffers-00048", "Invalid %s.", |
| 118 | report_data->FormatHandle(command_buffer).c_str()); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 119 | } |
| 120 | return skip; |
| 121 | } |
| 122 | |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 123 | void ObjectLifetimes::AllocateDescriptorSet(VkDescriptorPool descriptor_pool, VkDescriptorSet descriptor_set) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 124 | auto pNewObjNode = std::make_shared<ObjTrackState>(); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 125 | pNewObjNode->object_type = kVulkanObjectTypeDescriptorSet; |
| 126 | pNewObjNode->status = OBJSTATUS_NONE; |
| 127 | pNewObjNode->handle = HandleToUint64(descriptor_set); |
| 128 | pNewObjNode->parent_object = HandleToUint64(descriptor_pool); |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 129 | InsertObject(object_map[kVulkanObjectTypeDescriptorSet], descriptor_set, kVulkanObjectTypeDescriptorSet, pNewObjNode); |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 130 | num_objects[kVulkanObjectTypeDescriptorSet]++; |
| 131 | num_total_objects++; |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 132 | |
| 133 | auto itr = object_map[kVulkanObjectTypeDescriptorPool].find(HandleToUint64(descriptor_pool)); |
| 134 | if (itr != object_map[kVulkanObjectTypeDescriptorPool].end()) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 135 | itr->second->child_objects->insert(HandleToUint64(descriptor_set)); |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 136 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 137 | } |
| 138 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 139 | bool ObjectLifetimes::ValidateDescriptorSet(VkDescriptorPool descriptor_pool, VkDescriptorSet descriptor_set) const { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 140 | bool skip = false; |
| 141 | uint64_t object_handle = HandleToUint64(descriptor_set); |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 142 | auto dsItem = object_map[kVulkanObjectTypeDescriptorSet].find(object_handle); |
| 143 | if (dsItem != object_map[kVulkanObjectTypeDescriptorSet].end()) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 144 | if (dsItem->second->parent_object != HandleToUint64(descriptor_pool)) { |
John Zulauf | 1c3844a | 2019-04-01 17:39:48 -0600 | [diff] [blame] | 145 | // We know that the parent *must* be a descriptor pool |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 146 | const auto parent_pool = CastFromUint64<VkDescriptorPool>(dsItem->second->parent_object); |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 147 | skip |= LogError(descriptor_set, "VUID-vkFreeDescriptorSets-pDescriptorSets-parent", |
| 148 | "FreeDescriptorSets is attempting to free %s" |
| 149 | " belonging to %s from %s).", |
| 150 | report_data->FormatHandle(descriptor_set).c_str(), report_data->FormatHandle(parent_pool).c_str(), |
| 151 | report_data->FormatHandle(descriptor_pool).c_str()); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 152 | } |
| 153 | } else { |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 154 | skip |= LogError(descriptor_set, "VUID-vkFreeDescriptorSets-pDescriptorSets-00310", "Invalid %s.", |
| 155 | report_data->FormatHandle(descriptor_set).c_str()); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 156 | } |
| 157 | return skip; |
| 158 | } |
| 159 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 160 | bool ObjectLifetimes::ValidateDescriptorWrite(VkWriteDescriptorSet const *desc, bool isPush) const { |
Chris Forbes | 2c600e9 | 2017-10-20 11:13:20 -0700 | [diff] [blame] | 161 | bool skip = false; |
| 162 | |
| 163 | if (!isPush && desc->dstSet) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 164 | skip |= ValidateObject(desc->dstSet, kVulkanObjectTypeDescriptorSet, false, "VUID-VkWriteDescriptorSet-dstSet-00320", |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 165 | "VUID-VkWriteDescriptorSet-commonparent"); |
Chris Forbes | 2c600e9 | 2017-10-20 11:13:20 -0700 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | if ((desc->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 169 | (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 170 | for (uint32_t idx2 = 0; idx2 < desc->descriptorCount; ++idx2) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 171 | skip |= ValidateObject(desc->pTexelBufferView[idx2], kVulkanObjectTypeBufferView, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 172 | "VUID-VkWriteDescriptorSet-descriptorType-00323", "VUID-VkWriteDescriptorSet-commonparent"); |
Chris Forbes | 2c600e9 | 2017-10-20 11:13:20 -0700 | [diff] [blame] | 173 | } |
| 174 | } |
| 175 | |
| 176 | if ((desc->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
Dave Houlton | a9df0ce | 2018-02-07 10:51:23 -0700 | [diff] [blame] | 177 | (desc->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) || |
Chris Forbes | 2c600e9 | 2017-10-20 11:13:20 -0700 | [diff] [blame] | 178 | (desc->descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT)) { |
| 179 | for (uint32_t idx3 = 0; idx3 < desc->descriptorCount; ++idx3) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 180 | skip |= ValidateObject(desc->pImageInfo[idx3].imageView, kVulkanObjectTypeImageView, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 181 | "VUID-VkWriteDescriptorSet-descriptorType-00326", "VUID-VkDescriptorImageInfo-commonparent"); |
Chris Forbes | 2c600e9 | 2017-10-20 11:13:20 -0700 | [diff] [blame] | 182 | } |
| 183 | } |
| 184 | |
| 185 | if ((desc->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 186 | (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 187 | (desc->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 188 | (desc->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 189 | for (uint32_t idx4 = 0; idx4 < desc->descriptorCount; ++idx4) { |
| 190 | if (desc->pBufferInfo[idx4].buffer) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 191 | skip |= ValidateObject(desc->pBufferInfo[idx4].buffer, kVulkanObjectTypeBuffer, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 192 | "VUID-VkDescriptorBufferInfo-buffer-parameter", kVUIDUndefined); |
Chris Forbes | 2c600e9 | 2017-10-20 11:13:20 -0700 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | return skip; |
| 198 | } |
| 199 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 200 | bool ObjectLifetimes::PreCallValidateCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 201 | VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 202 | const VkWriteDescriptorSet *pDescriptorWrites) const { |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 203 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 204 | skip |= ValidateObject(commandBuffer, kVulkanObjectTypeCommandBuffer, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 205 | "VUID-vkCmdPushDescriptorSetKHR-commandBuffer-parameter", "VUID-vkCmdPushDescriptorSetKHR-commonparent"); |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 206 | skip |= ValidateObject(layout, kVulkanObjectTypePipelineLayout, false, "VUID-vkCmdPushDescriptorSetKHR-layout-parameter", |
| 207 | "VUID-vkCmdPushDescriptorSetKHR-commonparent"); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 208 | if (pDescriptorWrites) { |
| 209 | for (uint32_t index0 = 0; index0 < descriptorWriteCount; ++index0) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 210 | skip |= ValidateDescriptorWrite(&pDescriptorWrites[index0], true); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 211 | } |
| 212 | } |
| 213 | return skip; |
| 214 | } |
| 215 | |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 216 | void ObjectLifetimes::CreateQueue(VkQueue vkObj) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 217 | std::shared_ptr<ObjTrackState> p_obj_node = NULL; |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 218 | auto queue_item = object_map[kVulkanObjectTypeQueue].find(HandleToUint64(vkObj)); |
| 219 | if (queue_item == object_map[kVulkanObjectTypeQueue].end()) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 220 | p_obj_node = std::make_shared<ObjTrackState>(); |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 221 | InsertObject(object_map[kVulkanObjectTypeQueue], vkObj, kVulkanObjectTypeQueue, p_obj_node); |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 222 | num_objects[kVulkanObjectTypeQueue]++; |
| 223 | num_total_objects++; |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 224 | } else { |
| 225 | p_obj_node = queue_item->second; |
| 226 | } |
| 227 | p_obj_node->object_type = kVulkanObjectTypeQueue; |
| 228 | p_obj_node->status = OBJSTATUS_NONE; |
| 229 | p_obj_node->handle = HandleToUint64(vkObj); |
| 230 | } |
| 231 | |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 232 | void ObjectLifetimes::CreateSwapchainImageObject(VkImage swapchain_image, VkSwapchainKHR swapchain) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 233 | if (!swapchainImageMap.contains(HandleToUint64(swapchain_image))) { |
| 234 | auto pNewObjNode = std::make_shared<ObjTrackState>(); |
| 235 | pNewObjNode->object_type = kVulkanObjectTypeImage; |
| 236 | pNewObjNode->status = OBJSTATUS_NONE; |
| 237 | pNewObjNode->handle = HandleToUint64(swapchain_image); |
| 238 | pNewObjNode->parent_object = HandleToUint64(swapchain); |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 239 | InsertObject(swapchainImageMap, swapchain_image, kVulkanObjectTypeImage, pNewObjNode); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 240 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 241 | } |
| 242 | |
Mark Lobodzinski | be102ad | 2019-09-04 12:03:07 -0600 | [diff] [blame] | 243 | bool ObjectLifetimes::ReportLeakedInstanceObjects(VkInstance instance, VulkanObjectType object_type, |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 244 | const std::string &error_code) const { |
Mark Lobodzinski | 7cef263 | 2019-08-28 15:50:13 -0600 | [diff] [blame] | 245 | bool skip = false; |
| 246 | |
| 247 | auto snapshot = object_map[object_type].snapshot(); |
| 248 | for (const auto &item : snapshot) { |
| 249 | const auto object_info = item.second; |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 250 | skip |= LogError(instance, error_code, "OBJ ERROR : For %s, %s has not been destroyed.", |
| 251 | report_data->FormatHandle(instance).c_str(), |
| 252 | report_data->FormatHandle(ObjTrackStateTypedHandle(*object_info)).c_str()); |
Mark Lobodzinski | 7cef263 | 2019-08-28 15:50:13 -0600 | [diff] [blame] | 253 | } |
| 254 | return skip; |
| 255 | } |
| 256 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 257 | bool ObjectLifetimes::ReportLeakedDeviceObjects(VkDevice device, VulkanObjectType object_type, |
| 258 | const std::string &error_code) const { |
Mark Lobodzinski | 5183a03 | 2018-09-13 14:44:28 -0600 | [diff] [blame] | 259 | bool skip = false; |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 260 | |
| 261 | auto snapshot = object_map[object_type].snapshot(); |
| 262 | for (const auto &item : snapshot) { |
| 263 | const auto object_info = item.second; |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 264 | skip |= LogError(device, error_code, "OBJ ERROR : For %s, %s has not been destroyed.", |
| 265 | report_data->FormatHandle(device).c_str(), |
| 266 | report_data->FormatHandle(ObjTrackStateTypedHandle(*object_info)).c_str()); |
GabrÃel Arthúr Pétursson | fdcb540 | 2018-03-20 21:52:06 +0000 | [diff] [blame] | 267 | } |
Mark Lobodzinski | 5183a03 | 2018-09-13 14:44:28 -0600 | [diff] [blame] | 268 | return skip; |
GabrÃel Arthúr Pétursson | fdcb540 | 2018-03-20 21:52:06 +0000 | [diff] [blame] | 269 | } |
| 270 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 271 | bool ObjectLifetimes::PreCallValidateDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) const { |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 272 | bool skip = false; |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 273 | |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 274 | // We validate here for coverage, though we'd not have made it this for with a bad instance. |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 275 | skip |= ValidateObject(instance, kVulkanObjectTypeInstance, true, "VUID-vkDestroyInstance-instance-parameter", kVUIDUndefined); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 276 | |
| 277 | // Validate that child devices have been destroyed |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 278 | auto snapshot = object_map[kVulkanObjectTypeDevice].snapshot(); |
| 279 | for (const auto &iit : snapshot) { |
| 280 | auto pNode = iit.second; |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 281 | |
| 282 | VkDevice device = reinterpret_cast<VkDevice>(pNode->handle); |
| 283 | VkDebugReportObjectTypeEXT debug_object_type = get_debug_report_enum[pNode->object_type]; |
| 284 | |
Mark Lobodzinski | cb4784a | 2020-01-29 15:34:59 -0700 | [diff] [blame^] | 285 | skip |= LogError(device, kVUID_ObjectTracker_ObjectLeak, "OBJ ERROR : %s object %s has not been destroyed.", |
| 286 | string_VkDebugReportObjectTypeEXT(debug_object_type), |
| 287 | report_data->FormatHandle(ObjTrackStateTypedHandle(*pNode)).c_str()); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 288 | |
Mark Lobodzinski | 7cef263 | 2019-08-28 15:50:13 -0600 | [diff] [blame] | 289 | // Throw errors if any device objects belonging to this instance have not been destroyed |
Mark Lobodzinski | 0754809 | 2019-12-17 12:17:12 -0700 | [diff] [blame] | 290 | auto device_layer_data = GetLayerDataPtr(get_dispatch_key(device), layer_data_map); |
| 291 | auto obj_lifetimes_data = reinterpret_cast<ObjectLifetimes *>( |
| 292 | device_layer_data->GetValidationObject(device_layer_data->object_dispatch, LayerObjectTypeObjectTracker)); |
| 293 | skip |= obj_lifetimes_data->ReportUndestroyedDeviceObjects(device, "VUID-vkDestroyDevice-device-00378"); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 294 | |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 295 | skip |= ValidateDestroyObject(device, kVulkanObjectTypeDevice, pAllocator, "VUID-vkDestroyInstance-instance-00630", |
| 296 | "VUID-vkDestroyInstance-instance-00631"); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 297 | } |
| 298 | |
Mark Lobodzinski | 7cef263 | 2019-08-28 15:50:13 -0600 | [diff] [blame] | 299 | // Throw errors if any instance objects created on this instance have not been destroyed |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 300 | ValidateDestroyObject(instance, kVulkanObjectTypeInstance, pAllocator, "VUID-vkDestroyInstance-instance-00630", |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 301 | "VUID-vkDestroyInstance-instance-00631"); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 302 | |
Mark Lobodzinski | 7cef263 | 2019-08-28 15:50:13 -0600 | [diff] [blame] | 303 | // Report any remaining instance objects |
| 304 | skip |= ReportUndestroyedInstanceObjects(instance, "VUID-vkDestroyInstance-instance-00629"); |
Mark Lobodzinski | 7cef263 | 2019-08-28 15:50:13 -0600 | [diff] [blame] | 305 | |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 306 | return skip; |
| 307 | } |
| 308 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 309 | bool ObjectLifetimes::PreCallValidateEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 310 | VkPhysicalDevice *pPhysicalDevices) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 311 | bool skip = ValidateObject(instance, kVulkanObjectTypeInstance, false, "VUID-vkEnumeratePhysicalDevices-instance-parameter", |
| 312 | kVUIDUndefined); |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 313 | return skip; |
| 314 | } |
| 315 | |
| 316 | void ObjectLifetimes::PostCallRecordEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 317 | VkPhysicalDevice *pPhysicalDevices, VkResult result) { |
| 318 | if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) return; |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 319 | if (pPhysicalDevices) { |
| 320 | for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) { |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 321 | CreateObject(pPhysicalDevices[i], kVulkanObjectTypePhysicalDevice, nullptr); |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | void ObjectLifetimes::PreCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 327 | // Destroy physical devices |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 328 | auto snapshot = object_map[kVulkanObjectTypePhysicalDevice].snapshot(); |
| 329 | for (const auto &iit : snapshot) { |
| 330 | auto pNode = iit.second; |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 331 | VkPhysicalDevice physical_device = reinterpret_cast<VkPhysicalDevice>(pNode->handle); |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 332 | RecordDestroyObject(physical_device, kVulkanObjectTypePhysicalDevice); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 333 | } |
| 334 | |
Mark Lobodzinski | 9bd8119 | 2017-11-13 09:38:23 -0700 | [diff] [blame] | 335 | // Destroy child devices |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 336 | auto snapshot2 = object_map[kVulkanObjectTypeDevice].snapshot(); |
| 337 | for (const auto &iit : snapshot2) { |
| 338 | auto pNode = iit.second; |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 339 | VkDevice device = reinterpret_cast<VkDevice>(pNode->handle); |
Mark Lobodzinski | e65acca | 2019-09-11 12:06:17 -0600 | [diff] [blame] | 340 | DestroyLeakedInstanceObjects(); |
Mark Lobodzinski | 9bd8119 | 2017-11-13 09:38:23 -0700 | [diff] [blame] | 341 | |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 342 | RecordDestroyObject(device, kVulkanObjectTypeDevice); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 343 | } |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 344 | } |
| 345 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 346 | void ObjectLifetimes::PostCallRecordDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 347 | RecordDestroyObject(instance, kVulkanObjectTypeInstance); |
Mark Lobodzinski | 34f5ea6 | 2018-09-14 09:51:43 -0600 | [diff] [blame] | 348 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 349 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 350 | bool ObjectLifetimes::PreCallValidateDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) const { |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 351 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 352 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, true, "VUID-vkDestroyDevice-device-parameter", kVUIDUndefined); |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 353 | skip |= ValidateDestroyObject(device, kVulkanObjectTypeDevice, pAllocator, "VUID-vkDestroyDevice-device-00379", |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 354 | "VUID-vkDestroyDevice-device-00380"); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 355 | // Report any remaining objects associated with this VkDevice object in LL |
Mark Lobodzinski | 7cef263 | 2019-08-28 15:50:13 -0600 | [diff] [blame] | 356 | skip |= ReportUndestroyedDeviceObjects(device, "VUID-vkDestroyDevice-device-00378"); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 357 | |
| 358 | return skip; |
| 359 | } |
| 360 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 361 | void ObjectLifetimes::PreCallRecordDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 52db235 | 2018-12-28 09:41:15 -0700 | [diff] [blame] | 362 | auto instance_data = GetLayerDataPtr(get_dispatch_key(physical_device), layer_data_map); |
| 363 | ValidationObject *validation_data = GetValidationObject(instance_data->object_dispatch, LayerObjectTypeObjectTracker); |
| 364 | ObjectLifetimes *object_lifetimes = static_cast<ObjectLifetimes *>(validation_data); |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 365 | object_lifetimes->RecordDestroyObject(device, kVulkanObjectTypeDevice); |
Mark Lobodzinski | e65acca | 2019-09-11 12:06:17 -0600 | [diff] [blame] | 366 | DestroyLeakedDeviceObjects(); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 367 | |
| 368 | // Clean up Queue's MemRef Linked Lists |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 369 | DestroyQueueDataStructures(); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 370 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 371 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 372 | bool ObjectLifetimes::PreCallValidateGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 373 | VkQueue *pQueue) const { |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 374 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 375 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkGetDeviceQueue-device-parameter", kVUIDUndefined); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 376 | return skip; |
| 377 | } |
Mark Lobodzinski | 439645a | 2017-07-19 15:18:15 -0600 | [diff] [blame] | 378 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 379 | void ObjectLifetimes::PostCallRecordGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, |
| 380 | VkQueue *pQueue) { |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 381 | auto lock = write_shared_lock(); |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 382 | CreateQueue(*pQueue); |
Mark Lobodzinski | 439645a | 2017-07-19 15:18:15 -0600 | [diff] [blame] | 383 | } |
| 384 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 385 | bool ObjectLifetimes::PreCallValidateGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 386 | return ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkGetDeviceQueue2-device-parameter", kVUIDUndefined); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 387 | } |
| 388 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 389 | void ObjectLifetimes::PostCallRecordGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) { |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 390 | auto lock = write_shared_lock(); |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 391 | CreateQueue(*pQueue); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 392 | } |
| 393 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 394 | bool ObjectLifetimes::PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 395 | const VkWriteDescriptorSet *pDescriptorWrites, |
| 396 | uint32_t descriptorCopyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 397 | const VkCopyDescriptorSet *pDescriptorCopies) const { |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 398 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 399 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkUpdateDescriptorSets-device-parameter", kVUIDUndefined); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 400 | if (pDescriptorCopies) { |
| 401 | for (uint32_t idx0 = 0; idx0 < descriptorCopyCount; ++idx0) { |
| 402 | if (pDescriptorCopies[idx0].dstSet) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 403 | skip |= ValidateObject(pDescriptorCopies[idx0].dstSet, kVulkanObjectTypeDescriptorSet, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 404 | "VUID-VkCopyDescriptorSet-dstSet-parameter", "VUID-VkCopyDescriptorSet-commonparent"); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 405 | } |
| 406 | if (pDescriptorCopies[idx0].srcSet) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 407 | skip |= ValidateObject(pDescriptorCopies[idx0].srcSet, kVulkanObjectTypeDescriptorSet, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 408 | "VUID-VkCopyDescriptorSet-srcSet-parameter", "VUID-VkCopyDescriptorSet-commonparent"); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 409 | } |
| 410 | } |
| 411 | } |
| 412 | if (pDescriptorWrites) { |
| 413 | for (uint32_t idx1 = 0; idx1 < descriptorWriteCount; ++idx1) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 414 | skip |= ValidateDescriptorWrite(&pDescriptorWrites[idx1], false); |
Mark Lobodzinski | b58fe78 | 2018-09-14 11:50:27 -0600 | [diff] [blame] | 415 | } |
| 416 | } |
| 417 | return skip; |
| 418 | } |
| 419 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 420 | bool ObjectLifetimes::PreCallValidateResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 421 | VkDescriptorPoolResetFlags flags) const { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 422 | bool skip = false; |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 423 | auto lock = read_shared_lock(); |
Mark Lobodzinski | 0de500d | 2018-09-14 15:14:01 -0600 | [diff] [blame] | 424 | |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 425 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkResetDescriptorPool-device-parameter", kVUIDUndefined); |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 426 | skip |= |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 427 | ValidateObject(descriptorPool, kVulkanObjectTypeDescriptorPool, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 428 | "VUID-vkResetDescriptorPool-descriptorPool-parameter", "VUID-vkResetDescriptorPool-descriptorPool-parent"); |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 429 | |
| 430 | auto itr = object_map[kVulkanObjectTypeDescriptorPool].find(HandleToUint64(descriptorPool)); |
| 431 | if (itr != object_map[kVulkanObjectTypeDescriptorPool].end()) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 432 | auto pPoolNode = itr->second; |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 433 | for (auto set : *pPoolNode->child_objects) { |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 434 | skip |= ValidateDestroyObject((VkDescriptorSet)set, kVulkanObjectTypeDescriptorSet, nullptr, kVUIDUndefined, |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 435 | kVUIDUndefined); |
Mark Lobodzinski | 0de500d | 2018-09-14 15:14:01 -0600 | [diff] [blame] | 436 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 437 | } |
Mark Lobodzinski | 0de500d | 2018-09-14 15:14:01 -0600 | [diff] [blame] | 438 | return skip; |
| 439 | } |
| 440 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 441 | void ObjectLifetimes::PreCallRecordResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 442 | VkDescriptorPoolResetFlags flags) { |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 443 | auto lock = write_shared_lock(); |
Mark Lobodzinski | 0de500d | 2018-09-14 15:14:01 -0600 | [diff] [blame] | 444 | // A DescriptorPool's descriptor sets are implicitly deleted when the pool is reset. Remove this pool's descriptor sets from |
| 445 | // our descriptorSet map. |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 446 | auto itr = object_map[kVulkanObjectTypeDescriptorPool].find(HandleToUint64(descriptorPool)); |
| 447 | if (itr != object_map[kVulkanObjectTypeDescriptorPool].end()) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 448 | auto pPoolNode = itr->second; |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 449 | for (auto set : *pPoolNode->child_objects) { |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 450 | RecordDestroyObject((VkDescriptorSet)set, kVulkanObjectTypeDescriptorSet); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 451 | } |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 452 | pPoolNode->child_objects->clear(); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 453 | } |
Mark Lobodzinski | 0de500d | 2018-09-14 15:14:01 -0600 | [diff] [blame] | 454 | } |
| 455 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 456 | bool ObjectLifetimes::PreCallValidateBeginCommandBuffer(VkCommandBuffer command_buffer, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 457 | const VkCommandBufferBeginInfo *begin_info) const { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 458 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 459 | skip |= ValidateObject(command_buffer, kVulkanObjectTypeCommandBuffer, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 460 | "VUID-vkBeginCommandBuffer-commandBuffer-parameter", kVUIDUndefined); |
Mark Lobodzinski | 0de500d | 2018-09-14 15:14:01 -0600 | [diff] [blame] | 461 | if (begin_info) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 462 | auto iter = object_map[kVulkanObjectTypeCommandBuffer].find(HandleToUint64(command_buffer)); |
| 463 | if (iter != object_map[kVulkanObjectTypeCommandBuffer].end()) { |
| 464 | auto pNode = iter->second; |
| 465 | if ((begin_info->pInheritanceInfo) && (pNode->status & OBJSTATUS_COMMAND_BUFFER_SECONDARY) && |
| 466 | (begin_info->flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT)) { |
| 467 | skip |= |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 468 | ValidateObject(begin_info->pInheritanceInfo->framebuffer, kVulkanObjectTypeFramebuffer, true, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 469 | "VUID-VkCommandBufferBeginInfo-flags-00055", "VUID-VkCommandBufferInheritanceInfo-commonparent"); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 470 | skip |= |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 471 | ValidateObject(begin_info->pInheritanceInfo->renderPass, kVulkanObjectTypeRenderPass, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 472 | "VUID-VkCommandBufferBeginInfo-flags-00053", "VUID-VkCommandBufferInheritanceInfo-commonparent"); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 473 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 474 | } |
| 475 | } |
Mark Lobodzinski | 0de500d | 2018-09-14 15:14:01 -0600 | [diff] [blame] | 476 | return skip; |
| 477 | } |
| 478 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 479 | bool ObjectLifetimes::PreCallValidateGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 480 | uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) const { |
Mark Lobodzinski | be4b345 | 2018-09-14 16:14:33 -0600 | [diff] [blame] | 481 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 482 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkGetSwapchainImagesKHR-device-parameter", |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 483 | "VUID-vkGetSwapchainImagesKHR-commonparent"); |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 484 | skip |= ValidateObject(swapchain, kVulkanObjectTypeSwapchainKHR, false, "VUID-vkGetSwapchainImagesKHR-swapchain-parameter", |
| 485 | "VUID-vkGetSwapchainImagesKHR-commonparent"); |
Mark Lobodzinski | be4b345 | 2018-09-14 16:14:33 -0600 | [diff] [blame] | 486 | return skip; |
| 487 | } |
| 488 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 489 | void ObjectLifetimes::PostCallRecordGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 490 | VkImage *pSwapchainImages, VkResult result) { |
| 491 | if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) return; |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 492 | auto lock = write_shared_lock(); |
Mark Lobodzinski | be4b345 | 2018-09-14 16:14:33 -0600 | [diff] [blame] | 493 | if (pSwapchainImages != NULL) { |
| 494 | for (uint32_t i = 0; i < *pSwapchainImageCount; i++) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 495 | CreateSwapchainImageObject(pSwapchainImages[i], swapchain); |
Mark Lobodzinski | be4b345 | 2018-09-14 16:14:33 -0600 | [diff] [blame] | 496 | } |
| 497 | } |
| 498 | } |
| 499 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 500 | bool ObjectLifetimes::PreCallValidateCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 501 | const VkAllocationCallbacks *pAllocator, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 502 | VkDescriptorSetLayout *pSetLayout) const { |
Petr Kraus | 42f6f8d | 2017-12-17 17:37:33 +0100 | [diff] [blame] | 503 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 504 | skip |= |
| 505 | ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkCreateDescriptorSetLayout-device-parameter", kVUIDUndefined); |
Mark Lobodzinski | be4b345 | 2018-09-14 16:14:33 -0600 | [diff] [blame] | 506 | if (pCreateInfo) { |
| 507 | if (pCreateInfo->pBindings) { |
| 508 | for (uint32_t binding_index = 0; binding_index < pCreateInfo->bindingCount; ++binding_index) { |
| 509 | const VkDescriptorSetLayoutBinding &binding = pCreateInfo->pBindings[binding_index]; |
| 510 | const bool is_sampler_type = binding.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER || |
| 511 | binding.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; |
| 512 | if (binding.pImmutableSamplers && is_sampler_type) { |
| 513 | for (uint32_t index2 = 0; index2 < binding.descriptorCount; ++index2) { |
| 514 | const VkSampler sampler = binding.pImmutableSamplers[index2]; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 515 | skip |= ValidateObject(sampler, kVulkanObjectTypeSampler, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 516 | "VUID-VkDescriptorSetLayoutBinding-descriptorType-00282", kVUIDUndefined); |
Petr Kraus | 42f6f8d | 2017-12-17 17:37:33 +0100 | [diff] [blame] | 517 | } |
| 518 | } |
| 519 | } |
| 520 | } |
| 521 | } |
Mark Lobodzinski | be4b345 | 2018-09-14 16:14:33 -0600 | [diff] [blame] | 522 | return skip; |
| 523 | } |
| 524 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 525 | void ObjectLifetimes::PostCallRecordCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 526 | const VkAllocationCallbacks *pAllocator, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 527 | VkDescriptorSetLayout *pSetLayout, VkResult result) { |
| 528 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 529 | CreateObject(*pSetLayout, kVulkanObjectTypeDescriptorSetLayout, pAllocator); |
Mark Lobodzinski | be4b345 | 2018-09-14 16:14:33 -0600 | [diff] [blame] | 530 | } |
| 531 | |
Jeff Bolz | 46c0ea0 | 2019-10-09 13:06:29 -0500 | [diff] [blame] | 532 | bool ObjectLifetimes::ValidateSamplerObjects(const VkDescriptorSetLayoutCreateInfo *pCreateInfo) const { |
Mark Lobodzinski | 88a1a66 | 2018-07-02 14:09:39 -0600 | [diff] [blame] | 533 | bool skip = false; |
| 534 | if (pCreateInfo->pBindings) { |
| 535 | for (uint32_t index1 = 0; index1 < pCreateInfo->bindingCount; ++index1) { |
| 536 | for (uint32_t index2 = 0; index2 < pCreateInfo->pBindings[index1].descriptorCount; ++index2) { |
| 537 | if (pCreateInfo->pBindings[index1].pImmutableSamplers) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 538 | skip |= ValidateObject(pCreateInfo->pBindings[index1].pImmutableSamplers[index2], kVulkanObjectTypeSampler, |
| 539 | true, "VUID-VkDescriptorSetLayoutBinding-descriptorType-00282", kVUIDUndefined); |
Mark Lobodzinski | 88a1a66 | 2018-07-02 14:09:39 -0600 | [diff] [blame] | 540 | } |
| 541 | } |
| 542 | } |
| 543 | } |
| 544 | return skip; |
| 545 | } |
| 546 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 547 | bool ObjectLifetimes::PreCallValidateGetDescriptorSetLayoutSupport(VkDevice device, |
| 548 | const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 549 | VkDescriptorSetLayoutSupport *pSupport) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 550 | bool skip = ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkGetDescriptorSetLayoutSupport-device-parameter", |
| 551 | kVUIDUndefined); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 552 | if (pCreateInfo) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 553 | skip |= ValidateSamplerObjects(pCreateInfo); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 554 | } |
| 555 | return skip; |
| 556 | } |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 557 | bool ObjectLifetimes::PreCallValidateGetDescriptorSetLayoutSupportKHR(VkDevice device, |
| 558 | const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 559 | VkDescriptorSetLayoutSupport *pSupport) const { |
Mike Schuchardt | 65847d9 | 2019-12-20 13:50:47 -0800 | [diff] [blame] | 560 | bool skip = ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkGetDescriptorSetLayoutSupport-device-parameter", |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 561 | kVUIDUndefined); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 562 | if (pCreateInfo) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 563 | skip |= ValidateSamplerObjects(pCreateInfo); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 564 | } |
| 565 | return skip; |
| 566 | } |
| 567 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 568 | bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, |
| 569 | uint32_t *pQueueFamilyPropertyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 570 | VkQueueFamilyProperties *pQueueFamilyProperties) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 571 | return ValidateObject(physicalDevice, kVulkanObjectTypePhysicalDevice, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 572 | "VUID-vkGetPhysicalDeviceQueueFamilyProperties-physicalDevice-parameter", kVUIDUndefined); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 573 | } |
Mark Lobodzinski | 63902f0 | 2018-09-21 10:36:44 -0600 | [diff] [blame] | 574 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 575 | void ObjectLifetimes::PostCallRecordGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, |
| 576 | uint32_t *pQueueFamilyPropertyCount, |
Jeff Bolz | 6d24311 | 2019-08-21 13:24:11 -0500 | [diff] [blame] | 577 | VkQueueFamilyProperties *pQueueFamilyProperties) {} |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 578 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 579 | void ObjectLifetimes::PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 580 | VkInstance *pInstance, VkResult result) { |
| 581 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 582 | CreateObject(*pInstance, kVulkanObjectTypeInstance, pAllocator); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 583 | } |
| 584 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 585 | bool ObjectLifetimes::PreCallValidateAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 586 | VkCommandBuffer *pCommandBuffers) const { |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 587 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 588 | skip |= |
| 589 | ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkAllocateCommandBuffers-device-parameter", kVUIDUndefined); |
| 590 | skip |= ValidateObject(pAllocateInfo->commandPool, kVulkanObjectTypeCommandPool, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 591 | "VUID-VkCommandBufferAllocateInfo-commandPool-parameter", kVUIDUndefined); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 592 | return skip; |
| 593 | } |
| 594 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 595 | void ObjectLifetimes::PostCallRecordAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 596 | VkCommandBuffer *pCommandBuffers, VkResult result) { |
| 597 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 598 | for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 599 | AllocateCommandBuffer(pAllocateInfo->commandPool, pCommandBuffers[i], pAllocateInfo->level); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 600 | } |
| 601 | } |
| 602 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 603 | bool ObjectLifetimes::PreCallValidateAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 604 | VkDescriptorSet *pDescriptorSets) const { |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 605 | bool skip = false; |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 606 | auto lock = read_shared_lock(); |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 607 | skip |= |
| 608 | ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkAllocateDescriptorSets-device-parameter", kVUIDUndefined); |
| 609 | skip |= ValidateObject(pAllocateInfo->descriptorPool, kVulkanObjectTypeDescriptorPool, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 610 | "VUID-VkDescriptorSetAllocateInfo-descriptorPool-parameter", |
| 611 | "VUID-VkDescriptorSetAllocateInfo-commonparent"); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 612 | for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 613 | skip |= ValidateObject(pAllocateInfo->pSetLayouts[i], kVulkanObjectTypeDescriptorSetLayout, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 614 | "VUID-VkDescriptorSetAllocateInfo-pSetLayouts-parameter", |
| 615 | "VUID-VkDescriptorSetAllocateInfo-commonparent"); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 616 | } |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 617 | return skip; |
| 618 | } |
| 619 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 620 | void ObjectLifetimes::PostCallRecordAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 621 | VkDescriptorSet *pDescriptorSets, VkResult result) { |
| 622 | if (result != VK_SUCCESS) return; |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 623 | auto lock = write_shared_lock(); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 624 | for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 625 | AllocateDescriptorSet(pAllocateInfo->descriptorPool, pDescriptorSets[i]); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 626 | } |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 627 | } |
| 628 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 629 | bool ObjectLifetimes::PreCallValidateFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 630 | const VkCommandBuffer *pCommandBuffers) const { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 631 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 632 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkFreeCommandBuffers-device-parameter", kVUIDUndefined); |
| 633 | skip |= ValidateObject(commandPool, kVulkanObjectTypeCommandPool, false, "VUID-vkFreeCommandBuffers-commandPool-parameter", |
| 634 | "VUID-vkFreeCommandBuffers-commandPool-parent"); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 635 | for (uint32_t i = 0; i < commandBufferCount; i++) { |
| 636 | if (pCommandBuffers[i] != VK_NULL_HANDLE) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 637 | skip |= ValidateCommandBuffer(commandPool, pCommandBuffers[i]); |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 638 | skip |= |
| 639 | ValidateDestroyObject(pCommandBuffers[i], kVulkanObjectTypeCommandBuffer, nullptr, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 640 | } |
| 641 | } |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 642 | return skip; |
| 643 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 644 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 645 | void ObjectLifetimes::PreCallRecordFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
| 646 | const VkCommandBuffer *pCommandBuffers) { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 647 | for (uint32_t i = 0; i < commandBufferCount; i++) { |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 648 | RecordDestroyObject(pCommandBuffers[i], kVulkanObjectTypeCommandBuffer); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 649 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 650 | } |
| 651 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 652 | bool ObjectLifetimes::PreCallValidateDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 653 | const VkAllocationCallbacks *pAllocator) const { |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 654 | return ValidateDestroyObject(swapchain, kVulkanObjectTypeSwapchainKHR, pAllocator, "VUID-vkDestroySwapchainKHR-swapchain-01283", |
| 655 | "VUID-vkDestroySwapchainKHR-swapchain-01284"); |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 656 | } |
| 657 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 658 | void ObjectLifetimes::PreCallRecordDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, |
| 659 | const VkAllocationCallbacks *pAllocator) { |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 660 | RecordDestroyObject(swapchain, kVulkanObjectTypeSwapchainKHR); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 661 | |
| 662 | auto snapshot = swapchainImageMap.snapshot( |
| 663 | [swapchain](std::shared_ptr<ObjTrackState> pNode) { return pNode->parent_object == HandleToUint64(swapchain); }); |
| 664 | for (const auto &itr : snapshot) { |
| 665 | swapchainImageMap.erase(itr.first); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 666 | } |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 667 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 668 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 669 | bool ObjectLifetimes::PreCallValidateFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 670 | uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets) const { |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 671 | auto lock = read_shared_lock(); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 672 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 673 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkFreeDescriptorSets-device-parameter", kVUIDUndefined); |
| 674 | skip |= ValidateObject(descriptorPool, kVulkanObjectTypeDescriptorPool, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 675 | "VUID-vkFreeDescriptorSets-descriptorPool-parameter", "VUID-vkFreeDescriptorSets-descriptorPool-parent"); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 676 | for (uint32_t i = 0; i < descriptorSetCount; i++) { |
| 677 | if (pDescriptorSets[i] != VK_NULL_HANDLE) { |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 678 | skip |= ValidateDescriptorSet(descriptorPool, pDescriptorSets[i]); |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 679 | skip |= |
| 680 | ValidateDestroyObject(pDescriptorSets[i], kVulkanObjectTypeDescriptorSet, nullptr, kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 681 | } |
| 682 | } |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 683 | return skip; |
| 684 | } |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 685 | void ObjectLifetimes::PreCallRecordFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
| 686 | const VkDescriptorSet *pDescriptorSets) { |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 687 | auto lock = write_shared_lock(); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 688 | std::shared_ptr<ObjTrackState> pPoolNode = nullptr; |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 689 | auto itr = object_map[kVulkanObjectTypeDescriptorPool].find(HandleToUint64(descriptorPool)); |
| 690 | if (itr != object_map[kVulkanObjectTypeDescriptorPool].end()) { |
| 691 | pPoolNode = itr->second; |
| 692 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 693 | for (uint32_t i = 0; i < descriptorSetCount; i++) { |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 694 | RecordDestroyObject(pDescriptorSets[i], kVulkanObjectTypeDescriptorSet); |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 695 | if (pPoolNode) { |
| 696 | pPoolNode->child_objects->erase(HandleToUint64(pDescriptorSets[i])); |
| 697 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 698 | } |
Mark Lobodzinski | 1c7fa37 | 2018-09-17 11:35:00 -0600 | [diff] [blame] | 699 | } |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 700 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 701 | bool ObjectLifetimes::PreCallValidateDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 702 | const VkAllocationCallbacks *pAllocator) const { |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 703 | auto lock = read_shared_lock(); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 704 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 705 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkDestroyDescriptorPool-device-parameter", kVUIDUndefined); |
| 706 | skip |= ValidateObject(descriptorPool, kVulkanObjectTypeDescriptorPool, true, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 707 | "VUID-vkDestroyDescriptorPool-descriptorPool-parameter", |
| 708 | "VUID-vkDestroyDescriptorPool-descriptorPool-parent"); |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 709 | |
| 710 | auto itr = object_map[kVulkanObjectTypeDescriptorPool].find(HandleToUint64(descriptorPool)); |
| 711 | if (itr != object_map[kVulkanObjectTypeDescriptorPool].end()) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 712 | auto pPoolNode = itr->second; |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 713 | for (auto set : *pPoolNode->child_objects) { |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 714 | skip |= ValidateDestroyObject((VkDescriptorSet)set, kVulkanObjectTypeDescriptorSet, nullptr, kVUIDUndefined, |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 715 | kVUIDUndefined); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 716 | } |
| 717 | } |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 718 | skip |= ValidateDestroyObject(descriptorPool, kVulkanObjectTypeDescriptorPool, pAllocator, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 719 | "VUID-vkDestroyDescriptorPool-descriptorPool-00304", |
| 720 | "VUID-vkDestroyDescriptorPool-descriptorPool-00305"); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 721 | return skip; |
| 722 | } |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 723 | void ObjectLifetimes::PreCallRecordDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 724 | const VkAllocationCallbacks *pAllocator) { |
Jeff Bolz | c31aae4 | 2019-08-12 20:29:43 -0500 | [diff] [blame] | 725 | auto lock = write_shared_lock(); |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 726 | auto itr = object_map[kVulkanObjectTypeDescriptorPool].find(HandleToUint64(descriptorPool)); |
| 727 | if (itr != object_map[kVulkanObjectTypeDescriptorPool].end()) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 728 | auto pPoolNode = itr->second; |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 729 | for (auto set : *pPoolNode->child_objects) { |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 730 | RecordDestroyObject((VkDescriptorSet)set, kVulkanObjectTypeDescriptorSet); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 731 | } |
Jeff Bolz | cf802bc | 2019-02-10 00:18:00 -0600 | [diff] [blame] | 732 | pPoolNode->child_objects->clear(); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 733 | } |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 734 | RecordDestroyObject(descriptorPool, kVulkanObjectTypeDescriptorPool); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 735 | } |
| 736 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 737 | bool ObjectLifetimes::PreCallValidateDestroyCommandPool(VkDevice device, VkCommandPool commandPool, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 738 | const VkAllocationCallbacks *pAllocator) const { |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 739 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 740 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkDestroyCommandPool-device-parameter", kVUIDUndefined); |
| 741 | skip |= ValidateObject(commandPool, kVulkanObjectTypeCommandPool, true, "VUID-vkDestroyCommandPool-commandPool-parameter", |
| 742 | "VUID-vkDestroyCommandPool-commandPool-parent"); |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 743 | |
| 744 | auto snapshot = object_map[kVulkanObjectTypeCommandBuffer].snapshot( |
| 745 | [commandPool](std::shared_ptr<ObjTrackState> pNode) { return pNode->parent_object == HandleToUint64(commandPool); }); |
| 746 | for (const auto &itr : snapshot) { |
| 747 | auto pNode = itr.second; |
Mark Lobodzinski | 702c6a4 | 2019-09-11 11:52:23 -0600 | [diff] [blame] | 748 | skip |= ValidateCommandBuffer(commandPool, reinterpret_cast<VkCommandBuffer>(itr.first)); |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 749 | skip |= ValidateDestroyObject(reinterpret_cast<VkCommandBuffer>(itr.first), kVulkanObjectTypeCommandBuffer, nullptr, |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 750 | kVUIDUndefined, kVUIDUndefined); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 751 | } |
Mark Lobodzinski | 3d89a2c | 2019-09-11 11:41:11 -0600 | [diff] [blame] | 752 | skip |= ValidateDestroyObject(commandPool, kVulkanObjectTypeCommandPool, pAllocator, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 753 | "VUID-vkDestroyCommandPool-commandPool-00042", "VUID-vkDestroyCommandPool-commandPool-00043"); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 754 | return skip; |
| 755 | } |
| 756 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 757 | void ObjectLifetimes::PreCallRecordDestroyCommandPool(VkDevice device, VkCommandPool commandPool, |
| 758 | const VkAllocationCallbacks *pAllocator) { |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 759 | auto snapshot = object_map[kVulkanObjectTypeCommandBuffer].snapshot( |
| 760 | [commandPool](std::shared_ptr<ObjTrackState> pNode) { return pNode->parent_object == HandleToUint64(commandPool); }); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 761 | // A CommandPool's cmd buffers are implicitly deleted when pool is deleted. Remove this pool's cmdBuffers from cmd buffer map. |
Jeff Bolz | fd3bb24 | 2019-08-22 06:10:49 -0500 | [diff] [blame] | 762 | for (const auto &itr : snapshot) { |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 763 | RecordDestroyObject(reinterpret_cast<VkCommandBuffer>(itr.first), kVulkanObjectTypeCommandBuffer); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 764 | } |
Mark Lobodzinski | 82742f6 | 2019-09-11 11:20:26 -0600 | [diff] [blame] | 765 | RecordDestroyObject(commandPool, kVulkanObjectTypeCommandPool); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 766 | } |
| 767 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 768 | bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceQueueFamilyProperties2( |
| 769 | VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, |
| 770 | VkQueueFamilyProperties2KHR *pQueueFamilyProperties) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 771 | return ValidateObject(physicalDevice, kVulkanObjectTypePhysicalDevice, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 772 | "VUID-vkGetPhysicalDeviceQueueFamilyProperties2-physicalDevice-parameter", kVUIDUndefined); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 773 | } |
| 774 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 775 | bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceQueueFamilyProperties2KHR( |
| 776 | VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 777 | return ValidateObject(physicalDevice, kVulkanObjectTypePhysicalDevice, false, |
Shannon McPherson | 3ea6513 | 2018-12-05 10:37:39 -0700 | [diff] [blame] | 778 | "VUID-vkGetPhysicalDeviceQueueFamilyProperties2-physicalDevice-parameter", kVUIDUndefined); |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | void ObjectLifetimes::PostCallRecordGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, |
| 782 | uint32_t *pQueueFamilyPropertyCount, |
Jeff Bolz | 6d24311 | 2019-08-21 13:24:11 -0500 | [diff] [blame] | 783 | VkQueueFamilyProperties2KHR *pQueueFamilyProperties) {} |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 784 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 785 | void ObjectLifetimes::PostCallRecordGetPhysicalDeviceQueueFamilyProperties2KHR( |
Jeff Bolz | 6d24311 | 2019-08-21 13:24:11 -0500 | [diff] [blame] | 786 | VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR *pQueueFamilyProperties) {} |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 787 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 788 | bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, |
| 789 | uint32_t *pPropertyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 790 | VkDisplayPropertiesKHR *pProperties) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 791 | return ValidateObject(physicalDevice, kVulkanObjectTypePhysicalDevice, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 792 | "VUID-vkGetPhysicalDeviceDisplayPropertiesKHR-physicalDevice-parameter", kVUIDUndefined); |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 793 | } |
| 794 | |
| 795 | void ObjectLifetimes::PostCallRecordGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 796 | VkDisplayPropertiesKHR *pProperties, VkResult result) { |
| 797 | if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) return; |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 798 | if (pProperties) { |
| 799 | for (uint32_t i = 0; i < *pPropertyCount; ++i) { |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 800 | CreateObject(pProperties[i].display, kVulkanObjectTypeDisplayKHR, nullptr); |
Mark Lobodzinski | b2de97f | 2017-07-06 15:28:11 -0600 | [diff] [blame] | 801 | } |
| 802 | } |
| 803 | } |
| 804 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 805 | bool ObjectLifetimes::PreCallValidateGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 806 | uint32_t *pPropertyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 807 | VkDisplayModePropertiesKHR *pProperties) const { |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 808 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 809 | skip |= ValidateObject(physicalDevice, kVulkanObjectTypePhysicalDevice, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 810 | "VUID-vkGetDisplayModePropertiesKHR-physicalDevice-parameter", kVUIDUndefined); |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 811 | skip |= ValidateObject(display, kVulkanObjectTypeDisplayKHR, false, "VUID-vkGetDisplayModePropertiesKHR-display-parameter", |
| 812 | kVUIDUndefined); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 813 | |
| 814 | return skip; |
| 815 | } |
| 816 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 817 | void ObjectLifetimes::PostCallRecordGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 818 | uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties, |
| 819 | VkResult result) { |
| 820 | if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) return; |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 821 | if (pProperties) { |
Tony-LunarG | cd0c6b0 | 2018-10-26 14:56:44 -0600 | [diff] [blame] | 822 | for (uint32_t i = 0; i < *pPropertyCount; ++i) { |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 823 | CreateObject(pProperties[i].displayMode, kVulkanObjectTypeDisplayModeKHR, nullptr); |
Shannon McPherson | 9d5167f | 2018-05-02 15:24:37 -0600 | [diff] [blame] | 824 | } |
| 825 | } |
Shannon McPherson | 9d5167f | 2018-05-02 15:24:37 -0600 | [diff] [blame] | 826 | } |
| 827 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 828 | bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice, |
| 829 | uint32_t *pPropertyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 830 | VkDisplayProperties2KHR *pProperties) const { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 831 | return ValidateObject(physicalDevice, kVulkanObjectTypePhysicalDevice, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 832 | "VUID-vkGetPhysicalDeviceDisplayProperties2KHR-physicalDevice-parameter", kVUIDUndefined); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 833 | } |
| 834 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 835 | void ObjectLifetimes::PostCallRecordGetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice, |
| 836 | uint32_t *pPropertyCount, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 837 | VkDisplayProperties2KHR *pProperties, VkResult result) { |
| 838 | if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) return; |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 839 | for (uint32_t index = 0; index < *pPropertyCount; ++index) { |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 840 | CreateObject(pProperties[index].displayProperties.display, kVulkanObjectTypeDisplayKHR, nullptr); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 841 | } |
| 842 | } |
| 843 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 844 | bool ObjectLifetimes::PreCallValidateGetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 845 | uint32_t *pPropertyCount, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 846 | VkDisplayModeProperties2KHR *pProperties) const { |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 847 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 848 | skip |= ValidateObject(physicalDevice, kVulkanObjectTypePhysicalDevice, false, |
Mark Lobodzinski | add9323 | 2018-10-09 11:49:42 -0600 | [diff] [blame] | 849 | "VUID-vkGetDisplayModeProperties2KHR-physicalDevice-parameter", kVUIDUndefined); |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 850 | skip |= ValidateObject(display, kVulkanObjectTypeDisplayKHR, false, "VUID-vkGetDisplayModeProperties2KHR-display-parameter", |
| 851 | kVUIDUndefined); |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 852 | |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 853 | return skip; |
| 854 | } |
| 855 | |
Mark Lobodzinski | 0c66846 | 2018-09-27 10:13:19 -0600 | [diff] [blame] | 856 | void ObjectLifetimes::PostCallRecordGetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
Mark Lobodzinski | cd05c1e | 2019-01-17 15:33:46 -0700 | [diff] [blame] | 857 | uint32_t *pPropertyCount, VkDisplayModeProperties2KHR *pProperties, |
| 858 | VkResult result) { |
| 859 | if ((result != VK_SUCCESS) && (result != VK_INCOMPLETE)) return; |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 860 | for (uint32_t index = 0; index < *pPropertyCount; ++index) { |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 861 | CreateObject(pProperties[index].displayModeProperties.displayMode, kVulkanObjectTypeDisplayModeKHR, nullptr); |
Mark Lobodzinski | a2e9736 | 2018-09-17 13:58:32 -0600 | [diff] [blame] | 862 | } |
| 863 | } |
Shannon McPherson | f7d9cf6 | 2019-06-26 09:23:57 -0600 | [diff] [blame] | 864 | |
| 865 | bool ObjectLifetimes::PreCallValidateAcquirePerformanceConfigurationINTEL( |
| 866 | VkDevice device, const VkPerformanceConfigurationAcquireInfoINTEL *pAcquireInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 867 | VkPerformanceConfigurationINTEL *pConfiguration) const { |
Shannon McPherson | f7d9cf6 | 2019-06-26 09:23:57 -0600 | [diff] [blame] | 868 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 869 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkAcquirePerformanceConfigurationINTEL-device-parameter", |
| 870 | kVUIDUndefined); |
Shannon McPherson | f7d9cf6 | 2019-06-26 09:23:57 -0600 | [diff] [blame] | 871 | |
| 872 | return skip; |
| 873 | } |
| 874 | |
| 875 | bool ObjectLifetimes::PreCallValidateReleasePerformanceConfigurationINTEL(VkDevice device, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 876 | VkPerformanceConfigurationINTEL configuration) const { |
Shannon McPherson | f7d9cf6 | 2019-06-26 09:23:57 -0600 | [diff] [blame] | 877 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 878 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkReleasePerformanceConfigurationINTEL-device-parameter", |
| 879 | kVUIDUndefined); |
Shannon McPherson | f7d9cf6 | 2019-06-26 09:23:57 -0600 | [diff] [blame] | 880 | |
| 881 | return skip; |
| 882 | } |
| 883 | |
| 884 | bool ObjectLifetimes::PreCallValidateQueueSetPerformanceConfigurationINTEL(VkQueue queue, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 885 | VkPerformanceConfigurationINTEL configuration) const { |
Shannon McPherson | f7d9cf6 | 2019-06-26 09:23:57 -0600 | [diff] [blame] | 886 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 887 | skip |= ValidateObject(queue, kVulkanObjectTypeQueue, false, "VUID-vkQueueSetPerformanceConfigurationINTEL-queue-parameter", |
| 888 | "VUID-vkQueueSetPerformanceConfigurationINTEL-commonparent"); |
Shannon McPherson | f7d9cf6 | 2019-06-26 09:23:57 -0600 | [diff] [blame] | 889 | |
| 890 | return skip; |
| 891 | } |
Tobias Hector | c905742 | 2019-07-23 12:15:52 +0100 | [diff] [blame] | 892 | |
| 893 | bool ObjectLifetimes::PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 894 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) const { |
Tobias Hector | c905742 | 2019-07-23 12:15:52 +0100 | [diff] [blame] | 895 | bool skip = false; |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 896 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkCreateFramebuffer-device-parameter", kVUIDUndefined); |
Tobias Hector | c905742 | 2019-07-23 12:15:52 +0100 | [diff] [blame] | 897 | if (pCreateInfo) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 898 | skip |= ValidateObject(pCreateInfo->renderPass, kVulkanObjectTypeRenderPass, false, |
Tobias Hector | c905742 | 2019-07-23 12:15:52 +0100 | [diff] [blame] | 899 | "VUID-VkFramebufferCreateInfo-renderPass-parameter", "VUID-VkFramebufferCreateInfo-commonparent"); |
| 900 | if ((pCreateInfo->flags & VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR) == 0) { |
| 901 | for (uint32_t index1 = 0; index1 < pCreateInfo->attachmentCount; ++index1) { |
Mark Lobodzinski | 3996574 | 2019-09-11 11:03:51 -0600 | [diff] [blame] | 902 | skip |= ValidateObject(pCreateInfo->pAttachments[index1], kVulkanObjectTypeImageView, true, kVUIDUndefined, |
Tobias Hector | c905742 | 2019-07-23 12:15:52 +0100 | [diff] [blame] | 903 | "VUID-VkFramebufferCreateInfo-commonparent"); |
| 904 | } |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | return skip; |
| 909 | } |
| 910 | |
| 911 | void ObjectLifetimes::PostCallRecordCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
| 912 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer, |
| 913 | VkResult result) { |
| 914 | if (result != VK_SUCCESS) return; |
Mark Lobodzinski | 1e76a7d | 2019-09-11 11:11:46 -0600 | [diff] [blame] | 915 | CreateObject(*pFramebuffer, kVulkanObjectTypeFramebuffer, pAllocator); |
Tobias Hector | c905742 | 2019-07-23 12:15:52 +0100 | [diff] [blame] | 916 | } |
Mark Lobodzinski | 417b757 | 2019-09-11 15:10:26 -0600 | [diff] [blame] | 917 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 918 | bool ObjectLifetimes::PreCallValidateSetDebugUtilsObjectNameEXT(VkDevice device, |
| 919 | const VkDebugUtilsObjectNameInfoEXT *pNameInfo) const { |
Mark Lobodzinski | 417b757 | 2019-09-11 15:10:26 -0600 | [diff] [blame] | 920 | bool skip = false; |
| 921 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkSetDebugUtilsObjectNameEXT-device-parameter", |
| 922 | kVUIDUndefined); |
| 923 | skip |= ValidateAnonymousObject(pNameInfo->objectHandle, pNameInfo->objectType, false, |
| 924 | "VUID-VkDebugUtilsObjectNameInfoEXT-objectType-02590", kVUIDUndefined); |
| 925 | |
| 926 | return skip; |
| 927 | } |
| 928 | |
Jeff Bolz | 5c801d1 | 2019-10-09 10:38:45 -0500 | [diff] [blame] | 929 | bool ObjectLifetimes::PreCallValidateSetDebugUtilsObjectTagEXT(VkDevice device, |
| 930 | const VkDebugUtilsObjectTagInfoEXT *pTagInfo) const { |
Mark Lobodzinski | 417b757 | 2019-09-11 15:10:26 -0600 | [diff] [blame] | 931 | bool skip = false; |
| 932 | skip |= |
| 933 | ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkSetDebugUtilsObjectTagEXT-device-parameter", kVUIDUndefined); |
| 934 | skip |= ValidateAnonymousObject(pTagInfo->objectHandle, pTagInfo->objectType, false, |
| 935 | "VUID-VkDebugUtilsObjectTagInfoEXT-objectHandle-01910", kVUIDUndefined); |
| 936 | |
| 937 | return skip; |
| 938 | } |
Mark Lobodzinski | 67f8638 | 2019-12-12 12:28:54 -0700 | [diff] [blame] | 939 | |
| 940 | bool ObjectLifetimes::PreCallValidateCreateDescriptorUpdateTemplate(VkDevice device, |
| 941 | const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, |
| 942 | const VkAllocationCallbacks *pAllocator, |
| 943 | VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) const { |
| 944 | bool skip = false; |
| 945 | skip |= ValidateObject(device, kVulkanObjectTypeDevice, false, "VUID-vkCreateDescriptorUpdateTemplate-device-parameter", |
| 946 | kVUIDUndefined); |
| 947 | if (pCreateInfo) { |
| 948 | if (pCreateInfo->templateType == VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET) { |
| 949 | skip |= ValidateObject(pCreateInfo->descriptorSetLayout, kVulkanObjectTypeDescriptorSetLayout, false, |
| 950 | "VUID-VkDescriptorUpdateTemplateCreateInfo-templateType-00350", |
| 951 | "VUID-VkDescriptorUpdateTemplateCreateInfo-commonparent"); |
| 952 | } |
| 953 | if (pCreateInfo->templateType == VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR) { |
| 954 | skip |= ValidateObject(pCreateInfo->pipelineLayout, kVulkanObjectTypePipelineLayout, false, |
| 955 | "VUID-VkDescriptorUpdateTemplateCreateInfo-templateType-00352", |
| 956 | "VUID-VkDescriptorUpdateTemplateCreateInfo-commonparent"); |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | return skip; |
| 961 | } |
| 962 | |
| 963 | bool ObjectLifetimes::PreCallValidateCreateDescriptorUpdateTemplateKHR( |
| 964 | VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 965 | VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) const { |
| 966 | return PreCallValidateCreateDescriptorUpdateTemplate(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); |
| 967 | } |
| 968 | |
| 969 | void ObjectLifetimes::PostCallRecordCreateDescriptorUpdateTemplate(VkDevice device, |
| 970 | const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, |
| 971 | const VkAllocationCallbacks *pAllocator, |
| 972 | VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate, |
| 973 | VkResult result) { |
| 974 | if (result != VK_SUCCESS) return; |
| 975 | CreateObject(*pDescriptorUpdateTemplate, kVulkanObjectTypeDescriptorUpdateTemplate, pAllocator); |
| 976 | } |
| 977 | |
| 978 | void ObjectLifetimes::PostCallRecordCreateDescriptorUpdateTemplateKHR(VkDevice device, |
| 979 | const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, |
| 980 | const VkAllocationCallbacks *pAllocator, |
| 981 | VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate, |
| 982 | VkResult result) { |
| 983 | return PostCallRecordCreateDescriptorUpdateTemplate(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate, result); |
| 984 | } |