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