Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2016 The Khronos Group Inc. |
| 3 | * Copyright (c) 2015-2016 Valve Corporation |
| 4 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 5 | * Copyright (c) 2015-2016 Google, Inc. |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | * |
| 19 | * Author: Mark Lobodzinski <mark@lunarg.com> |
| 20 | * Author: Tobin Ehlis <tobine@google.com> |
| 21 | * Author: Courtney Goeltzenleuchter <courtneygo@google.com> |
| 22 | * Author: Jon Ashburn <jon@lunarg.com> |
| 23 | * Author: Mike Stroyan <stroyan@google.com> |
| 24 | * Author: Tony Barbour <tony@LunarG.com> |
| 25 | */ |
| 26 | |
| 27 | #include "vk_loader_platform.h" |
| 28 | #include "vulkan/vulkan.h" |
| 29 | |
| 30 | #include <cinttypes> |
| 31 | #include <stdio.h> |
| 32 | #include <stdlib.h> |
| 33 | #include <string.h> |
| 34 | |
| 35 | #include <unordered_map> |
Chris Forbes | 04257ad | 2016-10-04 10:08:31 +1300 | [diff] [blame^] | 36 | #include <type_traits> |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 37 | |
| 38 | #include "vk_layer_config.h" |
| 39 | #include "vk_layer_data.h" |
| 40 | #include "vk_layer_logging.h" |
| 41 | #include "vk_layer_table.h" |
| 42 | #include "vulkan/vk_layer.h" |
| 43 | |
| 44 | #include "object_tracker.h" |
| 45 | |
| 46 | namespace object_tracker { |
| 47 | |
| 48 | static void InitObjectTracker(layer_data *my_data, const VkAllocationCallbacks *pAllocator) { |
| 49 | |
| 50 | layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "lunarg_object_tracker"); |
| 51 | } |
| 52 | |
| 53 | // Add new queue to head of global queue list |
| 54 | static void AddQueueInfo(VkDevice device, uint32_t queue_node_index, VkQueue queue) { |
| 55 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 56 | auto queueItem = device_data->queue_info_map.find(queue); |
| 57 | if (queueItem == device_data->queue_info_map.end()) { |
| 58 | OT_QUEUE_INFO *p_queue_info = new OT_QUEUE_INFO; |
| 59 | if (p_queue_info != NULL) { |
| 60 | memset(p_queue_info, 0, sizeof(OT_QUEUE_INFO)); |
| 61 | p_queue_info->queue = queue; |
| 62 | p_queue_info->queue_node_index = queue_node_index; |
| 63 | device_data->queue_info_map[queue] = p_queue_info; |
| 64 | } else { |
| 65 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, |
| 66 | reinterpret_cast<uint64_t>(queue), __LINE__, OBJTRACK_INTERNAL_ERROR, LayerName, |
| 67 | "ERROR: VK_ERROR_OUT_OF_HOST_MEMORY -- could not allocate memory for Queue Information"); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // Destroy memRef lists and free all memory |
| 73 | static void DestroyQueueDataStructures(VkDevice device) { |
| 74 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 75 | |
| 76 | for (auto queue_item : device_data->queue_info_map) { |
| 77 | delete queue_item.second; |
| 78 | } |
| 79 | device_data->queue_info_map.clear(); |
| 80 | |
| 81 | // Destroy the items in the queue map |
| 82 | auto queue = device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT].begin(); |
| 83 | while (queue != device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT].end()) { |
| 84 | uint32_t obj_index = queue->second->object_type; |
| 85 | assert(device_data->num_total_objects > 0); |
| 86 | device_data->num_total_objects--; |
| 87 | assert(device_data->num_objects[obj_index] > 0); |
| 88 | device_data->num_objects[obj_index]--; |
| 89 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, queue->second->object_type, queue->second->handle, |
| 90 | __LINE__, OBJTRACK_NONE, LayerName, |
| 91 | "OBJ_STAT Destroy Queue obj 0x%" PRIxLEAST64 " (%" PRIu64 " total objs remain & %" PRIu64 " Queue objs).", |
| 92 | queue->second->handle, device_data->num_total_objects, device_data->num_objects[obj_index]); |
| 93 | delete queue->second; |
| 94 | queue = device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT].erase(queue); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | // Check Queue type flags for selected queue operations |
| 99 | static void ValidateQueueFlags(VkQueue queue, const char *function) { |
| 100 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); |
| 101 | auto queue_item = device_data->queue_info_map.find(queue); |
| 102 | if (queue_item != device_data->queue_info_map.end()) { |
| 103 | OT_QUEUE_INFO *pQueueInfo = queue_item->second; |
| 104 | if (pQueueInfo != NULL) { |
| 105 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(device_data->physical_device), layer_data_map); |
| 106 | if ((instance_data->queue_family_properties[pQueueInfo->queue_node_index].queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) == |
| 107 | 0) { |
| 108 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, |
| 109 | reinterpret_cast<uint64_t>(queue), __LINE__, OBJTRACK_UNKNOWN_OBJECT, LayerName, |
| 110 | "Attempting %s on a non-memory-management capable queue -- VK_QUEUE_SPARSE_BINDING_BIT not set", function); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | static void AllocateCommandBuffer(VkDevice device, const VkCommandPool command_pool, const VkCommandBuffer command_buffer, |
| 117 | VkDebugReportObjectTypeEXT object_type, VkCommandBufferLevel level) { |
| 118 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 119 | |
| 120 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, object_type, reinterpret_cast<const uint64_t>(command_buffer), |
| 121 | __LINE__, OBJTRACK_NONE, LayerName, "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, |
| 122 | string_VkDebugReportObjectTypeEXT(object_type), reinterpret_cast<const uint64_t>(command_buffer)); |
| 123 | |
| 124 | OBJTRACK_NODE *pNewObjNode = new OBJTRACK_NODE; |
| 125 | pNewObjNode->object_type = object_type; |
| 126 | pNewObjNode->handle = reinterpret_cast<const uint64_t>(command_buffer); |
| 127 | pNewObjNode->parent_object = reinterpret_cast<const uint64_t &>(command_pool); |
| 128 | if (level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) { |
| 129 | pNewObjNode->status = OBJSTATUS_COMMAND_BUFFER_SECONDARY; |
| 130 | } else { |
| 131 | pNewObjNode->status = OBJSTATUS_NONE; |
| 132 | } |
| 133 | device_data->object_map[object_type][reinterpret_cast<const uint64_t>(command_buffer)] = pNewObjNode; |
| 134 | device_data->num_objects[object_type]++; |
| 135 | device_data->num_total_objects++; |
| 136 | } |
| 137 | |
| 138 | static bool ValidateCommandBuffer(VkDevice device, VkCommandPool command_pool, VkCommandBuffer command_buffer) { |
| 139 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 140 | bool skip_call = false; |
| 141 | uint64_t object_handle = reinterpret_cast<uint64_t>(command_buffer); |
| 142 | if (device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT].find(object_handle) != |
| 143 | device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT].end()) { |
| 144 | OBJTRACK_NODE *pNode = |
| 145 | device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT][reinterpret_cast<uint64_t>(command_buffer)]; |
| 146 | |
| 147 | if (pNode->parent_object != reinterpret_cast<uint64_t &>(command_pool)) { |
| 148 | skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, pNode->object_type, object_handle, |
| 149 | __LINE__, OBJTRACK_COMMAND_POOL_MISMATCH, LayerName, |
| 150 | "FreeCommandBuffers is attempting to free Command Buffer 0x%" PRIxLEAST64 |
| 151 | " belonging to Command Pool 0x%" PRIxLEAST64 " from pool 0x%" PRIxLEAST64 ").", |
| 152 | reinterpret_cast<uint64_t>(command_buffer), pNode->parent_object, |
| 153 | reinterpret_cast<uint64_t &>(command_pool)); |
| 154 | } |
| 155 | } else { |
Mark Lobodzinski | 45e6861 | 2016-07-18 17:06:52 -0600 | [diff] [blame] | 156 | skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, object_handle, |
| 157 | __LINE__, OBJTRACK_NONE, LayerName, "Unable to remove command buffer obj 0x%" PRIxLEAST64 |
| 158 | ". Was it created? Has it already been destroyed?", |
| 159 | object_handle); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 160 | } |
| 161 | return skip_call; |
| 162 | } |
| 163 | |
| 164 | static void AllocateDescriptorSet(VkDevice device, VkDescriptorPool descriptor_pool, VkDescriptorSet descriptor_set, |
| 165 | VkDebugReportObjectTypeEXT object_type) { |
| 166 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 167 | |
| 168 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, object_type, |
| 169 | reinterpret_cast<uint64_t &>(descriptor_set), __LINE__, OBJTRACK_NONE, LayerName, |
| 170 | "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, object_name[object_type], |
| 171 | reinterpret_cast<uint64_t &>(descriptor_set)); |
| 172 | |
| 173 | OBJTRACK_NODE *pNewObjNode = new OBJTRACK_NODE; |
| 174 | pNewObjNode->object_type = object_type; |
| 175 | pNewObjNode->status = OBJSTATUS_NONE; |
| 176 | pNewObjNode->handle = reinterpret_cast<uint64_t &>(descriptor_set); |
| 177 | pNewObjNode->parent_object = reinterpret_cast<uint64_t &>(descriptor_pool); |
| 178 | device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT][reinterpret_cast<uint64_t &>(descriptor_set)] = |
| 179 | pNewObjNode; |
| 180 | device_data->num_objects[object_type]++; |
| 181 | device_data->num_total_objects++; |
| 182 | } |
| 183 | |
| 184 | static bool ValidateDescriptorSet(VkDevice device, VkDescriptorPool descriptor_pool, VkDescriptorSet descriptor_set) { |
| 185 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 186 | bool skip_call = false; |
| 187 | uint64_t object_handle = reinterpret_cast<uint64_t &>(descriptor_set); |
| 188 | auto dsItem = device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT].find(object_handle); |
| 189 | if (dsItem != device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT].end()) { |
| 190 | OBJTRACK_NODE *pNode = dsItem->second; |
| 191 | |
| 192 | if (pNode->parent_object != reinterpret_cast<uint64_t &>(descriptor_pool)) { |
| 193 | skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, pNode->object_type, object_handle, |
| 194 | __LINE__, OBJTRACK_DESCRIPTOR_POOL_MISMATCH, LayerName, |
| 195 | "FreeDescriptorSets is attempting to free descriptorSet 0x%" PRIxLEAST64 |
| 196 | " belonging to Descriptor Pool 0x%" PRIxLEAST64 " from pool 0x%" PRIxLEAST64 ").", |
| 197 | reinterpret_cast<uint64_t &>(descriptor_set), pNode->parent_object, |
| 198 | reinterpret_cast<uint64_t &>(descriptor_pool)); |
| 199 | } |
| 200 | } else { |
Mark Lobodzinski | 45e6861 | 2016-07-18 17:06:52 -0600 | [diff] [blame] | 201 | skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, object_handle, |
| 202 | __LINE__, OBJTRACK_NONE, LayerName, "Unable to remove descriptor set obj 0x%" PRIxLEAST64 |
| 203 | ". Was it created? Has it already been destroyed?", |
| 204 | object_handle); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 205 | } |
| 206 | return skip_call; |
| 207 | } |
| 208 | |
| 209 | static void CreateQueue(VkDevice device, VkQueue vkObj, VkDebugReportObjectTypeEXT object_type) { |
| 210 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 211 | |
| 212 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, object_type, reinterpret_cast<uint64_t>(vkObj), __LINE__, |
| 213 | OBJTRACK_NONE, LayerName, "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, |
| 214 | object_name[object_type], reinterpret_cast<uint64_t>(vkObj)); |
| 215 | |
| 216 | OBJTRACK_NODE *p_obj_node = NULL; |
| 217 | auto queue_item = device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT].find(reinterpret_cast<uint64_t>(vkObj)); |
| 218 | if (queue_item == device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT].end()) { |
| 219 | p_obj_node = new OBJTRACK_NODE; |
| 220 | device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT][reinterpret_cast<uint64_t>(vkObj)] = p_obj_node; |
| 221 | device_data->num_objects[object_type]++; |
| 222 | device_data->num_total_objects++; |
| 223 | } else { |
| 224 | p_obj_node = queue_item->second; |
| 225 | } |
| 226 | p_obj_node->object_type = object_type; |
| 227 | p_obj_node->status = OBJSTATUS_NONE; |
| 228 | p_obj_node->handle = reinterpret_cast<uint64_t>(vkObj); |
| 229 | } |
| 230 | |
| 231 | static void CreateSwapchainImageObject(VkDevice dispatchable_object, VkImage swapchain_image, VkSwapchainKHR swapchain) { |
| 232 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(dispatchable_object), layer_data_map); |
| 233 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, |
| 234 | reinterpret_cast<uint64_t &>(swapchain_image), __LINE__, OBJTRACK_NONE, LayerName, |
| 235 | "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, "SwapchainImage", |
| 236 | reinterpret_cast<uint64_t &>(swapchain_image)); |
| 237 | |
| 238 | OBJTRACK_NODE *pNewObjNode = new OBJTRACK_NODE; |
| 239 | pNewObjNode->object_type = VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT; |
| 240 | pNewObjNode->status = OBJSTATUS_NONE; |
| 241 | pNewObjNode->handle = reinterpret_cast<uint64_t &>(swapchain_image); |
| 242 | pNewObjNode->parent_object = reinterpret_cast<uint64_t &>(swapchain); |
| 243 | device_data->swapchainImageMap[reinterpret_cast<uint64_t &>(swapchain_image)] = pNewObjNode; |
| 244 | } |
| 245 | |
| 246 | template <typename T1, typename T2> |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 247 | static void CreateObject(T1 dispatchable_object, T2 object, VkDebugReportObjectTypeEXT object_type, bool custom_allocator) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 248 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(dispatchable_object), layer_data_map); |
Chris Forbes | 04257ad | 2016-10-04 10:08:31 +1300 | [diff] [blame^] | 249 | |
| 250 | auto object_handle = std::is_pointer<T2>::value |
| 251 | ? reinterpret_cast<uint64_t>(object) |
| 252 | : reinterpret_cast<uint64_t &>(object); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 253 | |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 254 | log_msg(instance_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, object_type, object_handle, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 255 | __LINE__, OBJTRACK_NONE, LayerName, "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 256 | object_name[object_type], object_handle); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 257 | |
| 258 | OBJTRACK_NODE *pNewObjNode = new OBJTRACK_NODE; |
| 259 | pNewObjNode->object_type = object_type; |
Chris Forbes | dbfe96a | 2016-09-29 13:51:10 +1300 | [diff] [blame] | 260 | pNewObjNode->status = custom_allocator ? OBJSTATUS_CUSTOM_ALLOCATOR : OBJSTATUS_NONE; |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 261 | pNewObjNode->handle = object_handle; |
| 262 | instance_data->object_map[object_type][object_handle] = pNewObjNode; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 263 | instance_data->num_objects[object_type]++; |
| 264 | instance_data->num_total_objects++; |
| 265 | } |
| 266 | |
| 267 | template <typename T1, typename T2> |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 268 | static void DestroyObject(T1 dispatchable_object, T2 object, VkDebugReportObjectTypeEXT object_type, bool custom_allocator) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 269 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(dispatchable_object), layer_data_map); |
| 270 | |
Chris Forbes | 04257ad | 2016-10-04 10:08:31 +1300 | [diff] [blame^] | 271 | auto object_handle = std::is_pointer<T2>::value |
| 272 | ? reinterpret_cast<uint64_t>(object) |
| 273 | : reinterpret_cast<uint64_t &>(object); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 274 | |
| 275 | auto item = device_data->object_map[object_type].find(object_handle); |
| 276 | if (item != device_data->object_map[object_type].end()) { |
| 277 | |
| 278 | OBJTRACK_NODE *pNode = item->second; |
| 279 | assert(device_data->num_total_objects > 0); |
| 280 | device_data->num_total_objects--; |
| 281 | assert(device_data->num_objects[pNode->object_type] > 0); |
| 282 | device_data->num_objects[pNode->object_type]--; |
| 283 | |
| 284 | log_msg(device_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, pNode->object_type, object_handle, __LINE__, |
| 285 | OBJTRACK_NONE, LayerName, |
| 286 | "OBJ_STAT Destroy %s obj 0x%" PRIxLEAST64 " (%" PRIu64 " total objs remain & %" PRIu64 " %s objs).", |
| 287 | object_name[pNode->object_type], reinterpret_cast<uint64_t &>(object), device_data->num_total_objects, |
| 288 | device_data->num_objects[pNode->object_type], object_name[pNode->object_type]); |
| 289 | |
Chris Forbes | 3e51a20 | 2016-09-29 14:35:09 +1300 | [diff] [blame] | 290 | auto allocated_with_custom = pNode->status & OBJSTATUS_CUSTOM_ALLOCATOR; |
| 291 | if (custom_allocator ^ allocated_with_custom) { |
| 292 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object_handle, __LINE__, |
| 293 | OBJTRACK_ALLOCATOR_MISMATCH, LayerName, |
| 294 | "Custom allocator %sspecified while destroying %s obj 0x%" PRIxLEAST64 " but %sspecified at creation", |
| 295 | (custom_allocator ? "" : "not "), object_name[object_type], object_handle, |
| 296 | (allocated_with_custom ? "" : "not ")); |
| 297 | } |
| 298 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 299 | delete pNode; |
| 300 | device_data->object_map[object_type].erase(item); |
| 301 | } else { |
| 302 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, object_handle, __LINE__, |
| 303 | OBJTRACK_UNKNOWN_OBJECT, LayerName, |
Mark Lobodzinski | 45e6861 | 2016-07-18 17:06:52 -0600 | [diff] [blame] | 304 | "Unable to remove %s obj 0x%" PRIxLEAST64 ". Was it created? Has it already been destroyed?", |
| 305 | object_name[object_type], object_handle); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 306 | } |
| 307 | } |
| 308 | |
| 309 | template <typename T1, typename T2> |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 310 | static bool ValidateObject(T1 dispatchable_object, T2 object, VkDebugReportObjectTypeEXT object_type, bool null_allowed) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 311 | if (null_allowed && (object == VK_NULL_HANDLE)) { |
| 312 | return false; |
| 313 | } |
Chris Forbes | 04257ad | 2016-10-04 10:08:31 +1300 | [diff] [blame^] | 314 | auto object_handle = std::is_pointer<T2>::value |
| 315 | ? reinterpret_cast<uint64_t>(object) |
| 316 | : reinterpret_cast<uint64_t &>(object); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 317 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(dispatchable_object), layer_data_map); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 318 | if (device_data->object_map[object_type].find(object_handle) == device_data->object_map[object_type].end()) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 319 | // If object is an image, also look for it in the swapchain image map |
| 320 | if ((object_type != VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT) || |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 321 | (device_data->swapchainImageMap.find(object_handle) == device_data->swapchainImageMap.end())) { |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 322 | return log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 323 | object_handle, __LINE__, OBJTRACK_INVALID_OBJECT, LayerName, |
| 324 | "Invalid %s Object 0x%" PRIxLEAST64, object_name[object_type], object_handle); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 325 | } |
| 326 | } |
| 327 | return false; |
| 328 | } |
| 329 | |
| 330 | static void DeviceReportUndestroyedObjects(VkDevice device, VkDebugReportObjectTypeEXT object_type) { |
| 331 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 332 | for (auto item = device_data->object_map[object_type].begin(); item != device_data->object_map[object_type].end();) { |
| 333 | OBJTRACK_NODE *object_info = item->second; |
| 334 | log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_info->object_type, object_info->handle, __LINE__, |
| 335 | OBJTRACK_OBJECT_LEAK, LayerName, |
| 336 | "OBJ ERROR : For device 0x%" PRIxLEAST64 ", %s object 0x%" PRIxLEAST64 " has not been destroyed.", |
| 337 | reinterpret_cast<uint64_t>(device), object_name[object_type], object_info->handle); |
| 338 | item = device_data->object_map[object_type].erase(item); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
| 343 | std::unique_lock<std::mutex> lock(global_lock); |
| 344 | |
| 345 | dispatch_key key = get_dispatch_key(instance); |
| 346 | layer_data *instance_data = get_my_data_ptr(key, layer_data_map); |
| 347 | |
| 348 | // Enable the temporary callback(s) here to catch cleanup issues: |
| 349 | bool callback_setup = false; |
| 350 | if (instance_data->num_tmp_callbacks > 0) { |
| 351 | if (!layer_enable_tmp_callbacks(instance_data->report_data, instance_data->num_tmp_callbacks, |
| 352 | instance_data->tmp_dbg_create_infos, instance_data->tmp_callbacks)) { |
| 353 | callback_setup = true; |
| 354 | } |
| 355 | } |
| 356 | |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 357 | ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 358 | |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 359 | DestroyObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 360 | // Report any remaining objects in LL |
| 361 | |
| 362 | for (auto iit = instance_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT].begin(); |
| 363 | iit != instance_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT].end();) { |
| 364 | OBJTRACK_NODE *pNode = iit->second; |
| 365 | |
| 366 | VkDevice device = reinterpret_cast<VkDevice>(pNode->handle); |
| 367 | |
| 368 | log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, pNode->object_type, pNode->handle, __LINE__, |
| 369 | OBJTRACK_OBJECT_LEAK, LayerName, "OBJ ERROR : %s object 0x%" PRIxLEAST64 " has not been destroyed.", |
| 370 | string_VkDebugReportObjectTypeEXT(pNode->object_type), pNode->handle); |
| 371 | // Semaphore: |
| 372 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT); |
| 373 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT); |
| 374 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT); |
| 375 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT); |
| 376 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT); |
| 377 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT); |
| 378 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT); |
| 379 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT); |
| 380 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT); |
| 381 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT); |
| 382 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT); |
| 383 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT); |
| 384 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT); |
| 385 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT); |
| 386 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT); |
| 387 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT); |
| 388 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT); |
| 389 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT); |
| 390 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT); |
| 391 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT); |
| 392 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT); |
| 393 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT); |
| 394 | // DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT); |
| 395 | } |
| 396 | instance_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT].clear(); |
| 397 | |
| 398 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 399 | pInstanceTable->DestroyInstance(instance, pAllocator); |
| 400 | |
| 401 | // Disable and cleanup the temporary callback(s): |
| 402 | if (callback_setup) { |
| 403 | layer_disable_tmp_callbacks(instance_data->report_data, instance_data->num_tmp_callbacks, instance_data->tmp_callbacks); |
| 404 | } |
| 405 | if (instance_data->num_tmp_callbacks > 0) { |
| 406 | layer_free_tmp_callbacks(instance_data->tmp_dbg_create_infos, instance_data->tmp_callbacks); |
| 407 | instance_data->num_tmp_callbacks = 0; |
| 408 | } |
| 409 | |
| 410 | // Clean up logging callback, if any |
| 411 | while (instance_data->logging_callback.size() > 0) { |
| 412 | VkDebugReportCallbackEXT callback = instance_data->logging_callback.back(); |
| 413 | layer_destroy_msg_callback(instance_data->report_data, callback, pAllocator); |
| 414 | instance_data->logging_callback.pop_back(); |
| 415 | } |
| 416 | |
| 417 | layer_debug_report_destroy_instance(instance_data->report_data); |
| 418 | layer_data_map.erase(key); |
| 419 | |
| 420 | instanceExtMap.erase(pInstanceTable); |
| 421 | lock.unlock(); |
| 422 | ot_instance_table_map.erase(key); |
| 423 | } |
| 424 | |
| 425 | VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { |
| 426 | |
| 427 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 428 | ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 429 | DestroyObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 430 | |
| 431 | // Report any remaining objects associated with this VkDevice object in LL |
| 432 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT); |
| 433 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT); |
| 434 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT); |
| 435 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT); |
| 436 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT); |
| 437 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT); |
| 438 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT); |
| 439 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT); |
| 440 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT); |
| 441 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT); |
| 442 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT); |
| 443 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT); |
| 444 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT); |
| 445 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT); |
| 446 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT); |
| 447 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT); |
| 448 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT); |
| 449 | // DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT); |
| 450 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT); |
| 451 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT); |
| 452 | // DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT); |
| 453 | DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT); |
| 454 | // DeviceReportUndestroyedObjects(device, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT); |
| 455 | |
| 456 | // Clean up Queue's MemRef Linked Lists |
| 457 | DestroyQueueDataStructures(device); |
| 458 | |
| 459 | lock.unlock(); |
| 460 | |
| 461 | dispatch_key key = get_dispatch_key(device); |
| 462 | VkLayerDispatchTable *pDisp = get_dispatch_table(ot_device_table_map, device); |
| 463 | pDisp->DestroyDevice(device, pAllocator); |
| 464 | ot_device_table_map.erase(key); |
| 465 | } |
| 466 | |
| 467 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { |
| 468 | bool skip_call = false; |
| 469 | { |
| 470 | std::lock_guard<std::mutex> lock(global_lock); |
| 471 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 472 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 473 | } |
| 474 | if (skip_call) { |
| 475 | return; |
| 476 | } |
| 477 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceFeatures(physicalDevice, pFeatures); |
| 478 | } |
| 479 | |
| 480 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 481 | VkFormatProperties *pFormatProperties) { |
| 482 | bool skip_call = false; |
| 483 | { |
| 484 | std::lock_guard<std::mutex> lock(global_lock); |
| 485 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 486 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 487 | } |
| 488 | if (skip_call) { |
| 489 | return; |
| 490 | } |
| 491 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 492 | ->GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); |
| 493 | } |
| 494 | |
| 495 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 496 | VkImageType type, VkImageTiling tiling, |
| 497 | VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 498 | VkImageFormatProperties *pImageFormatProperties) { |
| 499 | bool skip_call = false; |
| 500 | { |
| 501 | std::lock_guard<std::mutex> lock(global_lock); |
| 502 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 503 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 504 | } |
| 505 | if (skip_call) { |
| 506 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 507 | } |
| 508 | VkResult result = |
| 509 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 510 | ->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties); |
| 511 | return result; |
| 512 | } |
| 513 | |
| 514 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { |
| 515 | bool skip_call = false; |
| 516 | { |
| 517 | std::lock_guard<std::mutex> lock(global_lock); |
| 518 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 519 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 520 | } |
| 521 | if (skip_call) { |
| 522 | return; |
| 523 | } |
| 524 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceProperties(physicalDevice, pProperties); |
| 525 | } |
| 526 | |
| 527 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, |
| 528 | VkPhysicalDeviceMemoryProperties *pMemoryProperties) { |
| 529 | bool skip_call = false; |
| 530 | { |
| 531 | std::lock_guard<std::mutex> lock(global_lock); |
| 532 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 533 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 534 | } |
| 535 | if (skip_call) { |
| 536 | return; |
| 537 | } |
| 538 | get_dispatch_table(ot_instance_table_map, physicalDevice)->GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); |
| 539 | } |
| 540 | |
| 541 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *pName); |
| 542 | |
| 543 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *pName); |
| 544 | |
| 545 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, |
| 546 | VkExtensionProperties *pProperties); |
| 547 | |
| 548 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties); |
| 549 | |
| 550 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, |
| 551 | VkLayerProperties *pProperties); |
| 552 | |
| 553 | VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) { |
| 554 | bool skip_call = false; |
| 555 | { |
| 556 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 557 | skip_call |= ValidateObject(queue, fence, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, true); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 558 | if (pSubmits) { |
| 559 | for (uint32_t idx0 = 0; idx0 < submitCount; ++idx0) { |
| 560 | if (pSubmits[idx0].pCommandBuffers) { |
| 561 | for (uint32_t idx1 = 0; idx1 < pSubmits[idx0].commandBufferCount; ++idx1) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 562 | skip_call |= ValidateObject(queue, pSubmits[idx0].pCommandBuffers[idx1], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 563 | VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 564 | } |
| 565 | } |
| 566 | if (pSubmits[idx0].pSignalSemaphores) { |
| 567 | for (uint32_t idx2 = 0; idx2 < pSubmits[idx0].signalSemaphoreCount; ++idx2) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 568 | skip_call |= ValidateObject(queue, pSubmits[idx0].pSignalSemaphores[idx2], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 569 | VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, false); |
| 570 | } |
| 571 | } |
| 572 | if (pSubmits[idx0].pWaitSemaphores) { |
| 573 | for (uint32_t idx3 = 0; idx3 < pSubmits[idx0].waitSemaphoreCount; ++idx3) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 574 | skip_call |= ValidateObject(queue, pSubmits[idx0].pWaitSemaphores[idx3], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 575 | VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, false); |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | } |
| 580 | if (queue) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 581 | skip_call |= ValidateObject(queue, queue, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 582 | } |
| 583 | } |
| 584 | if (skip_call) { |
| 585 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 586 | } |
| 587 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueueSubmit(queue, submitCount, pSubmits, fence); |
| 588 | return result; |
| 589 | } |
| 590 | |
| 591 | VKAPI_ATTR VkResult VKAPI_CALL QueueWaitIdle(VkQueue queue) { |
| 592 | bool skip_call = false; |
| 593 | { |
| 594 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 595 | skip_call |= ValidateObject(queue, queue, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 596 | } |
| 597 | if (skip_call) { |
| 598 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 599 | } |
| 600 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueueWaitIdle(queue); |
| 601 | return result; |
| 602 | } |
| 603 | |
| 604 | VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(VkDevice device) { |
| 605 | bool skip_call = false; |
| 606 | { |
| 607 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 608 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 609 | } |
| 610 | if (skip_call) { |
| 611 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 612 | } |
| 613 | VkResult result = get_dispatch_table(ot_device_table_map, device)->DeviceWaitIdle(device); |
| 614 | return result; |
| 615 | } |
| 616 | |
| 617 | VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, |
| 618 | const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { |
| 619 | bool skip_call = false; |
| 620 | { |
| 621 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 622 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 623 | } |
| 624 | if (skip_call) { |
| 625 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 626 | } |
| 627 | VkResult result = get_dispatch_table(ot_device_table_map, device)->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); |
| 628 | { |
| 629 | std::lock_guard<std::mutex> lock(global_lock); |
| 630 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 631 | CreateObject(device, *pMemory, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 632 | } |
| 633 | } |
| 634 | return result; |
| 635 | } |
| 636 | |
| 637 | VKAPI_ATTR VkResult VKAPI_CALL FlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 638 | const VkMappedMemoryRange *pMemoryRanges) { |
| 639 | bool skip_call = false; |
| 640 | { |
| 641 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 642 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 643 | if (pMemoryRanges) { |
| 644 | for (uint32_t idx0 = 0; idx0 < memoryRangeCount; ++idx0) { |
| 645 | if (pMemoryRanges[idx0].memory) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 646 | skip_call |= ValidateObject(device, pMemoryRanges[idx0].memory, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 647 | VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, false); |
| 648 | } |
| 649 | } |
| 650 | } |
| 651 | } |
| 652 | if (skip_call) { |
| 653 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 654 | } |
| 655 | VkResult result = |
| 656 | get_dispatch_table(ot_device_table_map, device)->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 657 | return result; |
| 658 | } |
| 659 | |
| 660 | VKAPI_ATTR VkResult VKAPI_CALL InvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, |
| 661 | const VkMappedMemoryRange *pMemoryRanges) { |
| 662 | bool skip_call = false; |
| 663 | { |
| 664 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 665 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 666 | if (pMemoryRanges) { |
| 667 | for (uint32_t idx0 = 0; idx0 < memoryRangeCount; ++idx0) { |
| 668 | if (pMemoryRanges[idx0].memory) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 669 | skip_call |= ValidateObject(device, pMemoryRanges[idx0].memory, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 670 | VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, false); |
| 671 | } |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | if (skip_call) { |
| 676 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 677 | } |
| 678 | VkResult result = |
| 679 | get_dispatch_table(ot_device_table_map, device)->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); |
| 680 | return result; |
| 681 | } |
| 682 | |
| 683 | VKAPI_ATTR void VKAPI_CALL GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, |
| 684 | VkDeviceSize *pCommittedMemoryInBytes) { |
| 685 | bool skip_call = false; |
| 686 | { |
| 687 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 688 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 689 | skip_call |= ValidateObject(device, memory, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 690 | } |
| 691 | if (skip_call) { |
| 692 | return; |
| 693 | } |
| 694 | get_dispatch_table(ot_device_table_map, device)->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); |
| 695 | } |
| 696 | |
| 697 | VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, |
| 698 | VkDeviceSize memoryOffset) { |
| 699 | bool skip_call = false; |
| 700 | { |
| 701 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 702 | skip_call |= ValidateObject(device, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 703 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 704 | skip_call |= ValidateObject(device, memory, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 705 | } |
| 706 | if (skip_call) { |
| 707 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 708 | } |
| 709 | VkResult result = get_dispatch_table(ot_device_table_map, device)->BindBufferMemory(device, buffer, memory, memoryOffset); |
| 710 | return result; |
| 711 | } |
| 712 | |
| 713 | VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) { |
| 714 | bool skip_call = false; |
| 715 | { |
| 716 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 717 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 718 | skip_call |= ValidateObject(device, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
| 719 | skip_call |= ValidateObject(device, memory, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 720 | } |
| 721 | if (skip_call) { |
| 722 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 723 | } |
| 724 | VkResult result = get_dispatch_table(ot_device_table_map, device)->BindImageMemory(device, image, memory, memoryOffset); |
| 725 | return result; |
| 726 | } |
| 727 | |
| 728 | VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, |
| 729 | VkMemoryRequirements *pMemoryRequirements) { |
| 730 | bool skip_call = false; |
| 731 | { |
| 732 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 733 | skip_call |= ValidateObject(device, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 734 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 735 | } |
| 736 | if (skip_call) { |
| 737 | return; |
| 738 | } |
| 739 | get_dispatch_table(ot_device_table_map, device)->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); |
| 740 | } |
| 741 | |
| 742 | VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) { |
| 743 | bool skip_call = false; |
| 744 | { |
| 745 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 746 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 747 | skip_call |= ValidateObject(device, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 748 | } |
| 749 | if (skip_call) { |
| 750 | return; |
| 751 | } |
| 752 | get_dispatch_table(ot_device_table_map, device)->GetImageMemoryRequirements(device, image, pMemoryRequirements); |
| 753 | } |
| 754 | |
| 755 | VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, |
| 756 | VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { |
| 757 | bool skip_call = false; |
| 758 | { |
| 759 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 760 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 761 | skip_call |= ValidateObject(device, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 762 | } |
| 763 | if (skip_call) { |
| 764 | return; |
| 765 | } |
| 766 | get_dispatch_table(ot_device_table_map, device) |
| 767 | ->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 768 | } |
| 769 | |
| 770 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, |
| 771 | VkImageType type, VkSampleCountFlagBits samples, |
| 772 | VkImageUsageFlags usage, VkImageTiling tiling, |
| 773 | uint32_t *pPropertyCount, |
| 774 | VkSparseImageFormatProperties *pProperties) { |
| 775 | bool skip_call = false; |
| 776 | { |
| 777 | std::lock_guard<std::mutex> lock(global_lock); |
| 778 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 779 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 780 | } |
| 781 | if (skip_call) { |
| 782 | return; |
| 783 | } |
| 784 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 785 | ->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, |
| 786 | pProperties); |
| 787 | } |
| 788 | |
| 789 | VKAPI_ATTR VkResult VKAPI_CALL CreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, |
| 790 | const VkAllocationCallbacks *pAllocator, VkFence *pFence) { |
| 791 | bool skip_call = false; |
| 792 | { |
| 793 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 794 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 795 | } |
| 796 | if (skip_call) { |
| 797 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 798 | } |
| 799 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateFence(device, pCreateInfo, pAllocator, pFence); |
| 800 | { |
| 801 | std::lock_guard<std::mutex> lock(global_lock); |
| 802 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 803 | CreateObject(device, *pFence, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 804 | } |
| 805 | } |
| 806 | return result; |
| 807 | } |
| 808 | |
| 809 | VKAPI_ATTR void VKAPI_CALL DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { |
| 810 | bool skip_call = false; |
| 811 | { |
| 812 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 813 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 814 | skip_call |= ValidateObject(device, fence, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 815 | } |
| 816 | if (skip_call) { |
| 817 | return; |
| 818 | } |
| 819 | { |
| 820 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 821 | DestroyObject(device, fence, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 822 | } |
| 823 | get_dispatch_table(ot_device_table_map, device)->DestroyFence(device, fence, pAllocator); |
| 824 | } |
| 825 | |
| 826 | VKAPI_ATTR VkResult VKAPI_CALL ResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { |
| 827 | bool skip_call = false; |
| 828 | { |
| 829 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 830 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 831 | if (pFences) { |
| 832 | for (uint32_t idx0 = 0; idx0 < fenceCount; ++idx0) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 833 | skip_call |= ValidateObject(device, pFences[idx0], VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 834 | } |
| 835 | } |
| 836 | } |
| 837 | if (skip_call) { |
| 838 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 839 | } |
| 840 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetFences(device, fenceCount, pFences); |
| 841 | return result; |
| 842 | } |
| 843 | |
| 844 | VKAPI_ATTR VkResult VKAPI_CALL GetFenceStatus(VkDevice device, VkFence fence) { |
| 845 | bool skip_call = false; |
| 846 | { |
| 847 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 848 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 849 | skip_call |= ValidateObject(device, fence, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 850 | } |
| 851 | if (skip_call) { |
| 852 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 853 | } |
| 854 | VkResult result = get_dispatch_table(ot_device_table_map, device)->GetFenceStatus(device, fence); |
| 855 | return result; |
| 856 | } |
| 857 | |
| 858 | VKAPI_ATTR VkResult VKAPI_CALL WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, |
| 859 | uint64_t timeout) { |
| 860 | bool skip_call = false; |
| 861 | { |
| 862 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 863 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 864 | if (pFences) { |
| 865 | for (uint32_t idx0 = 0; idx0 < fenceCount; ++idx0) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 866 | skip_call |= ValidateObject(device, pFences[idx0], VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 867 | } |
| 868 | } |
| 869 | } |
| 870 | if (skip_call) { |
| 871 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 872 | } |
| 873 | VkResult result = get_dispatch_table(ot_device_table_map, device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout); |
| 874 | return result; |
| 875 | } |
| 876 | |
| 877 | VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, |
| 878 | const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { |
| 879 | bool skip_call = false; |
| 880 | { |
| 881 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 882 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 883 | } |
| 884 | if (skip_call) { |
| 885 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 886 | } |
| 887 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); |
| 888 | { |
| 889 | std::lock_guard<std::mutex> lock(global_lock); |
| 890 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 891 | CreateObject(device, *pSemaphore, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 892 | } |
| 893 | } |
| 894 | return result; |
| 895 | } |
| 896 | |
| 897 | VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { |
| 898 | bool skip_call = false; |
| 899 | { |
| 900 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 901 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 902 | skip_call |= ValidateObject(device, semaphore, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 903 | } |
| 904 | if (skip_call) { |
| 905 | return; |
| 906 | } |
| 907 | { |
| 908 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 909 | DestroyObject(device, semaphore, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 910 | } |
| 911 | get_dispatch_table(ot_device_table_map, device)->DestroySemaphore(device, semaphore, pAllocator); |
| 912 | } |
| 913 | |
| 914 | VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, |
| 915 | const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { |
| 916 | bool skip_call = false; |
| 917 | { |
| 918 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 919 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 920 | } |
| 921 | if (skip_call) { |
| 922 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 923 | } |
| 924 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateEvent(device, pCreateInfo, pAllocator, pEvent); |
| 925 | { |
| 926 | std::lock_guard<std::mutex> lock(global_lock); |
| 927 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 928 | CreateObject(device, *pEvent, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 929 | } |
| 930 | } |
| 931 | return result; |
| 932 | } |
| 933 | |
| 934 | VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { |
| 935 | bool skip_call = false; |
| 936 | { |
| 937 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 938 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 939 | skip_call |= ValidateObject(device, event, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 940 | } |
| 941 | if (skip_call) { |
| 942 | return; |
| 943 | } |
| 944 | { |
| 945 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 946 | DestroyObject(device, event, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 947 | } |
| 948 | get_dispatch_table(ot_device_table_map, device)->DestroyEvent(device, event, pAllocator); |
| 949 | } |
| 950 | |
| 951 | VKAPI_ATTR VkResult VKAPI_CALL GetEventStatus(VkDevice device, VkEvent event) { |
| 952 | bool skip_call = false; |
| 953 | { |
| 954 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 955 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 956 | skip_call |= ValidateObject(device, event, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 957 | } |
| 958 | if (skip_call) { |
| 959 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 960 | } |
| 961 | VkResult result = get_dispatch_table(ot_device_table_map, device)->GetEventStatus(device, event); |
| 962 | return result; |
| 963 | } |
| 964 | |
| 965 | VKAPI_ATTR VkResult VKAPI_CALL SetEvent(VkDevice device, VkEvent event) { |
| 966 | bool skip_call = false; |
| 967 | { |
| 968 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 969 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 970 | skip_call |= ValidateObject(device, event, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 971 | } |
| 972 | if (skip_call) { |
| 973 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 974 | } |
| 975 | VkResult result = get_dispatch_table(ot_device_table_map, device)->SetEvent(device, event); |
| 976 | return result; |
| 977 | } |
| 978 | |
| 979 | VKAPI_ATTR VkResult VKAPI_CALL ResetEvent(VkDevice device, VkEvent event) { |
| 980 | bool skip_call = false; |
| 981 | { |
| 982 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 983 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 984 | skip_call |= ValidateObject(device, event, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 985 | } |
| 986 | if (skip_call) { |
| 987 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 988 | } |
| 989 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetEvent(device, event); |
| 990 | return result; |
| 991 | } |
| 992 | |
| 993 | VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, |
| 994 | const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { |
| 995 | bool skip_call = false; |
| 996 | { |
| 997 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 998 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 999 | } |
| 1000 | if (skip_call) { |
| 1001 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1002 | } |
| 1003 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); |
| 1004 | { |
| 1005 | std::lock_guard<std::mutex> lock(global_lock); |
| 1006 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1007 | CreateObject(device, *pQueryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1008 | } |
| 1009 | } |
| 1010 | return result; |
| 1011 | } |
| 1012 | |
| 1013 | VKAPI_ATTR void VKAPI_CALL DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { |
| 1014 | bool skip_call = false; |
| 1015 | { |
| 1016 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1017 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1018 | skip_call |= ValidateObject(device, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1019 | } |
| 1020 | if (skip_call) { |
| 1021 | return; |
| 1022 | } |
| 1023 | { |
| 1024 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1025 | DestroyObject(device, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1026 | } |
| 1027 | get_dispatch_table(ot_device_table_map, device)->DestroyQueryPool(device, queryPool, pAllocator); |
| 1028 | } |
| 1029 | |
| 1030 | VKAPI_ATTR VkResult VKAPI_CALL GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, |
| 1031 | size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) { |
| 1032 | bool skip_call = false; |
| 1033 | { |
| 1034 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1035 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1036 | skip_call |= ValidateObject(device, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1037 | } |
| 1038 | if (skip_call) { |
| 1039 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1040 | } |
| 1041 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 1042 | ->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); |
| 1043 | return result; |
| 1044 | } |
| 1045 | |
| 1046 | VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, |
| 1047 | const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { |
| 1048 | bool skip_call = false; |
| 1049 | { |
| 1050 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1051 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1052 | } |
| 1053 | if (skip_call) { |
| 1054 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1055 | } |
| 1056 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); |
| 1057 | { |
| 1058 | std::lock_guard<std::mutex> lock(global_lock); |
| 1059 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1060 | CreateObject(device, *pBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1061 | } |
| 1062 | } |
| 1063 | return result; |
| 1064 | } |
| 1065 | |
| 1066 | VKAPI_ATTR void VKAPI_CALL DestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) { |
| 1067 | bool skip_call = false; |
| 1068 | { |
| 1069 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1070 | skip_call |= ValidateObject(device, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 1071 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1072 | } |
| 1073 | if (skip_call) { |
| 1074 | return; |
| 1075 | } |
| 1076 | { |
| 1077 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1078 | DestroyObject(device, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1079 | } |
| 1080 | get_dispatch_table(ot_device_table_map, device)->DestroyBuffer(device, buffer, pAllocator); |
| 1081 | } |
| 1082 | |
| 1083 | VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, |
| 1084 | const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { |
| 1085 | bool skip_call = false; |
| 1086 | { |
| 1087 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1088 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1089 | if (pCreateInfo) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1090 | skip_call |= ValidateObject(device, pCreateInfo->buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1091 | } |
| 1092 | } |
| 1093 | if (skip_call) { |
| 1094 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1095 | } |
| 1096 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateBufferView(device, pCreateInfo, pAllocator, pView); |
| 1097 | { |
| 1098 | std::lock_guard<std::mutex> lock(global_lock); |
| 1099 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1100 | CreateObject(device, *pView, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1101 | } |
| 1102 | } |
| 1103 | return result; |
| 1104 | } |
| 1105 | |
| 1106 | VKAPI_ATTR void VKAPI_CALL DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) { |
| 1107 | bool skip_call = false; |
| 1108 | { |
| 1109 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1110 | skip_call |= ValidateObject(device, bufferView, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT, false); |
| 1111 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1112 | } |
| 1113 | if (skip_call) { |
| 1114 | return; |
| 1115 | } |
| 1116 | { |
| 1117 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1118 | DestroyObject(device, bufferView, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1119 | } |
| 1120 | get_dispatch_table(ot_device_table_map, device)->DestroyBufferView(device, bufferView, pAllocator); |
| 1121 | } |
| 1122 | |
| 1123 | VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, |
| 1124 | const VkAllocationCallbacks *pAllocator, VkImage *pImage) { |
| 1125 | bool skip_call = false; |
| 1126 | { |
| 1127 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1128 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1129 | } |
| 1130 | if (skip_call) { |
| 1131 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1132 | } |
| 1133 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateImage(device, pCreateInfo, pAllocator, pImage); |
| 1134 | { |
| 1135 | std::lock_guard<std::mutex> lock(global_lock); |
| 1136 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1137 | CreateObject(device, *pImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1138 | } |
| 1139 | } |
| 1140 | return result; |
| 1141 | } |
| 1142 | |
| 1143 | VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { |
| 1144 | bool skip_call = false; |
| 1145 | { |
| 1146 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1147 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1148 | skip_call |= ValidateObject(device, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1149 | } |
| 1150 | if (skip_call) { |
| 1151 | return; |
| 1152 | } |
| 1153 | { |
| 1154 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1155 | DestroyObject(device, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1156 | } |
| 1157 | get_dispatch_table(ot_device_table_map, device)->DestroyImage(device, image, pAllocator); |
| 1158 | } |
| 1159 | |
| 1160 | VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, |
| 1161 | VkSubresourceLayout *pLayout) { |
| 1162 | bool skip_call = false; |
| 1163 | { |
| 1164 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1165 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1166 | skip_call |= ValidateObject(device, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1167 | } |
| 1168 | if (skip_call) { |
| 1169 | return; |
| 1170 | } |
| 1171 | get_dispatch_table(ot_device_table_map, device)->GetImageSubresourceLayout(device, image, pSubresource, pLayout); |
| 1172 | } |
| 1173 | |
| 1174 | VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, |
| 1175 | const VkAllocationCallbacks *pAllocator, VkImageView *pView) { |
| 1176 | bool skip_call = false; |
| 1177 | { |
| 1178 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1179 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1180 | if (pCreateInfo) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1181 | skip_call |= ValidateObject(device, pCreateInfo->image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1182 | } |
| 1183 | } |
| 1184 | if (skip_call) { |
| 1185 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1186 | } |
| 1187 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateImageView(device, pCreateInfo, pAllocator, pView); |
| 1188 | { |
| 1189 | std::lock_guard<std::mutex> lock(global_lock); |
| 1190 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1191 | CreateObject(device, *pView, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1192 | } |
| 1193 | } |
| 1194 | return result; |
| 1195 | } |
| 1196 | |
| 1197 | VKAPI_ATTR void VKAPI_CALL DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { |
| 1198 | bool skip_call = false; |
| 1199 | { |
| 1200 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1201 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1202 | skip_call |= ValidateObject(device, imageView, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1203 | } |
| 1204 | if (skip_call) { |
| 1205 | return; |
| 1206 | } |
| 1207 | { |
| 1208 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1209 | DestroyObject(device, imageView, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1210 | } |
| 1211 | get_dispatch_table(ot_device_table_map, device)->DestroyImageView(device, imageView, pAllocator); |
| 1212 | } |
| 1213 | |
| 1214 | VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, |
| 1215 | const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) { |
| 1216 | bool skip_call = false; |
| 1217 | { |
| 1218 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1219 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1220 | } |
| 1221 | if (skip_call) { |
| 1222 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1223 | } |
| 1224 | VkResult result = |
| 1225 | get_dispatch_table(ot_device_table_map, device)->CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); |
| 1226 | { |
| 1227 | std::lock_guard<std::mutex> lock(global_lock); |
| 1228 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1229 | CreateObject(device, *pShaderModule, VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1230 | } |
| 1231 | } |
| 1232 | return result; |
| 1233 | } |
| 1234 | |
| 1235 | VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, |
| 1236 | const VkAllocationCallbacks *pAllocator) { |
| 1237 | bool skip_call = false; |
| 1238 | { |
| 1239 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1240 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1241 | skip_call |= ValidateObject(device, shaderModule, VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1242 | } |
| 1243 | if (skip_call) { |
| 1244 | return; |
| 1245 | } |
| 1246 | { |
| 1247 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1248 | DestroyObject(device, shaderModule, VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1249 | } |
| 1250 | get_dispatch_table(ot_device_table_map, device)->DestroyShaderModule(device, shaderModule, pAllocator); |
| 1251 | } |
| 1252 | |
| 1253 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, |
| 1254 | const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) { |
| 1255 | bool skip_call = false; |
| 1256 | { |
| 1257 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1258 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1259 | } |
| 1260 | if (skip_call) { |
| 1261 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1262 | } |
| 1263 | VkResult result = |
| 1264 | get_dispatch_table(ot_device_table_map, device)->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); |
| 1265 | { |
| 1266 | std::lock_guard<std::mutex> lock(global_lock); |
| 1267 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1268 | CreateObject(device, *pPipelineCache, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1269 | } |
| 1270 | } |
| 1271 | return result; |
| 1272 | } |
| 1273 | |
| 1274 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, |
| 1275 | const VkAllocationCallbacks *pAllocator) { |
| 1276 | bool skip_call = false; |
| 1277 | { |
| 1278 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1279 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1280 | skip_call |= ValidateObject(device, pipelineCache, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1281 | } |
| 1282 | if (skip_call) { |
| 1283 | return; |
| 1284 | } |
| 1285 | { |
| 1286 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1287 | DestroyObject(device, pipelineCache, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1288 | } |
| 1289 | get_dispatch_table(ot_device_table_map, device)->DestroyPipelineCache(device, pipelineCache, pAllocator); |
| 1290 | } |
| 1291 | |
| 1292 | VKAPI_ATTR VkResult VKAPI_CALL GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, |
| 1293 | void *pData) { |
| 1294 | bool skip_call = false; |
| 1295 | { |
| 1296 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1297 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1298 | skip_call |= ValidateObject(device, pipelineCache, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1299 | } |
| 1300 | if (skip_call) { |
| 1301 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1302 | } |
| 1303 | VkResult result = |
| 1304 | get_dispatch_table(ot_device_table_map, device)->GetPipelineCacheData(device, pipelineCache, pDataSize, pData); |
| 1305 | return result; |
| 1306 | } |
| 1307 | |
| 1308 | VKAPI_ATTR VkResult VKAPI_CALL MergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, |
| 1309 | const VkPipelineCache *pSrcCaches) { |
| 1310 | bool skip_call = false; |
| 1311 | { |
| 1312 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1313 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1314 | skip_call |= ValidateObject(device, dstCache, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1315 | if (pSrcCaches) { |
| 1316 | for (uint32_t idx0 = 0; idx0 < srcCacheCount; ++idx0) { |
| 1317 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1318 | ValidateObject(device, pSrcCaches[idx0], VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1319 | } |
| 1320 | } |
| 1321 | } |
| 1322 | if (skip_call) { |
| 1323 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1324 | } |
| 1325 | VkResult result = |
| 1326 | get_dispatch_table(ot_device_table_map, device)->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); |
| 1327 | return result; |
| 1328 | } |
| 1329 | |
| 1330 | VKAPI_ATTR void VKAPI_CALL DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { |
| 1331 | bool skip_call = false; |
| 1332 | { |
| 1333 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1334 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1335 | skip_call |= ValidateObject(device, pipeline, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1336 | } |
| 1337 | if (skip_call) { |
| 1338 | return; |
| 1339 | } |
| 1340 | { |
| 1341 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1342 | DestroyObject(device, pipeline, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1343 | } |
| 1344 | get_dispatch_table(ot_device_table_map, device)->DestroyPipeline(device, pipeline, pAllocator); |
| 1345 | } |
| 1346 | |
| 1347 | VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, |
| 1348 | const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) { |
| 1349 | bool skip_call = false; |
| 1350 | { |
| 1351 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1352 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1353 | if (pCreateInfo) { |
| 1354 | if (pCreateInfo->pSetLayouts) { |
| 1355 | for (uint32_t idx0 = 0; idx0 < pCreateInfo->setLayoutCount; ++idx0) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1356 | skip_call |= ValidateObject(device, pCreateInfo->pSetLayouts[idx0], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1357 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT, false); |
| 1358 | } |
| 1359 | } |
| 1360 | } |
| 1361 | } |
| 1362 | if (skip_call) { |
| 1363 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1364 | } |
| 1365 | VkResult result = |
| 1366 | get_dispatch_table(ot_device_table_map, device)->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); |
| 1367 | { |
| 1368 | std::lock_guard<std::mutex> lock(global_lock); |
| 1369 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1370 | CreateObject(device, *pPipelineLayout, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1371 | } |
| 1372 | } |
| 1373 | return result; |
| 1374 | } |
| 1375 | |
| 1376 | VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, |
| 1377 | const VkAllocationCallbacks *pAllocator) { |
| 1378 | bool skip_call = false; |
| 1379 | { |
| 1380 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1381 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1382 | skip_call |= ValidateObject(device, pipelineLayout, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1383 | } |
| 1384 | if (skip_call) { |
| 1385 | return; |
| 1386 | } |
| 1387 | { |
| 1388 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1389 | DestroyObject(device, pipelineLayout, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1390 | } |
| 1391 | get_dispatch_table(ot_device_table_map, device)->DestroyPipelineLayout(device, pipelineLayout, pAllocator); |
| 1392 | } |
| 1393 | |
| 1394 | VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, |
| 1395 | const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { |
| 1396 | bool skip_call = false; |
| 1397 | { |
| 1398 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1399 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1400 | } |
| 1401 | if (skip_call) { |
| 1402 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1403 | } |
| 1404 | VkResult result = get_dispatch_table(ot_device_table_map, device)->CreateSampler(device, pCreateInfo, pAllocator, pSampler); |
| 1405 | { |
| 1406 | std::lock_guard<std::mutex> lock(global_lock); |
| 1407 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1408 | CreateObject(device, *pSampler, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1409 | } |
| 1410 | } |
| 1411 | return result; |
| 1412 | } |
| 1413 | |
| 1414 | VKAPI_ATTR void VKAPI_CALL DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { |
| 1415 | bool skip_call = false; |
| 1416 | { |
| 1417 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1418 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1419 | skip_call |= ValidateObject(device, sampler, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1420 | } |
| 1421 | if (skip_call) { |
| 1422 | return; |
| 1423 | } |
| 1424 | { |
| 1425 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1426 | DestroyObject(device, sampler, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1427 | } |
| 1428 | get_dispatch_table(ot_device_table_map, device)->DestroySampler(device, sampler, pAllocator); |
| 1429 | } |
| 1430 | |
| 1431 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, |
| 1432 | const VkAllocationCallbacks *pAllocator, |
| 1433 | VkDescriptorSetLayout *pSetLayout) { |
| 1434 | bool skip_call = false; |
| 1435 | { |
| 1436 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1437 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1438 | if (pCreateInfo) { |
| 1439 | if (pCreateInfo->pBindings) { |
| 1440 | for (uint32_t idx0 = 0; idx0 < pCreateInfo->bindingCount; ++idx0) { |
| 1441 | if (pCreateInfo->pBindings[idx0].pImmutableSamplers) { |
| 1442 | for (uint32_t idx1 = 0; idx1 < pCreateInfo->pBindings[idx0].descriptorCount; ++idx1) { |
| 1443 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1444 | ValidateObject(device, pCreateInfo->pBindings[idx0].pImmutableSamplers[idx1], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1445 | VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT, false); |
| 1446 | } |
| 1447 | } |
| 1448 | } |
| 1449 | } |
| 1450 | } |
| 1451 | } |
| 1452 | if (skip_call) { |
| 1453 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1454 | } |
| 1455 | VkResult result = |
| 1456 | get_dispatch_table(ot_device_table_map, device)->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); |
| 1457 | { |
| 1458 | std::lock_guard<std::mutex> lock(global_lock); |
| 1459 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1460 | CreateObject(device, *pSetLayout, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1461 | } |
| 1462 | } |
| 1463 | return result; |
| 1464 | } |
| 1465 | |
| 1466 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, |
| 1467 | const VkAllocationCallbacks *pAllocator) { |
| 1468 | bool skip_call = false; |
| 1469 | { |
| 1470 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1471 | skip_call |= ValidateObject(device, descriptorSetLayout, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1472 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT, false); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1473 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1474 | } |
| 1475 | if (skip_call) { |
| 1476 | return; |
| 1477 | } |
| 1478 | { |
| 1479 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1480 | DestroyObject(device, descriptorSetLayout, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1481 | } |
| 1482 | get_dispatch_table(ot_device_table_map, device)->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); |
| 1483 | } |
| 1484 | |
| 1485 | VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, |
| 1486 | const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) { |
| 1487 | bool skip_call = false; |
| 1488 | { |
| 1489 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1490 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1491 | } |
| 1492 | if (skip_call) { |
| 1493 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1494 | } |
| 1495 | VkResult result = |
| 1496 | get_dispatch_table(ot_device_table_map, device)->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); |
| 1497 | { |
| 1498 | std::lock_guard<std::mutex> lock(global_lock); |
| 1499 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1500 | CreateObject(device, *pDescriptorPool, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1501 | } |
| 1502 | } |
| 1503 | return result; |
| 1504 | } |
| 1505 | |
| 1506 | VKAPI_ATTR VkResult VKAPI_CALL ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 1507 | VkDescriptorPoolResetFlags flags) { |
| 1508 | bool skip_call = false; |
Chris Forbes | 2a947ce | 2016-09-29 18:47:50 +1300 | [diff] [blame] | 1509 | std::unique_lock<std::mutex> lock(global_lock); |
| 1510 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 1511 | skip_call |= ValidateObject(device, descriptorPool, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, false); |
| 1512 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1513 | if (skip_call) { |
| 1514 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1515 | } |
Chris Forbes | 2a947ce | 2016-09-29 18:47:50 +1300 | [diff] [blame] | 1516 | // A DescriptorPool's descriptor sets are implicitly deleted when the pool is reset. |
| 1517 | // Remove this pool's descriptor sets from our descriptorSet map. |
| 1518 | auto itr = device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT].begin(); |
| 1519 | while (itr != device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT].end()) { |
| 1520 | OBJTRACK_NODE *pNode = (*itr).second; |
| 1521 | auto del_itr = itr++; |
| 1522 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(descriptorPool)) { |
| 1523 | DestroyObject(device, (VkDescriptorSet)((*del_itr).first), |
| 1524 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); |
| 1525 | } |
| 1526 | } |
| 1527 | lock.unlock(); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1528 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetDescriptorPool(device, descriptorPool, flags); |
| 1529 | return result; |
| 1530 | } |
| 1531 | |
| 1532 | VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, |
| 1533 | const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, |
| 1534 | const VkCopyDescriptorSet *pDescriptorCopies) { |
| 1535 | bool skip_call = false; |
| 1536 | { |
| 1537 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1538 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1539 | if (pDescriptorCopies) { |
| 1540 | for (uint32_t idx0 = 0; idx0 < descriptorCopyCount; ++idx0) { |
| 1541 | if (pDescriptorCopies[idx0].dstSet) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1542 | skip_call |= ValidateObject(device, pDescriptorCopies[idx0].dstSet, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1543 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); |
| 1544 | } |
| 1545 | if (pDescriptorCopies[idx0].srcSet) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1546 | skip_call |= ValidateObject(device, pDescriptorCopies[idx0].srcSet, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1547 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); |
| 1548 | } |
| 1549 | } |
| 1550 | } |
| 1551 | if (pDescriptorWrites) { |
| 1552 | for (uint32_t idx1 = 0; idx1 < descriptorWriteCount; ++idx1) { |
| 1553 | if (pDescriptorWrites[idx1].dstSet) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1554 | skip_call |= ValidateObject(device, pDescriptorWrites[idx1].dstSet, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1555 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); |
| 1556 | } |
| 1557 | if ((pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || |
| 1558 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || |
| 1559 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || |
| 1560 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { |
| 1561 | for (uint32_t idx2 = 0; idx2 < pDescriptorWrites[idx1].descriptorCount; ++idx2) { |
| 1562 | if (pDescriptorWrites[idx1].pBufferInfo[idx2].buffer) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1563 | skip_call |= ValidateObject(device, pDescriptorWrites[idx1].pBufferInfo[idx2].buffer, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1564 | VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 1565 | } |
| 1566 | } |
| 1567 | } |
| 1568 | if ((pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) || |
| 1569 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) || |
| 1570 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT) || |
| 1571 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) || |
| 1572 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)) { |
| 1573 | for (uint32_t idx3 = 0; idx3 < pDescriptorWrites[idx1].descriptorCount; ++idx3) { |
| 1574 | if (pDescriptorWrites[idx1].pImageInfo[idx3].imageView) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1575 | skip_call |= ValidateObject(device, pDescriptorWrites[idx1].pImageInfo[idx3].imageView, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1576 | VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT, false); |
| 1577 | } |
| 1578 | if (pDescriptorWrites[idx1].pImageInfo[idx3].sampler) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1579 | skip_call |= ValidateObject(device, pDescriptorWrites[idx1].pImageInfo[idx3].sampler, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1580 | VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT, false); |
| 1581 | } |
| 1582 | } |
| 1583 | } |
| 1584 | if ((pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) || |
| 1585 | (pDescriptorWrites[idx1].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) { |
| 1586 | for (uint32_t idx4 = 0; idx4 < pDescriptorWrites[idx1].descriptorCount; ++idx4) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1587 | skip_call |= ValidateObject(device, pDescriptorWrites[idx1].pTexelBufferView[idx4], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1588 | VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT, true); |
| 1589 | } |
| 1590 | } |
| 1591 | } |
| 1592 | } |
| 1593 | } |
| 1594 | if (skip_call) { |
| 1595 | return; |
| 1596 | } |
| 1597 | get_dispatch_table(ot_device_table_map, device) |
| 1598 | ->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
| 1599 | } |
| 1600 | |
| 1601 | VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, |
| 1602 | const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) { |
| 1603 | bool skip_call = false; |
| 1604 | { |
| 1605 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1606 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1607 | if (pCreateInfo) { |
| 1608 | if (pCreateInfo->pAttachments) { |
| 1609 | for (uint32_t idx0 = 0; idx0 < pCreateInfo->attachmentCount; ++idx0) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1610 | skip_call |= ValidateObject(device, pCreateInfo->pAttachments[idx0], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1611 | VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT, false); |
| 1612 | } |
| 1613 | } |
| 1614 | if (pCreateInfo->renderPass) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1615 | skip_call |= ValidateObject(device, pCreateInfo->renderPass, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1616 | VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, false); |
| 1617 | } |
| 1618 | } |
| 1619 | } |
| 1620 | if (skip_call) { |
| 1621 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1622 | } |
| 1623 | VkResult result = |
| 1624 | get_dispatch_table(ot_device_table_map, device)->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); |
| 1625 | { |
| 1626 | std::lock_guard<std::mutex> lock(global_lock); |
| 1627 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1628 | CreateObject(device, *pFramebuffer, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1629 | } |
| 1630 | } |
| 1631 | return result; |
| 1632 | } |
| 1633 | |
| 1634 | VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) { |
| 1635 | bool skip_call = false; |
| 1636 | { |
| 1637 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1638 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1639 | skip_call |= ValidateObject(device, framebuffer, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1640 | } |
| 1641 | if (skip_call) { |
| 1642 | return; |
| 1643 | } |
| 1644 | { |
| 1645 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1646 | DestroyObject(device, framebuffer, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1647 | } |
| 1648 | get_dispatch_table(ot_device_table_map, device)->DestroyFramebuffer(device, framebuffer, pAllocator); |
| 1649 | } |
| 1650 | |
| 1651 | VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, |
| 1652 | const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { |
| 1653 | bool skip_call = false; |
| 1654 | { |
| 1655 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1656 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1657 | } |
| 1658 | if (skip_call) { |
| 1659 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1660 | } |
| 1661 | VkResult result = |
| 1662 | get_dispatch_table(ot_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); |
| 1663 | { |
| 1664 | std::lock_guard<std::mutex> lock(global_lock); |
| 1665 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1666 | CreateObject(device, *pRenderPass, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1667 | } |
| 1668 | } |
| 1669 | return result; |
| 1670 | } |
| 1671 | |
| 1672 | VKAPI_ATTR void VKAPI_CALL DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { |
| 1673 | bool skip_call = false; |
| 1674 | { |
| 1675 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1676 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1677 | skip_call |= ValidateObject(device, renderPass, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1678 | } |
| 1679 | if (skip_call) { |
| 1680 | return; |
| 1681 | } |
| 1682 | { |
| 1683 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 1684 | DestroyObject(device, renderPass, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1685 | } |
| 1686 | get_dispatch_table(ot_device_table_map, device)->DestroyRenderPass(device, renderPass, pAllocator); |
| 1687 | } |
| 1688 | |
| 1689 | VKAPI_ATTR void VKAPI_CALL GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { |
| 1690 | bool skip_call = false; |
| 1691 | { |
| 1692 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1693 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 1694 | skip_call |= ValidateObject(device, renderPass, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1695 | } |
| 1696 | if (skip_call) { |
| 1697 | return; |
| 1698 | } |
| 1699 | get_dispatch_table(ot_device_table_map, device)->GetRenderAreaGranularity(device, renderPass, pGranularity); |
| 1700 | } |
| 1701 | |
| 1702 | VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, |
| 1703 | const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) { |
| 1704 | bool skip_call = false; |
| 1705 | { |
| 1706 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1707 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1708 | } |
| 1709 | if (skip_call) { |
| 1710 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1711 | } |
| 1712 | VkResult result = |
| 1713 | get_dispatch_table(ot_device_table_map, device)->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); |
| 1714 | { |
| 1715 | std::lock_guard<std::mutex> lock(global_lock); |
| 1716 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 1717 | CreateObject(device, *pCommandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1718 | } |
| 1719 | } |
| 1720 | return result; |
| 1721 | } |
| 1722 | |
| 1723 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { |
| 1724 | bool skip_call = false; |
| 1725 | { |
| 1726 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1727 | skip_call |= ValidateObject(device, commandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, false); |
| 1728 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1729 | } |
| 1730 | if (skip_call) { |
| 1731 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1732 | } |
| 1733 | VkResult result = get_dispatch_table(ot_device_table_map, device)->ResetCommandPool(device, commandPool, flags); |
| 1734 | return result; |
| 1735 | } |
| 1736 | |
| 1737 | VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer command_buffer, const VkCommandBufferBeginInfo *begin_info) { |
| 1738 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(command_buffer), layer_data_map); |
| 1739 | bool skip_call = false; |
| 1740 | { |
| 1741 | std::lock_guard<std::mutex> lock(global_lock); |
| 1742 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1743 | ValidateObject(command_buffer, command_buffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1744 | if (begin_info) { |
| 1745 | OBJTRACK_NODE *pNode = |
| 1746 | device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT][reinterpret_cast<const uint64_t>(command_buffer)]; |
| 1747 | if ((begin_info->pInheritanceInfo) && (pNode->status & OBJSTATUS_COMMAND_BUFFER_SECONDARY)) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1748 | skip_call |= ValidateObject(command_buffer, begin_info->pInheritanceInfo->framebuffer, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1749 | VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT, true); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1750 | skip_call |= ValidateObject(command_buffer, begin_info->pInheritanceInfo->renderPass, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1751 | VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, true); |
| 1752 | } |
| 1753 | } |
| 1754 | } |
| 1755 | if (skip_call) { |
| 1756 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1757 | } |
| 1758 | VkResult result = get_dispatch_table(ot_device_table_map, command_buffer)->BeginCommandBuffer(command_buffer, begin_info); |
| 1759 | return result; |
| 1760 | } |
| 1761 | |
| 1762 | VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) { |
| 1763 | bool skip_call = false; |
| 1764 | { |
| 1765 | std::lock_guard<std::mutex> lock(global_lock); |
| 1766 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1767 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1768 | } |
| 1769 | if (skip_call) { |
| 1770 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1771 | } |
| 1772 | VkResult result = get_dispatch_table(ot_device_table_map, commandBuffer)->EndCommandBuffer(commandBuffer); |
| 1773 | return result; |
| 1774 | } |
| 1775 | |
| 1776 | VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { |
| 1777 | bool skip_call = false; |
| 1778 | { |
| 1779 | std::lock_guard<std::mutex> lock(global_lock); |
| 1780 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1781 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1782 | } |
| 1783 | if (skip_call) { |
| 1784 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 1785 | } |
| 1786 | VkResult result = get_dispatch_table(ot_device_table_map, commandBuffer)->ResetCommandBuffer(commandBuffer, flags); |
| 1787 | return result; |
| 1788 | } |
| 1789 | |
| 1790 | VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 1791 | VkPipeline pipeline) { |
| 1792 | bool skip_call = false; |
| 1793 | { |
| 1794 | std::lock_guard<std::mutex> lock(global_lock); |
| 1795 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1796 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 1797 | skip_call |= ValidateObject(commandBuffer, pipeline, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1798 | } |
| 1799 | if (skip_call) { |
| 1800 | return; |
| 1801 | } |
| 1802 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); |
| 1803 | } |
| 1804 | |
| 1805 | VKAPI_ATTR void VKAPI_CALL CmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, |
| 1806 | const VkViewport *pViewports) { |
| 1807 | bool skip_call = false; |
| 1808 | { |
| 1809 | std::lock_guard<std::mutex> lock(global_lock); |
| 1810 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1811 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1812 | } |
| 1813 | if (skip_call) { |
| 1814 | return; |
| 1815 | } |
| 1816 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); |
| 1817 | } |
| 1818 | |
| 1819 | VKAPI_ATTR void VKAPI_CALL CmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, |
| 1820 | const VkRect2D *pScissors) { |
| 1821 | bool skip_call = false; |
| 1822 | { |
| 1823 | std::lock_guard<std::mutex> lock(global_lock); |
| 1824 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1825 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1826 | } |
| 1827 | if (skip_call) { |
| 1828 | return; |
| 1829 | } |
| 1830 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); |
| 1831 | } |
| 1832 | |
| 1833 | VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { |
| 1834 | bool skip_call = false; |
| 1835 | { |
| 1836 | std::lock_guard<std::mutex> lock(global_lock); |
| 1837 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1838 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1839 | } |
| 1840 | if (skip_call) { |
| 1841 | return; |
| 1842 | } |
| 1843 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetLineWidth(commandBuffer, lineWidth); |
| 1844 | } |
| 1845 | |
| 1846 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, |
| 1847 | float depthBiasSlopeFactor) { |
| 1848 | bool skip_call = false; |
| 1849 | { |
| 1850 | std::lock_guard<std::mutex> lock(global_lock); |
| 1851 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1852 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1853 | } |
| 1854 | if (skip_call) { |
| 1855 | return; |
| 1856 | } |
| 1857 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 1858 | ->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
| 1859 | } |
| 1860 | |
| 1861 | VKAPI_ATTR void VKAPI_CALL CmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { |
| 1862 | bool skip_call = false; |
| 1863 | { |
| 1864 | std::lock_guard<std::mutex> lock(global_lock); |
| 1865 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1866 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1867 | } |
| 1868 | if (skip_call) { |
| 1869 | return; |
| 1870 | } |
| 1871 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetBlendConstants(commandBuffer, blendConstants); |
| 1872 | } |
| 1873 | |
| 1874 | VKAPI_ATTR void VKAPI_CALL CmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { |
| 1875 | bool skip_call = false; |
| 1876 | { |
| 1877 | std::lock_guard<std::mutex> lock(global_lock); |
| 1878 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1879 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1880 | } |
| 1881 | if (skip_call) { |
| 1882 | return; |
| 1883 | } |
| 1884 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); |
| 1885 | } |
| 1886 | |
| 1887 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, |
| 1888 | uint32_t compareMask) { |
| 1889 | bool skip_call = false; |
| 1890 | { |
| 1891 | std::lock_guard<std::mutex> lock(global_lock); |
| 1892 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1893 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1894 | } |
| 1895 | if (skip_call) { |
| 1896 | return; |
| 1897 | } |
| 1898 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); |
| 1899 | } |
| 1900 | |
| 1901 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) { |
| 1902 | bool skip_call = false; |
| 1903 | { |
| 1904 | std::lock_guard<std::mutex> lock(global_lock); |
| 1905 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1906 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1907 | } |
| 1908 | if (skip_call) { |
| 1909 | return; |
| 1910 | } |
| 1911 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); |
| 1912 | } |
| 1913 | |
| 1914 | VKAPI_ATTR void VKAPI_CALL CmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) { |
| 1915 | bool skip_call = false; |
| 1916 | { |
| 1917 | std::lock_guard<std::mutex> lock(global_lock); |
| 1918 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1919 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1920 | } |
| 1921 | if (skip_call) { |
| 1922 | return; |
| 1923 | } |
| 1924 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetStencilReference(commandBuffer, faceMask, reference); |
| 1925 | } |
| 1926 | |
| 1927 | VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, |
| 1928 | VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, |
| 1929 | const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, |
| 1930 | const uint32_t *pDynamicOffsets) { |
| 1931 | bool skip_call = false; |
| 1932 | { |
| 1933 | std::lock_guard<std::mutex> lock(global_lock); |
| 1934 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1935 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 1936 | skip_call |= ValidateObject(commandBuffer, layout, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1937 | if (pDescriptorSets) { |
| 1938 | for (uint32_t idx0 = 0; idx0 < descriptorSetCount; ++idx0) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1939 | skip_call |= ValidateObject(commandBuffer, pDescriptorSets[idx0], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1940 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); |
| 1941 | } |
| 1942 | } |
| 1943 | } |
| 1944 | if (skip_call) { |
| 1945 | return; |
| 1946 | } |
| 1947 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 1948 | ->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, |
| 1949 | dynamicOffsetCount, pDynamicOffsets); |
| 1950 | } |
| 1951 | |
| 1952 | VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 1953 | VkIndexType indexType) { |
| 1954 | bool skip_call = false; |
| 1955 | { |
| 1956 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1957 | skip_call |= ValidateObject(commandBuffer, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1958 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1959 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1960 | } |
| 1961 | if (skip_call) { |
| 1962 | return; |
| 1963 | } |
| 1964 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); |
| 1965 | } |
| 1966 | |
| 1967 | VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, |
| 1968 | const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) { |
| 1969 | bool skip_call = false; |
| 1970 | { |
| 1971 | std::lock_guard<std::mutex> lock(global_lock); |
| 1972 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1973 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1974 | if (pBuffers) { |
| 1975 | for (uint32_t idx0 = 0; idx0 < bindingCount; ++idx0) { |
| 1976 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1977 | ValidateObject(commandBuffer, pBuffers[idx0], VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1978 | } |
| 1979 | } |
| 1980 | } |
| 1981 | if (skip_call) { |
| 1982 | return; |
| 1983 | } |
| 1984 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 1985 | ->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); |
| 1986 | } |
| 1987 | |
| 1988 | VKAPI_ATTR void VKAPI_CALL CmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, |
| 1989 | uint32_t firstVertex, uint32_t firstInstance) { |
| 1990 | bool skip_call = false; |
| 1991 | { |
| 1992 | std::lock_guard<std::mutex> lock(global_lock); |
| 1993 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 1994 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 1995 | } |
| 1996 | if (skip_call) { |
| 1997 | return; |
| 1998 | } |
| 1999 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2000 | ->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); |
| 2001 | } |
| 2002 | |
| 2003 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, |
| 2004 | uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { |
| 2005 | bool skip_call = false; |
| 2006 | { |
| 2007 | std::lock_guard<std::mutex> lock(global_lock); |
| 2008 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2009 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2010 | } |
| 2011 | if (skip_call) { |
| 2012 | return; |
| 2013 | } |
| 2014 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2015 | ->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
| 2016 | } |
| 2017 | |
| 2018 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, |
| 2019 | uint32_t stride) { |
| 2020 | bool skip_call = false; |
| 2021 | { |
| 2022 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2023 | skip_call |= ValidateObject(commandBuffer, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2024 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2025 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2026 | } |
| 2027 | if (skip_call) { |
| 2028 | return; |
| 2029 | } |
| 2030 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2031 | } |
| 2032 | |
| 2033 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 2034 | uint32_t drawCount, uint32_t stride) { |
| 2035 | bool skip_call = false; |
| 2036 | { |
| 2037 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2038 | skip_call |= ValidateObject(commandBuffer, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2039 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2040 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2041 | } |
| 2042 | if (skip_call) { |
| 2043 | return; |
| 2044 | } |
| 2045 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2046 | ->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride); |
| 2047 | } |
| 2048 | |
| 2049 | VKAPI_ATTR void VKAPI_CALL CmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { |
| 2050 | bool skip_call = false; |
| 2051 | { |
| 2052 | std::lock_guard<std::mutex> lock(global_lock); |
| 2053 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2054 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2055 | } |
| 2056 | if (skip_call) { |
| 2057 | return; |
| 2058 | } |
| 2059 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDispatch(commandBuffer, x, y, z); |
| 2060 | } |
| 2061 | |
| 2062 | VKAPI_ATTR void VKAPI_CALL CmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { |
| 2063 | bool skip_call = false; |
| 2064 | { |
| 2065 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2066 | skip_call |= ValidateObject(commandBuffer, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2067 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2068 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2069 | } |
| 2070 | if (skip_call) { |
| 2071 | return; |
| 2072 | } |
| 2073 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDispatchIndirect(commandBuffer, buffer, offset); |
| 2074 | } |
| 2075 | |
| 2076 | VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, |
| 2077 | uint32_t regionCount, const VkBufferCopy *pRegions) { |
| 2078 | bool skip_call = false; |
| 2079 | { |
| 2080 | std::lock_guard<std::mutex> lock(global_lock); |
| 2081 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2082 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2083 | skip_call |= ValidateObject(commandBuffer, dstBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 2084 | skip_call |= ValidateObject(commandBuffer, srcBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2085 | } |
| 2086 | if (skip_call) { |
| 2087 | return; |
| 2088 | } |
| 2089 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2090 | ->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); |
| 2091 | } |
| 2092 | |
| 2093 | VKAPI_ATTR void VKAPI_CALL CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2094 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2095 | const VkImageCopy *pRegions) { |
| 2096 | bool skip_call = false; |
| 2097 | { |
| 2098 | std::lock_guard<std::mutex> lock(global_lock); |
| 2099 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2100 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2101 | skip_call |= ValidateObject(commandBuffer, dstImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
| 2102 | skip_call |= ValidateObject(commandBuffer, srcImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2103 | } |
| 2104 | if (skip_call) { |
| 2105 | return; |
| 2106 | } |
| 2107 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2108 | ->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2109 | } |
| 2110 | |
| 2111 | VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2112 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2113 | const VkImageBlit *pRegions, VkFilter filter) { |
| 2114 | bool skip_call = false; |
| 2115 | { |
| 2116 | std::lock_guard<std::mutex> lock(global_lock); |
| 2117 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2118 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2119 | skip_call |= ValidateObject(commandBuffer, dstImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
| 2120 | skip_call |= ValidateObject(commandBuffer, srcImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2121 | } |
| 2122 | if (skip_call) { |
| 2123 | return; |
| 2124 | } |
| 2125 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2126 | ->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); |
| 2127 | } |
| 2128 | |
| 2129 | VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, |
| 2130 | VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2131 | const VkBufferImageCopy *pRegions) { |
| 2132 | bool skip_call = false; |
| 2133 | { |
| 2134 | std::lock_guard<std::mutex> lock(global_lock); |
| 2135 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2136 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2137 | skip_call |= ValidateObject(commandBuffer, dstImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
| 2138 | skip_call |= ValidateObject(commandBuffer, srcBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2139 | } |
| 2140 | if (skip_call) { |
| 2141 | return; |
| 2142 | } |
| 2143 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2144 | ->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); |
| 2145 | } |
| 2146 | |
| 2147 | VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2148 | VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) { |
| 2149 | bool skip_call = false; |
| 2150 | { |
| 2151 | std::lock_guard<std::mutex> lock(global_lock); |
| 2152 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2153 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2154 | skip_call |= ValidateObject(commandBuffer, dstBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 2155 | skip_call |= ValidateObject(commandBuffer, srcImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2156 | } |
| 2157 | if (skip_call) { |
| 2158 | return; |
| 2159 | } |
| 2160 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2161 | ->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); |
| 2162 | } |
| 2163 | |
| 2164 | VKAPI_ATTR void VKAPI_CALL CmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 2165 | VkDeviceSize dataSize, const uint32_t *pData) { |
| 2166 | bool skip_call = false; |
| 2167 | { |
| 2168 | std::lock_guard<std::mutex> lock(global_lock); |
| 2169 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2170 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2171 | skip_call |= ValidateObject(commandBuffer, dstBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2172 | } |
| 2173 | if (skip_call) { |
| 2174 | return; |
| 2175 | } |
| 2176 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); |
| 2177 | } |
| 2178 | |
| 2179 | VKAPI_ATTR void VKAPI_CALL CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 2180 | VkDeviceSize size, uint32_t data) { |
| 2181 | bool skip_call = false; |
| 2182 | { |
| 2183 | std::lock_guard<std::mutex> lock(global_lock); |
| 2184 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2185 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2186 | skip_call |= ValidateObject(commandBuffer, dstBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2187 | } |
| 2188 | if (skip_call) { |
| 2189 | return; |
| 2190 | } |
| 2191 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); |
| 2192 | } |
| 2193 | |
| 2194 | VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 2195 | const VkClearColorValue *pColor, uint32_t rangeCount, |
| 2196 | const VkImageSubresourceRange *pRanges) { |
| 2197 | bool skip_call = false; |
| 2198 | { |
| 2199 | std::lock_guard<std::mutex> lock(global_lock); |
| 2200 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2201 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2202 | skip_call |= ValidateObject(commandBuffer, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2203 | } |
| 2204 | if (skip_call) { |
| 2205 | return; |
| 2206 | } |
| 2207 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2208 | ->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); |
| 2209 | } |
| 2210 | |
| 2211 | VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, |
| 2212 | const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, |
| 2213 | const VkImageSubresourceRange *pRanges) { |
| 2214 | bool skip_call = false; |
| 2215 | { |
| 2216 | std::lock_guard<std::mutex> lock(global_lock); |
| 2217 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2218 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2219 | skip_call |= ValidateObject(commandBuffer, image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2220 | } |
| 2221 | if (skip_call) { |
| 2222 | return; |
| 2223 | } |
| 2224 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2225 | ->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); |
| 2226 | } |
| 2227 | |
| 2228 | VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, |
| 2229 | const VkClearAttachment *pAttachments, uint32_t rectCount, |
| 2230 | const VkClearRect *pRects) { |
| 2231 | bool skip_call = false; |
| 2232 | { |
| 2233 | std::lock_guard<std::mutex> lock(global_lock); |
| 2234 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2235 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2236 | } |
| 2237 | if (skip_call) { |
| 2238 | return; |
| 2239 | } |
| 2240 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2241 | ->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); |
| 2242 | } |
| 2243 | |
| 2244 | VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, |
| 2245 | VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, |
| 2246 | const VkImageResolve *pRegions) { |
| 2247 | bool skip_call = false; |
| 2248 | { |
| 2249 | std::lock_guard<std::mutex> lock(global_lock); |
| 2250 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2251 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2252 | skip_call |= ValidateObject(commandBuffer, dstImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
| 2253 | skip_call |= ValidateObject(commandBuffer, srcImage, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2254 | } |
| 2255 | if (skip_call) { |
| 2256 | return; |
| 2257 | } |
| 2258 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2259 | ->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); |
| 2260 | } |
| 2261 | |
| 2262 | VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
| 2263 | bool skip_call = false; |
| 2264 | { |
| 2265 | std::lock_guard<std::mutex> lock(global_lock); |
| 2266 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2267 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2268 | skip_call |= ValidateObject(commandBuffer, event, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2269 | } |
| 2270 | if (skip_call) { |
| 2271 | return; |
| 2272 | } |
| 2273 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdSetEvent(commandBuffer, event, stageMask); |
| 2274 | } |
| 2275 | |
| 2276 | VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
| 2277 | bool skip_call = false; |
| 2278 | { |
| 2279 | std::lock_guard<std::mutex> lock(global_lock); |
| 2280 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2281 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2282 | skip_call |= ValidateObject(commandBuffer, event, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2283 | } |
| 2284 | if (skip_call) { |
| 2285 | return; |
| 2286 | } |
| 2287 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdResetEvent(commandBuffer, event, stageMask); |
| 2288 | } |
| 2289 | |
| 2290 | VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, |
| 2291 | VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 2292 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 2293 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 2294 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
| 2295 | bool skip_call = false; |
| 2296 | { |
| 2297 | std::lock_guard<std::mutex> lock(global_lock); |
| 2298 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2299 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2300 | if (pBufferMemoryBarriers) { |
| 2301 | for (uint32_t idx0 = 0; idx0 < bufferMemoryBarrierCount; ++idx0) { |
| 2302 | if (pBufferMemoryBarriers[idx0].buffer) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2303 | skip_call |= ValidateObject(commandBuffer, pBufferMemoryBarriers[idx0].buffer, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2304 | VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 2305 | } |
| 2306 | } |
| 2307 | } |
| 2308 | if (pEvents) { |
| 2309 | for (uint32_t idx1 = 0; idx1 < eventCount; ++idx1) { |
| 2310 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2311 | ValidateObject(commandBuffer, pEvents[idx1], VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2312 | } |
| 2313 | } |
| 2314 | if (pImageMemoryBarriers) { |
| 2315 | for (uint32_t idx2 = 0; idx2 < imageMemoryBarrierCount; ++idx2) { |
| 2316 | if (pImageMemoryBarriers[idx2].image) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2317 | skip_call |= ValidateObject(commandBuffer, pImageMemoryBarriers[idx2].image, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2318 | VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
| 2319 | } |
| 2320 | } |
| 2321 | } |
| 2322 | } |
| 2323 | if (skip_call) { |
| 2324 | return; |
| 2325 | } |
| 2326 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2327 | ->CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, |
| 2328 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
| 2329 | } |
| 2330 | |
| 2331 | VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, |
| 2332 | VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, |
| 2333 | uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, |
| 2334 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, |
| 2335 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { |
| 2336 | bool skip_call = false; |
| 2337 | { |
| 2338 | std::lock_guard<std::mutex> lock(global_lock); |
| 2339 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2340 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2341 | if (pBufferMemoryBarriers) { |
| 2342 | for (uint32_t idx0 = 0; idx0 < bufferMemoryBarrierCount; ++idx0) { |
| 2343 | if (pBufferMemoryBarriers[idx0].buffer) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2344 | skip_call |= ValidateObject(commandBuffer, pBufferMemoryBarriers[idx0].buffer, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2345 | VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 2346 | } |
| 2347 | } |
| 2348 | } |
| 2349 | if (pImageMemoryBarriers) { |
| 2350 | for (uint32_t idx1 = 0; idx1 < imageMemoryBarrierCount; ++idx1) { |
| 2351 | if (pImageMemoryBarriers[idx1].image) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2352 | skip_call |= ValidateObject(commandBuffer, pImageMemoryBarriers[idx1].image, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2353 | VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
| 2354 | } |
| 2355 | } |
| 2356 | } |
| 2357 | } |
| 2358 | if (skip_call) { |
| 2359 | return; |
| 2360 | } |
| 2361 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2362 | ->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, |
| 2363 | bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
| 2364 | } |
| 2365 | |
| 2366 | VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, |
| 2367 | VkQueryControlFlags flags) { |
| 2368 | bool skip_call = false; |
| 2369 | { |
| 2370 | std::lock_guard<std::mutex> lock(global_lock); |
| 2371 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2372 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2373 | skip_call |= ValidateObject(commandBuffer, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2374 | } |
| 2375 | if (skip_call) { |
| 2376 | return; |
| 2377 | } |
| 2378 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBeginQuery(commandBuffer, queryPool, query, flags); |
| 2379 | } |
| 2380 | |
| 2381 | VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) { |
| 2382 | bool skip_call = false; |
| 2383 | { |
| 2384 | std::lock_guard<std::mutex> lock(global_lock); |
| 2385 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2386 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2387 | skip_call |= ValidateObject(commandBuffer, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2388 | } |
| 2389 | if (skip_call) { |
| 2390 | return; |
| 2391 | } |
| 2392 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdEndQuery(commandBuffer, queryPool, query); |
| 2393 | } |
| 2394 | |
| 2395 | VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 2396 | uint32_t queryCount) { |
| 2397 | bool skip_call = false; |
| 2398 | { |
| 2399 | std::lock_guard<std::mutex> lock(global_lock); |
| 2400 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2401 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2402 | skip_call |= ValidateObject(commandBuffer, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2403 | } |
| 2404 | if (skip_call) { |
| 2405 | return; |
| 2406 | } |
| 2407 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); |
| 2408 | } |
| 2409 | |
| 2410 | VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, |
| 2411 | VkQueryPool queryPool, uint32_t query) { |
| 2412 | bool skip_call = false; |
| 2413 | { |
| 2414 | std::lock_guard<std::mutex> lock(global_lock); |
| 2415 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2416 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2417 | skip_call |= ValidateObject(commandBuffer, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2418 | } |
| 2419 | if (skip_call) { |
| 2420 | return; |
| 2421 | } |
| 2422 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); |
| 2423 | } |
| 2424 | |
| 2425 | VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, |
| 2426 | uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, |
| 2427 | VkDeviceSize stride, VkQueryResultFlags flags) { |
| 2428 | bool skip_call = false; |
| 2429 | { |
| 2430 | std::lock_guard<std::mutex> lock(global_lock); |
| 2431 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2432 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2433 | skip_call |= ValidateObject(commandBuffer, dstBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 2434 | skip_call |= ValidateObject(commandBuffer, queryPool, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2435 | } |
| 2436 | if (skip_call) { |
| 2437 | return; |
| 2438 | } |
| 2439 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2440 | ->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); |
| 2441 | } |
| 2442 | |
| 2443 | VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, |
| 2444 | uint32_t offset, uint32_t size, const void *pValues) { |
| 2445 | bool skip_call = false; |
| 2446 | { |
| 2447 | std::lock_guard<std::mutex> lock(global_lock); |
| 2448 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2449 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2450 | skip_call |= ValidateObject(commandBuffer, layout, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2451 | } |
| 2452 | if (skip_call) { |
| 2453 | return; |
| 2454 | } |
| 2455 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 2456 | ->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); |
| 2457 | } |
| 2458 | |
| 2459 | VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, |
| 2460 | VkSubpassContents contents) { |
| 2461 | bool skip_call = false; |
| 2462 | { |
| 2463 | std::lock_guard<std::mutex> lock(global_lock); |
| 2464 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2465 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2466 | if (pRenderPassBegin) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2467 | skip_call |= ValidateObject(commandBuffer, pRenderPassBegin->framebuffer, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2468 | VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT, false); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2469 | skip_call |= ValidateObject(commandBuffer, pRenderPassBegin->renderPass, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2470 | VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, false); |
| 2471 | } |
| 2472 | } |
| 2473 | if (skip_call) { |
| 2474 | return; |
| 2475 | } |
| 2476 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); |
| 2477 | } |
| 2478 | |
| 2479 | VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { |
| 2480 | bool skip_call = false; |
| 2481 | { |
| 2482 | std::lock_guard<std::mutex> lock(global_lock); |
| 2483 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2484 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2485 | } |
| 2486 | if (skip_call) { |
| 2487 | return; |
| 2488 | } |
| 2489 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdNextSubpass(commandBuffer, contents); |
| 2490 | } |
| 2491 | |
| 2492 | VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) { |
| 2493 | bool skip_call = false; |
| 2494 | { |
| 2495 | std::lock_guard<std::mutex> lock(global_lock); |
| 2496 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2497 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2498 | } |
| 2499 | if (skip_call) { |
| 2500 | return; |
| 2501 | } |
| 2502 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdEndRenderPass(commandBuffer); |
| 2503 | } |
| 2504 | |
| 2505 | VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, |
| 2506 | const VkCommandBuffer *pCommandBuffers) { |
| 2507 | bool skip_call = false; |
| 2508 | { |
| 2509 | std::lock_guard<std::mutex> lock(global_lock); |
| 2510 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2511 | ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2512 | if (pCommandBuffers) { |
| 2513 | for (uint32_t idx0 = 0; idx0 < commandBufferCount; ++idx0) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2514 | skip_call |= ValidateObject(commandBuffer, pCommandBuffers[idx0], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2515 | VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 2516 | } |
| 2517 | } |
| 2518 | } |
| 2519 | if (skip_call) { |
| 2520 | return; |
| 2521 | } |
| 2522 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); |
| 2523 | } |
| 2524 | |
| 2525 | VKAPI_ATTR void VKAPI_CALL DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) { |
| 2526 | bool skip_call = false; |
| 2527 | { |
| 2528 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2529 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
| 2530 | skip_call |= ValidateObject(instance, surface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2531 | } |
| 2532 | if (skip_call) { |
| 2533 | return; |
| 2534 | } |
| 2535 | { |
| 2536 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 2537 | DestroyObject(instance, surface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2538 | } |
| 2539 | get_dispatch_table(ot_instance_table_map, instance)->DestroySurfaceKHR(instance, surface, pAllocator); |
| 2540 | } |
| 2541 | |
| 2542 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, |
| 2543 | VkSurfaceKHR surface, VkBool32 *pSupported) { |
| 2544 | bool skip_call = false; |
| 2545 | { |
| 2546 | std::lock_guard<std::mutex> lock(global_lock); |
| 2547 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2548 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
| 2549 | skip_call |= ValidateObject(physicalDevice, surface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2550 | } |
| 2551 | if (skip_call) { |
| 2552 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2553 | } |
| 2554 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2555 | ->GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); |
| 2556 | return result; |
| 2557 | } |
| 2558 | |
| 2559 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 2560 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
| 2561 | bool skip_call = false; |
| 2562 | { |
| 2563 | std::lock_guard<std::mutex> lock(global_lock); |
| 2564 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2565 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
| 2566 | skip_call |= ValidateObject(physicalDevice, surface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2567 | } |
| 2568 | if (skip_call) { |
| 2569 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2570 | } |
| 2571 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2572 | ->GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); |
| 2573 | return result; |
| 2574 | } |
| 2575 | |
| 2576 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 2577 | uint32_t *pSurfaceFormatCount, |
| 2578 | VkSurfaceFormatKHR *pSurfaceFormats) { |
| 2579 | bool skip_call = false; |
| 2580 | { |
| 2581 | std::lock_guard<std::mutex> lock(global_lock); |
| 2582 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2583 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
| 2584 | skip_call |= ValidateObject(physicalDevice, surface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2585 | } |
| 2586 | if (skip_call) { |
| 2587 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2588 | } |
| 2589 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2590 | ->GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats); |
| 2591 | return result; |
| 2592 | } |
| 2593 | |
| 2594 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 2595 | uint32_t *pPresentModeCount, |
| 2596 | VkPresentModeKHR *pPresentModes) { |
| 2597 | bool skip_call = false; |
| 2598 | { |
| 2599 | std::lock_guard<std::mutex> lock(global_lock); |
| 2600 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2601 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
| 2602 | skip_call |= ValidateObject(physicalDevice, surface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2603 | } |
| 2604 | if (skip_call) { |
| 2605 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2606 | } |
| 2607 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2608 | ->GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes); |
| 2609 | return result; |
| 2610 | } |
| 2611 | |
| 2612 | VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
| 2613 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
| 2614 | bool skip_call = false; |
| 2615 | { |
| 2616 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2617 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2618 | if (pCreateInfo) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2619 | skip_call |= ValidateObject(device, pCreateInfo->oldSwapchain, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2620 | VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, true); |
| 2621 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2622 | skip_call |= ValidateObject(device_data->physical_device, pCreateInfo->surface, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2623 | VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, false); |
| 2624 | } |
| 2625 | } |
| 2626 | if (skip_call) { |
| 2627 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2628 | } |
| 2629 | VkResult result = |
| 2630 | get_dispatch_table(ot_device_table_map, device)->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
| 2631 | { |
| 2632 | std::lock_guard<std::mutex> lock(global_lock); |
| 2633 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2634 | CreateObject(device, *pSwapchain, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2635 | } |
| 2636 | } |
| 2637 | return result; |
| 2638 | } |
| 2639 | |
| 2640 | VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
| 2641 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { |
| 2642 | bool skip_call = false; |
| 2643 | { |
| 2644 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2645 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 2646 | skip_call |= ValidateObject(device, fence, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, true); |
| 2647 | skip_call |= ValidateObject(device, semaphore, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, true); |
| 2648 | skip_call |= ValidateObject(device, swapchain, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2649 | } |
| 2650 | if (skip_call) { |
| 2651 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2652 | } |
| 2653 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 2654 | ->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
| 2655 | return result; |
| 2656 | } |
| 2657 | |
| 2658 | VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
| 2659 | bool skip_call = false; |
| 2660 | { |
| 2661 | std::lock_guard<std::mutex> lock(global_lock); |
| 2662 | if (pPresentInfo) { |
| 2663 | if (pPresentInfo->pSwapchains) { |
| 2664 | for (uint32_t idx0 = 0; idx0 < pPresentInfo->swapchainCount; ++idx0) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2665 | skip_call |= ValidateObject(queue, pPresentInfo->pSwapchains[idx0], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2666 | VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, false); |
| 2667 | } |
| 2668 | } |
| 2669 | if (pPresentInfo->pWaitSemaphores) { |
| 2670 | for (uint32_t idx1 = 0; idx1 < pPresentInfo->waitSemaphoreCount; ++idx1) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2671 | skip_call |= ValidateObject(queue, pPresentInfo->pWaitSemaphores[idx1], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2672 | VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, false); |
| 2673 | } |
| 2674 | } |
| 2675 | } |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2676 | skip_call |= ValidateObject(queue, queue, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2677 | } |
| 2678 | if (skip_call) { |
| 2679 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2680 | } |
| 2681 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueuePresentKHR(queue, pPresentInfo); |
| 2682 | return result; |
| 2683 | } |
| 2684 | |
| 2685 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 2686 | VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 2687 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 2688 | bool skip_call = false; |
| 2689 | { |
| 2690 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2691 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2692 | } |
| 2693 | if (skip_call) { |
| 2694 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2695 | } |
| 2696 | VkResult result = |
| 2697 | get_dispatch_table(ot_instance_table_map, instance)->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2698 | { |
| 2699 | std::lock_guard<std::mutex> lock(global_lock); |
| 2700 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2701 | CreateObject(instance, *pSurface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2702 | } |
| 2703 | } |
| 2704 | return result; |
| 2705 | } |
| 2706 | |
| 2707 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2708 | uint32_t queueFamilyIndex) { |
| 2709 | bool skip_call = false; |
| 2710 | { |
| 2711 | std::lock_guard<std::mutex> lock(global_lock); |
| 2712 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2713 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2714 | } |
| 2715 | if (skip_call) { |
| 2716 | return VK_FALSE; |
| 2717 | } |
| 2718 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2719 | ->GetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); |
| 2720 | return result; |
| 2721 | } |
| 2722 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 2723 | |
| 2724 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 2725 | VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 2726 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 2727 | bool skip_call = false; |
| 2728 | { |
| 2729 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2730 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2731 | } |
| 2732 | if (skip_call) { |
| 2733 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2734 | } |
| 2735 | VkResult result = |
| 2736 | get_dispatch_table(ot_instance_table_map, instance)->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2737 | { |
| 2738 | std::lock_guard<std::mutex> lock(global_lock); |
| 2739 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2740 | CreateObject(instance, *pSurface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2741 | } |
| 2742 | } |
| 2743 | return result; |
| 2744 | } |
| 2745 | |
| 2746 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2747 | uint32_t queueFamilyIndex, xcb_connection_t *connection, |
| 2748 | xcb_visualid_t visual_id) { |
| 2749 | bool skip_call = false; |
| 2750 | { |
| 2751 | std::lock_guard<std::mutex> lock(global_lock); |
| 2752 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2753 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2754 | } |
| 2755 | if (skip_call) { |
| 2756 | return VK_FALSE; |
| 2757 | } |
| 2758 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2759 | ->GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, visual_id); |
| 2760 | return result; |
| 2761 | } |
| 2762 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 2763 | |
| 2764 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 2765 | VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
| 2766 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 2767 | bool skip_call = false; |
| 2768 | { |
| 2769 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2770 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2771 | } |
| 2772 | if (skip_call) { |
| 2773 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2774 | } |
| 2775 | VkResult result = |
| 2776 | get_dispatch_table(ot_instance_table_map, instance)->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2777 | { |
| 2778 | std::lock_guard<std::mutex> lock(global_lock); |
| 2779 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2780 | CreateObject(instance, *pSurface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2781 | } |
| 2782 | } |
| 2783 | return result; |
| 2784 | } |
| 2785 | |
| 2786 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2787 | uint32_t queueFamilyIndex, Display *dpy, |
| 2788 | VisualID visualID) { |
| 2789 | bool skip_call = false; |
| 2790 | { |
| 2791 | std::lock_guard<std::mutex> lock(global_lock); |
| 2792 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2793 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2794 | } |
| 2795 | if (skip_call) { |
| 2796 | return VK_FALSE; |
| 2797 | } |
| 2798 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2799 | ->GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); |
| 2800 | return result; |
| 2801 | } |
| 2802 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 2803 | |
| 2804 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 2805 | VKAPI_ATTR VkResult VKAPI_CALL CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, |
| 2806 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 2807 | bool skip_call = false; |
| 2808 | { |
| 2809 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2810 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2811 | } |
| 2812 | if (skip_call) { |
| 2813 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2814 | } |
| 2815 | VkResult result = |
| 2816 | get_dispatch_table(ot_instance_table_map, instance)->CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2817 | { |
| 2818 | std::lock_guard<std::mutex> lock(global_lock); |
| 2819 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2820 | CreateObject(instance, *pSurface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2821 | } |
| 2822 | } |
| 2823 | return result; |
| 2824 | } |
| 2825 | |
| 2826 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2827 | uint32_t queueFamilyIndex, MirConnection *connection) { |
| 2828 | bool skip_call = false; |
| 2829 | { |
| 2830 | std::lock_guard<std::mutex> lock(global_lock); |
| 2831 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2832 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2833 | } |
| 2834 | if (skip_call) { |
| 2835 | return VK_FALSE; |
| 2836 | } |
| 2837 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2838 | ->GetPhysicalDeviceMirPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection); |
| 2839 | return result; |
| 2840 | } |
| 2841 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 2842 | |
| 2843 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 2844 | VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
| 2845 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 2846 | bool skip_call = false; |
| 2847 | { |
| 2848 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2849 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2850 | } |
| 2851 | if (skip_call) { |
| 2852 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2853 | } |
| 2854 | VkResult result = |
| 2855 | get_dispatch_table(ot_instance_table_map, instance)->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2856 | { |
| 2857 | std::lock_guard<std::mutex> lock(global_lock); |
| 2858 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2859 | CreateObject(instance, *pSurface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2860 | } |
| 2861 | } |
| 2862 | return result; |
| 2863 | } |
| 2864 | |
| 2865 | VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 2866 | uint32_t queueFamilyIndex, |
| 2867 | struct wl_display *display) { |
| 2868 | bool skip_call = false; |
| 2869 | { |
| 2870 | std::lock_guard<std::mutex> lock(global_lock); |
| 2871 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2872 | ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2873 | } |
| 2874 | if (skip_call) { |
| 2875 | return VK_FALSE; |
| 2876 | } |
| 2877 | VkBool32 result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 2878 | ->GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); |
| 2879 | return result; |
| 2880 | } |
| 2881 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 2882 | |
| 2883 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 2884 | VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR *pCreateInfo, |
| 2885 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 2886 | bool skip_call = false; |
| 2887 | { |
| 2888 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2889 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2890 | } |
| 2891 | if (skip_call) { |
| 2892 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2893 | } |
| 2894 | VkResult result = |
| 2895 | get_dispatch_table(ot_instance_table_map, instance)->CreateAndroidSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
| 2896 | { |
| 2897 | std::lock_guard<std::mutex> lock(global_lock); |
| 2898 | if (result == VK_SUCCESS) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2899 | CreateObject(instance, *pSurface, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2900 | } |
| 2901 | } |
| 2902 | return result; |
| 2903 | } |
| 2904 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 2905 | |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 2906 | VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 2907 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 2908 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { |
| 2909 | bool skip_call = false; |
| 2910 | uint32_t i = 0; |
| 2911 | { |
| 2912 | std::lock_guard<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2913 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 2914 | if (NULL != pCreateInfos) { |
| 2915 | for (i = 0; i < swapchainCount; i++) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2916 | skip_call |= ValidateObject(device, pCreateInfos[i].oldSwapchain, |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 2917 | VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, true); |
| 2918 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 2919 | skip_call |= ValidateObject(device_data->physical_device, pCreateInfos[i].surface, |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 2920 | VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT, false); |
| 2921 | } |
| 2922 | } |
| 2923 | } |
| 2924 | if (skip_call) { |
| 2925 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 2926 | } |
| 2927 | VkResult result = |
| 2928 | get_dispatch_table(ot_device_table_map, device)->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
| 2929 | { |
| 2930 | std::lock_guard<std::mutex> lock(global_lock); |
| 2931 | if (result == VK_SUCCESS) { |
| 2932 | for (i = 0; i < swapchainCount; i++) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2933 | CreateObject(device, pSwapchains[i], VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, pAllocator); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 2934 | } |
| 2935 | } |
| 2936 | } |
| 2937 | return result; |
| 2938 | } |
| 2939 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2940 | VKAPI_ATTR VkResult VKAPI_CALL CreateDebugReportCallbackEXT(VkInstance instance, |
| 2941 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 2942 | const VkAllocationCallbacks *pAllocator, |
| 2943 | VkDebugReportCallbackEXT *pCallback) { |
| 2944 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 2945 | VkResult result = pInstanceTable->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback); |
| 2946 | if (VK_SUCCESS == result) { |
| 2947 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 2948 | result = layer_create_msg_callback(instance_data->report_data, false, pCreateInfo, pAllocator, pCallback); |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 2949 | CreateObject(instance, *pCallback, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2950 | } |
| 2951 | return result; |
| 2952 | } |
| 2953 | |
| 2954 | VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 2955 | const VkAllocationCallbacks *pAllocator) { |
| 2956 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 2957 | pInstanceTable->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
| 2958 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 2959 | layer_destroy_msg_callback(instance_data->report_data, msgCallback, pAllocator); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 2960 | DestroyObject(instance, msgCallback, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 2961 | } |
| 2962 | |
| 2963 | VKAPI_ATTR void VKAPI_CALL DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 2964 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 2965 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
| 2966 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, instance); |
| 2967 | pInstanceTable->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
| 2968 | } |
| 2969 | |
| 2970 | static const VkExtensionProperties instance_extensions[] = {{VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}}; |
| 2971 | |
| 2972 | static const VkLayerProperties globalLayerProps = {"VK_LAYER_LUNARG_object_tracker", |
| 2973 | VK_LAYER_API_VERSION, // specVersion |
| 2974 | 1, // implementationVersion |
| 2975 | "LunarG Validation Layer"}; |
| 2976 | |
| 2977 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) { |
| 2978 | return util_GetLayerProperties(1, &globalLayerProps, pCount, pProperties); |
| 2979 | } |
| 2980 | |
| 2981 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 2982 | VkLayerProperties *pProperties) { |
| 2983 | return util_GetLayerProperties(1, &globalLayerProps, pCount, pProperties); |
| 2984 | } |
| 2985 | |
| 2986 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 2987 | VkExtensionProperties *pProperties) { |
| 2988 | if (pLayerName && !strcmp(pLayerName, globalLayerProps.layerName)) |
| 2989 | return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties); |
| 2990 | |
| 2991 | return VK_ERROR_LAYER_NOT_PRESENT; |
| 2992 | } |
| 2993 | |
| 2994 | VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, |
| 2995 | uint32_t *pCount, VkExtensionProperties *pProperties) { |
| 2996 | if (pLayerName && !strcmp(pLayerName, globalLayerProps.layerName)) |
| 2997 | return util_GetExtensionProperties(0, nullptr, pCount, pProperties); |
| 2998 | |
| 2999 | assert(physicalDevice); |
| 3000 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(ot_instance_table_map, physicalDevice); |
| 3001 | return pTable->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties); |
| 3002 | } |
| 3003 | |
| 3004 | static inline PFN_vkVoidFunction InterceptMsgCallbackGetProcAddrCommand(const char *name, VkInstance instance) { |
| 3005 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); |
| 3006 | return debug_report_get_instance_proc_addr(instance_data->report_data, name); |
| 3007 | } |
| 3008 | |
| 3009 | static inline PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkInstance instance) { |
| 3010 | VkLayerInstanceDispatchTable *pTable = get_dispatch_table(ot_instance_table_map, instance); |
| 3011 | if (instanceExtMap.size() == 0 || !instanceExtMap[pTable].wsi_enabled) |
| 3012 | return nullptr; |
| 3013 | |
| 3014 | if (!strcmp("vkDestroySurfaceKHR", name)) |
| 3015 | return reinterpret_cast<PFN_vkVoidFunction>(DestroySurfaceKHR); |
| 3016 | if (!strcmp("vkGetPhysicalDeviceSurfaceSupportKHR", name)) |
| 3017 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceSupportKHR); |
| 3018 | if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", name)) |
| 3019 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceCapabilitiesKHR); |
| 3020 | if (!strcmp("vkGetPhysicalDeviceSurfaceFormatsKHR", name)) |
| 3021 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfaceFormatsKHR); |
| 3022 | if (!strcmp("vkGetPhysicalDeviceSurfacePresentModesKHR", name)) |
| 3023 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceSurfacePresentModesKHR); |
| 3024 | |
| 3025 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3026 | if ((instanceExtMap[pTable].win32_enabled == true) && !strcmp("vkCreateWin32SurfaceKHR", name)) |
| 3027 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWin32SurfaceKHR); |
| 3028 | if ((instanceExtMap[pTable].win32_enabled == true) && !strcmp("vkGetPhysicalDeviceWin32PresentationSupportKHR", name)) |
| 3029 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWin32PresentationSupportKHR); |
| 3030 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 3031 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3032 | if ((instanceExtMap[pTable].xcb_enabled == true) && !strcmp("vkCreateXcbSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3033 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXcbSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3034 | if ((instanceExtMap[pTable].xcb_enabled == true) && !strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3035 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXcbPresentationSupportKHR); |
| 3036 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 3037 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3038 | if ((instanceExtMap[pTable].xlib_enabled == true) && !strcmp("vkCreateXlibSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3039 | return reinterpret_cast<PFN_vkVoidFunction>(CreateXlibSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3040 | if ((instanceExtMap[pTable].xlib_enabled == true) && !strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3041 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceXlibPresentationSupportKHR); |
| 3042 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 3043 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3044 | if ((instanceExtMap[pTable].mir_enabled == true) && !strcmp("vkCreateMirSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3045 | return reinterpret_cast<PFN_vkVoidFunction>(CreateMirSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3046 | if ((instanceExtMap[pTable].mir_enabled == true) && !strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3047 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceMirPresentationSupportKHR); |
| 3048 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 3049 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3050 | if ((instanceExtMap[pTable].wayland_enabled == true) && !strcmp("vkCreateWaylandSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3051 | return reinterpret_cast<PFN_vkVoidFunction>(CreateWaylandSurfaceKHR); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3052 | if ((instanceExtMap[pTable].wayland_enabled == true) && !strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3053 | return reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceWaylandPresentationSupportKHR); |
| 3054 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 3055 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 3056 | if ((instanceExtMap[pTable].android_enabled == true) && !strcmp("vkCreateAndroidSurfaceKHR", name)) |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3057 | return reinterpret_cast<PFN_vkVoidFunction>(CreateAndroidSurfaceKHR); |
| 3058 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
| 3059 | |
| 3060 | return nullptr; |
| 3061 | } |
| 3062 | |
| 3063 | static void CheckDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo, VkDevice device) { |
| 3064 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3065 | device_data->wsi_enabled = false; |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3066 | device_data->wsi_display_swapchain_enabled = false; |
| 3067 | device_data->objtrack_extensions_enabled = false; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3068 | |
| 3069 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 3070 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 3071 | device_data->wsi_enabled = true; |
| 3072 | } |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 3073 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME) == 0) { |
| 3074 | device_data->wsi_display_swapchain_enabled = true; |
| 3075 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3076 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], "OBJTRACK_EXTENSIONS") == 0) { |
| 3077 | device_data->objtrack_extensions_enabled = true; |
| 3078 | } |
| 3079 | } |
| 3080 | } |
| 3081 | |
| 3082 | static void CheckInstanceRegisterExtensions(const VkInstanceCreateInfo *pCreateInfo, VkInstance instance) { |
| 3083 | VkLayerInstanceDispatchTable *pDisp = get_dispatch_table(ot_instance_table_map, instance); |
| 3084 | |
| 3085 | |
| 3086 | instanceExtMap[pDisp] = {}; |
| 3087 | |
| 3088 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
| 3089 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) { |
| 3090 | instanceExtMap[pDisp].wsi_enabled = true; |
| 3091 | } |
| 3092 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 3093 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { |
| 3094 | instanceExtMap[pDisp].xlib_enabled = true; |
| 3095 | } |
| 3096 | #endif |
| 3097 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 3098 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { |
| 3099 | instanceExtMap[pDisp].xcb_enabled = true; |
| 3100 | } |
| 3101 | #endif |
| 3102 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 3103 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { |
| 3104 | instanceExtMap[pDisp].wayland_enabled = true; |
| 3105 | } |
| 3106 | #endif |
| 3107 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 3108 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { |
| 3109 | instanceExtMap[pDisp].mir_enabled = true; |
| 3110 | } |
| 3111 | #endif |
| 3112 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 3113 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { |
| 3114 | instanceExtMap[pDisp].android_enabled = true; |
| 3115 | } |
| 3116 | #endif |
| 3117 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3118 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { |
| 3119 | instanceExtMap[pDisp].win32_enabled = true; |
| 3120 | } |
| 3121 | #endif |
| 3122 | } |
| 3123 | } |
| 3124 | |
| 3125 | VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, |
| 3126 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { |
| 3127 | std::lock_guard<std::mutex> lock(global_lock); |
| 3128 | layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3129 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
| 3130 | |
| 3131 | assert(chain_info->u.pLayerInfo); |
| 3132 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 3133 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
| 3134 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(phy_dev_data->instance, "vkCreateDevice"); |
| 3135 | if (fpCreateDevice == NULL) { |
| 3136 | return VK_ERROR_INITIALIZATION_FAILED; |
| 3137 | } |
| 3138 | |
| 3139 | // Advance the link info for the next element on the chain |
| 3140 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 3141 | |
| 3142 | VkResult result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); |
| 3143 | if (result != VK_SUCCESS) { |
| 3144 | return result; |
| 3145 | } |
| 3146 | |
| 3147 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); |
| 3148 | device_data->report_data = layer_debug_report_create_device(phy_dev_data->report_data, *pDevice); |
| 3149 | |
| 3150 | // Add link back to physDev |
| 3151 | device_data->physical_device = physicalDevice; |
| 3152 | |
| 3153 | initDeviceTable(*pDevice, fpGetDeviceProcAddr, ot_device_table_map); |
| 3154 | |
| 3155 | CheckDeviceRegisterExtensions(pCreateInfo, *pDevice); |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 3156 | CreateObject(*pDevice, *pDevice, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3157 | |
| 3158 | return result; |
| 3159 | } |
| 3160 | |
| 3161 | VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, |
| 3162 | uint32_t *pQueueFamilyPropertyCount, |
| 3163 | VkQueueFamilyProperties *pQueueFamilyProperties) { |
| 3164 | get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3165 | ->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 3166 | std::lock_guard<std::mutex> lock(global_lock); |
| 3167 | if (pQueueFamilyProperties != NULL) { |
| 3168 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); |
| 3169 | for (uint32_t i = 0; i < *pQueueFamilyPropertyCount; i++) { |
| 3170 | instance_data->queue_family_properties.emplace_back(pQueueFamilyProperties[i]); |
| 3171 | } |
| 3172 | } |
| 3173 | } |
| 3174 | |
| 3175 | VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 3176 | VkInstance *pInstance) { |
| 3177 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
| 3178 | |
| 3179 | assert(chain_info->u.pLayerInfo); |
| 3180 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 3181 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
| 3182 | if (fpCreateInstance == NULL) { |
| 3183 | return VK_ERROR_INITIALIZATION_FAILED; |
| 3184 | } |
| 3185 | |
| 3186 | // Advance the link info for the next element on the chain |
| 3187 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 3188 | |
| 3189 | VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
| 3190 | if (result != VK_SUCCESS) { |
| 3191 | return result; |
| 3192 | } |
| 3193 | |
| 3194 | layer_data *instance_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map); |
| 3195 | instance_data->instance = *pInstance; |
| 3196 | initInstanceTable(*pInstance, fpGetInstanceProcAddr, ot_instance_table_map); |
| 3197 | VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(ot_instance_table_map, *pInstance); |
| 3198 | |
| 3199 | // Look for one or more debug report create info structures, and copy the |
| 3200 | // callback(s) for each one found (for use by vkDestroyInstance) |
| 3201 | layer_copy_tmp_callbacks(pCreateInfo->pNext, &instance_data->num_tmp_callbacks, &instance_data->tmp_dbg_create_infos, |
| 3202 | &instance_data->tmp_callbacks); |
| 3203 | |
| 3204 | instance_data->report_data = debug_report_create_instance(pInstanceTable, *pInstance, pCreateInfo->enabledExtensionCount, |
| 3205 | pCreateInfo->ppEnabledExtensionNames); |
| 3206 | |
| 3207 | InitObjectTracker(instance_data, pAllocator); |
| 3208 | CheckInstanceRegisterExtensions(pCreateInfo, *pInstance); |
| 3209 | |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 3210 | CreateObject(*pInstance, *pInstance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3211 | |
| 3212 | return result; |
| 3213 | } |
| 3214 | |
| 3215 | VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, |
| 3216 | VkPhysicalDevice *pPhysicalDevices) { |
| 3217 | bool skip_call = VK_FALSE; |
| 3218 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3219 | skip_call |= ValidateObject(instance, instance, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3220 | lock.unlock(); |
| 3221 | if (skip_call) { |
| 3222 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3223 | } |
| 3224 | VkResult result = get_dispatch_table(ot_instance_table_map, instance) |
| 3225 | ->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
| 3226 | lock.lock(); |
| 3227 | if (result == VK_SUCCESS) { |
| 3228 | if (pPhysicalDevices) { |
| 3229 | for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 3230 | CreateObject(instance, pPhysicalDevices[i], VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3231 | } |
| 3232 | } |
| 3233 | } |
| 3234 | lock.unlock(); |
| 3235 | return result; |
| 3236 | } |
| 3237 | |
| 3238 | VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) { |
| 3239 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3240 | ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3241 | lock.unlock(); |
| 3242 | |
| 3243 | get_dispatch_table(ot_device_table_map, device)->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue); |
| 3244 | |
| 3245 | lock.lock(); |
| 3246 | |
| 3247 | CreateQueue(device, *pQueue, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT); |
| 3248 | AddQueueInfo(device, queueFamilyIndex, *pQueue); |
| 3249 | } |
| 3250 | |
| 3251 | VKAPI_ATTR void VKAPI_CALL FreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) { |
| 3252 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3253 | ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3254 | lock.unlock(); |
| 3255 | |
| 3256 | get_dispatch_table(ot_device_table_map, device)->FreeMemory(device, memory, pAllocator); |
| 3257 | |
| 3258 | lock.lock(); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3259 | DestroyObject(device, memory, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3260 | } |
| 3261 | |
| 3262 | VKAPI_ATTR VkResult VKAPI_CALL MapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, |
| 3263 | VkMemoryMapFlags flags, void **ppData) { |
| 3264 | bool skip_call = VK_FALSE; |
| 3265 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3266 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3267 | lock.unlock(); |
| 3268 | if (skip_call == VK_TRUE) { |
| 3269 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3270 | } |
| 3271 | VkResult result = get_dispatch_table(ot_device_table_map, device)->MapMemory(device, memory, offset, size, flags, ppData); |
| 3272 | return result; |
| 3273 | } |
| 3274 | |
| 3275 | VKAPI_ATTR void VKAPI_CALL UnmapMemory(VkDevice device, VkDeviceMemory memory) { |
| 3276 | bool skip_call = VK_FALSE; |
| 3277 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3278 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3279 | lock.unlock(); |
| 3280 | if (skip_call == VK_TRUE) { |
| 3281 | return; |
| 3282 | } |
| 3283 | |
| 3284 | get_dispatch_table(ot_device_table_map, device)->UnmapMemory(device, memory); |
| 3285 | } |
| 3286 | VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, |
| 3287 | VkFence fence) { |
| 3288 | std::unique_lock<std::mutex> lock(global_lock); |
| 3289 | ValidateQueueFlags(queue, "QueueBindSparse"); |
| 3290 | |
| 3291 | for (uint32_t i = 0; i < bindInfoCount; i++) { |
| 3292 | for (uint32_t j = 0; j < pBindInfo[i].bufferBindCount; j++) |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3293 | ValidateObject(queue, pBindInfo[i].pBufferBinds[j].buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3294 | false); |
| 3295 | for (uint32_t j = 0; j < pBindInfo[i].imageOpaqueBindCount; j++) |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3296 | ValidateObject(queue, pBindInfo[i].pImageOpaqueBinds[j].image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3297 | false); |
| 3298 | for (uint32_t j = 0; j < pBindInfo[i].imageBindCount; j++) |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3299 | ValidateObject(queue, pBindInfo[i].pImageBinds[j].image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3300 | } |
| 3301 | lock.unlock(); |
| 3302 | |
| 3303 | VkResult result = get_dispatch_table(ot_device_table_map, queue)->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); |
| 3304 | return result; |
| 3305 | } |
| 3306 | |
| 3307 | VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, |
| 3308 | VkCommandBuffer *pCommandBuffers) { |
| 3309 | bool skip_call = VK_FALSE; |
| 3310 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3311 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3312 | skip_call |= |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3313 | ValidateObject(device, pAllocateInfo->commandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3314 | lock.unlock(); |
| 3315 | |
| 3316 | if (skip_call) { |
| 3317 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3318 | } |
| 3319 | |
| 3320 | VkResult result = |
| 3321 | get_dispatch_table(ot_device_table_map, device)->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); |
| 3322 | |
| 3323 | lock.lock(); |
| 3324 | for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) { |
| 3325 | AllocateCommandBuffer(device, pAllocateInfo->commandPool, pCommandBuffers[i], |
| 3326 | VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, pAllocateInfo->level); |
| 3327 | } |
| 3328 | lock.unlock(); |
| 3329 | |
| 3330 | return result; |
| 3331 | } |
| 3332 | |
| 3333 | VKAPI_ATTR VkResult VKAPI_CALL AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, |
| 3334 | VkDescriptorSet *pDescriptorSets) { |
| 3335 | bool skip_call = VK_FALSE; |
| 3336 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3337 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3338 | skip_call |= ValidateObject(device, pAllocateInfo->descriptorPool, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3339 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, false); |
| 3340 | for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3341 | skip_call |= ValidateObject(device, pAllocateInfo->pSetLayouts[i], |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3342 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT, false); |
| 3343 | } |
| 3344 | lock.unlock(); |
| 3345 | if (skip_call) { |
| 3346 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3347 | } |
| 3348 | |
| 3349 | VkResult result = |
| 3350 | get_dispatch_table(ot_device_table_map, device)->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); |
| 3351 | |
| 3352 | if (VK_SUCCESS == result) { |
| 3353 | lock.lock(); |
| 3354 | for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; i++) { |
| 3355 | AllocateDescriptorSet(device, pAllocateInfo->descriptorPool, pDescriptorSets[i], |
| 3356 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT); |
| 3357 | } |
| 3358 | lock.unlock(); |
| 3359 | } |
| 3360 | |
| 3361 | return result; |
| 3362 | } |
| 3363 | |
| 3364 | VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, |
| 3365 | const VkCommandBuffer *pCommandBuffers) { |
| 3366 | bool skip_call = false; |
| 3367 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3368 | ValidateObject(device, commandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, false); |
| 3369 | ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3370 | for (uint32_t i = 0; i < commandBufferCount; i++) { |
| 3371 | skip_call |= ValidateCommandBuffer(device, commandPool, pCommandBuffers[i]); |
| 3372 | } |
| 3373 | |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3374 | for (uint32_t i = 0; i < commandBufferCount; i++) { |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3375 | DestroyObject(device, pCommandBuffers[i], VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3376 | } |
| 3377 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3378 | lock.unlock(); |
| 3379 | if (!skip_call) { |
| 3380 | get_dispatch_table(ot_device_table_map, device) |
| 3381 | ->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); |
| 3382 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3383 | } |
| 3384 | VKAPI_ATTR void VKAPI_CALL DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { |
| 3385 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3386 | std::unique_lock<std::mutex> lock(global_lock); |
| 3387 | // A swapchain's images are implicitly deleted when the swapchain is deleted. |
| 3388 | // Remove this swapchain's images from our map of such images. |
| 3389 | std::unordered_map<uint64_t, OBJTRACK_NODE *>::iterator itr = device_data->swapchainImageMap.begin(); |
| 3390 | while (itr != device_data->swapchainImageMap.end()) { |
| 3391 | OBJTRACK_NODE *pNode = (*itr).second; |
| 3392 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(swapchain)) { |
| 3393 | delete pNode; |
| 3394 | auto delete_item = itr++; |
| 3395 | device_data->swapchainImageMap.erase(delete_item); |
| 3396 | } else { |
| 3397 | ++itr; |
| 3398 | } |
| 3399 | } |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3400 | DestroyObject(device, swapchain, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3401 | lock.unlock(); |
| 3402 | |
| 3403 | get_dispatch_table(ot_device_table_map, device)->DestroySwapchainKHR(device, swapchain, pAllocator); |
| 3404 | } |
| 3405 | |
| 3406 | VKAPI_ATTR VkResult VKAPI_CALL FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, |
| 3407 | const VkDescriptorSet *pDescriptorSets) { |
| 3408 | bool skip_call = false; |
| 3409 | VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; |
| 3410 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3411 | skip_call |= ValidateObject(device, descriptorPool, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, false); |
| 3412 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3413 | for (uint32_t i = 0; i < descriptorSetCount; i++) { |
| 3414 | skip_call |= ValidateDescriptorSet(device, descriptorPool, pDescriptorSets[i]); |
| 3415 | } |
| 3416 | |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3417 | for (uint32_t i = 0; i < descriptorSetCount; i++) { |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3418 | DestroyObject(device, pDescriptorSets[i], VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); |
Mark Lobodzinski | 9bb1154 | 2016-07-13 11:29:00 -0600 | [diff] [blame] | 3419 | } |
| 3420 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3421 | lock.unlock(); |
| 3422 | if (!skip_call) { |
| 3423 | result = get_dispatch_table(ot_device_table_map, device) |
| 3424 | ->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); |
| 3425 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3426 | return result; |
| 3427 | } |
| 3428 | |
| 3429 | VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, |
| 3430 | const VkAllocationCallbacks *pAllocator) { |
| 3431 | bool skip_call = VK_FALSE; |
| 3432 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3433 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3434 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3435 | skip_call |= ValidateObject(device, descriptorPool, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3436 | lock.unlock(); |
| 3437 | if (skip_call) { |
| 3438 | return; |
| 3439 | } |
| 3440 | // A DescriptorPool's descriptor sets are implicitly deleted when the pool is deleted. |
| 3441 | // Remove this pool's descriptor sets from our descriptorSet map. |
| 3442 | lock.lock(); |
| 3443 | std::unordered_map<uint64_t, OBJTRACK_NODE *>::iterator itr = |
| 3444 | device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT].begin(); |
| 3445 | while (itr != device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT].end()) { |
| 3446 | OBJTRACK_NODE *pNode = (*itr).second; |
| 3447 | auto del_itr = itr++; |
| 3448 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(descriptorPool)) { |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3449 | DestroyObject(device, (VkDescriptorSet)((*del_itr).first), |
Chris Forbes | 3e51a20 | 2016-09-29 14:35:09 +1300 | [diff] [blame] | 3450 | VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3451 | } |
| 3452 | } |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3453 | DestroyObject(device, descriptorPool, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3454 | lock.unlock(); |
| 3455 | get_dispatch_table(ot_device_table_map, device)->DestroyDescriptorPool(device, descriptorPool, pAllocator); |
| 3456 | } |
| 3457 | |
| 3458 | VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { |
| 3459 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
| 3460 | bool skip_call = false; |
| 3461 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3462 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3463 | skip_call |= ValidateObject(device, commandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3464 | lock.unlock(); |
| 3465 | if (skip_call) { |
| 3466 | return; |
| 3467 | } |
| 3468 | lock.lock(); |
| 3469 | // A CommandPool's command buffers are implicitly deleted when the pool is deleted. |
| 3470 | // Remove this pool's cmdBuffers from our cmd buffer map. |
| 3471 | auto itr = device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT].begin(); |
| 3472 | auto del_itr = itr; |
| 3473 | while (itr != device_data->object_map[VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT].end()) { |
| 3474 | OBJTRACK_NODE *pNode = (*itr).second; |
| 3475 | del_itr = itr++; |
| 3476 | if (pNode->parent_object == reinterpret_cast<uint64_t &>(commandPool)) { |
| 3477 | skip_call |= ValidateCommandBuffer(device, commandPool, reinterpret_cast<VkCommandBuffer>((*del_itr).first)); |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3478 | DestroyObject(device, reinterpret_cast<VkCommandBuffer>((*del_itr).first), |
Chris Forbes | 3e51a20 | 2016-09-29 14:35:09 +1300 | [diff] [blame] | 3479 | VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3480 | } |
| 3481 | } |
Chris Forbes | ec46199 | 2016-09-29 14:41:44 +1300 | [diff] [blame] | 3482 | DestroyObject(device, commandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3483 | lock.unlock(); |
| 3484 | get_dispatch_table(ot_device_table_map, device)->DestroyCommandPool(device, commandPool, pAllocator); |
| 3485 | } |
| 3486 | |
| 3487 | VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, |
| 3488 | VkImage *pSwapchainImages) { |
| 3489 | bool skip_call = VK_FALSE; |
| 3490 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3491 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3492 | lock.unlock(); |
| 3493 | if (skip_call) { |
| 3494 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3495 | } |
| 3496 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 3497 | ->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
| 3498 | if (pSwapchainImages != NULL) { |
| 3499 | lock.lock(); |
| 3500 | for (uint32_t i = 0; i < *pSwapchainImageCount; i++) { |
| 3501 | CreateSwapchainImageObject(device, pSwapchainImages[i], swapchain); |
| 3502 | } |
| 3503 | lock.unlock(); |
| 3504 | } |
| 3505 | return result; |
| 3506 | } |
| 3507 | |
| 3508 | VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3509 | const VkGraphicsPipelineCreateInfo *pCreateInfos, |
| 3510 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
| 3511 | bool skip_call = VK_FALSE; |
| 3512 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3513 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3514 | if (pCreateInfos) { |
| 3515 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
| 3516 | if (pCreateInfos[idx0].basePipelineHandle) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3517 | skip_call |= ValidateObject(device, pCreateInfos[idx0].basePipelineHandle, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3518 | VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, true); |
| 3519 | } |
| 3520 | if (pCreateInfos[idx0].layout) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3521 | skip_call |= ValidateObject(device, pCreateInfos[idx0].layout, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3522 | VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT, false); |
| 3523 | } |
| 3524 | if (pCreateInfos[idx0].pStages) { |
| 3525 | for (uint32_t idx1 = 0; idx1 < pCreateInfos[idx0].stageCount; ++idx1) { |
| 3526 | if (pCreateInfos[idx0].pStages[idx1].module) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3527 | skip_call |= ValidateObject(device, pCreateInfos[idx0].pStages[idx1].module, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3528 | VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT, false); |
| 3529 | } |
| 3530 | } |
| 3531 | } |
| 3532 | if (pCreateInfos[idx0].renderPass) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3533 | skip_call |= ValidateObject(device, pCreateInfos[idx0].renderPass, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3534 | VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, false); |
| 3535 | } |
| 3536 | } |
| 3537 | } |
| 3538 | if (pipelineCache) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3539 | skip_call |= ValidateObject(device, pipelineCache, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3540 | } |
| 3541 | lock.unlock(); |
| 3542 | if (skip_call) { |
| 3543 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3544 | } |
| 3545 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 3546 | ->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
| 3547 | lock.lock(); |
| 3548 | if (result == VK_SUCCESS) { |
| 3549 | for (uint32_t idx2 = 0; idx2 < createInfoCount; ++idx2) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 3550 | CreateObject(device, pPipelines[idx2], VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3551 | } |
| 3552 | } |
| 3553 | lock.unlock(); |
| 3554 | return result; |
| 3555 | } |
| 3556 | |
| 3557 | VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, |
| 3558 | const VkComputePipelineCreateInfo *pCreateInfos, |
| 3559 | const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { |
| 3560 | bool skip_call = VK_FALSE; |
| 3561 | std::unique_lock<std::mutex> lock(global_lock); |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3562 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3563 | if (pCreateInfos) { |
| 3564 | for (uint32_t idx0 = 0; idx0 < createInfoCount; ++idx0) { |
| 3565 | if (pCreateInfos[idx0].basePipelineHandle) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3566 | skip_call |= ValidateObject(device, pCreateInfos[idx0].basePipelineHandle, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3567 | VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, true); |
| 3568 | } |
| 3569 | if (pCreateInfos[idx0].layout) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3570 | skip_call |= ValidateObject(device, pCreateInfos[idx0].layout, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3571 | VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT, false); |
| 3572 | } |
| 3573 | if (pCreateInfos[idx0].stage.module) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3574 | skip_call |= ValidateObject(device, pCreateInfos[idx0].stage.module, |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3575 | VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT, false); |
| 3576 | } |
| 3577 | } |
| 3578 | } |
| 3579 | if (pipelineCache) { |
Chris Forbes | 2f271a7 | 2016-09-29 14:58:08 +1300 | [diff] [blame] | 3580 | skip_call |= ValidateObject(device, pipelineCache, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT, false); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3581 | } |
| 3582 | lock.unlock(); |
| 3583 | if (skip_call) { |
| 3584 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3585 | } |
| 3586 | VkResult result = get_dispatch_table(ot_device_table_map, device) |
| 3587 | ->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); |
| 3588 | lock.lock(); |
| 3589 | if (result == VK_SUCCESS) { |
| 3590 | for (uint32_t idx1 = 0; idx1 < createInfoCount; ++idx1) { |
Chris Forbes | feecd40 | 2016-09-29 14:53:50 +1300 | [diff] [blame] | 3591 | CreateObject(device, pPipelines[idx1], VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, pAllocator); |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3592 | } |
| 3593 | } |
| 3594 | lock.unlock(); |
| 3595 | return result; |
| 3596 | } |
| 3597 | |
Mark Lobodzinski | 82db45e | 2016-09-28 12:45:29 -0600 | [diff] [blame] | 3598 | // VK_EXT_debug_marker Extension |
| 3599 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { |
| 3600 | bool skip_call = VK_FALSE; |
| 3601 | std::unique_lock<std::mutex> lock(global_lock); |
| 3602 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3603 | lock.unlock(); |
| 3604 | if (skip_call) { |
| 3605 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3606 | } |
| 3607 | VkResult result = get_dispatch_table(ot_device_table_map, device)->DebugMarkerSetObjectTagEXT(device, pTagInfo); |
| 3608 | return result; |
| 3609 | } |
| 3610 | |
| 3611 | VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { |
| 3612 | bool skip_call = VK_FALSE; |
| 3613 | std::unique_lock<std::mutex> lock(global_lock); |
| 3614 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3615 | lock.unlock(); |
| 3616 | if (skip_call) { |
| 3617 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3618 | } |
| 3619 | VkResult result = get_dispatch_table(ot_device_table_map, device)->DebugMarkerSetObjectNameEXT(device, pNameInfo); |
| 3620 | return result; |
| 3621 | } |
| 3622 | |
| 3623 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
| 3624 | bool skip_call = VK_FALSE; |
| 3625 | std::unique_lock<std::mutex> lock(global_lock); |
| 3626 | skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 3627 | lock.unlock(); |
| 3628 | if (!skip_call) { |
| 3629 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); |
| 3630 | } |
| 3631 | } |
| 3632 | |
| 3633 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer) { |
| 3634 | bool skip_call = VK_FALSE; |
| 3635 | std::unique_lock<std::mutex> lock(global_lock); |
| 3636 | skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 3637 | lock.unlock(); |
| 3638 | if (!skip_call) { |
| 3639 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerEndEXT(commandBuffer); |
| 3640 | } |
| 3641 | } |
| 3642 | |
| 3643 | VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT *pMarkerInfo) { |
| 3644 | bool skip_call = VK_FALSE; |
| 3645 | std::unique_lock<std::mutex> lock(global_lock); |
| 3646 | skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); |
| 3647 | lock.unlock(); |
| 3648 | if (!skip_call) { |
| 3649 | get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); |
| 3650 | } |
| 3651 | } |
| 3652 | |
Mark Lobodzinski | 5fcb92b | 2016-09-28 12:48:56 -0600 | [diff] [blame] | 3653 | // VK_NV_external_memory_capabilities Extension |
| 3654 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceExternalImageFormatPropertiesNV( |
| 3655 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, |
| 3656 | VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, |
| 3657 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { |
| 3658 | |
| 3659 | bool skip_call = false; |
| 3660 | { |
| 3661 | std::lock_guard<std::mutex> lock(global_lock); |
| 3662 | skip_call |= ValidateObject(physicalDevice, physicalDevice, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); |
| 3663 | } |
| 3664 | if (skip_call) { |
| 3665 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3666 | } |
| 3667 | VkResult result = get_dispatch_table(ot_instance_table_map, physicalDevice) |
| 3668 | ->GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags, |
| 3669 | externalHandleType, pExternalImageFormatProperties); |
| 3670 | return result; |
| 3671 | } |
| 3672 | |
Mark Lobodzinski | 8cc72bd | 2016-09-28 12:53:27 -0600 | [diff] [blame] | 3673 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3674 | // VK_NV_external_memory_win32 Extension |
| 3675 | VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, |
| 3676 | VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { |
| 3677 | bool skip_call = VK_FALSE; |
| 3678 | std::unique_lock<std::mutex> lock(global_lock); |
| 3679 | skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3680 | skip_call |= ValidateObject(device, memory, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, false); |
| 3681 | lock.unlock(); |
| 3682 | if (skip_call) { |
| 3683 | return VK_ERROR_VALIDATION_FAILED_EXT; |
| 3684 | } |
| 3685 | VkResult result = get_dispatch_table(ot_device_table_map, device)->GetMemoryWin32HandleNV(device, memory, handleType, pHandle); |
| 3686 | return result; |
| 3687 | } |
| 3688 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 3689 | |
Mark Lobodzinski | 4e0003a | 2016-09-28 12:58:00 -0600 | [diff] [blame] | 3690 | // VK_AMD_draw_indirect_count Extension |
| 3691 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 3692 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, |
| 3693 | uint32_t stride) { |
| 3694 | bool skip_call = VK_FALSE; |
| 3695 | std::unique_lock<std::mutex> lock(global_lock); |
| 3696 | skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3697 | skip_call |= ValidateObject(commandBuffer, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 3698 | lock.unlock(); |
| 3699 | if (!skip_call) { |
| 3700 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 3701 | ->CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 3702 | } |
| 3703 | } |
| 3704 | |
| 3705 | VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, |
| 3706 | VkBuffer countBuffer, VkDeviceSize countBufferOffset, |
| 3707 | uint32_t maxDrawCount, uint32_t stride) { |
| 3708 | bool skip_call = VK_FALSE; |
| 3709 | std::unique_lock<std::mutex> lock(global_lock); |
| 3710 | skip_call |= ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false); |
| 3711 | skip_call |= ValidateObject(commandBuffer, buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, false); |
| 3712 | lock.unlock(); |
| 3713 | if (!skip_call) { |
| 3714 | get_dispatch_table(ot_device_table_map, commandBuffer) |
| 3715 | ->CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); |
| 3716 | } |
| 3717 | } |
| 3718 | |
| 3719 | |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3720 | static inline PFN_vkVoidFunction InterceptCoreDeviceCommand(const char *name) { |
| 3721 | if (!name || name[0] != 'v' || name[1] != 'k') |
| 3722 | return NULL; |
| 3723 | |
| 3724 | name += 2; |
| 3725 | if (!strcmp(name, "GetDeviceProcAddr")) |
| 3726 | return (PFN_vkVoidFunction)GetDeviceProcAddr; |
| 3727 | if (!strcmp(name, "DestroyDevice")) |
| 3728 | return (PFN_vkVoidFunction)DestroyDevice; |
| 3729 | if (!strcmp(name, "GetDeviceQueue")) |
| 3730 | return (PFN_vkVoidFunction)GetDeviceQueue; |
| 3731 | if (!strcmp(name, "QueueSubmit")) |
| 3732 | return (PFN_vkVoidFunction)QueueSubmit; |
| 3733 | if (!strcmp(name, "QueueWaitIdle")) |
| 3734 | return (PFN_vkVoidFunction)QueueWaitIdle; |
| 3735 | if (!strcmp(name, "DeviceWaitIdle")) |
| 3736 | return (PFN_vkVoidFunction)DeviceWaitIdle; |
| 3737 | if (!strcmp(name, "AllocateMemory")) |
| 3738 | return (PFN_vkVoidFunction)AllocateMemory; |
| 3739 | if (!strcmp(name, "FreeMemory")) |
| 3740 | return (PFN_vkVoidFunction)FreeMemory; |
| 3741 | if (!strcmp(name, "MapMemory")) |
| 3742 | return (PFN_vkVoidFunction)MapMemory; |
| 3743 | if (!strcmp(name, "UnmapMemory")) |
| 3744 | return (PFN_vkVoidFunction)UnmapMemory; |
| 3745 | if (!strcmp(name, "FlushMappedMemoryRanges")) |
| 3746 | return (PFN_vkVoidFunction)FlushMappedMemoryRanges; |
| 3747 | if (!strcmp(name, "InvalidateMappedMemoryRanges")) |
| 3748 | return (PFN_vkVoidFunction)InvalidateMappedMemoryRanges; |
| 3749 | if (!strcmp(name, "GetDeviceMemoryCommitment")) |
| 3750 | return (PFN_vkVoidFunction)GetDeviceMemoryCommitment; |
| 3751 | if (!strcmp(name, "BindBufferMemory")) |
| 3752 | return (PFN_vkVoidFunction)BindBufferMemory; |
| 3753 | if (!strcmp(name, "BindImageMemory")) |
| 3754 | return (PFN_vkVoidFunction)BindImageMemory; |
| 3755 | if (!strcmp(name, "GetBufferMemoryRequirements")) |
| 3756 | return (PFN_vkVoidFunction)GetBufferMemoryRequirements; |
| 3757 | if (!strcmp(name, "GetImageMemoryRequirements")) |
| 3758 | return (PFN_vkVoidFunction)GetImageMemoryRequirements; |
| 3759 | if (!strcmp(name, "GetImageSparseMemoryRequirements")) |
| 3760 | return (PFN_vkVoidFunction)GetImageSparseMemoryRequirements; |
| 3761 | if (!strcmp(name, "QueueBindSparse")) |
| 3762 | return (PFN_vkVoidFunction)QueueBindSparse; |
| 3763 | if (!strcmp(name, "CreateFence")) |
| 3764 | return (PFN_vkVoidFunction)CreateFence; |
| 3765 | if (!strcmp(name, "DestroyFence")) |
| 3766 | return (PFN_vkVoidFunction)DestroyFence; |
| 3767 | if (!strcmp(name, "ResetFences")) |
| 3768 | return (PFN_vkVoidFunction)ResetFences; |
| 3769 | if (!strcmp(name, "GetFenceStatus")) |
| 3770 | return (PFN_vkVoidFunction)GetFenceStatus; |
| 3771 | if (!strcmp(name, "WaitForFences")) |
| 3772 | return (PFN_vkVoidFunction)WaitForFences; |
| 3773 | if (!strcmp(name, "CreateSemaphore")) |
| 3774 | return (PFN_vkVoidFunction)CreateSemaphore; |
| 3775 | if (!strcmp(name, "DestroySemaphore")) |
| 3776 | return (PFN_vkVoidFunction)DestroySemaphore; |
| 3777 | if (!strcmp(name, "CreateEvent")) |
| 3778 | return (PFN_vkVoidFunction)CreateEvent; |
| 3779 | if (!strcmp(name, "DestroyEvent")) |
| 3780 | return (PFN_vkVoidFunction)DestroyEvent; |
| 3781 | if (!strcmp(name, "GetEventStatus")) |
| 3782 | return (PFN_vkVoidFunction)GetEventStatus; |
| 3783 | if (!strcmp(name, "SetEvent")) |
| 3784 | return (PFN_vkVoidFunction)SetEvent; |
| 3785 | if (!strcmp(name, "ResetEvent")) |
| 3786 | return (PFN_vkVoidFunction)ResetEvent; |
| 3787 | if (!strcmp(name, "CreateQueryPool")) |
| 3788 | return (PFN_vkVoidFunction)CreateQueryPool; |
| 3789 | if (!strcmp(name, "DestroyQueryPool")) |
| 3790 | return (PFN_vkVoidFunction)DestroyQueryPool; |
| 3791 | if (!strcmp(name, "GetQueryPoolResults")) |
| 3792 | return (PFN_vkVoidFunction)GetQueryPoolResults; |
| 3793 | if (!strcmp(name, "CreateBuffer")) |
| 3794 | return (PFN_vkVoidFunction)CreateBuffer; |
| 3795 | if (!strcmp(name, "DestroyBuffer")) |
| 3796 | return (PFN_vkVoidFunction)DestroyBuffer; |
| 3797 | if (!strcmp(name, "CreateBufferView")) |
| 3798 | return (PFN_vkVoidFunction)CreateBufferView; |
| 3799 | if (!strcmp(name, "DestroyBufferView")) |
| 3800 | return (PFN_vkVoidFunction)DestroyBufferView; |
| 3801 | if (!strcmp(name, "CreateImage")) |
| 3802 | return (PFN_vkVoidFunction)CreateImage; |
| 3803 | if (!strcmp(name, "DestroyImage")) |
| 3804 | return (PFN_vkVoidFunction)DestroyImage; |
| 3805 | if (!strcmp(name, "GetImageSubresourceLayout")) |
| 3806 | return (PFN_vkVoidFunction)GetImageSubresourceLayout; |
| 3807 | if (!strcmp(name, "CreateImageView")) |
| 3808 | return (PFN_vkVoidFunction)CreateImageView; |
| 3809 | if (!strcmp(name, "DestroyImageView")) |
| 3810 | return (PFN_vkVoidFunction)DestroyImageView; |
| 3811 | if (!strcmp(name, "CreateShaderModule")) |
| 3812 | return (PFN_vkVoidFunction)CreateShaderModule; |
| 3813 | if (!strcmp(name, "DestroyShaderModule")) |
| 3814 | return (PFN_vkVoidFunction)DestroyShaderModule; |
| 3815 | if (!strcmp(name, "CreatePipelineCache")) |
| 3816 | return (PFN_vkVoidFunction)CreatePipelineCache; |
| 3817 | if (!strcmp(name, "DestroyPipelineCache")) |
| 3818 | return (PFN_vkVoidFunction)DestroyPipelineCache; |
| 3819 | if (!strcmp(name, "GetPipelineCacheData")) |
| 3820 | return (PFN_vkVoidFunction)GetPipelineCacheData; |
| 3821 | if (!strcmp(name, "MergePipelineCaches")) |
| 3822 | return (PFN_vkVoidFunction)MergePipelineCaches; |
| 3823 | if (!strcmp(name, "CreateGraphicsPipelines")) |
| 3824 | return (PFN_vkVoidFunction)CreateGraphicsPipelines; |
| 3825 | if (!strcmp(name, "CreateComputePipelines")) |
| 3826 | return (PFN_vkVoidFunction)CreateComputePipelines; |
| 3827 | if (!strcmp(name, "DestroyPipeline")) |
| 3828 | return (PFN_vkVoidFunction)DestroyPipeline; |
| 3829 | if (!strcmp(name, "CreatePipelineLayout")) |
| 3830 | return (PFN_vkVoidFunction)CreatePipelineLayout; |
| 3831 | if (!strcmp(name, "DestroyPipelineLayout")) |
| 3832 | return (PFN_vkVoidFunction)DestroyPipelineLayout; |
| 3833 | if (!strcmp(name, "CreateSampler")) |
| 3834 | return (PFN_vkVoidFunction)CreateSampler; |
| 3835 | if (!strcmp(name, "DestroySampler")) |
| 3836 | return (PFN_vkVoidFunction)DestroySampler; |
| 3837 | if (!strcmp(name, "CreateDescriptorSetLayout")) |
| 3838 | return (PFN_vkVoidFunction)CreateDescriptorSetLayout; |
| 3839 | if (!strcmp(name, "DestroyDescriptorSetLayout")) |
| 3840 | return (PFN_vkVoidFunction)DestroyDescriptorSetLayout; |
| 3841 | if (!strcmp(name, "CreateDescriptorPool")) |
| 3842 | return (PFN_vkVoidFunction)CreateDescriptorPool; |
| 3843 | if (!strcmp(name, "DestroyDescriptorPool")) |
| 3844 | return (PFN_vkVoidFunction)DestroyDescriptorPool; |
| 3845 | if (!strcmp(name, "ResetDescriptorPool")) |
| 3846 | return (PFN_vkVoidFunction)ResetDescriptorPool; |
| 3847 | if (!strcmp(name, "AllocateDescriptorSets")) |
| 3848 | return (PFN_vkVoidFunction)AllocateDescriptorSets; |
| 3849 | if (!strcmp(name, "FreeDescriptorSets")) |
| 3850 | return (PFN_vkVoidFunction)FreeDescriptorSets; |
| 3851 | if (!strcmp(name, "UpdateDescriptorSets")) |
| 3852 | return (PFN_vkVoidFunction)UpdateDescriptorSets; |
| 3853 | if (!strcmp(name, "CreateFramebuffer")) |
| 3854 | return (PFN_vkVoidFunction)CreateFramebuffer; |
| 3855 | if (!strcmp(name, "DestroyFramebuffer")) |
| 3856 | return (PFN_vkVoidFunction)DestroyFramebuffer; |
| 3857 | if (!strcmp(name, "CreateRenderPass")) |
| 3858 | return (PFN_vkVoidFunction)CreateRenderPass; |
| 3859 | if (!strcmp(name, "DestroyRenderPass")) |
| 3860 | return (PFN_vkVoidFunction)DestroyRenderPass; |
| 3861 | if (!strcmp(name, "GetRenderAreaGranularity")) |
| 3862 | return (PFN_vkVoidFunction)GetRenderAreaGranularity; |
| 3863 | if (!strcmp(name, "CreateCommandPool")) |
| 3864 | return (PFN_vkVoidFunction)CreateCommandPool; |
| 3865 | if (!strcmp(name, "DestroyCommandPool")) |
| 3866 | return (PFN_vkVoidFunction)DestroyCommandPool; |
| 3867 | if (!strcmp(name, "ResetCommandPool")) |
| 3868 | return (PFN_vkVoidFunction)ResetCommandPool; |
| 3869 | if (!strcmp(name, "AllocateCommandBuffers")) |
| 3870 | return (PFN_vkVoidFunction)AllocateCommandBuffers; |
| 3871 | if (!strcmp(name, "FreeCommandBuffers")) |
| 3872 | return (PFN_vkVoidFunction)FreeCommandBuffers; |
| 3873 | if (!strcmp(name, "BeginCommandBuffer")) |
| 3874 | return (PFN_vkVoidFunction)BeginCommandBuffer; |
| 3875 | if (!strcmp(name, "EndCommandBuffer")) |
| 3876 | return (PFN_vkVoidFunction)EndCommandBuffer; |
| 3877 | if (!strcmp(name, "ResetCommandBuffer")) |
| 3878 | return (PFN_vkVoidFunction)ResetCommandBuffer; |
| 3879 | if (!strcmp(name, "CmdBindPipeline")) |
| 3880 | return (PFN_vkVoidFunction)CmdBindPipeline; |
| 3881 | if (!strcmp(name, "CmdSetViewport")) |
| 3882 | return (PFN_vkVoidFunction)CmdSetViewport; |
| 3883 | if (!strcmp(name, "CmdSetScissor")) |
| 3884 | return (PFN_vkVoidFunction)CmdSetScissor; |
| 3885 | if (!strcmp(name, "CmdSetLineWidth")) |
| 3886 | return (PFN_vkVoidFunction)CmdSetLineWidth; |
| 3887 | if (!strcmp(name, "CmdSetDepthBias")) |
| 3888 | return (PFN_vkVoidFunction)CmdSetDepthBias; |
| 3889 | if (!strcmp(name, "CmdSetBlendConstants")) |
| 3890 | return (PFN_vkVoidFunction)CmdSetBlendConstants; |
| 3891 | if (!strcmp(name, "CmdSetDepthBounds")) |
| 3892 | return (PFN_vkVoidFunction)CmdSetDepthBounds; |
| 3893 | if (!strcmp(name, "CmdSetStencilCompareMask")) |
| 3894 | return (PFN_vkVoidFunction)CmdSetStencilCompareMask; |
| 3895 | if (!strcmp(name, "CmdSetStencilWriteMask")) |
| 3896 | return (PFN_vkVoidFunction)CmdSetStencilWriteMask; |
| 3897 | if (!strcmp(name, "CmdSetStencilReference")) |
| 3898 | return (PFN_vkVoidFunction)CmdSetStencilReference; |
| 3899 | if (!strcmp(name, "CmdBindDescriptorSets")) |
| 3900 | return (PFN_vkVoidFunction)CmdBindDescriptorSets; |
| 3901 | if (!strcmp(name, "CmdBindIndexBuffer")) |
| 3902 | return (PFN_vkVoidFunction)CmdBindIndexBuffer; |
| 3903 | if (!strcmp(name, "CmdBindVertexBuffers")) |
| 3904 | return (PFN_vkVoidFunction)CmdBindVertexBuffers; |
| 3905 | if (!strcmp(name, "CmdDraw")) |
| 3906 | return (PFN_vkVoidFunction)CmdDraw; |
| 3907 | if (!strcmp(name, "CmdDrawIndexed")) |
| 3908 | return (PFN_vkVoidFunction)CmdDrawIndexed; |
| 3909 | if (!strcmp(name, "CmdDrawIndirect")) |
| 3910 | return (PFN_vkVoidFunction)CmdDrawIndirect; |
| 3911 | if (!strcmp(name, "CmdDrawIndexedIndirect")) |
| 3912 | return (PFN_vkVoidFunction)CmdDrawIndexedIndirect; |
| 3913 | if (!strcmp(name, "CmdDispatch")) |
| 3914 | return (PFN_vkVoidFunction)CmdDispatch; |
| 3915 | if (!strcmp(name, "CmdDispatchIndirect")) |
| 3916 | return (PFN_vkVoidFunction)CmdDispatchIndirect; |
| 3917 | if (!strcmp(name, "CmdCopyBuffer")) |
| 3918 | return (PFN_vkVoidFunction)CmdCopyBuffer; |
| 3919 | if (!strcmp(name, "CmdCopyImage")) |
| 3920 | return (PFN_vkVoidFunction)CmdCopyImage; |
| 3921 | if (!strcmp(name, "CmdBlitImage")) |
| 3922 | return (PFN_vkVoidFunction)CmdBlitImage; |
| 3923 | if (!strcmp(name, "CmdCopyBufferToImage")) |
| 3924 | return (PFN_vkVoidFunction)CmdCopyBufferToImage; |
| 3925 | if (!strcmp(name, "CmdCopyImageToBuffer")) |
| 3926 | return (PFN_vkVoidFunction)CmdCopyImageToBuffer; |
| 3927 | if (!strcmp(name, "CmdUpdateBuffer")) |
| 3928 | return (PFN_vkVoidFunction)CmdUpdateBuffer; |
| 3929 | if (!strcmp(name, "CmdFillBuffer")) |
| 3930 | return (PFN_vkVoidFunction)CmdFillBuffer; |
| 3931 | if (!strcmp(name, "CmdClearColorImage")) |
| 3932 | return (PFN_vkVoidFunction)CmdClearColorImage; |
| 3933 | if (!strcmp(name, "CmdClearDepthStencilImage")) |
| 3934 | return (PFN_vkVoidFunction)CmdClearDepthStencilImage; |
| 3935 | if (!strcmp(name, "CmdClearAttachments")) |
| 3936 | return (PFN_vkVoidFunction)CmdClearAttachments; |
| 3937 | if (!strcmp(name, "CmdResolveImage")) |
| 3938 | return (PFN_vkVoidFunction)CmdResolveImage; |
| 3939 | if (!strcmp(name, "CmdSetEvent")) |
| 3940 | return (PFN_vkVoidFunction)CmdSetEvent; |
| 3941 | if (!strcmp(name, "CmdResetEvent")) |
| 3942 | return (PFN_vkVoidFunction)CmdResetEvent; |
| 3943 | if (!strcmp(name, "CmdWaitEvents")) |
| 3944 | return (PFN_vkVoidFunction)CmdWaitEvents; |
| 3945 | if (!strcmp(name, "CmdPipelineBarrier")) |
| 3946 | return (PFN_vkVoidFunction)CmdPipelineBarrier; |
| 3947 | if (!strcmp(name, "CmdBeginQuery")) |
| 3948 | return (PFN_vkVoidFunction)CmdBeginQuery; |
| 3949 | if (!strcmp(name, "CmdEndQuery")) |
| 3950 | return (PFN_vkVoidFunction)CmdEndQuery; |
| 3951 | if (!strcmp(name, "CmdResetQueryPool")) |
| 3952 | return (PFN_vkVoidFunction)CmdResetQueryPool; |
| 3953 | if (!strcmp(name, "CmdWriteTimestamp")) |
| 3954 | return (PFN_vkVoidFunction)CmdWriteTimestamp; |
| 3955 | if (!strcmp(name, "CmdCopyQueryPoolResults")) |
| 3956 | return (PFN_vkVoidFunction)CmdCopyQueryPoolResults; |
| 3957 | if (!strcmp(name, "CmdPushConstants")) |
| 3958 | return (PFN_vkVoidFunction)CmdPushConstants; |
| 3959 | if (!strcmp(name, "CmdBeginRenderPass")) |
| 3960 | return (PFN_vkVoidFunction)CmdBeginRenderPass; |
| 3961 | if (!strcmp(name, "CmdNextSubpass")) |
| 3962 | return (PFN_vkVoidFunction)CmdNextSubpass; |
| 3963 | if (!strcmp(name, "CmdEndRenderPass")) |
| 3964 | return (PFN_vkVoidFunction)CmdEndRenderPass; |
| 3965 | if (!strcmp(name, "CmdExecuteCommands")) |
| 3966 | return (PFN_vkVoidFunction)CmdExecuteCommands; |
Mark Lobodzinski | 82db45e | 2016-09-28 12:45:29 -0600 | [diff] [blame] | 3967 | if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) |
| 3968 | return (PFN_vkVoidFunction)DebugMarkerSetObjectTagEXT; |
| 3969 | if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) |
| 3970 | return (PFN_vkVoidFunction)DebugMarkerSetObjectNameEXT; |
| 3971 | if (!strcmp(name, "CmdDebugMarkerBeginEXT")) |
| 3972 | return (PFN_vkVoidFunction)CmdDebugMarkerBeginEXT; |
| 3973 | if (!strcmp(name, "CmdDebugMarkerEndEXT")) |
| 3974 | return (PFN_vkVoidFunction)CmdDebugMarkerEndEXT; |
| 3975 | if (!strcmp(name, "CmdDebugMarkerInsertEXT")) |
| 3976 | return (PFN_vkVoidFunction)CmdDebugMarkerInsertEXT; |
Mark Lobodzinski | 8cc72bd | 2016-09-28 12:53:27 -0600 | [diff] [blame] | 3977 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 3978 | if (!strcmp(name, "GetMemoryWin32HandleNV")) |
| 3979 | return (PFN_vkVoidFunction)GetMemoryWin32HandleNV; |
| 3980 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 4e0003a | 2016-09-28 12:58:00 -0600 | [diff] [blame] | 3981 | if (!strcmp(name, "CmdDrawIndirectCountAMD")) |
| 3982 | return (PFN_vkVoidFunction)CmdDrawIndirectCountAMD; |
| 3983 | if (!strcmp(name, "CmdDrawIndexedIndirectCountAMD")) |
| 3984 | return (PFN_vkVoidFunction)CmdDrawIndexedIndirectCountAMD; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 3985 | |
| 3986 | return NULL; |
| 3987 | } |
| 3988 | static inline PFN_vkVoidFunction InterceptCoreInstanceCommand(const char *name) { |
| 3989 | if (!name || name[0] != 'v' || name[1] != 'k') |
| 3990 | return NULL; |
| 3991 | |
| 3992 | name += 2; |
| 3993 | if (!strcmp(name, "CreateInstance")) |
| 3994 | return (PFN_vkVoidFunction)CreateInstance; |
| 3995 | if (!strcmp(name, "DestroyInstance")) |
| 3996 | return (PFN_vkVoidFunction)DestroyInstance; |
| 3997 | if (!strcmp(name, "EnumeratePhysicalDevices")) |
| 3998 | return (PFN_vkVoidFunction)EnumeratePhysicalDevices; |
| 3999 | if (!strcmp(name, "GetPhysicalDeviceFeatures")) |
| 4000 | return (PFN_vkVoidFunction)GetPhysicalDeviceFeatures; |
| 4001 | if (!strcmp(name, "GetPhysicalDeviceFormatProperties")) |
| 4002 | return (PFN_vkVoidFunction)GetPhysicalDeviceFormatProperties; |
| 4003 | if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties")) |
| 4004 | return (PFN_vkVoidFunction)GetPhysicalDeviceImageFormatProperties; |
| 4005 | if (!strcmp(name, "GetPhysicalDeviceProperties")) |
| 4006 | return (PFN_vkVoidFunction)GetPhysicalDeviceProperties; |
| 4007 | if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties")) |
| 4008 | return (PFN_vkVoidFunction)GetPhysicalDeviceQueueFamilyProperties; |
| 4009 | if (!strcmp(name, "GetPhysicalDeviceMemoryProperties")) |
| 4010 | return (PFN_vkVoidFunction)GetPhysicalDeviceMemoryProperties; |
| 4011 | if (!strcmp(name, "GetInstanceProcAddr")) |
| 4012 | return (PFN_vkVoidFunction)GetInstanceProcAddr; |
| 4013 | if (!strcmp(name, "CreateDevice")) |
| 4014 | return (PFN_vkVoidFunction)CreateDevice; |
| 4015 | if (!strcmp(name, "EnumerateInstanceExtensionProperties")) |
| 4016 | return (PFN_vkVoidFunction)EnumerateInstanceExtensionProperties; |
| 4017 | if (!strcmp(name, "EnumerateInstanceLayerProperties")) |
| 4018 | return (PFN_vkVoidFunction)EnumerateInstanceLayerProperties; |
| 4019 | if (!strcmp(name, "EnumerateDeviceLayerProperties")) |
| 4020 | return (PFN_vkVoidFunction)EnumerateDeviceLayerProperties; |
| 4021 | if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties")) |
| 4022 | return (PFN_vkVoidFunction)GetPhysicalDeviceSparseImageFormatProperties; |
Mark Lobodzinski | 5fcb92b | 2016-09-28 12:48:56 -0600 | [diff] [blame] | 4023 | if (!strcmp(name, "GetPhysicalDeviceExternalImageFormatPropertiesNV")) |
| 4024 | return (PFN_vkVoidFunction)GetPhysicalDeviceExternalImageFormatPropertiesNV; |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 4025 | |
| 4026 | return NULL; |
| 4027 | } |
| 4028 | |
| 4029 | static inline PFN_vkVoidFunction InterceptWsiEnabledCommand(const char *name, VkDevice device) { |
| 4030 | if (device) { |
| 4031 | layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); |
Mark Young | ead9b93 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 4032 | |
| 4033 | if (device_data->wsi_enabled) { |
| 4034 | if (!strcmp("vkCreateSwapchainKHR", name)) |
| 4035 | return reinterpret_cast<PFN_vkVoidFunction>(CreateSwapchainKHR); |
| 4036 | if (!strcmp("vkDestroySwapchainKHR", name)) |
| 4037 | return reinterpret_cast<PFN_vkVoidFunction>(DestroySwapchainKHR); |
| 4038 | if (!strcmp("vkGetSwapchainImagesKHR", name)) |
| 4039 | return reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR); |
| 4040 | if (!strcmp("vkAcquireNextImageKHR", name)) |
| 4041 | return reinterpret_cast<PFN_vkVoidFunction>(AcquireNextImageKHR); |
| 4042 | if (!strcmp("vkQueuePresentKHR", name)) |
| 4043 | return reinterpret_cast<PFN_vkVoidFunction>(QueuePresentKHR); |
| 4044 | } |
| 4045 | |
| 4046 | if (device_data->wsi_display_swapchain_enabled) { |
| 4047 | if (!strcmp("vkCreateSharedSwapchainsKHR", name)) { |
| 4048 | return reinterpret_cast<PFN_vkVoidFunction>(CreateSharedSwapchainsKHR); |
| 4049 | } |
| 4050 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 4051 | } |
Mark Lobodzinski | 9bab866 | 2016-07-01 10:53:31 -0600 | [diff] [blame] | 4052 | |
| 4053 | return nullptr; |
| 4054 | } |
| 4055 | |
| 4056 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) { |
| 4057 | PFN_vkVoidFunction addr; |
| 4058 | addr = InterceptCoreDeviceCommand(funcName); |
| 4059 | if (addr) { |
| 4060 | return addr; |
| 4061 | } |
| 4062 | assert(device); |
| 4063 | |
| 4064 | addr = InterceptWsiEnabledCommand(funcName, device); |
| 4065 | if (addr) { |
| 4066 | return addr; |
| 4067 | } |
| 4068 | if (get_dispatch_table(ot_device_table_map, device)->GetDeviceProcAddr == NULL) { |
| 4069 | return NULL; |
| 4070 | } |
| 4071 | return get_dispatch_table(ot_device_table_map, device)->GetDeviceProcAddr(device, funcName); |
| 4072 | } |
| 4073 | |
| 4074 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) { |
| 4075 | PFN_vkVoidFunction addr; |
| 4076 | addr = InterceptCoreInstanceCommand(funcName); |
| 4077 | if (!addr) { |
| 4078 | addr = InterceptCoreDeviceCommand(funcName); |
| 4079 | } |
| 4080 | if (!addr) { |
| 4081 | addr = InterceptWsiEnabledCommand(funcName, VkDevice(VK_NULL_HANDLE)); |
| 4082 | } |
| 4083 | if (addr) { |
| 4084 | return addr; |
| 4085 | } |
| 4086 | assert(instance); |
| 4087 | |
| 4088 | addr = InterceptMsgCallbackGetProcAddrCommand(funcName, instance); |
| 4089 | if (addr) { |
| 4090 | return addr; |
| 4091 | } |
| 4092 | addr = InterceptWsiEnabledCommand(funcName, instance); |
| 4093 | if (addr) { |
| 4094 | return addr; |
| 4095 | } |
| 4096 | if (get_dispatch_table(ot_instance_table_map, instance)->GetInstanceProcAddr == NULL) { |
| 4097 | return NULL; |
| 4098 | } |
| 4099 | return get_dispatch_table(ot_instance_table_map, instance)->GetInstanceProcAddr(instance, funcName); |
| 4100 | } |
| 4101 | |
| 4102 | } // namespace object_tracker |
| 4103 | |
| 4104 | // vk_layer_logging.h expects these to be defined |
| 4105 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, |
| 4106 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, |
| 4107 | const VkAllocationCallbacks *pAllocator, |
| 4108 | VkDebugReportCallbackEXT *pMsgCallback) { |
| 4109 | return object_tracker::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback); |
| 4110 | } |
| 4111 | |
| 4112 | VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT msgCallback, |
| 4113 | const VkAllocationCallbacks *pAllocator) { |
| 4114 | object_tracker::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator); |
| 4115 | } |
| 4116 | |
| 4117 | VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, |
| 4118 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, |
| 4119 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { |
| 4120 | object_tracker::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); |
| 4121 | } |
| 4122 | |
| 4123 | // Loader-layer interface v0, just wrappers since there is only a layer |
| 4124 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, |
| 4125 | VkExtensionProperties *pProperties) { |
| 4126 | return object_tracker::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties); |
| 4127 | } |
| 4128 | |
| 4129 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, |
| 4130 | VkLayerProperties *pProperties) { |
| 4131 | return object_tracker::EnumerateInstanceLayerProperties(pCount, pProperties); |
| 4132 | } |
| 4133 | |
| 4134 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 4135 | VkLayerProperties *pProperties) { |
| 4136 | // The layer command handles VK_NULL_HANDLE just fine internally |
| 4137 | assert(physicalDevice == VK_NULL_HANDLE); |
| 4138 | return object_tracker::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties); |
| 4139 | } |
| 4140 | |
| 4141 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char *funcName) { |
| 4142 | return object_tracker::GetDeviceProcAddr(dev, funcName); |
| 4143 | } |
| 4144 | |
| 4145 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) { |
| 4146 | return object_tracker::GetInstanceProcAddr(instance, funcName); |
| 4147 | } |
| 4148 | |
| 4149 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 4150 | const char *pLayerName, uint32_t *pCount, |
| 4151 | VkExtensionProperties *pProperties) { |
| 4152 | // The layer command handles VK_NULL_HANDLE just fine internally |
| 4153 | assert(physicalDevice == VK_NULL_HANDLE); |
| 4154 | return object_tracker::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties); |
Mark Lobodzinski | 3808068 | 2016-07-22 15:30:27 -0600 | [diff] [blame] | 4155 | } |