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